arcli 0.1.1 → 1.1.0

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 (269) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +164 -4
  3. package/dist/cli/commands/billing-family.command.d.ts +2 -0
  4. package/dist/cli/commands/billing-family.command.js +30 -0
  5. package/dist/cli/commands/billing-family.command.js.map +1 -0
  6. package/dist/cli/commands/billing-shortcuts.command.d.ts +2 -0
  7. package/dist/cli/commands/billing-shortcuts.command.js +18 -0
  8. package/dist/cli/commands/billing-shortcuts.command.js.map +1 -0
  9. package/dist/cli/commands/billing.command.interactive-preview.d.ts +17 -0
  10. package/dist/cli/commands/billing.command.interactive-preview.js +65 -0
  11. package/dist/cli/commands/billing.command.interactive-preview.js.map +1 -0
  12. package/dist/cli/commands/billing.command.options.d.ts +2 -0
  13. package/dist/cli/commands/billing.command.options.js +49 -0
  14. package/dist/cli/commands/billing.command.options.js.map +1 -0
  15. package/dist/cli/commands/billing.command.output.d.ts +12 -0
  16. package/dist/cli/commands/billing.command.output.js +33 -0
  17. package/dist/cli/commands/billing.command.output.js.map +1 -0
  18. package/dist/cli/commands/billing.command.parser.d.ts +18 -0
  19. package/dist/cli/commands/billing.command.parser.js +136 -0
  20. package/dist/cli/commands/billing.command.parser.js.map +1 -0
  21. package/dist/cli/commands/billing.command.shared.d.ts +7 -0
  22. package/dist/cli/commands/billing.command.shared.js +78 -0
  23. package/dist/cli/commands/billing.command.shared.js.map +1 -0
  24. package/dist/cli/commands/billing.command.shortcuts.d.ts +7 -0
  25. package/dist/cli/commands/billing.command.shortcuts.js +52 -0
  26. package/dist/cli/commands/billing.command.shortcuts.js.map +1 -0
  27. package/dist/cli/commands/config.command.d.ts +2 -0
  28. package/dist/cli/commands/config.command.js +125 -0
  29. package/dist/cli/commands/config.command.js.map +1 -0
  30. package/dist/cli/commands/examples.command.d.ts +2 -0
  31. package/dist/cli/commands/examples.command.js +14 -0
  32. package/dist/cli/commands/examples.command.js.map +1 -0
  33. package/dist/cli/commands/storybook.command.d.ts +2 -0
  34. package/dist/cli/commands/storybook.command.js +26 -0
  35. package/dist/cli/commands/storybook.command.js.map +1 -0
  36. package/dist/cli/help.d.ts +10 -0
  37. package/dist/cli/help.js +473 -0
  38. package/dist/cli/help.js.map +1 -0
  39. package/dist/cli/index.d.ts +2 -0
  40. package/dist/cli/index.js +41 -0
  41. package/dist/cli/index.js.map +1 -0
  42. package/dist/cli/program.d.ts +2 -0
  43. package/dist/cli/program.js +28 -0
  44. package/dist/cli/program.js.map +1 -0
  45. package/dist/cli/types.d.ts +6 -0
  46. package/dist/cli/types.js +2 -0
  47. package/dist/cli/types.js.map +1 -0
  48. package/dist/cli/version.d.ts +1 -0
  49. package/dist/cli/version.js +2 -0
  50. package/dist/cli/version.js.map +1 -0
  51. package/dist/index.d.ts +1 -0
  52. package/dist/index.js +2 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/lib/dates/arca-date.d.ts +2 -0
  55. package/dist/lib/dates/arca-date.js +28 -0
  56. package/dist/lib/dates/arca-date.js.map +1 -0
  57. package/dist/lib/errors/app-error.d.ts +14 -0
  58. package/dist/lib/errors/app-error.js +29 -0
  59. package/dist/lib/errors/app-error.js.map +1 -0
  60. package/dist/lib/files/read-json-file.d.ts +1 -0
  61. package/dist/lib/files/read-json-file.js +21 -0
  62. package/dist/lib/files/read-json-file.js.map +1 -0
  63. package/dist/lib/paths/mask-path.d.ts +1 -0
  64. package/dist/lib/paths/mask-path.js +17 -0
  65. package/dist/lib/paths/mask-path.js.map +1 -0
  66. package/dist/lib/security/certificate.d.ts +7 -0
  67. package/dist/lib/security/certificate.js +16 -0
  68. package/dist/lib/security/certificate.js.map +1 -0
  69. package/dist/lib/security/pem.d.ts +5 -0
  70. package/dist/lib/security/pem.js +36 -0
  71. package/dist/lib/security/pem.js.map +1 -0
  72. package/dist/modules/billing/billing-response.d.ts +4 -0
  73. package/dist/modules/billing/billing-response.js +74 -0
  74. package/dist/modules/billing/billing-response.js.map +1 -0
  75. package/dist/modules/billing/billing.amounts.d.ts +9 -0
  76. package/dist/modules/billing/billing.amounts.js +30 -0
  77. package/dist/modules/billing/billing.amounts.js.map +1 -0
  78. package/dist/modules/billing/billing.associated-vouchers.d.ts +10 -0
  79. package/dist/modules/billing/billing.associated-vouchers.js +51 -0
  80. package/dist/modules/billing/billing.associated-vouchers.js.map +1 -0
  81. package/dist/modules/billing/billing.constants.d.ts +2 -0
  82. package/dist/modules/billing/billing.constants.js +3 -0
  83. package/dist/modules/billing/billing.constants.js.map +1 -0
  84. package/dist/modules/billing/billing.date-range.d.ts +8 -0
  85. package/dist/modules/billing/billing.date-range.js +45 -0
  86. package/dist/modules/billing/billing.date-range.js.map +1 -0
  87. package/dist/modules/billing/billing.display.d.ts +13 -0
  88. package/dist/modules/billing/billing.display.js +111 -0
  89. package/dist/modules/billing/billing.display.js.map +1 -0
  90. package/dist/modules/billing/billing.json-format.d.ts +6 -0
  91. package/dist/modules/billing/billing.json-format.js +5 -0
  92. package/dist/modules/billing/billing.json-format.js.map +1 -0
  93. package/dist/modules/billing/billing.labels.d.ts +9 -0
  94. package/dist/modules/billing/billing.labels.js +108 -0
  95. package/dist/modules/billing/billing.labels.js.map +1 -0
  96. package/dist/modules/billing/billing.mappers.d.ts +8 -0
  97. package/dist/modules/billing/billing.mappers.js +59 -0
  98. package/dist/modules/billing/billing.mappers.js.map +1 -0
  99. package/dist/modules/billing/billing.presenter.d.ts +7 -0
  100. package/dist/modules/billing/billing.presenter.js +3 -0
  101. package/dist/modules/billing/billing.presenter.js.map +1 -0
  102. package/dist/modules/billing/billing.schemas.d.ts +74 -0
  103. package/dist/modules/billing/billing.schemas.js +69 -0
  104. package/dist/modules/billing/billing.schemas.js.map +1 -0
  105. package/dist/modules/billing/billing.serialize.d.ts +8 -0
  106. package/dist/modules/billing/billing.serialize.js +51 -0
  107. package/dist/modules/billing/billing.serialize.js.map +1 -0
  108. package/dist/modules/billing/billing.service.d.ts +15 -0
  109. package/dist/modules/billing/billing.service.js +88 -0
  110. package/dist/modules/billing/billing.service.js.map +1 -0
  111. package/dist/modules/billing/billing.text.d.ts +8 -0
  112. package/dist/modules/billing/billing.text.js +44 -0
  113. package/dist/modules/billing/billing.text.js.map +1 -0
  114. package/dist/modules/billing/billing.types.d.ts +13 -0
  115. package/dist/modules/billing/billing.types.internal.d.ts +25 -0
  116. package/dist/modules/billing/billing.types.internal.js +2 -0
  117. package/dist/modules/billing/billing.types.internal.js.map +1 -0
  118. package/dist/modules/billing/billing.types.js +2 -0
  119. package/dist/modules/billing/billing.types.js.map +1 -0
  120. package/dist/modules/billing/billing.validation.d.ts +5 -0
  121. package/dist/modules/billing/billing.validation.js +45 -0
  122. package/dist/modules/billing/billing.validation.js.map +1 -0
  123. package/dist/modules/billing/voucher-kind-map.d.ts +9 -0
  124. package/dist/modules/billing/voucher-kind-map.js +180 -0
  125. package/dist/modules/billing/voucher-kind-map.js.map +1 -0
  126. package/dist/modules/config/config-doctor.d.ts +15 -0
  127. package/dist/modules/config/config-doctor.js +125 -0
  128. package/dist/modules/config/config-doctor.js.map +1 -0
  129. package/dist/modules/config/config-value-parser.d.ts +2 -0
  130. package/dist/modules/config/config-value-parser.js +71 -0
  131. package/dist/modules/config/config-value-parser.js.map +1 -0
  132. package/dist/modules/config/config.presenter.d.ts +7 -0
  133. package/dist/modules/config/config.presenter.js +80 -0
  134. package/dist/modules/config/config.presenter.js.map +1 -0
  135. package/dist/modules/config/config.schemas.d.ts +87 -0
  136. package/dist/modules/config/config.schemas.js +84 -0
  137. package/dist/modules/config/config.schemas.js.map +1 -0
  138. package/dist/modules/config/config.service.d.ts +20 -0
  139. package/dist/modules/config/config.service.js +78 -0
  140. package/dist/modules/config/config.service.js.map +1 -0
  141. package/dist/modules/examples/examples.d.ts +1 -0
  142. package/dist/modules/examples/examples.js +156 -0
  143. package/dist/modules/examples/examples.js.map +1 -0
  144. package/dist/modules/storybook/showcase-theme.d.ts +7 -0
  145. package/dist/modules/storybook/showcase-theme.js +6 -0
  146. package/dist/modules/storybook/showcase-theme.js.map +1 -0
  147. package/dist/modules/storybook/showcase.d.ts +2 -0
  148. package/dist/modules/storybook/showcase.js +310 -0
  149. package/dist/modules/storybook/showcase.js.map +1 -0
  150. package/dist/modules/update-check/update-check.presenter.d.ts +2 -0
  151. package/dist/modules/update-check/update-check.presenter.js +6 -0
  152. package/dist/modules/update-check/update-check.presenter.js.map +1 -0
  153. package/dist/modules/update-check/update-check.service.d.ts +8 -0
  154. package/dist/modules/update-check/update-check.service.js +72 -0
  155. package/dist/modules/update-check/update-check.service.js.map +1 -0
  156. package/dist/services/arca/arca-billing.gateway.d.ts +9 -0
  157. package/dist/services/arca/arca-billing.gateway.js +10 -0
  158. package/dist/services/arca/arca-billing.gateway.js.map +1 -0
  159. package/dist/services/arca/arca-client.factory.d.ts +5 -0
  160. package/dist/services/arca/arca-client.factory.js +7 -0
  161. package/dist/services/arca/arca-client.factory.js.map +1 -0
  162. package/dist/services/arca/arca-context.resolver.d.ts +44 -0
  163. package/dist/services/arca/arca-context.resolver.js +120 -0
  164. package/dist/services/arca/arca-context.resolver.js.map +1 -0
  165. package/dist/ui/components/contentPanel.d.ts +5 -0
  166. package/dist/ui/components/contentPanel.js +11 -0
  167. package/dist/ui/components/contentPanel.js.map +1 -0
  168. package/dist/ui/components/errorPanel.d.ts +1 -0
  169. package/dist/ui/components/errorPanel.js +13 -0
  170. package/dist/ui/components/errorPanel.js.map +1 -0
  171. package/dist/ui/components/index.d.ts +6 -0
  172. package/dist/ui/components/index.js +7 -0
  173. package/dist/ui/components/index.js.map +1 -0
  174. package/dist/ui/components/keyValuePanel.d.ts +3 -0
  175. package/dist/ui/components/keyValuePanel.js +14 -0
  176. package/dist/ui/components/keyValuePanel.js.map +1 -0
  177. package/dist/ui/components/noticePanel.d.ts +3 -0
  178. package/dist/ui/components/noticePanel.js +11 -0
  179. package/dist/ui/components/noticePanel.js.map +1 -0
  180. package/dist/ui/components/rawPanel.d.ts +1 -0
  181. package/dist/ui/components/rawPanel.js +5 -0
  182. package/dist/ui/components/rawPanel.js.map +1 -0
  183. package/dist/ui/components/statusPanel.d.ts +3 -0
  184. package/dist/ui/components/statusPanel.js +20 -0
  185. package/dist/ui/components/statusPanel.js.map +1 -0
  186. package/dist/ui/index.d.ts +5 -0
  187. package/dist/ui/index.js +6 -0
  188. package/dist/ui/index.js.map +1 -0
  189. package/dist/ui/presenters/billing.presenter.d.ts +2 -0
  190. package/dist/ui/presenters/billing.presenter.js +2 -0
  191. package/dist/ui/presenters/billing.presenter.js.map +1 -0
  192. package/dist/ui/presenters/config.presenter.d.ts +1 -0
  193. package/dist/ui/presenters/config.presenter.js +2 -0
  194. package/dist/ui/presenters/config.presenter.js.map +1 -0
  195. package/dist/ui/presenters/errors.presenter.d.ts +1 -0
  196. package/dist/ui/presenters/errors.presenter.js +89 -0
  197. package/dist/ui/presenters/errors.presenter.js.map +1 -0
  198. package/dist/ui/presenters/errors.zod-presenter.d.ts +2 -0
  199. package/dist/ui/presenters/errors.zod-presenter.js +82 -0
  200. package/dist/ui/presenters/errors.zod-presenter.js.map +1 -0
  201. package/dist/ui/presenters/index.d.ts +4 -0
  202. package/dist/ui/presenters/index.js +5 -0
  203. package/dist/ui/presenters/index.js.map +1 -0
  204. package/dist/ui/presenters/showcase.presenter.d.ts +1 -0
  205. package/dist/ui/presenters/showcase.presenter.js +2 -0
  206. package/dist/ui/presenters/showcase.presenter.js.map +1 -0
  207. package/dist/ui/primitives/index.d.ts +10 -0
  208. package/dist/ui/primitives/index.js +11 -0
  209. package/dist/ui/primitives/index.js.map +1 -0
  210. package/dist/ui/primitives/renderDivider.d.ts +5 -0
  211. package/dist/ui/primitives/renderDivider.js +5 -0
  212. package/dist/ui/primitives/renderDivider.js.map +1 -0
  213. package/dist/ui/primitives/renderFooter.d.ts +7 -0
  214. package/dist/ui/primitives/renderFooter.js +6 -0
  215. package/dist/ui/primitives/renderFooter.js.map +1 -0
  216. package/dist/ui/primitives/renderJson.d.ts +3 -0
  217. package/dist/ui/primitives/renderJson.js +19 -0
  218. package/dist/ui/primitives/renderJson.js.map +1 -0
  219. package/dist/ui/primitives/renderKeyValue.d.ts +14 -0
  220. package/dist/ui/primitives/renderKeyValue.js +34 -0
  221. package/dist/ui/primitives/renderKeyValue.js.map +1 -0
  222. package/dist/ui/primitives/renderLogo.d.ts +2 -0
  223. package/dist/ui/primitives/renderLogo.js +28 -0
  224. package/dist/ui/primitives/renderLogo.js.map +1 -0
  225. package/dist/ui/primitives/renderObject.d.ts +1 -0
  226. package/dist/ui/primitives/renderObject.js +19 -0
  227. package/dist/ui/primitives/renderObject.js.map +1 -0
  228. package/dist/ui/primitives/renderPanel.d.ts +23 -0
  229. package/dist/ui/primitives/renderPanel.js +114 -0
  230. package/dist/ui/primitives/renderPanel.js.map +1 -0
  231. package/dist/ui/primitives/renderSubtitle.d.ts +7 -0
  232. package/dist/ui/primitives/renderSubtitle.js +6 -0
  233. package/dist/ui/primitives/renderSubtitle.js.map +1 -0
  234. package/dist/ui/primitives/renderTable.d.ts +6 -0
  235. package/dist/ui/primitives/renderTable.js +14 -0
  236. package/dist/ui/primitives/renderTable.js.map +1 -0
  237. package/dist/ui/primitives/text.d.ts +18 -0
  238. package/dist/ui/primitives/text.js +154 -0
  239. package/dist/ui/primitives/text.js.map +1 -0
  240. package/dist/ui/stream/index.d.ts +1 -0
  241. package/dist/ui/stream/index.js +2 -0
  242. package/dist/ui/stream/index.js.map +1 -0
  243. package/dist/ui/stream/terminal-stream.d.ts +10 -0
  244. package/dist/ui/stream/terminal-stream.js +20 -0
  245. package/dist/ui/stream/terminal-stream.js.map +1 -0
  246. package/dist/ui/theme/index.d.ts +1 -0
  247. package/dist/ui/theme/index.js +2 -0
  248. package/dist/ui/theme/index.js.map +1 -0
  249. package/dist/ui/theme/theme.d.ts +27 -0
  250. package/dist/ui/theme/theme.js +41 -0
  251. package/dist/ui/theme/theme.js.map +1 -0
  252. package/llms.txt +157 -0
  253. package/package.json +98 -35
  254. package/.babelrc +0 -4
  255. package/.eslintignore +0 -1
  256. package/.eslintrc.js +0 -17
  257. package/.npmignore +0 -1
  258. package/lib/arcli.min.js +0 -1
  259. package/src/commander/index.js +0 -3
  260. package/src/config.js +0 -22
  261. package/src/index.js +0 -19
  262. package/src/init/index.js +0 -13
  263. package/src/logger/index.js +0 -8
  264. package/src/logger/winston.js +0 -55
  265. package/src/run.js +0 -4
  266. package/src/spinner/index.js +0 -8
  267. package/src/spinner/ora.js +0 -50
  268. package/tst/index.js +0 -29
  269. package/webpack.config.js +0 -47
package/llms.txt ADDED
@@ -0,0 +1,157 @@
1
+ # arcli
2
+
3
+ > CLI de Node/TypeScript para emitir y previsualizar comprobantes ARCA (ex AFIP) desde
4
+ > terminal: facturas, notas de crédito/débito (papel y electrónicas), en testing o producción.
5
+ > Salida humana por defecto, `--json` para scripts/agentes. Repo: https://github.com/LcsGrz/arcli
6
+
7
+ Este archivo es una referencia densa para que un agente con acceso a shell pueda construir
8
+ comandos `arcli` correctos sin tener que ir probando `--ayuda` a ciegas. Para el detalle
9
+ completo de cada tema, ver los docs linkeados al final.
10
+
11
+ ## Instalación y setup mínimo
12
+
13
+ ```bash
14
+ npm install -g arcli # o: yarn dev <comando> si corrés desde el repo
15
+ arcli config establecer cuit <11 digitos>
16
+ arcli config establecer cert.testing /ruta/al/certificado.crt
17
+ arcli config establecer key.testing /ruta/a/la/clave.key
18
+ arcli config establecer puntoVenta <numero>
19
+ arcli config revisar # valida que este todo listo antes de emitir
20
+ ```
21
+
22
+ Sin `cuit`, `cert.<entorno>`, `key.<entorno>` y `puntoVenta` configurados (o pasados por
23
+ flag), cualquier comando de facturación falla con `ConfigurationError` antes de contactar
24
+ ARCA. `--testing` es el entorno por defecto; `--produccion` cambia a real.
25
+
26
+ ## Comandos de facturación (shortcut de 2-4 letras)
27
+
28
+ ```
29
+ arcli <shortcut> --monto <n> --cs|--cp|--csp --ir-<tipo>|--iva-receptor <tipo> [--cuit N|--cuil N|--dni N|--consumidor-final] [--emitir|--previsualizar] [--json]
30
+ ```
31
+
32
+ Shortcuts (`family` = comando alternativo `arcli <family> <letra>`, ej. `arcli factura c`):
33
+
34
+ | shortcut | comprobante | family | requiere comprobante asociado |
35
+ |---|---|---|---|
36
+ | fa, fb, fc | Factura A/B/C | factura | no |
37
+ | nca, ncb, ncc | Nota de crédito A/B/C | nota-credito | sí |
38
+ | nda, ndb, ndc | Nota de débito A/B/C | nota-debito | sí |
39
+ | fcea, fceb, fcec | Factura de crédito electrónica A/B/C | factura-credito-electronica | no |
40
+ | ncea, nceb, ncec | Nota de crédito electrónica A/B/C | nota-credito-electronica | sí |
41
+ | ndea, ndeb, ndec | Nota de débito electrónica A/B/C | nota-debito-electronica | sí |
42
+
43
+ ## Flags principales (alias corto entre paréntesis)
44
+
45
+ - `-m, --monto <n>`: importe total (requerido).
46
+ - Concepto: `--concepto <tipo>` (`productos`/`servicios`/`productos-servicios`) o atajos `--cs` `--cp` `--csp`. Uno solo, no combinar `--concepto` con un atajo.
47
+ - IVA receptor: `--iva-receptor <tipo>` / `--ir <tipo>` (alias) o un atajo `--ir-ce|--ir-cf|--ir-il|--ir-ina|--ir-ms|--ir-mtip|--ir-pe|--ir-ri|--ir-rm|--ir-se|--ir-snc`. Usar exactamente una forma.
48
+ Valores válidos: `cliente-del-exterior`, `consumidor-final`, `iva-liberado`, `iva-no-alcanzado`, `monotributista-social`, `monotributo-trabajador-independiente-promovido`, `proveedor-del-exterior`, `responsable-inscripto`, `responsable-monotributo`, `sujeto-exento`, `sujeto-no-categorizado`.
49
+ - Identidad del receptor: `--cuit <n>` / `--cuil <n>` / `--dni <n>` / `--consumidor-final` (alias `--cfinal`, documento 0). Usar como máximo una.
50
+ - Punto de venta: `--punto-venta <n>` (alias `--pv`). Si no se pasa, usa el default de config.
51
+ - Moneda: `--moneda <codigo>` (alias `--mda`, ej. `ARS`/`USD`) y `--cotizacion-moneda <n>` (alias `--cm`).
52
+ - Fechas: `-f, --fecha <fecha>` acepta formato argentino día-primero: `D`, `DD`, `D/M`, `DD/MM`, `D-M-YY`, `DD-MM-YYYY` (con `-` o `/`); si se omiten mes/año usa los actuales. También `--servicio-desde`/`--sd` y `--servicio-hasta`/`--sh`, y `-d, --dia <n>` (día de vencimiento).
53
+ - Comprobante asociado (obligatorio en notas de crédito/débito): `--ac <shortcut>` (ej. `fc`), `--apv <n>` (punto de venta, alias `--asociado-punto-venta`), `--ar <n>` (número), `--acuit <n>`, `--at <n>` (tipo ARCA, alternativa a `--ac`; no combinar ambos).
54
+ - Ejecución: `--previsualizar` (default si no se especifica nada) vs `--emitir` (real contra ARCA) — son mutuamente excluyentes. En producción hace falta `--produccion --emitir` juntos — no hay un flag de confirmación adicional, así que esa combinación emite de verdad.
55
+ - Salida: `--json` (estructurada, para scripts/agentes — desactiva el aviso de nueva versión), `--bruto` (incluye la respuesta cruda de ARCA).
56
+ - `--cargar <path.json>`: carga uno o un array de comprobantes desde un JSON en vez de flags (ver forma abajo). Los flags pisan lo que venga del archivo.
57
+
58
+ ## Modo no interactivo
59
+
60
+ Sin `--emitir` ni `--previsualizar`, si la sesión es interactiva (TTY) arcli muestra una vista
61
+ previa y pregunta si emitir. **Con `--json`, o cuando stdin/stdout no son un TTY (scripts,
62
+ agentes, CI), nunca pregunta** — se comporta como si fuera dry-run salvo que se pase
63
+ `--emitir` explícitamente. Para invocar desde un agente, siempre pasar `--emitir` o
64
+ `--previsualizar` de forma explícita y no depender del prompt.
65
+
66
+ ## Forma del JSON de `--cargar` (un objeto o un array de estos)
67
+
68
+ ```json
69
+ {
70
+ "concepto": "servicios",
71
+ "ivaReceptor": "consumidor-final",
72
+ "tipoDocumento": "consumidor-final",
73
+ "numeroDocumento": 0,
74
+ "montoTotal": 1000,
75
+ "puntoVenta": 3,
76
+ "codigoMoneda": "ARS",
77
+ "cotizacionMoneda": 1,
78
+ "fechaComprobante": "18-03-2026",
79
+ "servicioDesde": "01-03-2026",
80
+ "servicioHasta": "31-03-2026",
81
+ "dia": 10,
82
+ "emitir": false,
83
+ "previsualizar": true,
84
+ "confirmarProduccion": false,
85
+ "comprobanteAsociado": { "atajo": "fc", "cuit": "20123456789", "numero": 10, "puntoVenta": 3 }
86
+ }
87
+ ```
88
+
89
+ ## Forma de la respuesta (`--json`, sin `--bruto`)
90
+
91
+ ```json
92
+ {
93
+ "atajo": "fa",
94
+ "comprobante": "Factura A",
95
+ "tipoArca": 1,
96
+ "estado": "aprobado | observado | rechazado",
97
+ "resultado": "A | R | P | null",
98
+ "cae": "string | null",
99
+ "caeVencimiento": "YYYYMMDD | null",
100
+ "errores": [],
101
+ "eventos": [],
102
+ "observaciones": ["..."],
103
+ "observacion": "string | null",
104
+ "solicitud": { "...": "payload enviado a ARCA" },
105
+ "previsualizacion": true,
106
+ "sugerencias": ["texto en español sugiriendo como resolver errores comunes de ARCA"]
107
+ }
108
+ ```
109
+
110
+ Con múltiples comprobantes (batch o `--cargar` con array) la salida es un array de estos
111
+ objetos. Con `--bruto` se agrega `respuesta` con la respuesta cruda del SDK.
112
+
113
+ **Importante:** un comprobante rechazado por ARCA (`"estado": "rechazado"`) es una respuesta
114
+ válida, no una excepción — el proceso termina con exit code `0` igual. Para saber si un
115
+ comprobante fue realmente aprobado hay que revisar `estado`/`resultado`/`errores` en el
116
+ JSON, nunca alcanza con chequear el exit code.
117
+
118
+ ## Salida de error
119
+
120
+ Sin `--json`: panel de texto en stderr. Con `--json`: JSON en stderr con la forma
121
+ `{"codigo": "...", "detalles": {...} | null, "error": "mensaje", "sugerencia": "..." | null}`.
122
+ `codigo` es `CONFIGURATION_ERROR`, `INPUT_VALIDATION_ERROR`, `TRANSIENT_ERROR` (reintentar,
123
+ suele ser "transacción activa" de ARCA) o `UNEXPECTED_ERROR`. El proceso termina con
124
+ exit code `1` en cualquier error.
125
+
126
+ ## Comando `config`
127
+
128
+ ```bash
129
+ arcli config # ver config actual (agregar --json)
130
+ arcli config revisar [--testing|--produccion] # valida credenciales + contexto real
131
+ arcli config ruta # path del archivo de config
132
+ arcli config establecer <clave> <valor>
133
+ arcli config eliminar <clave>
134
+ ```
135
+
136
+ Claves válidas: `cuit`, `puntoVenta`, `concepto`, `ivaReceptor`, `moneda`, `cotizacion`,
137
+ `entorno` (`testing`/`produccion`), `emitir`, `json`, `bruto` (booleanos: `true/false`,
138
+ `si/no`, `1/0`), `cert.testing`, `cert.produccion`, `key.testing`, `key.produccion`
139
+ (rutas a archivos PEM, se validan al guardar), `ticketPath` (carpeta donde se cachea el
140
+ ticket WSAA; por defecto una carpeta junto al archivo de config).
141
+
142
+ `config revisar` también avisa si un certificado ya venció o vence en menos de 30 días.
143
+
144
+ ## Otros comandos
145
+
146
+ - `arcli ejemplos`: comandos listos para copiar por cada tipo de comprobante.
147
+ - `arcli storybook [escena]`: demos visuales de la UI (sin llamar a ARCA).
148
+ - `arcli <cualquier comando> ayuda` o `--ayuda`: ayuda contextual con ejemplos (nota: el flag
149
+ estándar `--help` de commander está deshabilitado, usar `--ayuda` o el subcomando `ayuda`).
150
+
151
+ ## Más detalle
152
+
153
+ - `docs/cli-reference.md`: referencia completa de comandos y flags.
154
+ - `docs/configuration.md`: config persistente, claves soportadas, ticketPath.
155
+ - `docs/validation-rules.md` y `docs/input-output.md`: reglas de validación y formatos de entrada/salida.
156
+ - `docs/troubleshooting.md`: errores comunes de ARCA y como resolverlos.
157
+ - `AGENTS.md`: para agentes que van a modificar el código de este repo (no para usar el CLI).
package/package.json CHANGED
@@ -1,47 +1,110 @@
1
1
  {
2
2
  "name": "arcli",
3
- "version": "0.1.1",
4
- "description": "Collection of awesome node packages wrapped in one to create a beautiful command line application.",
5
- "main": "lib/arcli.min.js",
6
- "scripts": {
7
- "build": "./node_modules/.bin/webpack --env build",
8
- "dev": "./node_modules/.bin/webpack --progress --colors --watch --env dev",
9
- "prepublish": "npm run build"
3
+ "version": "1.1.0",
4
+ "description": "CLI para previsualizar y emitir comprobantes ARCA desde terminal, con validaciones claras y salida lista para automatizar",
5
+ "keywords": [
6
+ "arca",
7
+ "afip",
8
+ "cli",
9
+ "facturacion",
10
+ "typescript",
11
+ "factura-electronica",
12
+ "argentina",
13
+ "cae",
14
+ "cuit",
15
+ "automation"
16
+ ],
17
+ "homepage": "https://github.com/LcsGrz/arcli#readme",
18
+ "bugs": {
19
+ "url": "https://github.com/LcsGrz/arcli/issues"
10
20
  },
11
21
  "repository": {
12
22
  "type": "git",
13
- "url": "git+https://github.com/arpitbbhayani/arcli.git"
23
+ "url": "git+https://github.com/LcsGrz/arcli.git"
14
24
  },
15
- "keywords": [
16
- ],
17
- "author": "Arpit Bhayani",
18
25
  "license": "MIT",
19
- "bugs": {
20
- "url": "https://github.com/arpitbbhayani/arcli/issues"
26
+ "author": "LcsGrz",
27
+ "sideEffects": false,
28
+ "type": "module",
29
+ "exports": {
30
+ ".": "./dist/cli/index.js"
31
+ },
32
+ "main": "./dist/cli/index.js",
33
+ "types": "./dist/cli/index.d.ts",
34
+ "bin": {
35
+ "arcli": "dist/cli/index.js"
36
+ },
37
+ "files": [
38
+ "dist",
39
+ "LICENSE",
40
+ "README.md",
41
+ "llms.txt"
42
+ ],
43
+ "scripts": {
44
+ "build": "node ./scripts/clean-dist.mjs && tsc --project tsconfig.json && node ./scripts/fix-esm-extensions.mjs",
45
+ "clean": "node ./scripts/clean-dist.mjs",
46
+ "dev": "node --import tsx ./src/cli/index.ts",
47
+ "lint": "yarn lint:eslint && yarn lint:prettier",
48
+ "lint:eslint": "eslint 'src/**/*.{js,jsx,ts,tsx,json}'",
49
+ "lint:eslint:fix": "eslint --fix 'src/**/*.{js,jsx,ts,tsx,json}'",
50
+ "lint:prettier": "prettier --check 'src/**/*.{js,jsx,ts,tsx,json,md}' docs/**/*.md AGENTS.md README.md package.json",
51
+ "lint:prettier:fix": "prettier --write 'src/**/*.{js,jsx,ts,tsx,json,md}' docs/**/*.md AGENTS.md README.md package.json",
52
+ "open-source:check": "yarn typecheck && yarn test:coverage && yarn build && npm pack --dry-run",
53
+ "prepack": "yarn build",
54
+ "pack:check": "npm pack --dry-run",
55
+ "prepare": "husky",
56
+ "test": "vitest run",
57
+ "test:coverage": "vitest run --coverage",
58
+ "test:watch": "vitest",
59
+ "typecheck": "tsc --project tsconfig.typecheck.json"
60
+ },
61
+ "lint-staged": {
62
+ "src/**/*.{ts,tsx}": [
63
+ "tsc-files --noEmit"
64
+ ],
65
+ "src/**/*.{js,jsx,ts,tsx,json}": [
66
+ "eslint --fix"
67
+ ],
68
+ "src/**/*.{js,jsx,ts,tsx}": [
69
+ "vitest related --silent --passWithNoTests --run"
70
+ ]
21
71
  },
22
- "homepage": "https://github.com/arpitbbhayani/arcli#readme",
23
72
  "dependencies": {
24
- "chalk": "^2.1.0",
25
- "commander": "^2.11.0",
26
- "node-emoji": "^1.8.1",
27
- "ora": "^1.3.0",
28
- "winston": "^2.4.0"
73
+ "@arcasdk/core": "2.0.0",
74
+ "@inquirer/select": "5.2.2",
75
+ "big.js": "7.0.1",
76
+ "boxen": "8.0.1",
77
+ "commander": "15.0.0",
78
+ "conf": "15.1.0",
79
+ "ora": "9.4.1",
80
+ "zod": "4.4.3"
29
81
  },
30
82
  "devDependencies": {
31
- "babel-cli": "^6.26.0",
32
- "babel-core": "^6.26.0",
33
- "babel-eslint": "^8.0.1",
34
- "babel-loader": "^7.1.2",
35
- "babel-plugin-add-module-exports": "^0.2.1",
36
- "babel-plugin-transform-object-rest-spread": "^6.26.0",
37
- "babel-preset-env": "^1.6.0",
38
- "babel-preset-es2015": "^6.24.1",
39
- "eslint": "^4.6.1",
40
- "eslint-config-airbnb-base": "^12.0.2",
41
- "eslint-loader": "^1.9.0",
42
- "eslint-plugin-import": "^2.7.0",
43
- "webpack": "^3.6.0",
44
- "webpack-node-externals": "^1.6.0",
45
- "yargs": "^9.0.1"
46
- }
83
+ "@eslint/js": "10.0.1",
84
+ "@eslint/json": "2.0.1",
85
+ "@types/big.js": "7.0.0",
86
+ "@types/node": "22.20.1",
87
+ "@typescript-eslint/parser": "8.67.0",
88
+ "@vitest/coverage-v8": "4.1.11",
89
+ "eslint": "10.9.0",
90
+ "eslint-config-prettier": "10.1.8",
91
+ "eslint-plugin-jsonc": "3.4.2",
92
+ "eslint-plugin-prettier": "5.5.6",
93
+ "eslint-plugin-simple-import-sort": "14.0.0",
94
+ "husky": "9.1.7",
95
+ "lint-staged": "17.3.0",
96
+ "prettier": "3.9.6",
97
+ "tsc-files": "1.1.4",
98
+ "tsx": "4.23.12",
99
+ "typescript": "6.0.3",
100
+ "typescript-eslint": "8.67.0",
101
+ "vitest": "4.1.11"
102
+ },
103
+ "engines": {
104
+ "node": ">=22.22.1"
105
+ },
106
+ "publishConfig": {
107
+ "access": "public"
108
+ },
109
+ "packageManager": "yarn@1.22.22+sha256.c17d3797fb9a9115bf375e31bfd30058cac6bc9c3b8807a3d8cb2094794b51ca"
47
110
  }
package/.babelrc DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "presets": ["es2015", "env"],
3
- "plugins": ["transform-object-rest-spread"],
4
- }
package/.eslintignore DELETED
@@ -1 +0,0 @@
1
- node_modules
package/.eslintrc.js DELETED
@@ -1,17 +0,0 @@
1
- module.exports = {
2
- "extends": "airbnb-base",
3
- "rules": {
4
- "semi": ["error", "always"],
5
- "quotes": ["error", "single"],
6
- "linebreak-style": "off",
7
- "indent": ["error", 4],
8
- "no-underscore-dangle": "off",
9
- "no-console": "off",
10
- "no-unused-vars": ["error", {"argsIgnorePattern": "next"}]
11
- },
12
- "env": {
13
- "node": true,
14
- "es6": true,
15
- },
16
- "parser": "babel-eslint",
17
- };
package/.npmignore DELETED
@@ -1 +0,0 @@
1
- node_modules
package/lib/arcli.min.js DELETED
@@ -1 +0,0 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("arcli",[],e):"object"==typeof exports?exports.arcli=e():t.arcli=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=5)}([function(t,e,r){"use strict";var n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},o={};t.exports={add:function(t){o=n({},o,t)},get:function(t,e){for(var r=t.split("."),n=o,i=0;i<r.length;i+=1){if(void 0===(n=n[r[i]]))return e}return n}}},function(t,e,r){"use strict";var n=r(0),o=null;t.exports={setup:function(t,e){o=t,n.add(e)},getArgv:function(){return o.argv}}},function(t,e,r){"use strict";var n=r(7);t.exports=n},function(t,e,r){"use strict";var n=r(8);t.exports={success:n.getLogger().warn,error:n.getLogger().error,info:n.getLogger().info,bold:n.getLogger().verbose}},function(t,e){t.exports=require("chalk")},function(t,e,r){"use strict";var n=r(1),o=r(6),i=r(3),s=r(2),u=r(0),c=r(10),f=r(4),a=r(13);t.exports={init:n,run:o,Logger:i,Commander:s,Config:u,Spinner:c,Chalk:f,Emoji:a}},function(t,e,r){"use strict";var n=r(1),o=r(2);t.exports=function(){return o.parse(n.getArgv())}},function(t,e){t.exports=require("commander")},function(t,e,r){"use strict";function n(t,e,r){return""+r(t)}function o(t,e){return"info"===e?n(t,e,i.blueBright):"error"===e?n(t,e,i.redBright):"warn"===e?n(t,e,i.greenBright):"verbose"===e?n(t,e,i.white.bold):i.white(t)}var i=r(4),s=r(9),u=r(0),c=null;t.exports={getLogger:function(){return c||(c=new s.Logger({level:"silly",transports:[new s.transports.Console({formatter:function(t){var e=u.get("fancy"),r="";return(r+=e?o(t.message,t.level):""+t.message)+" "+(t.meta&&Object.keys(t.meta).length?""+JSON.stringify(t.meta):"")}})]})),c}}},function(t,e){t.exports=require("winston")},function(t,e,r){"use strict";var n=r(11);t.exports={start:n.start,stop:n.stop,stopWithSuccess:n.stopWithSuccess,stopWithFailure:n.stopWithFailure}},function(t,e,r){"use strict";var n=r(12),o=r(0),i=r(3),s=null;t.exports={start:function(t){return o.get("fancy",!1)?(s||(s=n(t)),s.start(t)):i.bold(t)},stop:function(t){return o.get("fancy",!1)?(s||(s=n(t)),s.stop(),t&&i.bold(t),null):i.bold(t)},stopWithSuccess:function(t){return o.get("fancy",!1)?(s||(s=n(t)),t||s.stop(),s.succeed(t)):i.success(t)},stopWithFailure:function(t){return o.get("fancy",!1)?(s||(s=n(t)),t||s.stop(),s.fail(t)):i.error(t)}}},function(t,e){t.exports=require("ora")},function(t,e){t.exports=require("node-emoji")}])});
@@ -1,3 +0,0 @@
1
- const commander = require('commander');
2
-
3
- module.exports = commander;
package/src/config.js DELETED
@@ -1,22 +0,0 @@
1
- let configInstance = {};
2
-
3
- module.exports = {
4
- add(configurations) {
5
- configInstance = {
6
- ...configInstance,
7
- ...configurations,
8
- };
9
- },
10
- get(key, defaultValue) {
11
- const tokens = key.split('.');
12
- let tempConfig = configInstance;
13
- for (let i = 0; i < tokens.length; i += 1) {
14
- const token = tokens[i];
15
- tempConfig = tempConfig[token];
16
- if (tempConfig === undefined) {
17
- return defaultValue;
18
- }
19
- }
20
- return tempConfig;
21
- },
22
- };
package/src/index.js DELETED
@@ -1,19 +0,0 @@
1
- const init = require('./init');
2
- const run = require('./run');
3
- const Logger = require('./logger');
4
- const Commander = require('./commander');
5
- const Config = require('./config');
6
- const Spinner = require('./spinner');
7
- const Chalk = require('chalk');
8
- const Emoji = require('node-emoji');
9
-
10
- module.exports = {
11
- init,
12
- run,
13
- Logger,
14
- Commander,
15
- Config,
16
- Spinner,
17
- Chalk,
18
- Emoji,
19
- };
package/src/init/index.js DELETED
@@ -1,13 +0,0 @@
1
- const arcliConfig = require('../config');
2
-
3
- let proc = null;
4
-
5
- module.exports = {
6
- setup: (arcliProcess, configurations) => {
7
- proc = arcliProcess;
8
- arcliConfig.add(configurations);
9
- },
10
- getArgv() {
11
- return proc.argv;
12
- },
13
- };
@@ -1,8 +0,0 @@
1
- const winston = require('./winston');
2
-
3
- module.exports = {
4
- success: winston.getLogger().warn,
5
- error: winston.getLogger().error,
6
- info: winston.getLogger().info,
7
- bold: winston.getLogger().verbose,
8
- };
@@ -1,55 +0,0 @@
1
- const chalk = require('chalk');
2
- const winston = require('winston');
3
-
4
- const configurtions = require('../config');
5
-
6
- let instance = null;
7
-
8
- function getMessage(message, level, coloringFunction) {
9
- return `${coloringFunction(message)}`;
10
- }
11
-
12
- function getColoredMessage(message, level) {
13
- if (level === 'info') {
14
- return getMessage(message, level, chalk.blueBright);
15
- }
16
-
17
- if (level === 'error') {
18
- return getMessage(message, level, chalk.redBright);
19
- }
20
-
21
- if (level === 'warn') {
22
- return getMessage(message, level, chalk.greenBright);
23
- }
24
-
25
- if (level === 'verbose') {
26
- return getMessage(message, level, chalk.white.bold);
27
- }
28
- return chalk.white(message);
29
- }
30
-
31
- module.exports = {
32
- getLogger: () => {
33
- if (!instance) {
34
- instance = new (winston.Logger)({
35
- level: 'silly',
36
- transports: [
37
- new winston.transports.Console({
38
- formatter(options) {
39
- const fancy = configurtions.get('fancy');
40
- let message = '';
41
- if (fancy) {
42
- message += getColoredMessage(options.message, options.level);
43
- } else {
44
- message += `${options.message}`;
45
- }
46
- const meta = `${options.meta && Object.keys(options.meta).length ? `${JSON.stringify(options.meta)}` : ''}`;
47
- return `${message} ${meta}`;
48
- },
49
- }),
50
- ],
51
- });
52
- }
53
- return instance;
54
- },
55
- };
package/src/run.js DELETED
@@ -1,4 +0,0 @@
1
- const init = require('./init');
2
- const Commander = require('./commander');
3
-
4
- module.exports = () => Commander.parse(init.getArgv());
@@ -1,8 +0,0 @@
1
- const ora = require('./ora');
2
-
3
- module.exports = {
4
- start: ora.start,
5
- stop: ora.stop,
6
- stopWithSuccess: ora.stopWithSuccess,
7
- stopWithFailure: ora.stopWithFailure,
8
- };
@@ -1,50 +0,0 @@
1
- const ora = require('ora');
2
- const config = require('../config');
3
- const Logger = require('../logger');
4
-
5
- let _instance = null;
6
-
7
- module.exports = {
8
- start(text) {
9
- const fancy = config.get('fancy', false);
10
- if (!fancy) { return Logger.bold(text); }
11
- if (!_instance) {
12
- _instance = ora(text);
13
- }
14
- return _instance.start(text);
15
- },
16
- stop(text) {
17
- const fancy = config.get('fancy', false);
18
- if (!fancy) { return Logger.bold(text); }
19
- if (!_instance) {
20
- _instance = ora(text);
21
- }
22
- _instance.stop();
23
- if (text) {
24
- Logger.bold(text);
25
- }
26
- return null;
27
- },
28
- stopWithSuccess(text) {
29
- const fancy = config.get('fancy', false);
30
- if (!fancy) { return Logger.success(text); }
31
- if (!_instance) {
32
- _instance = ora(text);
33
- }
34
- if (!text) {
35
- _instance.stop();
36
- }
37
- return _instance.succeed(text);
38
- },
39
- stopWithFailure(text) {
40
- const fancy = config.get('fancy', false);
41
- if (!fancy) { return Logger.error(text); }
42
- if (!_instance) {
43
- _instance = ora(text);
44
- }
45
- if (!text) {
46
- _instance.stop();
47
- }
48
- return _instance.fail(text);
49
- },
50
- };
package/tst/index.js DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const arcli = require('../lib/arcli')
4
-
5
- arcli.init.setup(process, {
6
- fancy: true
7
- });
8
-
9
- const { Commander, Logger, Spinner } = arcli;
10
-
11
- Commander
12
- .version('0.0.1')
13
- .description('an opinionated command line app in NodeJS');
14
-
15
- Commander
16
- .command('ping')
17
- .description('Sends a ping and prints pong')
18
- .action(() => {
19
- Logger.info("logging: info")
20
- Logger.success("logging: success")
21
- Logger.error("logging: error")
22
- Logger.bold("logging: error")
23
- Spinner.start("Drinking 10 beers ...")
24
- setTimeout(() => {
25
- Spinner.stopWithSuccess("I'm drunk!");
26
- }, 1000);
27
- });
28
-
29
- arcli.run()
package/webpack.config.js DELETED
@@ -1,47 +0,0 @@
1
- const webpack = require('webpack');
2
- const UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
3
- const path = require('path');
4
- const env = require('yargs').argv.env;
5
- const nodeExternals = require('webpack-node-externals');
6
-
7
- let libraryName = 'arcli';
8
-
9
- let plugins = [], outputFile;
10
-
11
- if (env === 'build') {
12
- plugins.push(new UglifyJsPlugin({ minimize: true }));
13
- outputFile = libraryName + '.min.js';
14
- } else {
15
- outputFile = libraryName + '.js';
16
- }
17
-
18
- const config = {
19
- externals: [nodeExternals()],
20
- entry: __dirname + '/src/index.js',
21
- output: {
22
- path: __dirname + '/lib',
23
- filename: outputFile,
24
- library: libraryName,
25
- libraryTarget: 'umd',
26
- umdNamedDefine: true
27
- },
28
- module: {
29
- rules: [
30
- {
31
- test: /(\.js)$/,
32
- loader: 'babel-loader',
33
- },
34
- {
35
- test: /(\.js)$/,
36
- loader: 'eslint-loader',
37
- }
38
- ]
39
- },
40
- resolve: {
41
- modules: [path.resolve('./node_modules'), path.resolve('./src')],
42
- extensions: ['.js']
43
- },
44
- plugins: plugins
45
- };
46
-
47
- module.exports = config;