trello-cli-unofficial 0.7.3 → 0.7.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.
@@ -1,13 +1,16 @@
1
1
  import type { CardEntity, ListEntity } from '@domain/entities';
2
2
  import type { TrelloRepository } from '@domain/repositories';
3
+
3
4
  import {
4
5
  CreateCardUseCase,
5
6
  DeleteCardUseCase,
6
7
  MoveCardUseCase,
7
8
  UpdateCardUseCase,
8
9
  } from '@application/use-cases';
10
+
9
11
  import { CARD_ACTIONS } from '@shared/types';
10
12
  import inquirer from 'inquirer';
13
+ import { t } from '@/i18n';
11
14
 
12
15
  export class CardController {
13
16
  private createCardUseCase: CreateCardUseCase;
@@ -32,8 +35,11 @@ export class CardController {
32
35
  {
33
36
  type: 'list',
34
37
  name: 'selectedBoard',
35
- message: 'Selecione o quadro:',
36
- choices: boards.map((board: any) => ({ name: board.name, value: board.id })),
38
+ message: t('card.selectBoard'),
39
+ choices: boards.map((board: any) => ({
40
+ name: board.name,
41
+ value: board.id,
42
+ })),
37
43
  },
38
44
  ]);
39
45
 
@@ -43,8 +49,11 @@ export class CardController {
43
49
  {
44
50
  type: 'list',
45
51
  name: 'selectedList',
46
- message: 'Selecione a lista:',
47
- choices: lists.map((list: any) => ({ name: list.name, value: list.id })),
52
+ message: t('card.selectList'),
53
+ choices: lists.map((list: any) => ({
54
+ name: list.name,
55
+ value: list.id,
56
+ })),
48
57
  },
49
58
  ]);
50
59
 
@@ -52,13 +61,13 @@ export class CardController {
52
61
  {
53
62
  type: 'input',
54
63
  name: 'cardName',
55
- message: 'Nome do cartão:',
64
+ message: t('card.enterName'),
56
65
  validate: input => input.length > 0 || 'Nome é obrigatório',
57
66
  },
58
67
  {
59
68
  type: 'input',
60
69
  name: 'cardDesc',
61
- message: 'Descrição (opcional):',
70
+ message: t('card.enterDescription'),
62
71
  },
63
72
  ]);
64
73
 
@@ -68,9 +77,9 @@ export class CardController {
68
77
  listId: selectedList,
69
78
  });
70
79
 
71
- console.log('✅ Cartão criado com sucesso!');
72
- console.log(`📝 Nome: ${newCard.name}`);
73
- console.log(`🔗 URL: ${newCard.url}`);
80
+ console.log(t('card.created'));
81
+ console.log(t('card.cardName', { name: newCard.name }));
82
+ console.log(t('card.cardUrl', { url: newCard.url }));
74
83
  }
75
84
 
76
85
  async exploreCards(boardId: string, lists: ListEntity[]): Promise<void> {
@@ -78,7 +87,7 @@ export class CardController {
78
87
  {
79
88
  type: 'list',
80
89
  name: 'selectedList',
81
- message: 'Selecione uma lista:',
90
+ message: t('card.selectList'),
82
91
  choices: lists.map(list => ({ name: list.name, value: list.id })),
83
92
  },
84
93
  ]);
@@ -86,7 +95,7 @@ export class CardController {
86
95
  const cards = await (this.boardController as any).getCards(selectedList);
87
96
 
88
97
  if (cards.length === 0) {
89
- console.log('📭 Esta lista está vazia.');
98
+ console.log(t('card.emptyList'));
90
99
  return;
91
100
  }
92
101
 
@@ -110,11 +119,11 @@ export class CardController {
110
119
  {
111
120
  type: 'list',
112
121
  name: 'nextAction',
113
- message: 'O que deseja fazer?',
122
+ message: t('card.whatToDo'),
114
123
  choices: [
115
- { name: '⬅️ Voltar ao menu', value: CARD_ACTIONS.BACK },
116
- { name: '📝 Editar cartão', value: CARD_ACTIONS.EDIT },
117
- { name: '🗑️ Deletar cartão', value: CARD_ACTIONS.DELETE },
124
+ { name: t('card.actions.back'), value: CARD_ACTIONS.BACK },
125
+ { name: t('card.actions.edit'), value: CARD_ACTIONS.EDIT },
126
+ { name: t('card.actions.delete'), value: CARD_ACTIONS.DELETE },
118
127
  { name: '📦 Mover cartão', value: CARD_ACTIONS.MOVE },
119
128
  ],
120
129
  },
@@ -125,8 +134,11 @@ export class CardController {
125
134
  {
126
135
  type: 'list',
127
136
  name: 'selectedCard',
128
- message: 'Selecione um cartão:',
129
- choices: cards.map((card: any) => ({ name: card.name, value: card.id })),
137
+ message: t('card.selectCard'),
138
+ choices: cards.map((card: any) => ({
139
+ name: card.name,
140
+ value: card.id,
141
+ })),
130
142
  },
131
143
  ]);
132
144
 
@@ -151,13 +163,13 @@ export class CardController {
151
163
  {
152
164
  type: 'input',
153
165
  name: 'newName',
154
- message: 'Novo nome:',
166
+ message: t('card.newName'),
155
167
  default: card.name,
156
168
  },
157
169
  {
158
170
  type: 'input',
159
171
  name: 'newDesc',
160
- message: 'Nova descrição:',
172
+ message: t('card.newDescription'),
161
173
  default: card.desc || '',
162
174
  },
163
175
  ]);
@@ -166,7 +178,7 @@ export class CardController {
166
178
  name: newName,
167
179
  desc: newDesc,
168
180
  });
169
- console.log('✅ Cartão atualizado com sucesso!');
181
+ console.log(t('card.updated'));
170
182
  }
171
183
 
172
184
  private async deleteCardInteractive(
@@ -177,7 +189,7 @@ export class CardController {
177
189
  {
178
190
  type: 'confirm',
179
191
  name: 'confirm',
180
- message: `Tem certeza que deseja deletar "${card.name}"?`,
192
+ message: t('card.confirmDelete', { name: card.name }),
181
193
  default: false,
182
194
  },
183
195
  ]);
@@ -196,7 +208,7 @@ export class CardController {
196
208
  {
197
209
  type: 'list',
198
210
  name: 'targetList',
199
- message: 'Mover para qual lista?',
211
+ message: t('card.moveToWhichList'),
200
212
  choices: lists.map(list => ({ name: list.name, value: list.id })),
201
213
  },
202
214
  ]);
@@ -218,16 +230,14 @@ export class CardController {
218
230
  const board = boards.find((b: any) => b.name === boardName);
219
231
 
220
232
  if (!board) {
221
- throw new Error(`Quadro "${boardName}" não encontrado`);
233
+ throw new Error(t('board.notFound', { name: boardName }));
222
234
  }
223
235
 
224
236
  const lists = await (this.boardController as any).getLists(board.id);
225
237
  const list = lists.find((l: any) => l.name === listName);
226
238
 
227
239
  if (!list) {
228
- throw new Error(
229
- `Lista "${listName}" não encontrada no quadro "${boardName}"`,
230
- );
240
+ throw new Error(t('list.notFound', { listName, boardName }));
231
241
  }
232
242
 
233
243
  const newCard = await this.createCardUseCase.execute({
@@ -236,10 +246,10 @@ export class CardController {
236
246
  listId: list.id,
237
247
  });
238
248
 
239
- console.log('✅ Cartão criado com sucesso!');
240
- console.log(`📝 Nome: ${newCard.name}`);
241
- console.log(`🔗 URL: ${newCard.url}`);
242
- console.log(`🆔 ID: ${newCard.id}`);
249
+ console.log(t('card.created'));
250
+ console.log(t('card.cardName', { name: newCard.name }));
251
+ console.log(t('card.cardUrl', { url: newCard.url }));
252
+ console.log(t('card.cardId', { id: newCard.id }));
243
253
  }
244
254
 
245
255
  async moveCard(cardId: string, targetListName: string): Promise<void> {
@@ -262,14 +272,17 @@ export class CardController {
262
272
 
263
273
  if (!targetList) {
264
274
  throw new Error(
265
- `Lista "${targetListName}" não encontrada no quadro "${board.name}"`,
275
+ t('list.notFound', {
276
+ listName: targetListName,
277
+ boardName: board.name,
278
+ }),
266
279
  );
267
280
  }
268
281
 
269
282
  await this.moveCardUseCase.execute(cardId, targetList.id);
270
- console.log('✅ Cartão movido com sucesso!');
271
- console.log(`📝 Cartão: ${card.name}`);
272
- console.log(`➡️ Para: ${targetList.name}`);
283
+ console.log(t('card.moved'));
284
+ console.log(t('card.cardName', { name: card.name }));
285
+ console.log(t('card.movedTo', { listName: targetList.name }));
273
286
  return;
274
287
  }
275
288
  } catch {
@@ -279,7 +292,7 @@ export class CardController {
279
292
  }
280
293
  }
281
294
 
282
- throw new Error(`Cartão com ID "${cardId}" não encontrado`);
295
+ throw new Error(t('card.notFound', { cardId }));
283
296
  }
284
297
 
285
298
  async deleteCard(cardId: string, card?: CardEntity): Promise<void> {
@@ -308,12 +321,12 @@ export class CardController {
308
321
  }
309
322
 
310
323
  if (!card) {
311
- throw new Error(`Cartão com ID "${cardId}" não encontrado`);
324
+ throw new Error(t('card.notFound', { cardId }));
312
325
  }
313
326
  }
314
327
 
315
328
  await this.deleteCardUseCase.execute(cardId);
316
- console.log('✅ Cartão deletado com sucesso!');
317
- console.log(`📝 Nome: ${card.name}`);
329
+ console.log(t('card.deleted'));
330
+ console.log(t('card.cardName', { name: card.name }));
318
331
  }
319
332
  }
@@ -1,5 +1,7 @@
1
1
  import { CONFIG_ACTIONS } from '@shared/types';
2
+
2
3
  import inquirer from 'inquirer';
4
+ import { t } from '@/i18n';
3
5
 
4
6
  export class ConfigController {
5
7
  constructor(private authController: { getConfig: () => Promise<unknown>; setupToken: () => Promise<void> }) {}
@@ -10,12 +12,12 @@ export class ConfigController {
10
12
  {
11
13
  type: 'list',
12
14
  name: 'configAction',
13
- message: '⚙️ Configurações',
15
+ message: t('menu.configTitle'),
14
16
  choices: [
15
- { name: '🔑 Configurar token', value: CONFIG_ACTIONS.TOKEN },
16
- { name: '👀 Ver configuração atual', value: CONFIG_ACTIONS.VIEW },
17
- { name: '🔄 Resetar configuração', value: CONFIG_ACTIONS.RESET },
18
- { name: '⬅️ Voltar', value: CONFIG_ACTIONS.BACK },
17
+ { name: t('menu.configToken'), value: CONFIG_ACTIONS.TOKEN },
18
+ { name: t('menu.configView'), value: CONFIG_ACTIONS.VIEW },
19
+ { name: t('menu.configReset'), value: CONFIG_ACTIONS.RESET },
20
+ { name: t('menu.configBack'), value: CONFIG_ACTIONS.BACK },
19
21
  ],
20
22
  },
21
23
  ]);
@@ -26,27 +28,26 @@ export class ConfigController {
26
28
  break;
27
29
  case CONFIG_ACTIONS.VIEW:
28
30
  const config = await this.authController.getConfig() as any;
29
- console.log('📋 Configuração atual:');
31
+ console.log(t('menu.currentConfig'));
30
32
  console.log(`API Key: ${config.apiKey}`);
31
- console.log(
32
- `Token configurado: ${config.hasValidToken() ? '✅ Sim' : '❌ Não'}`,
33
- );
34
- console.log(
35
- `Arquivo de config: ~/.trello-cli-unofficial/config.json`,
36
- );
33
+ const tokenStatus = config.hasValidToken()
34
+ ? `✅ ${t('common.yes')}`
35
+ : `❌ ${t('common.no')}`;
36
+ console.log(`${t('menu.tokenConfigured')} ${tokenStatus}`);
37
+ console.log(t('menu.configFile'));
37
38
  break;
38
39
  case CONFIG_ACTIONS.RESET:
39
40
  const { confirm } = await inquirer.prompt([
40
41
  {
41
42
  type: 'confirm',
42
43
  name: 'confirm',
43
- message: 'Tem certeza que deseja resetar toda a configuração?',
44
+ message: t('menu.confirmReset'),
44
45
  default: false,
45
46
  },
46
47
  ]);
47
48
  if (confirm) {
48
49
  // Reset logic would need to be implemented in the use case
49
- console.log('✅ Configuração resetada!');
50
+ console.log(t('menu.configResetted'));
50
51
  }
51
52
  break;
52
53
  case CONFIG_ACTIONS.BACK:
@@ -1,6 +1,9 @@
1
1
  import type { ListEntity } from '@domain/entities';
2
+
2
3
  import { MENU_ACTIONS } from '@shared/types';
4
+
3
5
  import inquirer from 'inquirer';
6
+ import { t } from '@/i18n';
4
7
 
5
8
  export class MainMenuController {
6
9
  constructor(
@@ -18,13 +21,13 @@ export class MainMenuController {
18
21
  {
19
22
  type: 'list',
20
23
  name: 'action',
21
- message: '🏠 Menu Principal - Trello CLI Unofficial',
24
+ message: t('menu.title'),
22
25
  choices: [
23
- { name: '📋 Ver meus quadros', value: MENU_ACTIONS.BOARDS },
24
- { name: '📝 Explorar quadro', value: MENU_ACTIONS.EXPLORE },
25
- { name: '➕ Criar cartão', value: MENU_ACTIONS.CREATE },
26
- { name: '⚙️ Configurações', value: MENU_ACTIONS.CONFIG },
27
- { name: '🚪 Sair', value: MENU_ACTIONS.EXIT },
26
+ { name: t('menu.boards'), value: MENU_ACTIONS.BOARDS },
27
+ { name: t('menu.explore'), value: MENU_ACTIONS.EXPLORE },
28
+ { name: t('menu.create'), value: MENU_ACTIONS.CREATE },
29
+ { name: t('menu.config'), value: MENU_ACTIONS.CONFIG },
30
+ { name: t('menu.exit'), value: MENU_ACTIONS.EXIT },
28
31
  ],
29
32
  },
30
33
  ]);
@@ -44,11 +47,11 @@ export class MainMenuController {
44
47
  await this.configController.showConfigMenu();
45
48
  break;
46
49
  case MENU_ACTIONS.EXIT:
47
- console.log('👋 Até logo!');
50
+ console.log(t('menu.goodbye'));
48
51
  return;
49
52
  }
50
53
  } catch (error) {
51
- console.error('❌ Erro:', (error as Error).message);
54
+ console.error(t('errors.generic'), (error as Error).message);
52
55
  }
53
56
 
54
57
  console.log(`\n${'='.repeat(50)}\n`);
@@ -57,6 +60,6 @@ export class MainMenuController {
57
60
 
58
61
  private async exploreBoard(): Promise<void> {
59
62
  // This will be implemented when we refactor the main controller
60
- console.log('🚧 Explorar quadro - Em desenvolvimento');
63
+ console.log(t('menu.exploreInDevelopment'));
61
64
  }
62
65
  }
package/test_trigger.txt DELETED
@@ -1,3 +0,0 @@
1
- # Test comment to trigger CI
2
- # Another test comment
3
- test