pkg-track 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/CHANGELOG.md ADDED
@@ -0,0 +1,53 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2026-02-21
9
+
10
+ ### 🎉 Initial Release
11
+
12
+ **Features:**
13
+ - 📧 Gmail integration with OAuth - scan emails for shipping confirmations
14
+ - 📦 Support for UPS, FedEx, USPS, and Amazon Logistics tracking
15
+ - 🎮 Interactive CLI with ASCII art banner
16
+ - 🔍 Smart tracking number extraction from emails
17
+ - 🌐 Auto-open tracking pages in browser
18
+ - 🗑️ Interactive package cleanup (remove old/delivered packages)
19
+ - ➕ Manual package entry with carrier auto-detection
20
+ - 📄 Pagination (5 packages per page) for easy navigation
21
+ - 📅 Shows last email date for each package
22
+
23
+ **Commands:**
24
+ - `pkg init` - Set up Gmail OAuth (one-time)
25
+ - `pkg sync` - Scan Gmail for packages (customizable date range)
26
+ - `pkg open` - Interactive menu to select and track packages
27
+ - `pkg add` - Manually add tracking numbers
28
+ - `pkg clean` - Remove packages interactively
29
+
30
+ **Security:**
31
+ - 🔒 Read-only Gmail access (cannot send/delete emails)
32
+ - 💾 All data stored locally in `~/.pkg-tracker/`
33
+ - 🔐 Secure file permissions (0600/0700)
34
+ - ✅ Input validation and sanitization
35
+ - 🚫 No telemetry or external data transmission
36
+
37
+ **Privacy:**
38
+ - Local-only storage
39
+ - No external tracking or analytics
40
+ - Revocable OAuth access
41
+ - Secure credential handling
42
+
43
+ ### Technical Details
44
+ - Node.js 14+ required
45
+ - Dependencies: commander, googleapis, better-sqlite3, chalk, ora, inquirer, open
46
+ - Cross-platform support (macOS, Linux, Windows)
47
+ - SQLite database for local package storage
48
+
49
+ ---
50
+
51
+ ## Future Releases
52
+
53
+ See [GitHub Issues](https://github.com/vvanessaww/pkg-tracker/issues) for planned features and improvements.
@@ -0,0 +1,42 @@
1
+ # Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We are committed to providing a friendly, safe, and welcoming environment for all contributors, regardless of experience level, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristics.
6
+
7
+ ## Our Standards
8
+
9
+ **Examples of behavior that contributes to a positive environment:**
10
+
11
+ - Being respectful and considerate in communication
12
+ - Welcoming newcomers and helping them get started
13
+ - Accepting constructive criticism gracefully
14
+ - Focusing on what is best for the community
15
+ - Showing empathy towards other community members
16
+
17
+ **Examples of unacceptable behavior:**
18
+
19
+ - Harassment, trolling, insulting/derogatory comments
20
+ - Publishing others' private information without permission
21
+ - Personal or political attacks
22
+ - Any conduct which could reasonably be considered inappropriate
23
+
24
+ ## Enforcement
25
+
26
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by:
27
+ - Opening an issue with the "conduct" label
28
+ - Contacting the project maintainer directly
29
+
30
+ All complaints will be reviewed and investigated promptly and fairly.
31
+
32
+ ## Scope
33
+
34
+ This Code of Conduct applies within all project spaces (GitHub issues, pull requests, discussions) and in public spaces when an individual is representing the project or its community.
35
+
36
+ ## Attribution
37
+
38
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.0.
39
+
40
+ ---
41
+
42
+ **TL;DR:** Be kind, be helpful, be professional. We're all here to build something useful together. 🤝
@@ -0,0 +1,157 @@
1
+ # Contributing to pkg-tracker
2
+
3
+ First off, thanks for taking the time to contribute! 🎉
4
+
5
+ ## How Can I Contribute?
6
+
7
+ ### 🐛 Reporting Bugs
8
+
9
+ Before creating bug reports, please check existing issues to avoid duplicates.
10
+
11
+ **When submitting a bug report, include:**
12
+ - **OS & Node.js version** (`node --version`)
13
+ - **Steps to reproduce** the issue
14
+ - **Expected vs actual behavior**
15
+ - **Error messages** (if any)
16
+ - **Screenshots** (if relevant)
17
+
18
+ ### 💡 Suggesting Features
19
+
20
+ Feature suggestions are welcome! Please:
21
+ - Check existing issues first
22
+ - Explain the use case clearly
23
+ - Describe how it would work
24
+ - Consider if it fits the project's scope (simple, focused CLI)
25
+
26
+ ### 🔧 Pull Requests
27
+
28
+ **Good first issues:**
29
+ - Bug fixes
30
+ - Documentation improvements
31
+ - Additional carrier support (DHL, OnTrac, etc.)
32
+ - Better error messages
33
+ - Test coverage
34
+
35
+ **Before submitting a PR:**
36
+
37
+ 1. **Fork** the repo and create your branch from `master`
38
+ 2. **Install** dependencies: `npm install`
39
+ 3. **Test** your changes thoroughly
40
+ 4. **Commit** with clear messages (see [Commit Guidelines](#commit-guidelines))
41
+ 5. **Push** to your fork and submit a PR
42
+
43
+ ### 📝 Commit Guidelines
44
+
45
+ Use clear, descriptive commit messages:
46
+
47
+ ```
48
+ Add support for DHL tracking numbers
49
+
50
+ - Added DHL regex pattern to parser.js
51
+ - Updated README with DHL info
52
+ - Added tests for DHL validation
53
+ ```
54
+
55
+ **Format:**
56
+ - First line: Brief summary (50 chars max)
57
+ - Blank line
58
+ - Detailed description (if needed)
59
+
60
+ ## Development Setup
61
+
62
+ ```bash
63
+ # Clone your fork
64
+ git clone https://github.com/YOUR-USERNAME/pkg-tracker.git
65
+ cd pkg-tracker
66
+
67
+ # Install dependencies
68
+ npm install
69
+
70
+ # Link for local testing
71
+ npm link
72
+
73
+ # Test your changes
74
+ pkg sync
75
+ pkg open
76
+ ```
77
+
78
+ ## Code Style
79
+
80
+ - Use **descriptive variable names**
81
+ - Add **comments** for complex logic
82
+ - Follow existing **code structure**
83
+ - Keep functions **focused and small**
84
+ - Use **async/await** over callbacks
85
+
86
+ ## Project Structure
87
+
88
+ ```
89
+ pkg-tracker/
90
+ ├── bin/
91
+ │ └── cli.js # Main CLI entry point
92
+ ├── src/
93
+ │ ├── banner.js # ASCII art banner
94
+ │ ├── db.js # SQLite database layer
95
+ │ ├── gmail.js # Gmail OAuth & sync
96
+ │ ├── open.js # Interactive package opener
97
+ │ ├── parser.js # Tracking number extraction
98
+ │ └── tracker.js # Manual package entry
99
+ ├── README.md
100
+ ├── QUICKSTART.md
101
+ └── package.json
102
+ ```
103
+
104
+ ## Adding a New Carrier
105
+
106
+ Want to add support for DHL, OnTrac, or another carrier?
107
+
108
+ 1. **Add regex pattern** in `src/parser.js`:
109
+ ```javascript
110
+ dhl: {
111
+ pattern: /\b(\d{10,11})\b/g,
112
+ carrier: 'DHL'
113
+ }
114
+ ```
115
+
116
+ 2. **Add validation** in `isValidTrackingNumber()`:
117
+ ```javascript
118
+ if (carrierKey === 'dhl') {
119
+ return number.length === 10 || number.length === 11;
120
+ }
121
+ ```
122
+
123
+ 3. **Add tracking URL** in `src/open.js`:
124
+ ```javascript
125
+ 'DHL': `https://www.dhl.com/track?tracking-id=${trackingNumber}`
126
+ ```
127
+
128
+ 4. **Update supported carriers** in all modules (open.js, tracker.js, db.js)
129
+
130
+ 5. **Test** with real tracking numbers
131
+
132
+ 6. **Update docs** (README.md)
133
+
134
+ ## Testing
135
+
136
+ Currently manual testing. We'd love help adding automated tests!
137
+
138
+ **Test checklist:**
139
+ - [ ] `pkg init` - OAuth flow works
140
+ - [ ] `pkg sync` - Finds packages in Gmail
141
+ - [ ] `pkg open` - Interactive menu works, opens browser
142
+ - [ ] `pkg add` - Manual entry with validation
143
+ - [ ] `pkg clean` - Package removal works
144
+ - [ ] Edge cases: no packages, invalid tracking numbers, no credentials
145
+
146
+ ## Questions?
147
+
148
+ - Open an issue with the "question" label
149
+ - Tag @vvanessaww in discussions
150
+
151
+ ## License
152
+
153
+ By contributing, you agree that your contributions will be licensed under the MIT License.
154
+
155
+ ---
156
+
157
+ **Thank you for contributing!** 🎉📦
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vanessa Wang
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/PUBLISH.md ADDED
@@ -0,0 +1,188 @@
1
+ # 📦 Publishing to npm - Step by Step Guide
2
+
3
+ ## ✅ Pre-publish Checklist (COMPLETED)
4
+
5
+ - ✅ Security audit passed
6
+ - ✅ `.npmignore` configured
7
+ - ✅ Secure file permissions
8
+ - ✅ Input validation
9
+ - ✅ Privacy documentation
10
+ - ✅ Package metadata complete
11
+ - ✅ LICENSE added (MIT)
12
+ - ✅ CHANGELOG.md created
13
+ - ✅ README polished with troubleshooting
14
+ - ✅ CONTRIBUTING.md added
15
+ - ✅ CODE_OF_CONDUCT.md added
16
+ - ✅ Tests written and passing (13/13)
17
+ - ✅ Global error handlers
18
+ - ✅ Dry run successful (20.5 KB package)
19
+ - ✅ Git tag v1.0.0 created
20
+
21
+ ## 🚀 Publishing Steps
22
+
23
+ ### Step 1: Create npm Account (if you don't have one)
24
+
25
+ 1. Go to https://www.npmjs.com/signup
26
+ 2. Create account with email/password
27
+ 3. Verify your email address
28
+
29
+ ### Step 2: Login to npm CLI
30
+
31
+ ```bash
32
+ npm login
33
+ ```
34
+
35
+ You'll be prompted for:
36
+ - Username
37
+ - Password
38
+ - Email (public)
39
+ - One-time password (if 2FA enabled)
40
+
41
+ **Verify you're logged in:**
42
+ ```bash
43
+ npm whoami
44
+ ```
45
+
46
+ ### Step 3: Check Package Name Availability
47
+
48
+ ```bash
49
+ npm search pkg-tracker
50
+ ```
51
+
52
+ If `pkg-tracker` is already taken, you have two options:
53
+ 1. Choose a different name (e.g., `package-tracker-cli`)
54
+ 2. Use a scoped package: `@yourusername/pkg-tracker`
55
+
56
+ **To use scoped package:**
57
+ Edit `package.json`:
58
+ ```json
59
+ {
60
+ "name": "@yourusername/pkg-tracker",
61
+ ...
62
+ }
63
+ ```
64
+
65
+ ### Step 4: Final Verification
66
+
67
+ **Test the package locally:**
68
+ ```bash
69
+ # Test from tarball
70
+ npm install -g ./pkg-tracker-1.0.0.tgz
71
+ pkg --version
72
+ pkg --help
73
+
74
+ # Uninstall test version
75
+ npm uninstall -g pkg-tracker
76
+ ```
77
+
78
+ **Run tests:**
79
+ ```bash
80
+ npm test
81
+ ```
82
+
83
+ ### Step 5: Publish to npm! 🎉
84
+
85
+ **For public package (FREE):**
86
+ ```bash
87
+ npm publish
88
+ ```
89
+
90
+ **For scoped package:**
91
+ ```bash
92
+ npm publish --access public
93
+ ```
94
+
95
+ ### Step 6: Verify Publication
96
+
97
+ 1. Visit: https://www.npmjs.com/package/pkg-tracker
98
+ 2. Check that README displays correctly
99
+ 3. Verify version is 1.0.0
100
+ 4. Test installation:
101
+ ```bash
102
+ npm install -g pkg-tracker
103
+ pkg --version
104
+ ```
105
+
106
+ ## 🎊 Post-Publication
107
+
108
+ ### Update README with npm badge
109
+
110
+ Add to top of README.md:
111
+ ```markdown
112
+ [![npm version](https://badge.fury.io/js/pkg-tracker.svg)](https://www.npmjs.com/package/pkg-tracker)
113
+ [![downloads](https://img.shields.io/npm/dm/pkg-tracker.svg)](https://www.npmjs.com/package/pkg-tracker)
114
+ ```
115
+
116
+ ### Announce it!
117
+
118
+ - Tweet about it
119
+ - Post on Reddit (r/node, r/javascript)
120
+ - Share on Hacker News
121
+ - LinkedIn post
122
+ - Add to your portfolio
123
+
124
+ ### Monitor
125
+
126
+ - Watch for issues on GitHub
127
+ - Check npm download stats
128
+ - Respond to user feedback
129
+
130
+ ## 🔄 Future Updates
131
+
132
+ When you make changes:
133
+
134
+ 1. Update code
135
+ 2. Update CHANGELOG.md
136
+ 3. Bump version in package.json:
137
+ ```bash
138
+ npm version patch # 1.0.0 -> 1.0.1 (bug fixes)
139
+ npm version minor # 1.0.0 -> 1.1.0 (new features)
140
+ npm version major # 1.0.0 -> 2.0.0 (breaking changes)
141
+ ```
142
+ 4. Push changes + tags:
143
+ ```bash
144
+ git push && git push --tags
145
+ ```
146
+ 5. Publish update:
147
+ ```bash
148
+ npm publish
149
+ ```
150
+
151
+ ## 🆘 Troubleshooting
152
+
153
+ ### "You do not have permission to publish"
154
+
155
+ - Check you're logged in: `npm whoami`
156
+ - Check package name isn't taken: `npm info pkg-tracker`
157
+ - Use scoped package if name is taken
158
+
159
+ ### "npm ERR! 403 Forbidden"
160
+
161
+ - Package name is taken - choose different name
162
+ - Or use scoped package: `@yourusername/pkg-tracker`
163
+
164
+ ### "npm ERR! need auth"
165
+
166
+ - Run `npm login` first
167
+ - Make sure you verified your email
168
+
169
+ ### Want to unpublish?
170
+
171
+ **Within 72 hours:**
172
+ ```bash
173
+ npm unpublish pkg-tracker@1.0.0
174
+ ```
175
+
176
+ **After 72 hours:**
177
+ - Can only deprecate: `npm deprecate pkg-tracker@1.0.0 "Message"`
178
+ - Contact npm support for removal
179
+
180
+ ## 📊 Package Stats
181
+
182
+ After publishing, track stats at:
183
+ - npm page: https://www.npmjs.com/package/pkg-tracker
184
+ - npm stats: https://npm-stat.com/charts.html?package=pkg-tracker
185
+
186
+ ---
187
+
188
+ **Good luck! 🚀📦**
package/QUICKSTART.md ADDED
@@ -0,0 +1,136 @@
1
+ # 📦 Quick Start Guide
2
+
3
+ Get up and running with pkg-tracker in 5 minutes!
4
+
5
+ ## Prerequisites
6
+
7
+ - Node.js 14+ ([Download here](https://nodejs.org/))
8
+ - Gmail account
9
+ - Google Cloud account (free tier)
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install -g pkg-tracker
15
+ ```
16
+
17
+ ## First Time Setup (5 minutes)
18
+
19
+ ### 1. Get Gmail API Credentials
20
+
21
+ **a) Create Google Cloud Project:**
22
+ 1. Visit https://console.cloud.google.com/
23
+ 2. Click "Select a project" → "New Project"
24
+ 3. Name it "pkg-tracker" → Create
25
+
26
+ **b) Enable Gmail API:**
27
+ 1. In the project, go to "APIs & Services" → "Library"
28
+ 2. Search for "Gmail API"
29
+ 3. Click it → Enable
30
+
31
+ **c) Create OAuth Credentials:**
32
+ 1. Go to "APIs & Services" → "Credentials"
33
+ 2. Click "Create Credentials" → "OAuth client ID"
34
+ 3. If prompted, configure OAuth consent screen:
35
+ - User Type: External
36
+ - App name: pkg-tracker
37
+ - User support email: your email
38
+ - Developer contact: your email
39
+ - Save
40
+ 4. Back to "Create OAuth client ID":
41
+ - Application type: **Desktop app**
42
+ - Name: pkg-tracker
43
+ - **Authorized redirect URIs**: Add `http://localhost:3000`
44
+ - Create
45
+ 5. Download the JSON file (click download icon)
46
+ 6. Save it as `~/.pkg-tracker/credentials.json`:
47
+ ```bash
48
+ mkdir -p ~/.pkg-tracker
49
+ mv ~/Downloads/client_secret_*.json ~/.pkg-tracker/credentials.json
50
+ ```
51
+
52
+ ### 2. Initialize pkg
53
+
54
+ ```bash
55
+ pkg init
56
+ ```
57
+
58
+ This will:
59
+ 1. Open your browser
60
+ 2. Ask you to authorize Gmail access (read-only)
61
+ 3. Automatically capture the authorization (no code to paste!)
62
+ 4. Save the token for future use
63
+
64
+ The browser will show a success page when done.
65
+
66
+ ### 3. Scan Your Email
67
+
68
+ ```bash
69
+ pkg sync
70
+ ```
71
+
72
+ This searches your last 30 days of email for shipping confirmations and extracts tracking numbers.
73
+
74
+ ### 4. Open Your Packages
75
+
76
+ ```bash
77
+ pkg open
78
+ ```
79
+
80
+ ## Daily Usage
81
+
82
+ ```bash
83
+ # Scan for new packages
84
+ pkg sync
85
+
86
+ # Open packages interactively (select and track in browser)
87
+ pkg open
88
+
89
+ # Manually add a tracking number (interactive)
90
+ pkg add 1Z999AA10123456784
91
+
92
+ # Remove old/delivered packages
93
+ pkg clean
94
+ ```
95
+
96
+ ## Troubleshooting
97
+
98
+ **"Gmail credentials not found"**
99
+ - Make sure `~/.pkg-tracker/credentials.json` exists
100
+ - Run `pkg init` again
101
+
102
+ **"No packages found"**
103
+ - Your emails might not match the search terms
104
+ - Try `pkg sync --days 90` to scan further back
105
+ - Check if you have shipping confirmation emails in Gmail
106
+
107
+ **"Invalid tracking number"**
108
+ - Not all carriers are supported yet
109
+ - Use `pkg add` to manually add if auto-detection fails
110
+
111
+ ## What Gets Scanned?
112
+
113
+ The tool searches for emails with these terms:
114
+ - "shipped"
115
+ - "tracking"
116
+ - "delivered"
117
+ - "out for delivery"
118
+ - "order confirmation"
119
+
120
+ From senders like:
121
+ - Amazon
122
+ - Target
123
+ - Walmart
124
+ - Etsy
125
+ - eBay
126
+ - Best Buy
127
+ - Nike
128
+ - Adidas
129
+ - And many more!
130
+
131
+ ## Privacy Note
132
+
133
+ - All data stays on your computer (`~/.pkg-tracker/`)
134
+ - Gmail token is read-only (can't send/delete emails)
135
+ - No external tracking APIs called (yet)
136
+ - No data sent to any server