@invoicer/cli 1.1.0 → 1.1.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/README.md +236 -0
- package/package.json +14 -1
- package/.env.example +0 -15
- package/config.json +0 -19
- package/data/last.json +0 -11
- package/index.html +0 -2584
- package/logo.svg +0 -17
- package/src/cli.ts +0 -44
- package/src/commands/clients.ts +0 -221
- package/src/commands/generate.ts +0 -379
- package/src/commands/timesheet.ts +0 -47
- package/src/core/json-store.ts +0 -33
- package/src/core/paths.ts +0 -42
- package/src/core/validators.ts +0 -168
- package/src/domain/types.ts +0 -129
- package/src/services/email.ts +0 -40
- package/src/services/invoice-number.ts +0 -46
- package/src/services/pdf-render.ts +0 -95
- package/src/services/timesheet.ts +0 -173
- package/src/utils/sanitize.ts +0 -8
- package/test/cli-wiring.test.ts +0 -25
- package/test/invoice-number.test.ts +0 -45
- package/test/timesheet.test.ts +0 -104
- package/tsconfig.json +0 -17
package/README.md
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# @invoicer/cli
|
|
2
|
+
|
|
3
|
+
Professional invoice generator with timesheet integration. Turn hours into polished PDF invoices and email them automatically—all from the command line.
|
|
4
|
+
|
|
5
|
+
- ⚡ **Fast** - Generate invoices in seconds
|
|
6
|
+
- 📋 **Smart** - Auto-fills client details from config
|
|
7
|
+
- 🔢 **Auto-numbering** - Tracks invoice numbers per month
|
|
8
|
+
- 📊 **Multi-line items** - Add services with different rates
|
|
9
|
+
- 📧 **Email integration** - Send via SMTP automatically
|
|
10
|
+
- 🌍 **Open source** - MIT licensed
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install -g @invoicer/cli
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Then run:
|
|
19
|
+
```bash
|
|
20
|
+
invoicer --help
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
### 1. Configure Your Details
|
|
26
|
+
|
|
27
|
+
Create or edit `~/.invoicer/config.json`:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"from": {
|
|
32
|
+
"name": "Your Name",
|
|
33
|
+
"email": "you@example.com",
|
|
34
|
+
"address": "Your Address"
|
|
35
|
+
},
|
|
36
|
+
"client": [
|
|
37
|
+
{
|
|
38
|
+
"name": "Acme Corp",
|
|
39
|
+
"email": "billing@acme.com",
|
|
40
|
+
"address": "123 Business St",
|
|
41
|
+
"currency": "USD",
|
|
42
|
+
"defaultRate": 50,
|
|
43
|
+
"payPeriodType": "Net 30"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 2. Generate an Invoice
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
invoicer
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Interactive prompts will guide you through:
|
|
56
|
+
- Client selection
|
|
57
|
+
- Hours worked
|
|
58
|
+
- Hourly rate
|
|
59
|
+
- Line item details
|
|
60
|
+
- Additional items (optional)
|
|
61
|
+
|
|
62
|
+
### 3. Output
|
|
63
|
+
|
|
64
|
+
PDF is saved to:
|
|
65
|
+
```
|
|
66
|
+
./out/{client-name}/Invoice_YYYYMM_01.pdf
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
|
|
71
|
+
### Interactive Mode (Recommended)
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
invoicer
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### With CLI Arguments
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Specific month and hours
|
|
81
|
+
invoicer --month=2026-02 --hours=160 --rate=75
|
|
82
|
+
|
|
83
|
+
# Custom invoice number
|
|
84
|
+
invoicer --invoice=INV-202602-007
|
|
85
|
+
|
|
86
|
+
# Specific description for first item
|
|
87
|
+
invoicer --desc="Web Development Services"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Generate Current Month's Invoice
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
invoicer:month
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
This automatically fills the current month (YYYY-MM).
|
|
97
|
+
|
|
98
|
+
## Features
|
|
99
|
+
|
|
100
|
+
### Invoice Number Auto-Generation
|
|
101
|
+
|
|
102
|
+
Format: `{prefix}-{YYYYMM}-{sequence}`
|
|
103
|
+
|
|
104
|
+
Example: `INV-202602-001`, `INV-202602-002`
|
|
105
|
+
|
|
106
|
+
Sequence numbers are tracked per month and per client, stored in `data/last.json`.
|
|
107
|
+
|
|
108
|
+
### Multiple Line Items
|
|
109
|
+
|
|
110
|
+
Add as many services as needed:
|
|
111
|
+
- Description (e.g., "Development", "Design")
|
|
112
|
+
- Hours worked
|
|
113
|
+
- Hourly rate
|
|
114
|
+
- Period (from/to dates)
|
|
115
|
+
|
|
116
|
+
Running calculation shown after each item.
|
|
117
|
+
|
|
118
|
+
### Email Integration (Optional)
|
|
119
|
+
|
|
120
|
+
After PDF generation, you'll be prompted:
|
|
121
|
+
```
|
|
122
|
+
Send invoice via email? (y/n)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Automatically:
|
|
126
|
+
- Attaches PDF
|
|
127
|
+
- Uses client email from config
|
|
128
|
+
- Professional subject and body
|
|
129
|
+
- Error handling if SMTP not configured
|
|
130
|
+
|
|
131
|
+
## Configuration
|
|
132
|
+
|
|
133
|
+
### config.json Structure
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"from": {
|
|
138
|
+
"name": "string", // Your name
|
|
139
|
+
"email": "string", // Your email
|
|
140
|
+
"address": "string" // Your business address
|
|
141
|
+
},
|
|
142
|
+
"client": [
|
|
143
|
+
{
|
|
144
|
+
"name": "string", // Client name
|
|
145
|
+
"email": "string", // Client email
|
|
146
|
+
"address": "string", // Client address
|
|
147
|
+
"currency": "string", // USD, EUR, GBP, etc.
|
|
148
|
+
"defaultRate": 50, // Default hourly rate
|
|
149
|
+
"payPeriodType": "Net 30" // Payment terms
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
"invoicePrefix": "INV" // (Optional) Prefix for invoice numbers
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Environment Variables (.env)
|
|
157
|
+
|
|
158
|
+
For email sending:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
cp .env.example .env
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
SMTP_HOST=smtp.gmail.com
|
|
166
|
+
SMTP_PORT=465
|
|
167
|
+
SMTP_USER=your@gmail.com
|
|
168
|
+
SMTP_PASS=your-app-password
|
|
169
|
+
INVOICE_FROM=Your Name <your@gmail.com>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**For Gmail:**
|
|
173
|
+
1. Enable 2FA on your Google account
|
|
174
|
+
2. Create App Password: https://myaccount.google.com/apppasswords
|
|
175
|
+
3. Use the 16-character password in `SMTP_PASS`
|
|
176
|
+
|
|
177
|
+
## Data Files
|
|
178
|
+
|
|
179
|
+
The CLI stores data locally:
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
~/.invoicer/
|
|
183
|
+
├── config.json # Your configuration
|
|
184
|
+
├── data/
|
|
185
|
+
│ ├── last.json # Last used hours/rate per client
|
|
186
|
+
│ ├── timesheet.json # Time entries (optional)
|
|
187
|
+
│ └── active-timer.json # Timer state (optional)
|
|
188
|
+
└── .env # SMTP credentials
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Output
|
|
192
|
+
|
|
193
|
+
All PDFs saved to: `./out/{client-name}/`
|
|
194
|
+
|
|
195
|
+
Example structure:
|
|
196
|
+
```
|
|
197
|
+
out/
|
|
198
|
+
├── Acme Corp/
|
|
199
|
+
│ ├── Invoice_202602_001.pdf
|
|
200
|
+
│ └── Invoice_202602_002.pdf
|
|
201
|
+
└── TechCorp/
|
|
202
|
+
└── Invoice_202602_001.pdf
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Development
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# Build TypeScript
|
|
209
|
+
npm run build
|
|
210
|
+
|
|
211
|
+
# Run tests
|
|
212
|
+
npm test
|
|
213
|
+
|
|
214
|
+
# Build and run
|
|
215
|
+
npm run invoice
|
|
216
|
+
|
|
217
|
+
# Current month shortcut
|
|
218
|
+
npm run invoice:month
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Links
|
|
222
|
+
|
|
223
|
+
- **Website:** https://invoicer.inbrief.sh/
|
|
224
|
+
- **GitHub:** https://github.com/miladezzat/InvoicePilot
|
|
225
|
+
- **Issues:** https://github.com/miladezzat/InvoicePilot/issues
|
|
226
|
+
- **Desktop App:** https://invoicer.inbrief.sh/ (cross-platform with timer)
|
|
227
|
+
|
|
228
|
+
## License
|
|
229
|
+
|
|
230
|
+
MIT © 2026 Milad Fahmy
|
|
231
|
+
|
|
232
|
+
## Support
|
|
233
|
+
|
|
234
|
+
For issues, questions, or suggestions:
|
|
235
|
+
- GitHub Issues: https://github.com/miladezzat/InvoicePilot/issues
|
|
236
|
+
- Website: https://invoicer.inbrief.sh/
|
package/package.json
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@invoicer/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Professional invoice generator with timesheet integration and CLI support",
|
|
5
|
+
"homepage": "https://invoicer.inbrief.sh/",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/miladezzat/InvoicePilot"
|
|
9
|
+
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/miladezzat/InvoicePilot/issues"
|
|
12
|
+
},
|
|
5
13
|
"type": "module",
|
|
6
14
|
"preferGlobal": true,
|
|
7
15
|
"bin": {
|
|
8
16
|
"invoicer": "./scripts/invoice.mjs"
|
|
9
17
|
},
|
|
18
|
+
"files": [
|
|
19
|
+
"scripts/",
|
|
20
|
+
"dist/",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
10
23
|
"scripts": {
|
|
11
24
|
"build": "tsc -p tsconfig.json",
|
|
12
25
|
"invoice": "npm run build && node scripts/invoice.mjs",
|
package/.env.example
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# SMTP Configuration for Email Sending
|
|
2
|
-
# Copy this file to .env and fill in your details
|
|
3
|
-
|
|
4
|
-
SMTP_HOST=smtp.gmail.com
|
|
5
|
-
SMTP_PORT=465
|
|
6
|
-
SMTP_USER=your@email.com
|
|
7
|
-
SMTP_PASS=your_app_password
|
|
8
|
-
INVOICE_FROM="Your Name <your@email.com>"
|
|
9
|
-
|
|
10
|
-
# Gmail App Password Setup:
|
|
11
|
-
# 1. Go to https://myaccount.google.com/security
|
|
12
|
-
# 2. Enable 2-Factor Authentication
|
|
13
|
-
# 3. Go to App Passwords: https://myaccount.google.com/apppasswords
|
|
14
|
-
# 4. Create app password for "Mail" on "Other (Custom name)"
|
|
15
|
-
# 5. Copy the 16-character password and use it as SMTP_PASS
|
package/config.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"client": [
|
|
3
|
-
{
|
|
4
|
-
"address": "",
|
|
5
|
-
"currency": "USD",
|
|
6
|
-
"defaultRate": 40,
|
|
7
|
-
"email": "miladezzat.f+dasix@gmail.com",
|
|
8
|
-
"name": "Dasix Inc.",
|
|
9
|
-
"payPeriodType": "Net 7"
|
|
10
|
-
}
|
|
11
|
-
],
|
|
12
|
-
"defaultDescription": "",
|
|
13
|
-
"from": {
|
|
14
|
-
"address": "Test",
|
|
15
|
-
"email": "miladezzat.f@gmail.com",
|
|
16
|
-
"name": "Milad"
|
|
17
|
-
},
|
|
18
|
-
"invoicePrefix": "INV"
|
|
19
|
-
}
|