jira-invoice 1.0.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.
package/README.es.md ADDED
@@ -0,0 +1,142 @@
1
+ # Invoice Generator
2
+
3
+ > **[English version](README.md)**
4
+
5
+ CLI interactivo para generar invoices PDF desde reportes de Jira Logged Time.
6
+
7
+ ## Requisitos
8
+
9
+ - Node.js >= 18
10
+
11
+ ## Instalacion
12
+
13
+ ```bash
14
+ cd ~/workspace/invoice-generator
15
+ npm install
16
+ npm run build
17
+ npm link
18
+ ```
19
+
20
+ ## Configuracion inicial
21
+
22
+ La primera vez que ejecutes `invoice`, un wizard te pedira:
23
+ 1. Tus datos personales (nombre, email, direccion)
24
+ 2. Los datos de tu primera empresa (nombre, direccion, moneda, tarifa, limite de horas)
25
+
26
+ La configuracion se guarda en `~/.invoice/config.json`.
27
+
28
+ ## Uso
29
+
30
+ ### Modo interactivo (recomendado)
31
+ ```bash
32
+ invoice
33
+ ```
34
+ Flujo completo:
35
+ 1. Selecciona empresa (con opciones de agregar/editar empresa o editar tus datos)
36
+ 2. Selecciona el CSV de Jira (navegacion de directorios con filtro por texto)
37
+ 3. Confirma tarifa por hora
38
+ 4. Vista previa con opcion de editar filas
39
+ 5. Fecha del invoice (enter = hoy)
40
+ 6. Numero de invoice
41
+ 7. Si la empresa tiene limite de horas: opcion de incluir columna "horas trabajadas" en el PDF
42
+ 8. Ruta del PDF de salida
43
+ 9. Resumen y confirmacion
44
+ 10. Genera el PDF
45
+
46
+ ### Modo directo
47
+ ```bash
48
+ invoice generate reporte.csv
49
+ invoice generate reporte.csv --company acme-corp --rate 30.20
50
+ invoice generate reporte.csv --date "April 14, 2026" --output ~/facturas/inv.pdf
51
+ ```
52
+
53
+ ### Opciones del modo directo
54
+
55
+ | Opcion | Descripcion |
56
+ |--------|-------------|
57
+ | `--rate <number>` | Tarifa por hora (default: tarifa de la empresa) |
58
+ | `--date <string>` | Fecha del invoice (default: hoy) |
59
+ | `--number <string>` | Numero de invoice |
60
+ | `--output <string>` | Ruta del PDF de salida |
61
+ | `--company <id>` | ID de la empresa (requerido si hay mas de una) |
62
+
63
+ ### Ayuda
64
+ ```bash
65
+ invoice --help
66
+ invoice generate --help
67
+ ```
68
+
69
+ ## Multi-empresa
70
+
71
+ Puedes tener multiples empresas configuradas, cada una con su propia moneda, tarifa y limite de horas.
72
+
73
+ Al ejecutar `invoice` en modo interactivo, el selector te permite:
74
+ - Seleccionar una empresa existente
75
+ - Agregar una nueva empresa
76
+ - Editar una empresa existente
77
+ - Editar tus datos personales (emisor)
78
+
79
+ En modo directo, usa `--company <id>` para especificar la empresa.
80
+
81
+ ## Moneda
82
+
83
+ Cada empresa tiene su propia moneda (ej: USD, EUR, CRC). Se configura al crear o editar la empresa y se usa en toda la CLI y en el PDF generado.
84
+
85
+ ## Limite de horas
86
+
87
+ Cada empresa puede tener un limite de horas diario (ej: 8h). Si lo tiene:
88
+ - Las horas del CSV se limitan al maximo diario (se escalan proporcionalmente si el total del dia lo excede)
89
+ - La vista previa muestra columnas "Trabajadas" y "Horas"
90
+ - Opcionalmente puedes incluir ambas columnas en el PDF
91
+
92
+ Si no tiene limite, las horas del CSV se usan tal cual.
93
+
94
+ ## Edicion de filas
95
+
96
+ En la vista previa puedes editar cualquier fila antes de generar el PDF:
97
+ - Ingresa el numero de fila
98
+ - Modifica fecha, ticket, descripcion o horas
99
+ - La tabla se actualiza al instante
100
+ - Presiona enter sin numero para continuar
101
+
102
+ ## Formatos de CSV soportados
103
+
104
+ | Formato | Descripcion |
105
+ |---------|-------------|
106
+ | `pivot` | Una columna por fecha (exportado con vista de calendario en Jira) |
107
+ | `date_col` | Columna `Date` con fechas o rangos (`19/Jan/26 to 30/Jan/26`) |
108
+
109
+ El formato se detecta automaticamente.
110
+
111
+ ## Nombre del PDF
112
+
113
+ El archivo se genera con el formato: `invoice_DDMonYY_to_DDMonYY.pdf`
114
+
115
+ Ejemplo: `invoice_05Jan26_to_16Jan26.pdf`
116
+
117
+ ## Desarrollo
118
+
119
+ ```bash
120
+ npm run dev # Ejecutar sin compilar (usa tsx)
121
+ npm run build # Compilar a JavaScript
122
+ npm start # Ejecutar la version compilada
123
+ ```
124
+
125
+ ## Estructura del proyecto
126
+
127
+ ```
128
+ invoice-generator/
129
+ ├── src/
130
+ │ ├── index.ts ← Entry point (shebang + main())
131
+ │ ├── cli.ts ← Interfaz CLI (interactivo + directo)
132
+ │ ├── parser.ts ← Parseo de CSV (formatos pivot y date_col)
133
+ │ ├── renderer.ts ← Generacion del PDF con pdfmake
134
+ │ ├── store.ts ← Persistencia de config en ~/.invoice/
135
+ │ ├── setup.ts ← Wizard de configuracion, gestion de empresas y datos del usuario
136
+ │ └── types.ts ← Interfaces TypeScript
137
+ ├── dist/ ← Output compilado
138
+ ├── CLAUDE.md ← Guia de desarrollo (arquitectura, flujos, como extender)
139
+ ├── package.json
140
+ ├── tsconfig.json
141
+ └── README.md
142
+ ```
package/README.md ADDED
@@ -0,0 +1,142 @@
1
+ # Invoice Generator
2
+
3
+ > **[Version en espanol](README.es.md)**
4
+
5
+ Interactive CLI to generate PDF invoices from Jira Logged Time reports.
6
+
7
+ ## Requirements
8
+
9
+ - Node.js >= 18
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ cd ~/workspace/invoice-generator
15
+ npm install
16
+ npm run build
17
+ npm link
18
+ ```
19
+
20
+ ## Initial setup
21
+
22
+ The first time you run `invoice`, a wizard will ask for:
23
+ 1. Your personal details (name, email, address)
24
+ 2. Your first company's details (name, address, currency, rate, hour limit)
25
+
26
+ Configuration is saved to `~/.invoice/config.json`.
27
+
28
+ ## Usage
29
+
30
+ ### Interactive mode (recommended)
31
+ ```bash
32
+ invoice
33
+ ```
34
+ Full flow:
35
+ 1. Select company (with options to add/edit company or edit your personal data)
36
+ 2. Select the Jira CSV file (directory navigation with text filtering)
37
+ 3. Confirm hourly rate
38
+ 4. Preview with option to edit rows
39
+ 5. Invoice date (enter = today)
40
+ 6. Invoice number
41
+ 7. If the company has an hour limit: option to include "worked hours" column in the PDF
42
+ 8. Output PDF path
43
+ 9. Summary and confirmation
44
+ 10. Generate PDF
45
+
46
+ ### Direct mode
47
+ ```bash
48
+ invoice generate report.csv
49
+ invoice generate report.csv --company acme-corp --rate 30.20
50
+ invoice generate report.csv --date "April 14, 2026" --output ~/invoices/inv.pdf
51
+ ```
52
+
53
+ ### Direct mode options
54
+
55
+ | Option | Description |
56
+ |--------|-------------|
57
+ | `--rate <number>` | Hourly rate (default: company's rate) |
58
+ | `--date <string>` | Invoice date (default: today) |
59
+ | `--number <string>` | Invoice number |
60
+ | `--output <string>` | Output PDF path |
61
+ | `--company <id>` | Company ID (required if more than one) |
62
+
63
+ ### Help
64
+ ```bash
65
+ invoice --help
66
+ invoice generate --help
67
+ ```
68
+
69
+ ## Multi-company
70
+
71
+ You can have multiple companies configured, each with its own currency, rate, and hour limit.
72
+
73
+ When running `invoice` in interactive mode, the selector lets you:
74
+ - Select an existing company
75
+ - Add a new company
76
+ - Edit an existing company
77
+ - Edit your personal data (issuer)
78
+
79
+ In direct mode, use `--company <id>` to specify the company.
80
+
81
+ ## Currency
82
+
83
+ Each company has its own currency (e.g., USD, EUR, CRC). It's configured when creating or editing the company and is used throughout the CLI and in the generated PDF.
84
+
85
+ ## Hour limit
86
+
87
+ Each company can have a daily hour limit (e.g., 8h). If set:
88
+ - CSV hours are limited to the daily maximum (scaled proportionally if the day's total exceeds it)
89
+ - The preview shows "Worked" and "Hours" columns
90
+ - You can optionally include both columns in the PDF
91
+
92
+ If no limit is set, CSV hours are used as-is.
93
+
94
+ ## Row editing
95
+
96
+ In the preview you can edit any row before generating the PDF:
97
+ - Enter the row number
98
+ - Modify date, ticket, description, or hours
99
+ - The table updates instantly
100
+ - Press enter without a number to continue
101
+
102
+ ## Supported CSV formats
103
+
104
+ | Format | Description |
105
+ |--------|-------------|
106
+ | `pivot` | One column per date (exported with calendar view in Jira) |
107
+ | `date_col` | `Date` column with dates or ranges (`19/Jan/26 to 30/Jan/26`) |
108
+
109
+ Format is detected automatically.
110
+
111
+ ## PDF filename
112
+
113
+ The file is generated with the format: `invoice_DDMonYY_to_DDMonYY.pdf`
114
+
115
+ Example: `invoice_05Jan26_to_16Jan26.pdf`
116
+
117
+ ## Development
118
+
119
+ ```bash
120
+ npm run dev # Run without compiling (uses tsx)
121
+ npm run build # Compile to JavaScript
122
+ npm start # Run the compiled version
123
+ ```
124
+
125
+ ## Project structure
126
+
127
+ ```
128
+ invoice-generator/
129
+ ├── src/
130
+ │ ├── index.ts ← Entry point (shebang + main())
131
+ │ ├── cli.ts ← CLI interface (interactive + direct)
132
+ │ ├── parser.ts ← CSV parsing (pivot and date_col formats)
133
+ │ ├── renderer.ts ← PDF generation with pdfmake
134
+ │ ├── store.ts ← Config persistence in ~/.invoice/
135
+ │ ├── setup.ts ← Setup wizard, company and user data management
136
+ │ └── types.ts ← TypeScript interfaces
137
+ ├── dist/ ← Compiled output
138
+ ├── CLAUDE.md ← Development guide (architecture, flows, how to extend)
139
+ ├── package.json
140
+ ├── tsconfig.json
141
+ └── README.md
142
+ ```
package/dist/cli.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * CLI interactivo para generar invoices PDF desde CSV de Jira.
3
+ */
4
+ export declare function main(): void;