@seethruhead/cra-payroll 0.1.3

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 (3) hide show
  1. package/README.md +183 -0
  2. package/dist/cra-payroll.js +80082 -0
  3. package/package.json +33 -0
package/README.md ADDED
@@ -0,0 +1,183 @@
1
+ # cra-payroll
2
+
3
+ Calculate Canadian payroll deductions using CRA's [Payroll Deductions Online Calculator (PDOC)](https://apps.cra-arc.gc.ca/ebci/rhpd/beta/entry).
4
+
5
+ Automates the CRA wizard via Playwright and returns your net pay, taxes, CPP, EI, and RRSP breakdown — per paycheck, monthly, or annually.
6
+
7
+ ## Download
8
+
9
+ Grab the latest binary for your platform from [**Releases**](https://github.com/SeeThruHead/cra-payroll/releases):
10
+
11
+ | Platform | File |
12
+ |----------|------|
13
+ | macOS (Apple Silicon) | `cra-payroll-darwin-arm64` |
14
+ | macOS (Intel) | `cra-payroll-darwin-x64` |
15
+ | Linux (x64) | `cra-payroll-linux-x64` |
16
+
17
+ ```bash
18
+ # Example: macOS Apple Silicon
19
+ curl -L -o cra-payroll https://github.com/SeeThruHead/cra-payroll/releases/latest/download/cra-payroll-darwin-arm64
20
+ chmod +x cra-payroll
21
+
22
+ # Remove macOS quarantine flag (unsigned binary)
23
+ xattr -d com.apple.quarantine cra-payroll
24
+
25
+ sudo mv cra-payroll /usr/local/bin/
26
+ ```
27
+
28
+ > **Requires Google Chrome** — uses your system Chrome, no extra browser install needed.
29
+
30
+ Or use the one-liner:
31
+
32
+ ```bash
33
+ curl -fsSL https://raw.githubusercontent.com/SeeThruHead/cra-payroll/main/install.sh | bash
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ ```bash
39
+ # Interactive — prompts for missing values
40
+ cra-payroll
41
+
42
+ # CLI args
43
+ cra-payroll --salary 120000 --province "British Columbia"
44
+
45
+ # Per-paycheck table for the year (tracks CPP/EI maxout)
46
+ cra-payroll --salary 263000 --table
47
+
48
+ # Annual totals
49
+ cra-payroll --salary 100000 --annual
50
+
51
+ # Monthly averages
52
+ cra-payroll --salary 100000 --monthly
53
+
54
+ # Combine them
55
+ cra-payroll --salary 263000 --table --annual --monthly
56
+
57
+ # Verbose logging
58
+ cra-payroll -v --salary 100000
59
+
60
+ # Check version
61
+ cra-payroll --version
62
+
63
+ # Self-update to latest release
64
+ cra-payroll --update
65
+ ```
66
+
67
+ ### Example output (`--table`)
68
+
69
+ ```
70
+ 📊 Per-Paycheck Table (2026)
71
+ ══════════════════════════════════════════════════════════════════════════════════════════════
72
+ # │ Gross │ Fed Tax │ Prov Tax │ CPP │ EI │ Net Pay │ Cum CPP/EI
73
+ ──────────────────────────────────────────────────────────────────────────────────────────────
74
+ 1 │ 10,958.33 │ 2,232.82 │ 1,431.13 │ 669.42 │ 178.62 │ 6,446.34 │ 848.04
75
+ 2 │ 10,958.33 │ 2,232.82 │ 1,431.13 │ 669.42 │ 178.62 │ 6,446.34 │ 1,696.08
76
+ ... │ ... │ ... │ ... │ ... │ ... │ ... │ ...
77
+ 7 │ 10,958.33 │ 2,232.82 │ 1,431.13 │ 213.93 │ 51.35 │ 7,029.10 │ 5,353.52 ← partial
78
+ 8 │ 10,958.33 │ 2,232.82 │ 1,431.13 │ 0.00 │ 0.00 │ 7,294.38 │ 5,353.52 ✓ maxed
79
+ ... │ ... │ ... │ ... │ ... │ ... │ ... │ ...
80
+ ```
81
+
82
+ ## Config
83
+
84
+ Config is loaded from the first file found:
85
+ 1. `--config <path>`
86
+ 2. `./config.json`
87
+ 3. `~/.config/cra-payroll.json`
88
+ 4. `~/.cra-payroll.json`
89
+
90
+ CLI args override config file values. Missing values are prompted interactively.
91
+
92
+ ```json
93
+ {
94
+ "province": "Ontario",
95
+ "annualSalary": 100000,
96
+ "payPeriod": "Semi-monthly (24 pay periods a year)",
97
+ "rrspEmployeePercent": 4,
98
+ "rrspEmployerPercent": 4
99
+ }
100
+ ```
101
+
102
+ ### Options
103
+
104
+ | Option | CLI flag | Config key | Default |
105
+ |--------|----------|------------|---------|
106
+ | Province | `-p`, `--province` | `province` | `Ontario` |
107
+ | Annual salary | `-s`, `--salary` | `annualSalary` | _(prompted)_ |
108
+ | Pay period | `--pay-period` | `payPeriod` | `Semi-monthly (24)` |
109
+ | Employee RRSP % | `--rrsp-employee` | `rrspEmployeePercent` | `4` |
110
+ | Employer RRSP % | `--rrsp-employer` | `rrspEmployerPercent` | `4` |
111
+ | CPP maxed | `--cpp-maxed` | `cppMaxedOut` | `false` |
112
+ | EI maxed | `--ei-maxed` | `eiMaxedOut` | `false` |
113
+ | Yearly table | `-t`, `--table` | — | `false` |
114
+ | Annual totals | `-a`, `--annual` | — | `false` |
115
+ | Monthly averages | `-m`, `--monthly` | — | `false` |
116
+ | Verbose | `-v`, `--verbose` | — | `false` |
117
+ | Self-update | `--update` | — | — |
118
+ | Show version | `--version` | — | — |
119
+ | Headless | `--headless` | — | `false` |
120
+ | Config path | `-c`, `--config` | — | — |
121
+
122
+ ### 2026 CPP/EI Maximums (used for `--table`)
123
+
124
+ | | Amount |
125
+ |---|---|
126
+ | CPP max contribution | $4,230.45 |
127
+ | CPP2 max (additional) | $416.00 |
128
+ | EI max premium | $1,123.07 |
129
+
130
+ ## Run from source
131
+
132
+ If you'd rather not download a binary, you can clone and run directly. You'll need [Google Chrome](https://www.google.com/chrome/) installed.
133
+
134
+ ### With Bun
135
+
136
+ ```bash
137
+ git clone https://github.com/SeeThruHead/cra-payroll.git
138
+ cd cra-payroll
139
+ bun install
140
+ bun run dev -- --salary 100000
141
+ bun run dev -- --salary 263000 --table
142
+ ```
143
+
144
+ ### With Node
145
+
146
+ ```bash
147
+ git clone https://github.com/SeeThruHead/cra-payroll.git
148
+ cd cra-payroll
149
+ npm install
150
+ npx tsx src/cli.ts --salary 100000
151
+ npx tsx src/cli.ts --salary 263000 --table
152
+ ```
153
+
154
+ ## Development
155
+
156
+ ```bash
157
+ # Run directly
158
+ bun run dev -- --salary 100000
159
+
160
+ # Build standalone binary
161
+ bun run build
162
+
163
+ # Unit tests (fast, no browser)
164
+ bun test
165
+
166
+ # Integration tests (hits CRA, needs Chrome, may be flaky)
167
+ bun run test:integration
168
+
169
+ # All tests
170
+ bun run test:all
171
+ ```
172
+
173
+ ## How it works
174
+
175
+ 1. Launches your system Chrome via Puppeteer (headed by default — CRA blocks headless)
176
+ 2. Fills out the PDOC wizard: province, pay period, salary, RRSP contributions
177
+ 3. Sets CPP/EI status and hits Calculate
178
+ 4. Scrapes the results page for taxes, deductions, and net pay
179
+ 5. For `--table` mode: runs twice (with/without CPP/EI) and simulates each paycheck using the 2026 maximums
180
+
181
+ ## License
182
+
183
+ MIT