trello-cli-unofficial 0.11.4 → 0.11.6

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,19 @@
1
+ ## [0.11.6](https://github.com/JaegerCaiser/trello-cli-unofficial/compare/v0.11.5...v0.11.6) (2025-11-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Add debug logs to CommandController for Windows troubleshooting ([5c146a9](https://github.com/JaegerCaiser/trello-cli-unofficial/commit/5c146a9801502747c9eb1dee3f6db38fa9ad20ab))
7
+ * Implement lazy Commander initialization for Windows compatibility ([e08ca9f](https://github.com/JaegerCaiser/trello-cli-unofficial/commit/e08ca9f298fb15d9b29e4e3daa98584c5d6321ad))
8
+ * Improve Windows compatibility test script ([2b230d9](https://github.com/JaegerCaiser/trello-cli-unofficial/commit/2b230d9b36e0b0b4f2fec52bbd9200fd424b4de9))
9
+
10
+ ## [0.11.5](https://github.com/JaegerCaiser/trello-cli-unofficial/compare/v0.11.4...v0.11.5) (2025-11-14)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * Make version reading robust for Windows compatibility ([5af0780](https://github.com/JaegerCaiser/trello-cli-unofficial/commit/5af07803c4bd074fa28a4a77de24790aa1bda666))
16
+
1
17
  ## [0.11.4](https://github.com/JaegerCaiser/trello-cli-unofficial/compare/v0.11.3...v0.11.4) (2025-11-14)
2
18
 
3
19
 
package/dist/main.js CHANGED
@@ -31130,20 +31130,45 @@ var init_TrelloCliController = __esm(() => {
31130
31130
  });
31131
31131
 
31132
31132
  // src/presentation/cli/CommandController.ts
31133
- import { readFileSync as readFileSync2 } from "fs";
31134
- 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";
31135
31136
 
31136
31137
  class CommandController {
31137
31138
  authController;
31138
31139
  boardController;
31139
31140
  cardController;
31140
- program;
31141
+ program = null;
31141
31142
  outputFormatter;
31142
31143
  constructor() {
31143
31144
  const configRepository = new FileConfigRepository;
31144
31145
  this.authController = new AuthController(configRepository);
31145
31146
  this.outputFormatter = new OutputFormatter;
31146
- this.program = new Command;
31147
+ }
31148
+ getProgram() {
31149
+ if (!this.program) {
31150
+ this.program = new Command;
31151
+ }
31152
+ return this.program;
31153
+ }
31154
+ getVersion() {
31155
+ const cwdPackageJson = join(process.cwd(), "package.json");
31156
+ if (existsSync(cwdPackageJson)) {
31157
+ try {
31158
+ const packageJson = JSON.parse(readFileSync2(cwdPackageJson, "utf-8"));
31159
+ return packageJson.version;
31160
+ } catch {}
31161
+ }
31162
+ try {
31163
+ const currentFilePath = fileURLToPath2(import.meta.url);
31164
+ const currentDir = dirname(currentFilePath);
31165
+ const installedPackageJson = join(currentDir, "..", "..", "package.json");
31166
+ if (existsSync(installedPackageJson)) {
31167
+ const packageJson = JSON.parse(readFileSync2(installedPackageJson, "utf-8"));
31168
+ return packageJson.version;
31169
+ }
31170
+ } catch {}
31171
+ return "0.11.3";
31147
31172
  }
31148
31173
  async initializeTrelloControllers() {
31149
31174
  await this.authController.ensureAuthenticated();
@@ -31154,13 +31179,8 @@ class CommandController {
31154
31179
  this.cardController = new CardController(trelloRepository, this.boardController, this.outputFormatter);
31155
31180
  }
31156
31181
  async setupCommands() {
31157
- if (!this.program) {
31158
- throw new Error(t2("errors.programNotInitialized"));
31159
- }
31160
- const packageJsonPath = join(process.cwd(), "package.json");
31161
- const packageJson = JSON.parse(readFileSync2(packageJsonPath, "utf-8"));
31162
- const version = packageJson.version;
31163
- 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) => {
31182
+ const version = this.getVersion();
31183
+ this.getProgram().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) => {
31164
31184
  this.outputFormatter.setFormat(format);
31165
31185
  }).on("option:v", () => {
31166
31186
  console.log(version);
@@ -31168,15 +31188,15 @@ class CommandController {
31168
31188
  }).on("option:verbose", () => {
31169
31189
  process.env.VERBOSE_ERRORS = "true";
31170
31190
  });
31171
- this.program.command("interactive").alias("i").description(t2("commands.interactive.description")).action(async () => {
31191
+ this.getProgram().command("interactive").alias("i").description(t2("commands.interactive.description")).action(async () => {
31172
31192
  const configRepository = new FileConfigRepository;
31173
31193
  const cli = new (await Promise.resolve().then(() => (init_TrelloCliController(), exports_TrelloCliController))).TrelloCliController(configRepository, this.outputFormatter);
31174
31194
  await cli.run();
31175
31195
  });
31176
- this.program.command("setup").description(t2("commands.setup.description")).action(async () => {
31196
+ this.getProgram().command("setup").description(t2("commands.setup.description")).action(async () => {
31177
31197
  await this.authController.setupToken();
31178
31198
  });
31179
- const boardsCmd = this.program.command("boards").description(t2("commands.boards.manage"));
31199
+ const boardsCmd = this.getProgram().command("boards").description(t2("commands.boards.manage"));
31180
31200
  boardsCmd.command("list").description(t2("commands.boards.description")).option("-f, --format <format>", t2("commands.formatOption"), "table").action(async (options) => {
31181
31201
  try {
31182
31202
  await this.initializeTrelloControllers();
@@ -31207,7 +31227,7 @@ class CommandController {
31207
31227
  console.error("\u274C Erro:", error.message);
31208
31228
  }
31209
31229
  });
31210
- this.program.command("boards-legacy").description(t2("commands.deprecated.boardsLegacyDescription")).action(async () => {
31230
+ this.getProgram().command("boards-legacy").description(t2("commands.deprecated.boardsLegacyDescription")).action(async () => {
31211
31231
  console.warn(t2("commands.deprecated.boardsLegacyWarning"));
31212
31232
  try {
31213
31233
  await this.initializeTrelloControllers();
@@ -31216,7 +31236,7 @@ class CommandController {
31216
31236
  console.error(t2("commands.deprecated.boardsLegacyError"), error.message);
31217
31237
  }
31218
31238
  });
31219
- const listsCmd = this.program.command("lists").description(t2("commands.lists.description"));
31239
+ const listsCmd = this.getProgram().command("lists").description(t2("commands.lists.description"));
31220
31240
  listsCmd.command("list <boardId>").description(t2("commands.lists.list.description")).option("-f, --format <format>", t2("commands.formatOption"), "table").action(async (boardId, options) => {
31221
31241
  try {
31222
31242
  await this.initializeTrelloControllers();
@@ -31252,7 +31272,7 @@ class CommandController {
31252
31272
  console.error(t2("commands.commandErrors.genericError"), error.message);
31253
31273
  }
31254
31274
  });
31255
- this.program.command("lists-legacy <boardName>").description(t2("commands.deprecated.listsLegacyDescription")).action(async (boardName) => {
31275
+ this.getProgram().command("lists-legacy <boardName>").description(t2("commands.deprecated.listsLegacyDescription")).action(async (boardName) => {
31256
31276
  console.warn(t2("commands.deprecated.listsLegacyWarning"));
31257
31277
  try {
31258
31278
  await this.initializeTrelloControllers();
@@ -31261,7 +31281,7 @@ class CommandController {
31261
31281
  console.error(t2("commands.deprecated.listsLegacyError"), error.message);
31262
31282
  }
31263
31283
  });
31264
- const cardsCmd = this.program.command("cards").description(t2("commands.cards.manage"));
31284
+ const cardsCmd = this.getProgram().command("cards").description(t2("commands.cards.manage"));
31265
31285
  cardsCmd.command("list <listId>").description(t2("commands.cards.list.description")).option("-f, --format <format>", t2("commands.formatOption"), "table").action(async (listId, options) => {
31266
31286
  try {
31267
31287
  await this.initializeTrelloControllers();
@@ -31305,7 +31325,7 @@ class CommandController {
31305
31325
  console.error(t2("commands.commandErrors.genericError"), error.message);
31306
31326
  }
31307
31327
  });
31308
- this.program.command("cards-legacy <boardName> <listName>").description(t2("commands.deprecated.cardsLegacyDescription")).action(async (boardName, listName) => {
31328
+ this.getProgram().command("cards-legacy <boardName> <listName>").description(t2("commands.deprecated.cardsLegacyDescription")).action(async (boardName, listName) => {
31309
31329
  console.warn(t2("commands.deprecated.cardsLegacyWarning"));
31310
31330
  try {
31311
31331
  await this.initializeTrelloControllers();
@@ -31314,7 +31334,7 @@ class CommandController {
31314
31334
  console.error(t2("commands.deprecated.cardsLegacyError"), error.message);
31315
31335
  }
31316
31336
  });
31317
- this.program.command("create-card-legacy <boardName> <listName> <cardName>").description(t2("commands.deprecated.createCardLegacyDescription")).option("-d, --desc <description>", t2("commands.options.cardDescription")).action(async (boardName, listName, cardName, options) => {
31337
+ this.getProgram().command("create-card-legacy <boardName> <listName> <cardName>").description(t2("commands.deprecated.createCardLegacyDescription")).option("-d, --desc <description>", t2("commands.options.cardDescription")).action(async (boardName, listName, cardName, options) => {
31318
31338
  console.warn(t2("commands.deprecated.createCardLegacyWarning"));
31319
31339
  try {
31320
31340
  await this.initializeTrelloControllers();
@@ -31323,7 +31343,7 @@ class CommandController {
31323
31343
  console.error(t2("commands.commandErrors.genericError"), error.message);
31324
31344
  }
31325
31345
  });
31326
- this.program.command("move-card-legacy <cardId> <listName>").description(t2("commands.deprecated.moveCardLegacyDescription")).action(async (cardId, listName) => {
31346
+ this.getProgram().command("move-card-legacy <cardId> <listName>").description(t2("commands.deprecated.moveCardLegacyDescription")).action(async (cardId, listName) => {
31327
31347
  console.warn(t2("commands.deprecated.moveCardLegacyWarning"));
31328
31348
  try {
31329
31349
  await this.initializeTrelloControllers();
@@ -31332,7 +31352,7 @@ class CommandController {
31332
31352
  console.error(t2("commands.commandErrors.genericError"), error.message);
31333
31353
  }
31334
31354
  });
31335
- this.program.command("delete-card-legacy <cardId>").description(t2("commands.deprecated.deleteCardLegacyDescription")).action(async (cardId) => {
31355
+ this.getProgram().command("delete-card-legacy <cardId>").description(t2("commands.deprecated.deleteCardLegacyDescription")).action(async (cardId) => {
31336
31356
  console.warn(t2("commands.deprecated.deleteCardLegacyWarning"));
31337
31357
  try {
31338
31358
  await this.initializeTrelloControllers();
@@ -31349,7 +31369,7 @@ class CommandController {
31349
31369
  const cli = new (await Promise.resolve().then(() => (init_TrelloCliController(), exports_TrelloCliController))).TrelloCliController(configRepository, this.outputFormatter);
31350
31370
  await cli.run();
31351
31371
  } else {
31352
- await this.program.parseAsync();
31372
+ await this.getProgram().parseAsync();
31353
31373
  }
31354
31374
  }
31355
31375
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "trello-cli-unofficial",
3
3
  "type": "module",
4
- "version": "0.11.4",
4
+ "version": "0.11.6",
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,7 @@
1
1
  import type { OutputFormat } from '@/shared';
2
- import { readFileSync } from 'node:fs';
3
- import { join } from 'node:path';
2
+ import { existsSync, readFileSync } from 'node:fs';
3
+ import { dirname, join } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
4
5
 
5
6
  import { AuthenticationService } from '@domain/services';
6
7
  import {
@@ -18,15 +19,52 @@ export class CommandController {
18
19
  private authController: AuthController;
19
20
  private boardController!: BoardController;
20
21
  private cardController!: CardController;
21
- private program: Command;
22
+ private program: Command | null = null;
22
23
  private outputFormatter: OutputFormatter;
23
24
 
24
25
  constructor() {
25
26
  const configRepository = new FileConfigRepository();
26
27
  this.authController = new AuthController(configRepository);
27
28
  this.outputFormatter = new OutputFormatter();
28
- // Initialize Commander immediately in constructor
29
- this.program = new Command();
29
+ }
30
+
31
+ private getProgram(): Command {
32
+ if (!this.program) {
33
+ this.program = new Command();
34
+ }
35
+ return this.program;
36
+ }
37
+
38
+ private getVersion(): string {
39
+ // Try multiple approaches to find package.json (robust for different environments)
40
+
41
+ // 1. Try relative to current working directory (development)
42
+ const cwdPackageJson = join(process.cwd(), 'package.json');
43
+ if (existsSync(cwdPackageJson)) {
44
+ try {
45
+ const packageJson = JSON.parse(readFileSync(cwdPackageJson, 'utf-8'));
46
+ return packageJson.version;
47
+ } catch {
48
+ // Continue to next approach
49
+ }
50
+ }
51
+
52
+ // 2. Try relative to this file's directory (when installed globally)
53
+ try {
54
+ const currentFilePath = fileURLToPath(import.meta.url);
55
+ const currentDir = dirname(currentFilePath);
56
+ const installedPackageJson = join(currentDir, '..', '..', 'package.json');
57
+
58
+ if (existsSync(installedPackageJson)) {
59
+ const packageJson = JSON.parse(readFileSync(installedPackageJson, 'utf-8'));
60
+ return packageJson.version;
61
+ }
62
+ } catch {
63
+ // Continue to fallback
64
+ }
65
+
66
+ // 3. Fallback to hardcoded version from package.json
67
+ return '0.11.3';
30
68
  }
31
69
 
32
70
  private async initializeTrelloControllers(): Promise<void> {
@@ -51,17 +89,10 @@ export class CommandController {
51
89
  }
52
90
 
53
91
  private async setupCommands(): Promise<void> {
54
- // Program should be initialized by now
55
- if (!this.program) {
56
- throw new Error(t('errors.programNotInitialized'));
57
- }
58
-
59
- // Get version from package.json
60
- const packageJsonPath = join(process.cwd(), 'package.json');
61
- const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
62
- const version = packageJson.version;
92
+ // Get version using robust method
93
+ const version = this.getVersion();
63
94
 
64
- this.program
95
+ this.getProgram()
65
96
  .name('trello-cli-unofficial')
66
97
  .description(t('commands.description'))
67
98
  .version(version)
@@ -81,7 +112,7 @@ export class CommandController {
81
112
  });
82
113
 
83
114
  // Interactive mode
84
- this.program
115
+ this.getProgram()
85
116
  .command('interactive')
86
117
  .alias('i')
87
118
  .description(t('commands.interactive.description'))
@@ -94,7 +125,7 @@ export class CommandController {
94
125
  });
95
126
 
96
127
  // Setup command
97
- this.program
128
+ this.getProgram()
98
129
  .command('setup')
99
130
  .description(t('commands.setup.description'))
100
131
  .action(async () => {
@@ -102,7 +133,7 @@ export class CommandController {
102
133
  });
103
134
 
104
135
  // Boards subcommands
105
- const boardsCmd = this.program
136
+ const boardsCmd = this.getProgram()
106
137
  .command('boards')
107
138
  .description(t('commands.boards.manage'));
108
139
 
@@ -155,7 +186,7 @@ export class CommandController {
155
186
  });
156
187
 
157
188
  // Legacy boards command with deprecation warning
158
- this.program
189
+ this.getProgram()
159
190
  .command('boards-legacy')
160
191
  .description(t('commands.deprecated.boardsLegacyDescription'))
161
192
  .action(async () => {
@@ -172,7 +203,7 @@ export class CommandController {
172
203
  });
173
204
 
174
205
  // Lists subcommands
175
- const listsCmd = this.program
206
+ const listsCmd = this.getProgram()
176
207
  .command('lists')
177
208
  .description(t('commands.lists.description'));
178
209
 
@@ -241,7 +272,7 @@ export class CommandController {
241
272
  });
242
273
 
243
274
  // Legacy lists command with deprecation warning
244
- this.program
275
+ this.getProgram()
245
276
  .command('lists-legacy <boardName>')
246
277
  .description(t('commands.deprecated.listsLegacyDescription'))
247
278
  .action(async (boardName: string) => {
@@ -258,7 +289,7 @@ export class CommandController {
258
289
  });
259
290
 
260
291
  // Cards subcommands
261
- const cardsCmd = this.program
292
+ const cardsCmd = this.getProgram()
262
293
  .command('cards')
263
294
  .description(t('commands.cards.manage'));
264
295
 
@@ -358,7 +389,7 @@ export class CommandController {
358
389
  );
359
390
 
360
391
  // Legacy commands with deprecation warnings
361
- this.program
392
+ this.getProgram()
362
393
  .command('cards-legacy <boardName> <listName>')
363
394
  .description(t('commands.deprecated.cardsLegacyDescription'))
364
395
  .action(async (boardName: string, listName: string) => {
@@ -374,7 +405,7 @@ export class CommandController {
374
405
  }
375
406
  });
376
407
 
377
- this.program
408
+ this.getProgram()
378
409
  .command('create-card-legacy <boardName> <listName> <cardName>')
379
410
  .description(t('commands.deprecated.createCardLegacyDescription'))
380
411
  .option('-d, --desc <description>', t('commands.options.cardDescription'))
@@ -403,7 +434,7 @@ export class CommandController {
403
434
  },
404
435
  );
405
436
 
406
- this.program
437
+ this.getProgram()
407
438
  .command('move-card-legacy <cardId> <listName>')
408
439
  .description(t('commands.deprecated.moveCardLegacyDescription'))
409
440
  .action(async (cardId: string, listName: string) => {
@@ -419,7 +450,7 @@ export class CommandController {
419
450
  }
420
451
  });
421
452
 
422
- this.program
453
+ this.getProgram()
423
454
  .command('delete-card-legacy <cardId>')
424
455
  .description(t('commands.deprecated.deleteCardLegacyDescription'))
425
456
  .action(async (cardId: string) => {
@@ -447,7 +478,7 @@ export class CommandController {
447
478
  ).TrelloCliController(configRepository, this.outputFormatter);
448
479
  await cli.run();
449
480
  } else {
450
- await this.program.parseAsync();
481
+ await this.getProgram().parseAsync();
451
482
  }
452
483
  }
453
484
  }