@ecuafact/cli 0.0.0-stage → 0.0.1-preview.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ecuanexus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,27 @@
1
- # Temporary Holding Version
1
+ # @ecuafact/cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ CLI oficial de Ecuafact para la facturación electrónica del SRI (Ecuador): emite comprobantes desde JSON, JSONL, carpetas, CSV o Excel; los valida sin consumir cupo; sigue su autorización; descarga el RIDE y el XML; consulta el SRI y vigila carpetas para emitir lo que deja tu ERP.
4
+
5
+ > **Versión preliminar (`preview`).** Puede cambiar sin aviso. Pruébala primero en el entorno `sandbox`.
6
+
7
+ Funciona en Windows, Linux y macOS, en equipos x64 y arm64. npm, Bun, pnpm y Yarn instalan automáticamente la versión de tu sistema; requiere Node.js 18 o superior.
8
+
9
+ ```bash
10
+ npm install -g @ecuafact/cli@preview # o: bun add -g @ecuafact/cli@preview / pnpm add -g @ecuafact/cli@preview
11
+ npx @ecuafact/cli@preview --help # o: bunx @ecuafact/cli@preview --help
12
+ ```
13
+
14
+ ## Primeros pasos
15
+
16
+ ```bash
17
+ ecuafact --entorno sandbox login # pide tu API Key sin mostrarla y la guarda en el almacén de credenciales del sistema
18
+ ecuafact --entorno sandbox doctor # revisa conexión, API Key, IP registrada y cupo
19
+ ecuafact --entorno sandbox emitir factura.json --esperar --descargar ride
20
+ ```
21
+
22
+ Tu API Key solo funciona desde una IP registrada en el portal (**Cuenta > IP permitidas**).
23
+
24
+ ## Documentación
25
+
26
+ - Guía completa: https://docsapi.ecuafact.com/v1/guias/cli
27
+ - Ayuda sin conexión: `ecuafact ayuda` y `ecuafact <comando> --help`
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env node
2
+ // Lanzador del CLI ecuafact para npm, Bun, pnpm y Yarn: ubica el binario nativo del paquete de la
3
+ // plataforma (instalado como dependencia opcional) y le pasa los argumentos, la entrada y la salida.
4
+ "use strict";
5
+
6
+ const { spawnSync } = require("node:child_process");
7
+ const fs = require("node:fs");
8
+
9
+ const PLATAFORMAS = {
10
+ "win32-x64": "@ecuafact/cli-win32-x64",
11
+ "win32-arm64": "@ecuafact/cli-win32-arm64",
12
+ "linux-x64": "@ecuafact/cli-linux-x64",
13
+ "linux-arm64": "@ecuafact/cli-linux-arm64",
14
+ "linux-x64-musl": "@ecuafact/cli-linux-x64-musl",
15
+ "darwin-x64": "@ecuafact/cli-darwin-x64",
16
+ "darwin-arm64": "@ecuafact/cli-darwin-arm64",
17
+ };
18
+
19
+ function sufijoLibc() {
20
+ if (process.platform !== "linux") {
21
+ return "";
22
+ }
23
+ try {
24
+ const reporte = process.report && process.report.getReport();
25
+ return reporte && reporte.header && reporte.header.glibcVersionRuntime ? "" : "-musl";
26
+ } catch {
27
+ return "";
28
+ }
29
+ }
30
+
31
+ function binario() {
32
+ if (process.env.ECUAFACT_BINARIO) {
33
+ return process.env.ECUAFACT_BINARIO;
34
+ }
35
+ const clave = `${process.platform}-${process.arch}${sufijoLibc()}`;
36
+ const paquete = PLATAFORMAS[clave];
37
+ if (!paquete) {
38
+ console.error(`ecuafact: no hay binario para esta plataforma (${clave}).`);
39
+ process.exit(1);
40
+ }
41
+ const archivo = process.platform === "win32" ? "ecuafact.exe" : "ecuafact";
42
+ try {
43
+ return require.resolve(`${paquete}/bin/${archivo}`);
44
+ } catch {
45
+ console.error(`ecuafact: falta el paquete ${paquete}.`);
46
+ console.error("Reinstala sin omitir dependencias opcionales, por ejemplo: npm install -g @ecuafact/cli");
47
+ process.exit(1);
48
+ }
49
+ }
50
+
51
+ const ruta = binario();
52
+ if (process.platform !== "win32") {
53
+ try {
54
+ fs.accessSync(ruta, fs.constants.X_OK);
55
+ } catch {
56
+ // Algunos empaquetados pierden el permiso de ejecucion: se restablece.
57
+ try {
58
+ fs.chmodSync(ruta, 0o755);
59
+ } catch (error) {
60
+ console.error(`ecuafact: el binario no es ejecutable (${ruta}): ${error.message}`);
61
+ process.exit(1);
62
+ }
63
+ }
64
+ }
65
+
66
+ const resultado = spawnSync(ruta, process.argv.slice(2), { stdio: "inherit", windowsHide: false });
67
+ if (resultado.error) {
68
+ console.error(`ecuafact: no se pudo ejecutar ${ruta}: ${resultado.error.message}`);
69
+ process.exit(1);
70
+ }
71
+ process.exit(resultado.status === null ? 1 : resultado.status);
package/package.json CHANGED
@@ -1,6 +1,38 @@
1
- {
2
- "name": "@ecuafact/cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "@ecuafact/cli",
3
+ "version": "0.0.1-preview.2",
4
+ "description": "CLI de facturacion electronica de Ecuafact (SRI Ecuador).",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/Ecuanexus/ecuafact-cli.git"
9
+ },
10
+ "homepage": "https://docsapi.ecuafact.com/",
11
+ "keywords": [
12
+ "ecuafact",
13
+ "sri",
14
+ "ecuador",
15
+ "facturacion-electronica",
16
+ "cli"
17
+ ],
18
+ "bin": {
19
+ "ecuafact": "bin/ecuafact.js"
20
+ },
21
+ "files": [
22
+ "bin/ecuafact.js",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "engines": {
27
+ "node": "\u003e=18"
28
+ },
29
+ "optionalDependencies": {
30
+ "@ecuafact/cli-win32-x64": "0.0.1-preview.2",
31
+ "@ecuafact/cli-win32-arm64": "0.0.1-preview.2",
32
+ "@ecuafact/cli-linux-x64": "0.0.1-preview.2",
33
+ "@ecuafact/cli-linux-arm64": "0.0.1-preview.2",
34
+ "@ecuafact/cli-linux-x64-musl": "0.0.1-preview.2",
35
+ "@ecuafact/cli-darwin-x64": "0.0.1-preview.2",
36
+ "@ecuafact/cli-darwin-arm64": "0.0.1-preview.2"
37
+ }
38
+ }