@newpeak/barista-cli 0.1.11 → 0.1.12

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.
Files changed (298) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +7 -3
  3. package/docs/ARCHITECTURE.md +0 -184
  4. package/docs/COMMANDS.md +0 -352
  5. package/docs/COMMAND_DESIGN_SPEC.md +0 -840
  6. package/docs/INTEGRATION_NOTES.md +0 -270
  7. package/docs/commands/REFERENCE.md +0 -323
  8. package/docs/commands/arabica/auth/index.md +0 -296
  9. package/docs/commands/liberica/auth/index.md +0 -133
  10. package/docs/commands/liberica/calendar/DESIGN.md +0 -333
  11. package/docs/commands/liberica/client-contacts/create.md +0 -152
  12. package/docs/commands/liberica/client-contacts/delete.md +0 -123
  13. package/docs/commands/liberica/client-contacts/get.md +0 -133
  14. package/docs/commands/liberica/client-contacts/list.md +0 -143
  15. package/docs/commands/liberica/client-contacts/update.md +0 -158
  16. package/docs/commands/liberica/context/index.md +0 -60
  17. package/docs/commands/liberica/currency/create.md +0 -145
  18. package/docs/commands/liberica/currency/delete.md +0 -121
  19. package/docs/commands/liberica/currency/disable.md +0 -119
  20. package/docs/commands/liberica/currency/enable.md +0 -115
  21. package/docs/commands/liberica/currency/get.md +0 -118
  22. package/docs/commands/liberica/currency/list.md +0 -149
  23. package/docs/commands/liberica/currency/update.md +0 -141
  24. package/docs/commands/liberica/employees/create.md +0 -185
  25. package/docs/commands/liberica/employees/disable.md +0 -138
  26. package/docs/commands/liberica/employees/enable.md +0 -137
  27. package/docs/commands/liberica/employees/get.md +0 -153
  28. package/docs/commands/liberica/employees/list.md +0 -168
  29. package/docs/commands/liberica/employees/update.md +0 -180
  30. package/docs/commands/liberica/locations/create.md +0 -195
  31. package/docs/commands/liberica/locations/list.md +0 -171
  32. package/docs/commands/liberica/materials/create.md +0 -293
  33. package/docs/commands/liberica/materials/delete.md +0 -240
  34. package/docs/commands/liberica/materials/disable.md +0 -150
  35. package/docs/commands/liberica/materials/enable.md +0 -146
  36. package/docs/commands/liberica/materials/get.md +0 -188
  37. package/docs/commands/liberica/materials/list.md +0 -198
  38. package/docs/commands/liberica/materials/update.md +0 -250
  39. package/docs/commands/liberica/orgs/list.md +0 -62
  40. package/docs/commands/liberica/positions/list.md +0 -61
  41. package/docs/commands/liberica/roles/list.md +0 -67
  42. package/docs/commands/liberica/stock/ledger.md +0 -209
  43. package/docs/commands/liberica/stock/list.md +0 -165
  44. package/docs/commands/liberica/supplier-contacts/create.md +0 -152
  45. package/docs/commands/liberica/supplier-contacts/delete.md +0 -123
  46. package/docs/commands/liberica/supplier-contacts/get.md +0 -133
  47. package/docs/commands/liberica/supplier-contacts/list.md +0 -143
  48. package/docs/commands/liberica/supplier-contacts/update.md +0 -158
  49. package/docs/commands/liberica/teams/issues/close.md +0 -161
  50. package/docs/commands/liberica/teams/issues/create.md +0 -212
  51. package/docs/commands/liberica/teams/issues/delete.md +0 -179
  52. package/docs/commands/liberica/teams/issues/get.md +0 -167
  53. package/docs/commands/liberica/teams/issues/list.md +0 -182
  54. package/docs/commands/liberica/teams/issues/tests-design.md +0 -341
  55. package/docs/commands/liberica/teams/issues/update.md +0 -202
  56. package/docs/commands/liberica/teams/projects/create.md +0 -174
  57. package/docs/commands/liberica/teams/projects/delete.md +0 -180
  58. package/docs/commands/liberica/teams/projects/get.md +0 -150
  59. package/docs/commands/liberica/teams/projects/list.md +0 -179
  60. package/docs/commands/liberica/teams/projects/update.md +0 -175
  61. package/docs/commands/liberica/teams/tasks/create.md +0 -163
  62. package/docs/commands/liberica/teams/tasks/delete.md +0 -109
  63. package/docs/commands/liberica/teams/tasks/get.md +0 -121
  64. package/docs/commands/liberica/teams/tasks/list.md +0 -148
  65. package/docs/commands/liberica/teams/tasks/update.md +0 -158
  66. package/docs/commands/liberica/teams/work-logs/create.md +0 -151
  67. package/docs/commands/liberica/teams/work-logs/delete.md +0 -130
  68. package/docs/commands/liberica/teams/work-logs/get.md +0 -131
  69. package/docs/commands/liberica/teams/work-logs/list.md +0 -153
  70. package/docs/commands/liberica/teams/work-logs/update.md +0 -150
  71. package/docs/commands/liberica/transfer-in-forms/batch-delete.md +0 -157
  72. package/docs/commands/liberica/transfer-in-forms/batch-review.md +0 -157
  73. package/docs/commands/liberica/transfer-in-forms/batch-unreview.md +0 -157
  74. package/docs/commands/liberica/transfer-in-forms/create.md +0 -220
  75. package/docs/commands/liberica/transfer-in-forms/get.md +0 -221
  76. package/docs/commands/liberica/transfer-in-forms/list.md +0 -242
  77. package/docs/commands/liberica/transfer-in-forms/update.md +0 -185
  78. package/docs/commands/liberica/transfer-out-forms/batch-delete.md +0 -187
  79. package/docs/commands/liberica/transfer-out-forms/batch-review.md +0 -157
  80. package/docs/commands/liberica/transfer-out-forms/batch-unreview.md +0 -157
  81. package/docs/commands/liberica/transfer-out-forms/create.md +0 -280
  82. package/docs/commands/liberica/transfer-out-forms/get.md +0 -211
  83. package/docs/commands/liberica/transfer-out-forms/list.md +0 -233
  84. package/docs/commands/liberica/transfer-out-forms/update.md +0 -286
  85. package/docs/commands/liberica/uoms/create.md +0 -136
  86. package/docs/commands/liberica/uoms/delete.md +0 -119
  87. package/docs/commands/liberica/uoms/disable.md +0 -117
  88. package/docs/commands/liberica/uoms/enable.md +0 -115
  89. package/docs/commands/liberica/uoms/get.md +0 -119
  90. package/docs/commands/liberica/uoms/list.md +0 -155
  91. package/docs/commands/liberica/uoms/update.md +0 -148
  92. package/docs/commands/liberica/users/create.md +0 -170
  93. package/docs/commands/liberica/users/get.md +0 -151
  94. package/docs/commands/liberica/users/list.md +0 -175
  95. package/docs/commands/liberica/warehouses/create.md +0 -222
  96. package/docs/commands/liberica/warehouses/list.md +0 -184
  97. package/src/commands/arabica/auth/index.ts +0 -277
  98. package/src/commands/arabica/auth/login.ts +0 -5
  99. package/src/commands/arabica/auth/logout.ts +0 -5
  100. package/src/commands/arabica/auth/register.ts +0 -5
  101. package/src/commands/arabica/auth/status.ts +0 -5
  102. package/src/commands/arabica/index.ts +0 -23
  103. package/src/commands/auth.ts +0 -107
  104. package/src/commands/context.ts +0 -60
  105. package/src/commands/liberica/auth/index.ts +0 -176
  106. package/src/commands/liberica/calendar/index.ts +0 -13
  107. package/src/commands/liberica/calendar/list.ts +0 -214
  108. package/src/commands/liberica/calendar/set.ts +0 -130
  109. package/src/commands/liberica/client-contacts/create.ts +0 -115
  110. package/src/commands/liberica/client-contacts/delete.ts +0 -140
  111. package/src/commands/liberica/client-contacts/get.ts +0 -103
  112. package/src/commands/liberica/client-contacts/index.ts +0 -19
  113. package/src/commands/liberica/client-contacts/list.ts +0 -118
  114. package/src/commands/liberica/client-contacts/update.ts +0 -137
  115. package/src/commands/liberica/clients/create.ts +0 -122
  116. package/src/commands/liberica/clients/delete.ts +0 -125
  117. package/src/commands/liberica/clients/get.ts +0 -88
  118. package/src/commands/liberica/clients/index.ts +0 -19
  119. package/src/commands/liberica/clients/list.ts +0 -123
  120. package/src/commands/liberica/clients/update.ts +0 -103
  121. package/src/commands/liberica/context/index.ts +0 -43
  122. package/src/commands/liberica/currency/create.ts +0 -183
  123. package/src/commands/liberica/currency/delete.ts +0 -124
  124. package/src/commands/liberica/currency/disable.ts +0 -147
  125. package/src/commands/liberica/currency/enable.ts +0 -128
  126. package/src/commands/liberica/currency/get.ts +0 -91
  127. package/src/commands/liberica/currency/index.ts +0 -23
  128. package/src/commands/liberica/currency/list.ts +0 -140
  129. package/src/commands/liberica/currency/update.ts +0 -129
  130. package/src/commands/liberica/dict-types/get.ts +0 -74
  131. package/src/commands/liberica/dict-types/index.ts +0 -15
  132. package/src/commands/liberica/dict-types/list.ts +0 -118
  133. package/src/commands/liberica/dict-types/update.ts +0 -134
  134. package/src/commands/liberica/dicts/create.ts +0 -175
  135. package/src/commands/liberica/dicts/delete.ts +0 -107
  136. package/src/commands/liberica/dicts/get.ts +0 -80
  137. package/src/commands/liberica/dicts/index.ts +0 -19
  138. package/src/commands/liberica/dicts/list.ts +0 -114
  139. package/src/commands/liberica/dicts/update.ts +0 -116
  140. package/src/commands/liberica/employees/create.ts +0 -275
  141. package/src/commands/liberica/employees/delete.ts +0 -122
  142. package/src/commands/liberica/employees/disable.ts +0 -97
  143. package/src/commands/liberica/employees/enable.ts +0 -97
  144. package/src/commands/liberica/employees/get.ts +0 -115
  145. package/src/commands/liberica/employees/index.ts +0 -23
  146. package/src/commands/liberica/employees/list.ts +0 -131
  147. package/src/commands/liberica/employees/update.ts +0 -157
  148. package/src/commands/liberica/index.ts +0 -81
  149. package/src/commands/liberica/materials/create.ts +0 -199
  150. package/src/commands/liberica/materials/delete.ts +0 -105
  151. package/src/commands/liberica/materials/disable.ts +0 -148
  152. package/src/commands/liberica/materials/enable.ts +0 -129
  153. package/src/commands/liberica/materials/get.ts +0 -83
  154. package/src/commands/liberica/materials/index.ts +0 -23
  155. package/src/commands/liberica/materials/list.ts +0 -142
  156. package/src/commands/liberica/materials/update.ts +0 -125
  157. package/src/commands/liberica/mould/get.ts +0 -111
  158. package/src/commands/liberica/mould/index.ts +0 -17
  159. package/src/commands/liberica/mould/list.ts +0 -157
  160. package/src/commands/liberica/mould/set-status.ts +0 -99
  161. package/src/commands/liberica/mould/stock-in.ts +0 -165
  162. package/src/commands/liberica/operations/active.ts +0 -153
  163. package/src/commands/liberica/operations/batch-delete.ts +0 -131
  164. package/src/commands/liberica/operations/copy.ts +0 -138
  165. package/src/commands/liberica/operations/create.ts +0 -223
  166. package/src/commands/liberica/operations/deactive.ts +0 -152
  167. package/src/commands/liberica/operations/delete.ts +0 -128
  168. package/src/commands/liberica/operations/design.md +0 -587
  169. package/src/commands/liberica/operations/get.ts +0 -112
  170. package/src/commands/liberica/operations/index.ts +0 -27
  171. package/src/commands/liberica/operations/list.ts +0 -180
  172. package/src/commands/liberica/operations/update.ts +0 -218
  173. package/src/commands/liberica/orgs/index.ts +0 -34
  174. package/src/commands/liberica/positions/index.ts +0 -30
  175. package/src/commands/liberica/roles/index.ts +0 -59
  176. package/src/commands/liberica/stock/index.ts +0 -13
  177. package/src/commands/liberica/stock/ledger.ts +0 -159
  178. package/src/commands/liberica/stock/list.ts +0 -128
  179. package/src/commands/liberica/supplier-contacts/create.ts +0 -120
  180. package/src/commands/liberica/supplier-contacts/delete.ts +0 -88
  181. package/src/commands/liberica/supplier-contacts/get.ts +0 -94
  182. package/src/commands/liberica/supplier-contacts/index.ts +0 -19
  183. package/src/commands/liberica/supplier-contacts/list.ts +0 -130
  184. package/src/commands/liberica/supplier-contacts/update.ts +0 -127
  185. package/src/commands/liberica/suppliers/create.ts +0 -149
  186. package/src/commands/liberica/suppliers/delete.ts +0 -102
  187. package/src/commands/liberica/suppliers/disable.ts +0 -145
  188. package/src/commands/liberica/suppliers/enable.ts +0 -126
  189. package/src/commands/liberica/suppliers/get.ts +0 -86
  190. package/src/commands/liberica/suppliers/index.ts +0 -23
  191. package/src/commands/liberica/suppliers/list.ts +0 -134
  192. package/src/commands/liberica/suppliers/update.ts +0 -128
  193. package/src/commands/liberica/teams/index.ts +0 -17
  194. package/src/commands/liberica/teams/issues/close.ts +0 -104
  195. package/src/commands/liberica/teams/issues/create.ts +0 -254
  196. package/src/commands/liberica/teams/issues/delete.ts +0 -58
  197. package/src/commands/liberica/teams/issues/get.ts +0 -78
  198. package/src/commands/liberica/teams/issues/index.ts +0 -21
  199. package/src/commands/liberica/teams/issues/list.ts +0 -144
  200. package/src/commands/liberica/teams/issues/update.ts +0 -141
  201. package/src/commands/liberica/teams/projects/create.ts +0 -159
  202. package/src/commands/liberica/teams/projects/delete.ts +0 -58
  203. package/src/commands/liberica/teams/projects/get.ts +0 -87
  204. package/src/commands/liberica/teams/projects/index.ts +0 -19
  205. package/src/commands/liberica/teams/projects/list.ts +0 -147
  206. package/src/commands/liberica/teams/projects/update.ts +0 -117
  207. package/src/commands/liberica/teams/tasks/create.ts +0 -102
  208. package/src/commands/liberica/teams/tasks/delete.ts +0 -92
  209. package/src/commands/liberica/teams/tasks/get.ts +0 -64
  210. package/src/commands/liberica/teams/tasks/index.ts +0 -19
  211. package/src/commands/liberica/teams/tasks/list.ts +0 -102
  212. package/src/commands/liberica/teams/tasks/update.ts +0 -122
  213. package/src/commands/liberica/teams/work-logs/create.ts +0 -204
  214. package/src/commands/liberica/teams/work-logs/delete.ts +0 -58
  215. package/src/commands/liberica/teams/work-logs/get.ts +0 -87
  216. package/src/commands/liberica/teams/work-logs/index.ts +0 -19
  217. package/src/commands/liberica/teams/work-logs/list.ts +0 -141
  218. package/src/commands/liberica/teams/work-logs/update.ts +0 -120
  219. package/src/commands/liberica/transfer-in-forms/batch-delete.ts +0 -152
  220. package/src/commands/liberica/transfer-in-forms/batch-review.ts +0 -151
  221. package/src/commands/liberica/transfer-in-forms/batch-unreview.ts +0 -152
  222. package/src/commands/liberica/transfer-in-forms/create.ts +0 -179
  223. package/src/commands/liberica/transfer-in-forms/get.ts +0 -107
  224. package/src/commands/liberica/transfer-in-forms/index.ts +0 -23
  225. package/src/commands/liberica/transfer-in-forms/list.ts +0 -97
  226. package/src/commands/liberica/transfer-in-forms/update.ts +0 -213
  227. package/src/commands/liberica/transfer-out-forms/batch-delete.ts +0 -83
  228. package/src/commands/liberica/transfer-out-forms/batch-review.ts +0 -148
  229. package/src/commands/liberica/transfer-out-forms/batch-unreview.ts +0 -56
  230. package/src/commands/liberica/transfer-out-forms/create.ts +0 -194
  231. package/src/commands/liberica/transfer-out-forms/get.ts +0 -114
  232. package/src/commands/liberica/transfer-out-forms/index.ts +0 -23
  233. package/src/commands/liberica/transfer-out-forms/list.ts +0 -125
  234. package/src/commands/liberica/transfer-out-forms/update.ts +0 -197
  235. package/src/commands/liberica/uoms/create.ts +0 -134
  236. package/src/commands/liberica/uoms/delete.ts +0 -105
  237. package/src/commands/liberica/uoms/disable.ts +0 -148
  238. package/src/commands/liberica/uoms/enable.ts +0 -129
  239. package/src/commands/liberica/uoms/get.ts +0 -83
  240. package/src/commands/liberica/uoms/index.ts +0 -23
  241. package/src/commands/liberica/uoms/list.ts +0 -129
  242. package/src/commands/liberica/uoms/update.ts +0 -124
  243. package/src/commands/liberica/users/create.ts +0 -133
  244. package/src/commands/liberica/users/delete.ts +0 -49
  245. package/src/commands/liberica/users/disable.ts +0 -41
  246. package/src/commands/liberica/users/enable.ts +0 -30
  247. package/src/commands/liberica/users/get.ts +0 -46
  248. package/src/commands/liberica/users/index.ts +0 -27
  249. package/src/commands/liberica/users/list.ts +0 -68
  250. package/src/commands/liberica/users/me.ts +0 -42
  251. package/src/commands/liberica/users/reset-password.ts +0 -42
  252. package/src/commands/liberica/users/update.ts +0 -48
  253. package/src/commands/liberica/warehouses/create.ts +0 -204
  254. package/src/commands/liberica/warehouses/delete.ts +0 -112
  255. package/src/commands/liberica/warehouses/disable.ts +0 -174
  256. package/src/commands/liberica/warehouses/enable.ts +0 -174
  257. package/src/commands/liberica/warehouses/get.ts +0 -101
  258. package/src/commands/liberica/warehouses/index.ts +0 -25
  259. package/src/commands/liberica/warehouses/list.ts +0 -136
  260. package/src/commands/liberica/warehouses/locations/create.ts +0 -209
  261. package/src/commands/liberica/warehouses/locations/delete.ts +0 -116
  262. package/src/commands/liberica/warehouses/locations/disable.ts +0 -174
  263. package/src/commands/liberica/warehouses/locations/enable.ts +0 -174
  264. package/src/commands/liberica/warehouses/locations/get.ts +0 -84
  265. package/src/commands/liberica/warehouses/locations/index.ts +0 -23
  266. package/src/commands/liberica/warehouses/locations/list.ts +0 -140
  267. package/src/commands/liberica/warehouses/locations/update.ts +0 -135
  268. package/src/commands/liberica/warehouses/update.ts +0 -142
  269. package/src/core/api/client.ts +0 -4443
  270. package/src/core/auth/token-manager.ts +0 -183
  271. package/src/core/config/manager.ts +0 -164
  272. package/src/index.ts +0 -35
  273. package/src/types/calendar.ts +0 -36
  274. package/src/types/client-contact.ts +0 -78
  275. package/src/types/client.ts +0 -115
  276. package/src/types/currency.ts +0 -90
  277. package/src/types/dict.ts +0 -121
  278. package/src/types/employee.ts +0 -102
  279. package/src/types/index.ts +0 -93
  280. package/src/types/location.ts +0 -66
  281. package/src/types/material.ts +0 -61
  282. package/src/types/mould-stock-in.ts +0 -82
  283. package/src/types/mould.ts +0 -74
  284. package/src/types/operation.ts +0 -72
  285. package/src/types/org.ts +0 -25
  286. package/src/types/position.ts +0 -24
  287. package/src/types/stock.ts +0 -161
  288. package/src/types/supplier-contact.ts +0 -78
  289. package/src/types/supplier.ts +0 -66
  290. package/src/types/team-issue.ts +0 -94
  291. package/src/types/team-project.ts +0 -74
  292. package/src/types/team-task.ts +0 -98
  293. package/src/types/team-work-log.ts +0 -87
  294. package/src/types/transfer-in-form.ts +0 -265
  295. package/src/types/transfer-out-form.ts +0 -290
  296. package/src/types/uom.ts +0 -60
  297. package/src/types/user.ts +0 -64
  298. package/src/types/warehouse.ts +0 -82
@@ -1,107 +0,0 @@
1
- import { Command } from 'commander';
2
- import chalk from 'chalk';
3
- import Table from 'cli-table3';
4
- import { configManager } from '../../../core/config/manager.js';
5
- import { apiClient } from '../../../core/api/client.js';
6
- import { Environment } from '../../../types/index.js';
7
- import { TransferInForm, TransferInFormItem } from '../../../types/transfer-in-form.js';
8
-
9
- export function createTransferInFormGetCommand(): Command {
10
- const getCommand = new Command('get');
11
- getCommand.description('Get transfer-in form details by ID');
12
- getCommand.arguments('<transferInFormId>');
13
- getCommand.option('--json', 'Output as JSON');
14
-
15
- getCommand.action(async (transferInFormId: string, options: Record<string, unknown>) => {
16
- const context = configManager.getCurrentContext();
17
- const environment = (options.env as Environment) || context.environment;
18
- const tenant = (options.tenant as string) || context.tenant;
19
-
20
- if (!transferInFormId || transferInFormId.trim() === '') {
21
- console.error(chalk.red('\n✗ Invalid transfer-in form ID.\n'));
22
- process.exit(1);
23
- }
24
-
25
- try {
26
- const response = await apiClient.getTransferInForm(environment, tenant, transferInFormId);
27
-
28
- if (!response.success) {
29
- const errorCode = response.error?.code || 'UNKNOWN_ERROR';
30
- const errorMessage = response.error?.message || 'Unknown error';
31
-
32
- // Handle "transfer-in form not found" case
33
- if (errorCode === '01001xx001' || errorMessage.includes('不存在')) {
34
- console.error(chalk.red(`\n✗ Transfer-in form not found: ${transferInFormId}\n`));
35
- } else {
36
- console.error(chalk.red(`\n✗ Error: ${errorMessage} (${errorCode})\n`));
37
- }
38
- process.exit(1);
39
- }
40
-
41
- const transferInForm = response.data as TransferInForm | null;
42
-
43
- if (!transferInForm) {
44
- console.error(chalk.red('\n✗ Transfer-in form not found\n'));
45
- process.exit(1);
46
- }
47
-
48
- if (options.json) {
49
- console.log(JSON.stringify({
50
- success: true,
51
- data: transferInForm,
52
- }, null, 2));
53
- return;
54
- }
55
-
56
- // Main details table
57
- console.log(chalk.bold('\n📋 Transfer-In Form Details\n'));
58
- console.log(` ${chalk.gray('ID:')} ${transferInForm.transferInFormId}`);
59
- console.log(` ${chalk.gray('Code:')} ${transferInForm.transferInFormCode}`);
60
- console.log(` ${chalk.gray('Warehouse:')} ${transferInForm.mainWarehouseCode}`);
61
- console.log(` ${chalk.gray('Stock Date:')} ${transferInForm.stockDate}`);
62
- console.log(` ${chalk.gray('Type:')} ${transferInForm.transferInType}`);
63
- console.log(` ${chalk.gray('Follower:')} ${transferInForm.followerName || transferInForm.follower}`);
64
- console.log(` ${chalk.gray('Review Flag:')} ${transferInForm.reviewFlag === 'REVIEWED' ? 'Reviewed' : 'Unreviewed'}`);
65
- if (transferInForm.reviewer) {
66
- console.log(` ${chalk.gray('Reviewer:')} ${transferInForm.reviewerName || transferInForm.reviewer}`);
67
- }
68
- if (transferInForm.reviewTime) {
69
- console.log(` ${chalk.gray('Review Time:')} ${transferInForm.reviewTime}`);
70
- }
71
- if (transferInForm.remark) {
72
- console.log(` ${chalk.gray('Remark:')} ${transferInForm.remark}`);
73
- }
74
- console.log();
75
-
76
- // Item list table
77
- const items = transferInForm.itemList || [];
78
- if (items.length > 0) {
79
- console.log(chalk.bold(`Items (${items.length}):\n`));
80
- const itemTable = new Table({
81
- head: [chalk.bold('Material Code'), chalk.bold('Material Name'), chalk.bold('Qty'), chalk.bold('UOM'), chalk.bold('Unit Price'), chalk.bold('Amount')],
82
- colWidths: [15, 20, 10, 8, 12, 12],
83
- style: { head: [], border: [] },
84
- });
85
-
86
- for (const item of items as TransferInFormItem[]) {
87
- itemTable.push([
88
- item.materialCode || '-',
89
- item.materialName || '-',
90
- String(item.stockQuantity !== undefined ? item.stockQuantity : item.formQuantity),
91
- item.materialUomCode || '-',
92
- item.unitPrice !== undefined ? String(item.unitPrice) : '-',
93
- item.stockAmount !== undefined ? String(item.stockAmount) : '-',
94
- ]);
95
- }
96
-
97
- console.log(itemTable.toString());
98
- console.log();
99
- }
100
- } catch (error) {
101
- console.error(chalk.red(`\n✗ Unexpected error: ${error instanceof Error ? error.message : 'Unknown error'}\n`));
102
- process.exit(1);
103
- }
104
- });
105
-
106
- return getCommand;
107
- }
@@ -1,23 +0,0 @@
1
- import { Command } from 'commander';
2
- import { createTransferInFormListCommand } from './list.js';
3
- import { createTransferInFormGetCommand } from './get.js';
4
- import { createTransferInFormCreateCommand } from './create.js';
5
- import { createTransferInFormUpdateCommand } from './update.js';
6
- import { createTransferInFormBatchDeleteCommand } from './batch-delete.js';
7
- import { createTransferInFormBatchReviewCommand } from './batch-review.js';
8
- import { createTransferInFormBatchUnreviewCommand } from './batch-unreview.js';
9
-
10
- export function createTransferInFormsCommand(): Command {
11
- const transferInFormsCommand = new Command('transfer-in-forms');
12
- transferInFormsCommand.description('Manage transfer-in forms');
13
-
14
- transferInFormsCommand.addCommand(createTransferInFormListCommand());
15
- transferInFormsCommand.addCommand(createTransferInFormGetCommand());
16
- transferInFormsCommand.addCommand(createTransferInFormCreateCommand());
17
- transferInFormsCommand.addCommand(createTransferInFormUpdateCommand());
18
- transferInFormsCommand.addCommand(createTransferInFormBatchDeleteCommand());
19
- transferInFormsCommand.addCommand(createTransferInFormBatchReviewCommand());
20
- transferInFormsCommand.addCommand(createTransferInFormBatchUnreviewCommand());
21
-
22
- return transferInFormsCommand;
23
- }
@@ -1,97 +0,0 @@
1
- import { Command } from 'commander';
2
- import chalk from 'chalk';
3
- import Table from 'cli-table3';
4
- import { configManager } from '../../../core/config/manager.js';
5
- import { apiClient } from '../../../core/api/client.js';
6
- import { TransferInFormCompact, TransferInFormCompactListResponse } from '../../../types/transfer-in-form.js';
7
- import { Environment } from '../../../types/index.js';
8
-
9
- export function createTransferInFormListCommand(): Command {
10
- const listCommand = new Command('list');
11
- listCommand.description('List transfer-in forms with pagination');
12
-
13
- listCommand
14
- .option('-p, --page <number>', 'Page number', '1')
15
- .option('-s, --size <number>', 'Page size', '20')
16
- .option('--code <string>', 'Transfer-in form code')
17
- .option('--warehouse-code <string>', 'Warehouse code')
18
- .option('--type <string>', 'Transfer-in type')
19
- .option('--review-flag <string>', 'Review flag (REVIEWED/UN_REVIEWED)')
20
- .option('--stock-date <string>', 'Stock date (YYYY-MM-DD)')
21
- .option('--stock-date-from <string>', 'Stock date from (YYYY-MM-DD)')
22
- .option('--stock-date-to <string>', 'Stock date to (YYYY-MM-DD)')
23
- .option('--material-code <string>', 'Material code')
24
- .option('--material-name <string>', 'Material name')
25
- .option('--follower <string>', 'Follower')
26
- .option('--reviewer <string>', 'Reviewer')
27
- .option('--json', 'Output as JSON')
28
- .action(async (options) => {
29
- const context = configManager.getCurrentContext();
30
- const environment = (options.env as Environment) || context.environment;
31
- const tenant = options.tenant || context.tenant;
32
-
33
- const page = parseInt(options.page as string, 10) - 1; // API uses 0-based
34
- const size = parseInt(options.size as string, 10);
35
-
36
- const params: Record<string, unknown> = { pageNo: page, pageSize: size };
37
- if (options.code) params.transferInFormCode = options.code;
38
- if (options.warehouseCode) params.warehouseCode = options.warehouseCode;
39
- if (options.type) params.transferInType = options.type;
40
- if (options.reviewFlag) params.reviewFlag = options.reviewFlag;
41
- if (options.stockDate) params.stockDate = options.stockDate;
42
- if (options.stockDateFrom) params.stockDateBegin = options.stockDateFrom;
43
- if (options.stockDateTo) params.stockDateEnd = options.stockDateTo;
44
- if (options.materialCode) params.materialCode = options.materialCode;
45
- if (options.materialName) params.materialName = options.materialName;
46
- if (options.follower) params.follower = options.follower;
47
- if (options.reviewer) params.reviewer = options.reviewer;
48
-
49
- const response = await apiClient.listTransferInForms(environment, tenant, params as any);
50
-
51
- if (!response.success) {
52
- console.error(chalk.red(`\n✗ Failed to list transfer-in forms: ${response.error?.message || 'Unknown error'}`));
53
- process.exit(1);
54
- }
55
-
56
- const data = response.data as TransferInFormCompactListResponse | undefined;
57
- if (!data || data.totalRows === 0) {
58
- console.log(chalk.bold('\n📋 Transfer-In Form List\n'));
59
- console.log(chalk.gray(' No records found\n'));
60
- return;
61
- }
62
-
63
- if (options.json) {
64
- console.log(JSON.stringify({ success: true, data }, null, 2));
65
- return;
66
- }
67
-
68
- const records = data.rows || [];
69
- console.log(chalk.bold('\n📋 Transfer-In Form List\n'));
70
-
71
- const table = new Table({
72
- head: [chalk.bold('ID'), chalk.bold('Code'), chalk.bold('Warehouse'), chalk.bold('Material'), chalk.bold('Qty'), chalk.bold('Review'), chalk.bold('Date')],
73
- colWidths: [20, 15, 12, 20, 10, 10, 12],
74
- style: { head: [], border: [] },
75
- });
76
-
77
- for (const r of records as TransferInFormCompact[]) {
78
- const quantity = r.stockQuantity !== undefined ? r.stockQuantity : r.formQuantity;
79
- table.push([
80
- r.transferInFormId || '-',
81
- r.transferInFormCode || '-',
82
- r.warehouseCode || '-',
83
- r.materialName || '-',
84
- String(quantity || ''),
85
- r.reviewFlag === 'REVIEWED' ? chalk.green('Reviewed') : chalk.yellow('Unreviewed'),
86
- r.stockDate || '-',
87
- ]);
88
- }
89
-
90
- console.log(table.toString());
91
- console.log();
92
- console.log(chalk.gray(` Total: ${data.totalRows} | Page: ${data.pageNo + 1} / ${Math.ceil(data.totalRows / data.pageSize) || 1}`));
93
- console.log();
94
- });
95
-
96
- return listCommand;
97
- }
@@ -1,213 +0,0 @@
1
- import { Command } from 'commander';
2
- import chalk from 'chalk';
3
- import { configManager } from '../../../core/config/manager.js';
4
- import { apiClient } from '../../../core/api/client.js';
5
- import { UpdateTransferInFormRequest, TransferInFormItemRequest } from '../../../types/transfer-in-form.js';
6
- import { Environment } from '../../../types/index.js';
7
-
8
- export function createTransferInFormUpdateCommand(): Command {
9
- const cmd = new Command('update');
10
- cmd.description('Update a transfer-in form');
11
-
12
- cmd
13
- .argument('<id>', 'Transfer-in form ID')
14
- .option('-c, --code <code>', 'Transfer-in form code')
15
- .option('-w, --warehouse-code <code>', 'Main warehouse code')
16
- .option('-t, --type <type>', 'Transfer-in type')
17
- .option('-f, --follower <id>', 'Follower ID')
18
- .option('--follower-name <name>', 'Follower name')
19
- .option('--stock-date <date>', 'Stock date (YYYY-MM-DD)')
20
- .option('--remark <remark>', 'Remark')
21
- // Individual item options (for single item update)
22
- .option('--item-id <id>', 'Existing transfer-in form item ID (for updating existing item)')
23
- .option('--item-warehouse-code <code>', 'Item warehouse code')
24
- .option('-m, --material-code <code>', 'Material code')
25
- .option('--material-no <no>', 'Material number')
26
- .option('--material-name <name>', 'Material name')
27
- .option('--material-type <type>', 'Material type')
28
- .option('-q, --quantity <number>', 'Form quantity')
29
- .option('--form-uom <code>', 'Form UOM code')
30
- .option('--unit-price <price>', 'Unit price')
31
- .option('--produced-date <date>', 'Produced date (YYYY-MM-DD)')
32
- .option('--lot-no <no>', 'Lot number')
33
- .option('--item-remark <remark>', 'Item remark')
34
- // JSON items array (alternative to individual item options)
35
- .option('--items <json>', 'JSON array of items (overrides individual item options)')
36
- .option('--dry-run', 'Preview mode')
37
- .option('--json', 'Output as JSON');
38
-
39
- cmd.action(async (id, options) => {
40
- const context = configManager.getCurrentContext();
41
- const environment = context.environment as Environment;
42
- const tenant = context.tenant;
43
- const dryRun = options.dryRun === true;
44
- const jsonOutput = options.json === true;
45
-
46
- // Validate stock date format
47
- if (options.stockDate && !/^\d{4}-\d{2}-\d{2}$/.test(options.stockDate)) {
48
- console.error(chalk.red('\n✗ Invalid stock-date format. Use YYYY-MM-DD\n'));
49
- process.exit(1);
50
- }
51
-
52
- const request: UpdateTransferInFormRequest = {
53
- transferInFormId: id,
54
- };
55
-
56
- // Add optional fields if provided
57
- if (options.code !== undefined) request.transferInFormCode = options.code;
58
- if (options.warehouseCode !== undefined) request.mainWarehouseCode = options.warehouseCode;
59
- if (options.stockDate !== undefined) request.stockDate = options.stockDate;
60
- if (options.type !== undefined) request.transferInType = options.type;
61
- if (options.follower !== undefined) request.follower = options.follower;
62
- if (options.followerName !== undefined) request.followerName = options.followerName;
63
- if (options.remark !== undefined) request.remark = options.remark;
64
-
65
- let itemList: TransferInFormItemRequest[] | undefined = undefined;
66
-
67
- if (options.items) {
68
- // Parse JSON items
69
- try {
70
- const parsed = JSON.parse(options.items);
71
- if (!Array.isArray(parsed)) {
72
- console.error(chalk.red('\n✗ --items must be a JSON array\n'));
73
- process.exit(1);
74
- }
75
- // Validate each item has required fields (if updating items, all required fields must be present)
76
- for (const item of parsed) {
77
- if (!item.warehouseCode || !item.materialCode || !item.formQuantity || !item.formMaterialUomCode || item.formUnitPrice == null) {
78
- console.error(chalk.red('\n✗ Each item must have warehouseCode, materialCode, formQuantity, formMaterialUomCode, formUnitPrice\n'));
79
- process.exit(1);
80
- }
81
- }
82
- itemList = parsed;
83
- } catch (error) {
84
- console.error(chalk.red('\n✗ Invalid JSON for --items: ' + (error instanceof Error ? error.message : 'Unknown error') + '\n'));
85
- process.exit(1);
86
- }
87
- } else {
88
- // Check if any individual item option is provided
89
- const hasItemOption = options.itemId !== undefined ||
90
- options.itemWarehouseCode !== undefined ||
91
- options.materialCode !== undefined ||
92
- options.materialNo !== undefined ||
93
- options.materialName !== undefined ||
94
- options.materialType !== undefined ||
95
- options.quantity !== undefined ||
96
- options.formUom !== undefined ||
97
- options.unitPrice !== undefined ||
98
- options.producedDate !== undefined ||
99
- options.lotNo !== undefined ||
100
- options.itemRemark !== undefined;
101
-
102
- if (hasItemOption) {
103
- // Validate required fields for item update
104
- if (!options.materialCode) {
105
- console.error(chalk.red('\n✗ Material code is required when updating item (--material-code)\n'));
106
- process.exit(1);
107
- }
108
- if (!options.formUom) {
109
- console.error(chalk.red('\n✗ Form UOM code is required when updating item (--form-uom)\n'));
110
- process.exit(1);
111
- }
112
- if (!options.unitPrice) {
113
- console.error(chalk.red('\n✗ Unit price is required when updating item (--unit-price)\n'));
114
- process.exit(1);
115
- }
116
-
117
- // Validate quantity
118
- let quantity = 1;
119
- if (options.quantity) {
120
- const q = parseFloat(options.quantity);
121
- if (isNaN(q) || q <= 0) {
122
- console.error(chalk.red('\n✗ Quantity must be a positive number\n'));
123
- process.exit(1);
124
- }
125
- quantity = q;
126
- } else {
127
- console.error(chalk.red('\n✗ Quantity is required when updating item (--quantity)\n'));
128
- process.exit(1);
129
- }
130
-
131
- // Validate unit price
132
- const unitPrice = parseFloat(options.unitPrice);
133
- if (isNaN(unitPrice) || unitPrice < 0) {
134
- console.error(chalk.red('\n✗ Unit price must be a non-negative number\n'));
135
- process.exit(1);
136
- }
137
-
138
- // Validate produced date format
139
- if (options.producedDate && !/^\d{4}-\d{2}-\d{2}$/.test(options.producedDate)) {
140
- console.error(chalk.red('\n✗ Invalid produced-date format. Use YYYY-MM-DD\n'));
141
- process.exit(1);
142
- }
143
-
144
- const item: TransferInFormItemRequest = {
145
- transferInFormItemId: options.itemId,
146
- warehouseCode: options.itemWarehouseCode || options.warehouseCode,
147
- materialCode: options.materialCode,
148
- materialNo: options.materialNo,
149
- materialName: options.materialName,
150
- materialType: options.materialType,
151
- formQuantity: quantity,
152
- formMaterialUomCode: options.formUom,
153
- formUnitPrice: unitPrice,
154
- producedDate: options.producedDate,
155
- lotNo: options.lotNo,
156
- remark: options.itemRemark,
157
- };
158
- itemList = [item];
159
- }
160
- }
161
-
162
- if (itemList) {
163
- request.itemList = itemList;
164
- }
165
-
166
- // Check if any fields to update (excluding transferInFormId)
167
- const updateFields = Object.keys(request).filter(k => k !== 'transferInFormId');
168
- if (updateFields.length === 0) {
169
- console.error(chalk.red('\n✗ No fields to update. Provide at least one option to change.\n'));
170
- process.exit(1);
171
- }
172
-
173
- if (dryRun) {
174
- if (jsonOutput) {
175
- console.log(JSON.stringify({ success: true, dryRun: true, data: request }));
176
- } else {
177
- console.log(chalk.bold('\n🔍 Dry-Run Mode: No changes will be made\n'));
178
- console.log(' Transfer-in form to be updated:');
179
- console.log(` ID: ${request.transferInFormId}`);
180
- updateFields.forEach(field => {
181
- const value = request[field as keyof UpdateTransferInFormRequest];
182
- console.log(` ${field}: ${Array.isArray(value) ? JSON.stringify(value) : value}`);
183
- });
184
- console.log();
185
- }
186
- return;
187
- }
188
-
189
- if (!jsonOutput) {
190
- console.log(chalk.bold('\n📝 Updating Transfer-In Form\n'));
191
- }
192
-
193
- const response = await apiClient.updateTransferInForm(environment, tenant, request);
194
-
195
- if (response.success) {
196
- if (jsonOutput) {
197
- console.log(JSON.stringify({ success: true, data: response.data }));
198
- } else {
199
- console.log(chalk.green('\n✓ Transfer-in form updated successfully\n'));
200
- }
201
- } else {
202
- const errMsg = response.error?.message || 'Failed to update';
203
- if (jsonOutput) {
204
- console.log(JSON.stringify({ success: false, error: { code: response.error?.code, message: errMsg } }));
205
- } else {
206
- console.error(chalk.red(`\n✗ ${errMsg}\n`));
207
- }
208
- process.exit(1);
209
- }
210
- });
211
-
212
- return cmd;
213
- }
@@ -1,83 +0,0 @@
1
- import { Command } from 'commander';
2
- import chalk from 'chalk';
3
- import { configManager } from '../../../core/config/manager.js';
4
- import { apiClient } from '../../../core/api/client.js';
5
- import { Environment } from '../../../types/index.js';
6
-
7
- export function createTransferOutFormBatchDeleteCommand(): Command {
8
- const cmd = new Command('batch-delete');
9
- cmd
10
- .description('Batch delete transfer-out forms')
11
- .argument('<ids...>', 'Transfer-out form IDs to delete')
12
- .option('--force', 'Skip confirmation and delete directly')
13
- .option('--dry-run', 'Preview what would be deleted')
14
- .option('--json', 'Output as JSON');
15
-
16
- cmd.action(async (ids: string[], options: Record<string, unknown>) => {
17
- const context = configManager.getCurrentContext();
18
- const environment = context.environment as Environment;
19
- const tenant = context.tenant;
20
- const jsonOutput = options.json === true;
21
- const dryRun = options.dryRun === true;
22
- const force = options.force === true;
23
-
24
- if (ids.length === 0) {
25
- const errMsg = 'No transfer-out form IDs provided';
26
- if (jsonOutput) {
27
- console.log(JSON.stringify({ success: false, error: { code: 'MISSING_IDS', message: errMsg } }));
28
- } else {
29
- console.error(chalk.red(`\n✗ ${errMsg}\n`));
30
- }
31
- process.exit(1);
32
- }
33
-
34
- if (dryRun) {
35
- if (jsonOutput) {
36
- console.log(JSON.stringify({ success: true, dryRun: true, ids }));
37
- } else {
38
- console.log(chalk.bold(`\n🔍 Dry-Run Mode: No actual deletion will be made\n`));
39
- console.log(chalk.gray(` Form IDs: ${ids.join(', ')}`));
40
- console.log(chalk.gray(` Count: ${ids.length}\n`));
41
- }
42
- return;
43
- }
44
-
45
- if (!force) {
46
- if (jsonOutput) {
47
- console.log(JSON.stringify({ success: true, dryRun: true, ids }));
48
- } else {
49
- console.log(chalk.bold(`\n🗑️ Batch Delete Transfer-Out Forms (${environment})\n`));
50
- console.log(chalk.gray(` Form IDs: ${ids.join(', ')}`));
51
- console.log(chalk.gray(` Count: ${ids.length}\n`));
52
- console.log(chalk.cyan(' To delete, add: --force\n'));
53
- }
54
- return;
55
- }
56
-
57
- if (!jsonOutput) {
58
- console.log(chalk.bold(`\n🗑️ Batch Delete Transfer-Out Forms (${environment})\n`));
59
- console.log(chalk.gray(` Form IDs: ${ids.join(', ')}`));
60
- console.log(chalk.gray(` Count: ${ids.length}\n`));
61
- }
62
-
63
- const response = await apiClient.batchDeleteTransferOutForms(environment, tenant, ids);
64
-
65
- if (response.success) {
66
- if (jsonOutput) {
67
- console.log(JSON.stringify({ success: true, ids, count: ids.length }));
68
- } else {
69
- console.log(chalk.green(`\n✓ ${ids.length} transfer-out form(s) deleted successfully\n`));
70
- }
71
- } else {
72
- const errMsg = response.error?.message || 'Failed to delete';
73
- if (jsonOutput) {
74
- console.log(JSON.stringify({ success: false, error: { code: response.error?.code, message: errMsg } }));
75
- } else {
76
- console.error(chalk.red(`\n✗ ${errMsg}\n`));
77
- }
78
- process.exit(1);
79
- }
80
- });
81
-
82
- return cmd;
83
- }
@@ -1,148 +0,0 @@
1
- import { Command } from 'commander';
2
- import chalk from 'chalk';
3
- import inquirer from 'inquirer';
4
- import { configManager } from '../../../core/config/manager.js';
5
- import { apiClient } from '../../../core/api/client.js';
6
- import { Environment } from '../../../types/index.js';
7
- import { TransferOutForm } from '../../../types/transfer-out-form.js';
8
-
9
- export function createTransferOutFormBatchReviewCommand(): Command {
10
- const cmd = new Command('batch-review');
11
- cmd
12
- .description('Batch review (审核) transfer-out forms')
13
- .argument('<ids...>', 'Transfer-out form IDs to review')
14
- .option('--force', 'Skip confirmation and review directly')
15
- .option('--dry-run', 'Preview what would be reviewed')
16
- .option('--json', 'Output as JSON');
17
-
18
- cmd.action(async (ids: string[], options: Record<string, unknown>) => {
19
- const context = configManager.getCurrentContext();
20
- const environment = context.environment as Environment;
21
- const tenant = context.tenant;
22
- const jsonOutput = options.json === true;
23
- const dryRun = options.dryRun === true;
24
- const force = options.force === true;
25
-
26
- if (ids.length === 0) {
27
- const errMsg = 'No transfer-out form IDs provided';
28
- if (jsonOutput) {
29
- console.log(JSON.stringify({ success: false, error: { code: 'MISSING_IDS', message: errMsg } }));
30
- } else {
31
- console.error(chalk.red(`\n✗ ${errMsg}\n`));
32
- }
33
- process.exit(1);
34
- }
35
-
36
- // Validate IDs are non-empty strings
37
- const validIds = ids.filter(id => id.trim() !== '');
38
- if (validIds.length === 0) {
39
- const errMsg = 'No valid transfer-out form IDs provided';
40
- if (jsonOutput) {
41
- console.log(JSON.stringify({ success: false, error: { code: 'INVALID_IDS', message: errMsg } }));
42
- } else {
43
- console.error(chalk.red(`\n✗ ${errMsg}\n`));
44
- }
45
- process.exit(1);
46
- }
47
-
48
- // Fetch details for dry-run or confirmation
49
- const forms: TransferOutForm[] = [];
50
- if (!force || dryRun) {
51
- for (const id of validIds) {
52
- try {
53
- const response = await apiClient.getTransferOutForm(environment, tenant, id);
54
- if (response.success && response.data && 'transferOutFormId' in (response.data as any)) {
55
- forms.push(response.data as TransferOutForm);
56
- }
57
- } catch {
58
- // ignore fetch errors
59
- }
60
- }
61
- }
62
-
63
- if (dryRun) {
64
- if (jsonOutput) {
65
- console.log(JSON.stringify({
66
- success: true,
67
- dryRun: true,
68
- ids: validIds,
69
- forms: forms.map(form => ({
70
- transferOutFormId: form.transferOutFormId,
71
- transferOutFormCode: form.transferOutFormCode,
72
- warehouseCode: form.warehouseCode,
73
- stockDate: form.stockDate,
74
- reviewFlag: form.reviewFlag,
75
- })),
76
- message: 'Dry-run mode: no actual review will be performed',
77
- }));
78
- } else {
79
- console.log(chalk.bold('\n🔍 Dry-Run Mode: No changes will be made\n'));
80
- console.log(chalk.gray(` IDs to review: ${validIds.join(', ')}\n`));
81
- if (forms.length > 0) {
82
- console.log(chalk.gray(' Transfer-out forms to be reviewed:'));
83
- forms.forEach(form => {
84
- console.log(chalk.gray(` • ${form.transferOutFormCode} (ID: ${form.transferOutFormId})`));
85
- });
86
- console.log();
87
- }
88
- }
89
- return;
90
- }
91
-
92
- if (!force) {
93
- if (!jsonOutput) {
94
- console.log(chalk.bold('\n📝 Batch Review Transfer-Out Forms\n'));
95
- console.log(chalk.gray(` IDs: ${validIds.join(', ')}\n`));
96
- if (forms.length > 0) {
97
- console.log(chalk.gray(' Transfer-out forms to review:'));
98
- forms.forEach(form => {
99
- console.log(chalk.gray(` • ${form.transferOutFormCode} (ID: ${form.transferOutFormId})`));
100
- });
101
- console.log();
102
- }
103
- }
104
-
105
- const { confirm } = await inquirer.prompt([
106
- {
107
- type: 'confirm',
108
- name: 'confirm',
109
- message: `Review ${validIds.length} transfer-out form(s)?`,
110
- default: false,
111
- },
112
- ]);
113
-
114
- if (!confirm) {
115
- if (jsonOutput) {
116
- console.log(JSON.stringify({ success: false, error: { code: 'CANCELLED', message: 'Operation cancelled by user' } }));
117
- } else {
118
- console.log(chalk.gray('\n Operation cancelled.\n'));
119
- }
120
- process.exit(0);
121
- }
122
- }
123
-
124
- if (!jsonOutput) {
125
- console.log(chalk.bold(`\n📝 Reviewing ${validIds.length} Transfer-Out Form(s)\n`));
126
- }
127
-
128
- const response = await apiClient.batchReviewTransferOutForms(environment, tenant, validIds);
129
-
130
- if (response.success) {
131
- if (jsonOutput) {
132
- console.log(JSON.stringify({ success: true, reviewedCount: validIds.length, ids: validIds }));
133
- } else {
134
- console.log(chalk.green(`\n✓ ${validIds.length} transfer-out form(s) reviewed\n`));
135
- }
136
- } else {
137
- const errMsg = response.error?.message || 'Failed to review';
138
- if (jsonOutput) {
139
- console.log(JSON.stringify({ success: false, error: { code: response.error?.code, message: errMsg } }));
140
- } else {
141
- console.error(chalk.red(`\n✗ ${errMsg}\n`));
142
- }
143
- process.exit(1);
144
- }
145
- });
146
-
147
- return cmd;
148
- }