huntr-cli 1.0.9
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/.env.example +7 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +43 -0
- package/.github/ISSUE_TEMPLATE/config.yml +8 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +29 -0
- package/.github/labels.json +92 -0
- package/.github/pull_request_template.md +64 -0
- package/.github/workflows/ci.yml +87 -0
- package/.github/workflows/labels.yml +27 -0
- package/.github/workflows/manual-publish.yml +105 -0
- package/.github/workflows/publish.yml +57 -0
- package/.github/workflows/release.yml +124 -0
- package/.github/workflows/security-audit.yml +44 -0
- package/.husky/pre-commit +12 -0
- package/.husky/pre-push +27 -0
- package/.lintstagedrc.json +3 -0
- package/AGENTS.md +449 -0
- package/CHANGELOG.md +38 -0
- package/CHANGES.md +259 -0
- package/LICENSE +15 -0
- package/PUBLISHING.md +191 -0
- package/README.md +385 -0
- package/ROADMAP.md +158 -0
- package/SETUP-COMPLETE.md +446 -0
- package/WORKFLOW-SUMMARY.md +368 -0
- package/completions/_huntr +168 -0
- package/completions/huntr.1 +266 -0
- package/completions/huntr.bash +91 -0
- package/dist/api/client.d.ts +14 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +74 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/personal/activities.d.ts +20 -0
- package/dist/api/personal/activities.d.ts.map +1 -0
- package/dist/api/personal/activities.js +50 -0
- package/dist/api/personal/activities.js.map +1 -0
- package/dist/api/personal/boards.d.ts +9 -0
- package/dist/api/personal/boards.d.ts.map +1 -0
- package/dist/api/personal/boards.js +16 -0
- package/dist/api/personal/boards.js.map +1 -0
- package/dist/api/personal/index.d.ts +17 -0
- package/dist/api/personal/index.d.ts.map +1 -0
- package/dist/api/personal/index.js +37 -0
- package/dist/api/personal/index.js.map +1 -0
- package/dist/api/personal/jobs.d.ts +13 -0
- package/dist/api/personal/jobs.d.ts.map +1 -0
- package/dist/api/personal/jobs.js +31 -0
- package/dist/api/personal/jobs.js.map +1 -0
- package/dist/api/personal/user.d.ts +8 -0
- package/dist/api/personal/user.d.ts.map +1 -0
- package/dist/api/personal/user.js +13 -0
- package/dist/api/personal/user.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +501 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/capture-session.d.ts +10 -0
- package/dist/commands/capture-session.d.ts.map +1 -0
- package/dist/commands/capture-session.js +478 -0
- package/dist/commands/capture-session.js.map +1 -0
- package/dist/config/clerk-session-manager.d.ts +44 -0
- package/dist/config/clerk-session-manager.d.ts.map +1 -0
- package/dist/config/clerk-session-manager.js +232 -0
- package/dist/config/clerk-session-manager.js.map +1 -0
- package/dist/config/config-manager.d.ts +15 -0
- package/dist/config/config-manager.d.ts.map +1 -0
- package/dist/config/config-manager.js +51 -0
- package/dist/config/config-manager.js.map +1 -0
- package/dist/config/keychain-manager.d.ts +6 -0
- package/dist/config/keychain-manager.d.ts.map +1 -0
- package/dist/config/keychain-manager.js +37 -0
- package/dist/config/keychain-manager.js.map +1 -0
- package/dist/config/token-capture.d.ts +11 -0
- package/dist/config/token-capture.d.ts.map +1 -0
- package/dist/config/token-capture.js +252 -0
- package/dist/config/token-capture.js.map +1 -0
- package/dist/config/token-manager.d.ts +38 -0
- package/dist/config/token-manager.d.ts.map +1 -0
- package/dist/config/token-manager.js +153 -0
- package/dist/config/token-manager.js.map +1 -0
- package/dist/lib/list-options.d.ts +69 -0
- package/dist/lib/list-options.d.ts.map +1 -0
- package/dist/lib/list-options.js +299 -0
- package/dist/lib/list-options.js.map +1 -0
- package/dist/types/personal.d.ts +113 -0
- package/dist/types/personal.d.ts.map +1 -0
- package/dist/types/personal.js +4 -0
- package/dist/types/personal.js.map +1 -0
- package/docs/AUTOMATIC-PUBLISHING.md +520 -0
- package/docs/CHANGELOG-AUTOMATION.md +418 -0
- package/docs/CI-CD-SETUP.md +582 -0
- package/docs/DEV-SETUP.md +512 -0
- package/docs/ENHANCEMENT-PLAN.md +204 -0
- package/docs/ENTITY-TYPES.md +462 -0
- package/docs/GITHUB-ACTIONS-GUIDE.md +367 -0
- package/docs/NPM-PUBLISHING.md +324 -0
- package/docs/OUTPUT-EXAMPLES.md +414 -0
- package/docs/OUTPUT-FORMATS.md +299 -0
- package/docs/TESTING.md +216 -0
- package/eslint.config.js +68 -0
- package/package.json +64 -0
- package/src/api/client.ts +88 -0
- package/src/api/personal/activities.ts +66 -0
- package/src/api/personal/boards.ts +14 -0
- package/src/api/personal/index.ts +25 -0
- package/src/api/personal/jobs.ts +33 -0
- package/src/api/personal/user.ts +10 -0
- package/src/cli.ts +487 -0
- package/src/commands/capture-session.ts +582 -0
- package/src/config/clerk-session-manager.ts +263 -0
- package/src/config/config-manager.ts +56 -0
- package/src/config/keychain-manager.ts +30 -0
- package/src/config/token-capture.ts +233 -0
- package/src/config/token-manager.ts +139 -0
- package/src/lib/list-options.ts +370 -0
- package/src/types/personal.ts +114 -0
- package/tests/example.test.ts +130 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
# Development Setup Guide
|
|
2
|
+
|
|
3
|
+
Complete guide for setting up huntr-cli for local development with all tools configured.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### 1. Clone Repository
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
git clone https://github.com/mattmck/huntr-cli.git
|
|
11
|
+
cd huntr-cli
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### 2. Install Dependencies
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install
|
|
18
|
+
# Automatically:
|
|
19
|
+
# - Installs all npm packages
|
|
20
|
+
# - Runs "prepare" script to setup git hooks with husky
|
|
21
|
+
# - Configures pre-commit and pre-push hooks
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 3. Verify Setup
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm run build # Should compile with no errors
|
|
28
|
+
npm run lint # Should pass (warnings ok)
|
|
29
|
+
npm run typecheck # Should pass
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Available Commands
|
|
35
|
+
|
|
36
|
+
### Development
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm run dev -- me # Run CLI in dev mode
|
|
40
|
+
npm run dev -- boards list # List boards
|
|
41
|
+
npm run dev -- activities list <id> # List activities
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Building & Testing
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm run build # Compile TypeScript to dist/
|
|
48
|
+
npm run typecheck # Check TypeScript types (no emit)
|
|
49
|
+
npm run lint # Check code style (errors only)
|
|
50
|
+
npm run lint:fix # Auto-fix style issues
|
|
51
|
+
npm test # Run tests (currently none)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Git Hooks
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# These run automatically
|
|
58
|
+
npm run prepare # Install git hooks manually
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Git Workflow
|
|
64
|
+
|
|
65
|
+
### Create Feature Branch
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
git checkout -b feat/new-feature
|
|
69
|
+
# or
|
|
70
|
+
git checkout -b fix/bug-fix
|
|
71
|
+
git checkout -b docs/update-readme
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Make Changes
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Edit files
|
|
78
|
+
nano src/cli.ts
|
|
79
|
+
|
|
80
|
+
# Check style (pre-commit will do this too)
|
|
81
|
+
npm run lint:fix
|
|
82
|
+
|
|
83
|
+
# Test locally
|
|
84
|
+
npm run dev -- boards list
|
|
85
|
+
|
|
86
|
+
# Build and typecheck
|
|
87
|
+
npm run build
|
|
88
|
+
npm run typecheck
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Commit Changes
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Stage files
|
|
95
|
+
git add src/
|
|
96
|
+
|
|
97
|
+
# Commit with conventional message
|
|
98
|
+
git commit -m "feat: add new feature"
|
|
99
|
+
|
|
100
|
+
# ⚠️ Pre-commit hook runs here:
|
|
101
|
+
# - Lints staged files
|
|
102
|
+
# - Blocks commit if errors found
|
|
103
|
+
# - Auto-fixes some issues
|
|
104
|
+
|
|
105
|
+
# If hook fails, fix errors and retry
|
|
106
|
+
git add .
|
|
107
|
+
git commit -m "feat: add new feature"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Push to Remote
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
git push origin feat/new-feature
|
|
114
|
+
|
|
115
|
+
# ⚠️ Pre-push hook runs here:
|
|
116
|
+
# - Typecheck
|
|
117
|
+
# - Lint all files
|
|
118
|
+
# - Build
|
|
119
|
+
# - Blocks push if any fail
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Create Pull Request
|
|
123
|
+
|
|
124
|
+
1. Go to GitHub repository
|
|
125
|
+
2. Click "Create Pull Request"
|
|
126
|
+
3. Fill in title and description
|
|
127
|
+
4. Create PR
|
|
128
|
+
|
|
129
|
+
### Wait for CI
|
|
130
|
+
|
|
131
|
+
- GitHub Actions runs automatically
|
|
132
|
+
- Check `Actions` tab for status
|
|
133
|
+
- All jobs must pass (green checkmarks)
|
|
134
|
+
- Cannot merge if CI fails
|
|
135
|
+
|
|
136
|
+
### Merge to Main
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Via GitHub UI (Squash merge recommended)
|
|
140
|
+
# OR locally:
|
|
141
|
+
git checkout main
|
|
142
|
+
git pull origin main
|
|
143
|
+
git merge feat/new-feature
|
|
144
|
+
git push origin main
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Pre-commit Hook Details
|
|
150
|
+
|
|
151
|
+
**What it does:** Lints only the files you're committing
|
|
152
|
+
|
|
153
|
+
**When:** Before `git commit` succeeds
|
|
154
|
+
|
|
155
|
+
**Behavior:**
|
|
156
|
+
- ✅ Runs ESLint on staged `.ts` files
|
|
157
|
+
- ✅ Auto-fixes fixable issues
|
|
158
|
+
- ✅ Stages fixed files
|
|
159
|
+
- ❌ Blocks commit if non-fixable errors found
|
|
160
|
+
|
|
161
|
+
**Example:**
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
$ git commit -m "feat: add feature"
|
|
165
|
+
|
|
166
|
+
🔍 Running pre-commit checks...
|
|
167
|
+
✓ src/cli.ts (fixed 2 issues)
|
|
168
|
+
✓ Pre-commit checks passed
|
|
169
|
+
|
|
170
|
+
[feat/new-feature abc1234] feat: add feature
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**If it fails:**
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
$ git commit -m "feat: add feature"
|
|
177
|
+
|
|
178
|
+
🔍 Running pre-commit checks...
|
|
179
|
+
✗ src/lib/list-options.ts
|
|
180
|
+
error: Missing trailing comma (comma-dangle)
|
|
181
|
+
error: Unexpected any type (no-explicit-any)
|
|
182
|
+
❌ Linting failed. Please fix errors and try again.
|
|
183
|
+
|
|
184
|
+
# Fix errors
|
|
185
|
+
vim src/lib/list-options.ts
|
|
186
|
+
|
|
187
|
+
# Re-stage and retry
|
|
188
|
+
git add .
|
|
189
|
+
git commit -m "feat: add feature"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Manual linting:**
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
npm run lint # Check all files
|
|
196
|
+
npm run lint:fix # Auto-fix issues
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Pre-push Hook Details
|
|
202
|
+
|
|
203
|
+
**What it does:** Comprehensive checks before pushing
|
|
204
|
+
|
|
205
|
+
**When:** Before `git push` succeeds
|
|
206
|
+
|
|
207
|
+
**Checks (in order):**
|
|
208
|
+
1. TypeScript compilation (`npm run typecheck`)
|
|
209
|
+
2. ESLint all files (`npm run lint`)
|
|
210
|
+
3. Build to dist/ (`npm run build`)
|
|
211
|
+
|
|
212
|
+
**Example:**
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
$ git push origin feat/new-feature
|
|
216
|
+
|
|
217
|
+
🧪 Running pre-push checks...
|
|
218
|
+
📋 Typechecking...
|
|
219
|
+
✓ No TypeScript errors
|
|
220
|
+
🔍 Linting all source files...
|
|
221
|
+
✓ Lint passed
|
|
222
|
+
🔨 Building...
|
|
223
|
+
✓ Build successful
|
|
224
|
+
✓ All pre-push checks passed
|
|
225
|
+
|
|
226
|
+
Counting objects: 3, done.
|
|
227
|
+
Writing objects: 100% (3/3), 287 bytes | 287.00 KiB/s, done.
|
|
228
|
+
Total 3 (delta 0), reused 0 (delta 0)
|
|
229
|
+
To github.com:mattmck/huntr-cli.git
|
|
230
|
+
abc1234..def5678 feat/new-feature -> feat/new-feature
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**If it fails:**
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
$ git push origin feat/new-feature
|
|
237
|
+
|
|
238
|
+
🧪 Running pre-push checks...
|
|
239
|
+
📋 Typechecking...
|
|
240
|
+
❌ TypeScript errors found
|
|
241
|
+
|
|
242
|
+
# Fix issues locally
|
|
243
|
+
npm run typecheck # See what's wrong
|
|
244
|
+
# Edit files to fix
|
|
245
|
+
npm run build
|
|
246
|
+
npm run lint
|
|
247
|
+
|
|
248
|
+
# Retry push
|
|
249
|
+
git push origin feat/new-feature
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## ESLint Configuration
|
|
255
|
+
|
|
256
|
+
**File:** `eslint.config.js` (modern flat config)
|
|
257
|
+
|
|
258
|
+
**What's checked:**
|
|
259
|
+
- TypeScript type safety
|
|
260
|
+
- Code style (quotes, semicolons, trailing commas)
|
|
261
|
+
- Unused variables
|
|
262
|
+
- Unneeded assignments
|
|
263
|
+
- No console.log in production (warning)
|
|
264
|
+
|
|
265
|
+
**Fix style issues:**
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
npm run lint:fix
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**Common issues:**
|
|
272
|
+
- Missing trailing commas in objects/arrays
|
|
273
|
+
- Wrong quote style (should be single quotes)
|
|
274
|
+
- Missing semicolons
|
|
275
|
+
|
|
276
|
+
All can be auto-fixed with `npm run lint:fix`.
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## Debugging
|
|
281
|
+
|
|
282
|
+
### Run CLI with Debug Output
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
DEBUG=* npm run dev -- boards list
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Check Node Version
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
node --version
|
|
292
|
+
# Should be 18+
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Clear Cache & Reinstall
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
rm -rf node_modules package-lock.json
|
|
299
|
+
npm install
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Bypass Hooks (Emergency Only)
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
# Skip pre-commit
|
|
306
|
+
git commit --no-verify
|
|
307
|
+
|
|
308
|
+
# Skip pre-push
|
|
309
|
+
git push --no-verify
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
**⚠️ Not recommended:** These should only be used in emergencies. Better to fix the issue!
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Project Structure
|
|
317
|
+
|
|
318
|
+
```
|
|
319
|
+
huntr-cli/
|
|
320
|
+
├── src/
|
|
321
|
+
│ ├── cli.ts # Main CLI entry point
|
|
322
|
+
│ ├── types/ # Type definitions
|
|
323
|
+
│ ├── api/ # API clients
|
|
324
|
+
│ ├── config/ # Configuration management
|
|
325
|
+
│ ├── commands/ # CLI commands
|
|
326
|
+
│ └── lib/ # Shared utilities
|
|
327
|
+
├── dist/ # Compiled output (git ignored)
|
|
328
|
+
├── .github/
|
|
329
|
+
│ └── workflows/ # GitHub Actions
|
|
330
|
+
├── .husky/ # Git hooks
|
|
331
|
+
├── completions/ # Shell completions
|
|
332
|
+
├── docs/ # Documentation
|
|
333
|
+
├── eslint.config.js # ESLint configuration
|
|
334
|
+
├── tsconfig.json # TypeScript configuration
|
|
335
|
+
├── package.json # Dependencies & scripts
|
|
336
|
+
└── README.md # Project README
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## Conventional Commits
|
|
342
|
+
|
|
343
|
+
Follow this format for commit messages:
|
|
344
|
+
|
|
345
|
+
```
|
|
346
|
+
type: subject
|
|
347
|
+
|
|
348
|
+
body (optional)
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
**Types:**
|
|
352
|
+
- `feat:` — New feature
|
|
353
|
+
- `fix:` — Bug fix
|
|
354
|
+
- `docs:` — Documentation only
|
|
355
|
+
- `chore:` — Build tools, dependencies
|
|
356
|
+
- `refactor:` — Code restructuring
|
|
357
|
+
- `test:` — Test-related changes
|
|
358
|
+
- `perf:` — Performance improvements
|
|
359
|
+
|
|
360
|
+
**Examples:**
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
git commit -m "feat: add field selection to list commands"
|
|
364
|
+
git commit -m "fix: handle missing company in activities"
|
|
365
|
+
git commit -m "docs: add CI/CD setup guide"
|
|
366
|
+
git commit -m "chore: update dependencies"
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## Tips & Tricks
|
|
372
|
+
|
|
373
|
+
### Quick Lint & Build
|
|
374
|
+
|
|
375
|
+
```bash
|
|
376
|
+
npm run lint:fix && npm run build && npm run typecheck
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### Test Changes Before Commit
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
npm run dev -- <your-command>
|
|
383
|
+
npm run build
|
|
384
|
+
npm run typecheck
|
|
385
|
+
npm run lint
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### View What Will Be Committed
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
git diff --cached
|
|
392
|
+
git status
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### Undo Last Commit (Keep Changes)
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
git reset --soft HEAD~1
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### Check Git Hooks Status
|
|
402
|
+
|
|
403
|
+
```bash
|
|
404
|
+
ls -la .husky/
|
|
405
|
+
# Should show pre-commit and pre-push
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### Reinstall Hooks
|
|
409
|
+
|
|
410
|
+
```bash
|
|
411
|
+
npm run prepare
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
## Troubleshooting
|
|
417
|
+
|
|
418
|
+
### "Hooks not running"
|
|
419
|
+
|
|
420
|
+
**Solution:**
|
|
421
|
+
```bash
|
|
422
|
+
npm run prepare
|
|
423
|
+
chmod +x .husky/pre-commit .husky/pre-push
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### "Module not found" errors
|
|
427
|
+
|
|
428
|
+
**Solution:**
|
|
429
|
+
```bash
|
|
430
|
+
npm install
|
|
431
|
+
npm run build
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
### "TypeScript errors"
|
|
435
|
+
|
|
436
|
+
**Solution:**
|
|
437
|
+
```bash
|
|
438
|
+
npm run typecheck
|
|
439
|
+
# Read errors and fix
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### "ESLint errors"
|
|
443
|
+
|
|
444
|
+
**Solution:**
|
|
445
|
+
```bash
|
|
446
|
+
npm run lint # See issues
|
|
447
|
+
npm run lint:fix # Auto-fix
|
|
448
|
+
git add .
|
|
449
|
+
git commit -m "..."
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### "Build fails"
|
|
453
|
+
|
|
454
|
+
**Solution:**
|
|
455
|
+
```bash
|
|
456
|
+
npm run build 2>&1 | head -20
|
|
457
|
+
# Read error, fix issue
|
|
458
|
+
npm run build
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
## Next Steps
|
|
464
|
+
|
|
465
|
+
1. **Clone & install:** `git clone ... && npm install`
|
|
466
|
+
2. **Verify setup:** `npm run build && npm run lint && npm run typecheck`
|
|
467
|
+
3. **Try a change:** Edit `src/cli.ts`, run `npm run dev`, commit, push
|
|
468
|
+
4. **Check hooks:** Notice pre-commit and pre-push running
|
|
469
|
+
5. **Read docs:** See `docs/` for detailed information
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
## Documentation Index
|
|
474
|
+
|
|
475
|
+
- **CI/CD Setup:** `docs/CI-CD-SETUP.md`
|
|
476
|
+
- **GitHub Actions:** `docs/GITHUB-ACTIONS-GUIDE.md`
|
|
477
|
+
- **Output Formats:** `docs/OUTPUT-FORMATS.md`
|
|
478
|
+
- **Output Examples:** `docs/OUTPUT-EXAMPLES.md`
|
|
479
|
+
- **npm Publishing:** `docs/NPM-PUBLISHING.md`
|
|
480
|
+
- **Enhancement Plan:** `docs/ENHANCEMENT-PLAN.md`
|
|
481
|
+
|
|
482
|
+
---
|
|
483
|
+
|
|
484
|
+
## Quick Commands Reference
|
|
485
|
+
|
|
486
|
+
```bash
|
|
487
|
+
# Development
|
|
488
|
+
npm run dev -- <command> # Run CLI in dev mode
|
|
489
|
+
npm run dev -- --help # See all commands
|
|
490
|
+
|
|
491
|
+
# Quality
|
|
492
|
+
npm run lint # Check code style
|
|
493
|
+
npm run lint:fix # Fix style issues
|
|
494
|
+
npm run typecheck # Check TypeScript
|
|
495
|
+
npm run build # Build project
|
|
496
|
+
npm test # Run tests
|
|
497
|
+
|
|
498
|
+
# Git (automatic with hooks)
|
|
499
|
+
git add . # Stage changes
|
|
500
|
+
git commit -m "type: message" # Triggers pre-commit hook
|
|
501
|
+
git push origin branch # Triggers pre-push hook
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
---
|
|
505
|
+
|
|
506
|
+
## Support
|
|
507
|
+
|
|
508
|
+
- **Lint issues?** Run `npm run lint:fix`
|
|
509
|
+
- **Type errors?** Run `npm run typecheck` to see details
|
|
510
|
+
- **Build failing?** Run `npm run build` for error details
|
|
511
|
+
- **Git hooks?** See `docs/CI-CD-SETUP.md`
|
|
512
|
+
- **Publishing?** See `docs/NPM-PUBLISHING.md`
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Output Format Enhancements — Implementation Plan
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This document outlines the implementation plan for:
|
|
6
|
+
1. `--fields` parameter for field selection
|
|
7
|
+
2. PDF output format
|
|
8
|
+
3. Excel output format
|
|
9
|
+
4. Enhanced output validation
|
|
10
|
+
|
|
11
|
+
## Changes to list-options.ts
|
|
12
|
+
|
|
13
|
+
### Type Updates
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
export interface ListOptions {
|
|
17
|
+
format: OutputFormat;
|
|
18
|
+
days?: number;
|
|
19
|
+
types?: string[];
|
|
20
|
+
fields?: string[]; // NEW: selected fields
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type OutputFormat = 'table' | 'json' | 'csv' | 'pdf' | 'excel'; // UPDATED
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### New Functions
|
|
27
|
+
|
|
28
|
+
1. **`validateFields(availableFields: string[], requestedFields?: string[]): string[]`**
|
|
29
|
+
- Validates that requested fields exist in available set
|
|
30
|
+
- Returns requested fields if valid, or all available fields if none specified
|
|
31
|
+
- Throws error with helpful message if invalid
|
|
32
|
+
|
|
33
|
+
2. **`formatPdf<T>(rows: T[], headers: string[], title?: string): Buffer`**
|
|
34
|
+
- Generates PDF with professional formatting
|
|
35
|
+
- Includes headers, borders, auto-sized columns
|
|
36
|
+
- Uses `pdfkit` library
|
|
37
|
+
|
|
38
|
+
3. **`formatExcel<T>(rows: T[], headers: string[], title?: string): Buffer`**
|
|
39
|
+
- Generates Excel workbook
|
|
40
|
+
- Includes headers with formatting
|
|
41
|
+
- Auto-adjusted column widths
|
|
42
|
+
- Uses `exceljs` library
|
|
43
|
+
|
|
44
|
+
### Parser Update
|
|
45
|
+
|
|
46
|
+
Update `parseListOptions()` to:
|
|
47
|
+
- Accept and validate `fields` parameter
|
|
48
|
+
- Provide it in returned `ListOptions` object
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## CLI Updates
|
|
53
|
+
|
|
54
|
+
### Package Dependencies
|
|
55
|
+
|
|
56
|
+
Add to `package.json`:
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"pdfkit": "^0.13.0",
|
|
60
|
+
"exceljs": "^4.4.0"
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Command Updates
|
|
65
|
+
|
|
66
|
+
Each list command (`boards list`, `jobs list`, `activities list`):
|
|
67
|
+
|
|
68
|
+
1. Add option:
|
|
69
|
+
```typescript
|
|
70
|
+
.option('--fields <fields>', 'Comma-separated list of fields to include')
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
2. Define `AVAILABLE_FIELDS` for each entity:
|
|
74
|
+
```typescript
|
|
75
|
+
const AVAILABLE_FIELDS = ['ID', 'Name', 'Created'];
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
3. Call helper to validate:
|
|
79
|
+
```typescript
|
|
80
|
+
const validFields = validateFields(AVAILABLE_FIELDS, listOpts.fields);
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
4. Handle PDF/Excel formats:
|
|
84
|
+
```typescript
|
|
85
|
+
if (listOpts.format === 'pdf') {
|
|
86
|
+
const buffer = formatPdf(rows, validFields, 'Boards List');
|
|
87
|
+
process.stdout.write(buffer);
|
|
88
|
+
} else if (listOpts.format === 'excel') {
|
|
89
|
+
const buffer = formatExcel(rows, validFields, 'Boards List');
|
|
90
|
+
process.stdout.write(buffer);
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Field Definitions by Command
|
|
97
|
+
|
|
98
|
+
### `boards list`
|
|
99
|
+
- Available: ID, Name, Created
|
|
100
|
+
- Default (no `--fields`): ID, Name, Created
|
|
101
|
+
|
|
102
|
+
### `jobs list`
|
|
103
|
+
- Available: ID, Title, URL, Created, Company (if available), Location (if available)
|
|
104
|
+
- Default: ID, Title, URL, Created
|
|
105
|
+
|
|
106
|
+
### `activities list`
|
|
107
|
+
- Available: Date, Type, Company, Job, Status, JobID, CompanyID (raw IDs)
|
|
108
|
+
- Default: Date, Type, Company, Job, Status
|
|
109
|
+
|
|
110
|
+
### `me`
|
|
111
|
+
- Not applicable (no format parameter)
|
|
112
|
+
|
|
113
|
+
### `boards get`, `jobs get`
|
|
114
|
+
- Not applicable (no format parameter, singular entity)
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Error Handling
|
|
119
|
+
|
|
120
|
+
Invalid field example:
|
|
121
|
+
```bash
|
|
122
|
+
$ huntr boards list --fields ID,InvalidField
|
|
123
|
+
Error: Unknown field 'InvalidField'
|
|
124
|
+
Available fields: ID, Name, Created
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Invalid format example:
|
|
128
|
+
```bash
|
|
129
|
+
$ huntr boards list --format doc
|
|
130
|
+
Error: Invalid format: doc. Must be table, json, csv, pdf, or excel.
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Testing Strategy
|
|
136
|
+
|
|
137
|
+
1. **Field Validation**
|
|
138
|
+
- Valid field selection
|
|
139
|
+
- Invalid field selection (error)
|
|
140
|
+
- No `--fields` parameter (all fields)
|
|
141
|
+
|
|
142
|
+
2. **Format Output**
|
|
143
|
+
- PDF generation and binary integrity
|
|
144
|
+
- Excel generation and spreadsheet validity
|
|
145
|
+
- CSV escaping still works
|
|
146
|
+
- Table formatting preserved
|
|
147
|
+
|
|
148
|
+
3. **Round-trip Testing**
|
|
149
|
+
- CSV → Excel conversion
|
|
150
|
+
- CSV → PDF conversion
|
|
151
|
+
- Field selection works across all formats
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Rollout Plan
|
|
156
|
+
|
|
157
|
+
### Phase 1: Foundation
|
|
158
|
+
- [ ] Update `list-options.ts` with types and validation
|
|
159
|
+
- [ ] Add `validateFields()` utility
|
|
160
|
+
- [ ] Install dependencies: pdfkit, exceljs
|
|
161
|
+
|
|
162
|
+
### Phase 2: Field Selection
|
|
163
|
+
- [ ] Update all commands to support `--fields` parameter
|
|
164
|
+
- [ ] Test field validation across all commands
|
|
165
|
+
|
|
166
|
+
### Phase 3: PDF Format
|
|
167
|
+
- [ ] Implement `formatPdf()` in list-options.ts
|
|
168
|
+
- [ ] Test PDF output for each command
|
|
169
|
+
- [ ] Update completions for `--format pdf`
|
|
170
|
+
|
|
171
|
+
### Phase 4: Excel Format
|
|
172
|
+
- [ ] Implement `formatExcel()` in list-options.ts
|
|
173
|
+
- [ ] Test Excel output for each command
|
|
174
|
+
- [ ] Update completions for `--format excel`
|
|
175
|
+
|
|
176
|
+
### Phase 5: Documentation
|
|
177
|
+
- [ ] Update OUTPUT-FORMATS.md with examples
|
|
178
|
+
- [ ] Update README.md with new options
|
|
179
|
+
- [ ] Update bash/zsh completions
|
|
180
|
+
- [ ] Add examples to help text
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Library Selection Rationale
|
|
185
|
+
|
|
186
|
+
### pdfkit vs alternatives
|
|
187
|
+
- **pdfkit**: Pure Node.js, no native dependencies, good for CLI
|
|
188
|
+
- **puppeteer**: Overkill, requires headless browser
|
|
189
|
+
- **pdf-lib**: Good but pdfkit more feature-complete for tables
|
|
190
|
+
|
|
191
|
+
### exceljs vs alternatives
|
|
192
|
+
- **exceljs**: Pure JavaScript, supports streaming, professional features
|
|
193
|
+
- **xlsx**: Simpler but less control over formatting
|
|
194
|
+
- **node-xlsx**: Minimal, but exceljs more actively maintained
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Backward Compatibility
|
|
199
|
+
|
|
200
|
+
All changes are backward compatible:
|
|
201
|
+
- Existing commands work without `--fields` parameter
|
|
202
|
+
- Existing formats (table, json, csv) unchanged
|
|
203
|
+
- Default behavior unchanged
|
|
204
|
+
- No breaking changes to API
|