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,367 @@
|
|
|
1
|
+
# GitHub Actions Workflows Guide
|
|
2
|
+
|
|
3
|
+
Quick reference for all GitHub Actions workflows in this project.
|
|
4
|
+
|
|
5
|
+
## Summary
|
|
6
|
+
|
|
7
|
+
| Workflow | Trigger | Purpose | Status |
|
|
8
|
+
|----------|---------|---------|--------|
|
|
9
|
+
| **CI** | Push, PR | Lint, typecheck, build, test | Always runs |
|
|
10
|
+
| **Publish** | Release created | Auto-publish to npm | Production |
|
|
11
|
+
| **Manual Publish** | Manual dispatch | On-demand publish with version | Optional |
|
|
12
|
+
| **Security Audit** | Daily, push, manual | Check dependencies | Monitoring |
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Workflow Details
|
|
17
|
+
|
|
18
|
+
### CI Workflow (`.github/workflows/ci.yml`)
|
|
19
|
+
|
|
20
|
+
**Runs on:** Every push to `main`/`develop`, every PR
|
|
21
|
+
|
|
22
|
+
**Jobs:**
|
|
23
|
+
- `lint` — ESLint all TypeScript files
|
|
24
|
+
- `typecheck` — TypeScript compilation check
|
|
25
|
+
- `build` — Build to dist/
|
|
26
|
+
- `test` — Run tests
|
|
27
|
+
|
|
28
|
+
**Status:** ✅ Passing all checks
|
|
29
|
+
|
|
30
|
+
**View logs:** `Actions` → workflow run → job → step
|
|
31
|
+
|
|
32
|
+
**What to do if it fails:**
|
|
33
|
+
1. Click the failed job in Actions tab
|
|
34
|
+
2. Read error message
|
|
35
|
+
3. Fix locally: `npm run lint:fix`, `npm run typecheck`, `npm run build`
|
|
36
|
+
4. Commit and push fix
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
### Publish Workflow (`.github/workflows/publish.yml`)
|
|
41
|
+
|
|
42
|
+
**Runs on:** GitHub Release published
|
|
43
|
+
|
|
44
|
+
**How to trigger:**
|
|
45
|
+
```bash
|
|
46
|
+
# 1. Tag and push
|
|
47
|
+
git tag v1.1.0
|
|
48
|
+
git push origin v1.1.0
|
|
49
|
+
|
|
50
|
+
# 2. Create release (GitHub CLI)
|
|
51
|
+
gh release create v1.1.0 --generate-notes
|
|
52
|
+
|
|
53
|
+
# OR create in GitHub UI:
|
|
54
|
+
# Releases → Create new release → select tag → Publish
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**What it does:**
|
|
58
|
+
1. Checks out code
|
|
59
|
+
2. Installs dependencies
|
|
60
|
+
3. Runs lint, typecheck, build
|
|
61
|
+
4. **Publishes to npm** with NPM_TOKEN
|
|
62
|
+
5. Comments on release with result
|
|
63
|
+
|
|
64
|
+
**Requirements:**
|
|
65
|
+
- `NPM_TOKEN` secret configured
|
|
66
|
+
|
|
67
|
+
**View logs:** `Actions` → `Publish to npm` → run
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
### Manual Publish Workflow (`.github/workflows/manual-publish.yml`)
|
|
72
|
+
|
|
73
|
+
**Runs on:** Manual trigger via GitHub UI
|
|
74
|
+
|
|
75
|
+
**How to trigger:**
|
|
76
|
+
1. Go to GitHub repo
|
|
77
|
+
2. `Actions` tab
|
|
78
|
+
3. `Manual Publish` workflow (left sidebar)
|
|
79
|
+
4. Click `Run workflow`
|
|
80
|
+
5. Enter version (e.g., `1.1.0-beta.1`)
|
|
81
|
+
6. Select npm tag (`latest`, `beta`, `rc`)
|
|
82
|
+
7. Click `Run workflow`
|
|
83
|
+
|
|
84
|
+
**What it does:**
|
|
85
|
+
1. Validates version format
|
|
86
|
+
2. Updates package.json
|
|
87
|
+
3. Runs full CI pipeline
|
|
88
|
+
4. Publishes to npm
|
|
89
|
+
5. Creates git tag and GitHub Release
|
|
90
|
+
6. (Optional) Posts to Slack
|
|
91
|
+
|
|
92
|
+
**Use cases:**
|
|
93
|
+
- Publishing pre-releases (beta, RC)
|
|
94
|
+
- Emergency patches
|
|
95
|
+
- Skipping GitHub Release step
|
|
96
|
+
|
|
97
|
+
**Requirements:**
|
|
98
|
+
- `NPM_TOKEN` secret
|
|
99
|
+
- `SLACK_WEBHOOK_URL` (optional)
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### Security Audit Workflow (`.github/workflows/security-audit.yml`)
|
|
104
|
+
|
|
105
|
+
**Runs on:**
|
|
106
|
+
- Daily at midnight UTC
|
|
107
|
+
- Every push to main/develop
|
|
108
|
+
- Manual via Actions tab
|
|
109
|
+
|
|
110
|
+
**What it does:**
|
|
111
|
+
- Installs dependencies
|
|
112
|
+
- Runs `npm audit` (moderate+ severity)
|
|
113
|
+
- Uploads report as artifact
|
|
114
|
+
|
|
115
|
+
**View report:**
|
|
116
|
+
1. `Actions` → `Security Audit` → latest run
|
|
117
|
+
2. Download artifacts
|
|
118
|
+
3. Review audit-report.json
|
|
119
|
+
|
|
120
|
+
**What to do if vulnerabilities found:**
|
|
121
|
+
```bash
|
|
122
|
+
npm audit
|
|
123
|
+
npm audit fix
|
|
124
|
+
git add package-lock.json
|
|
125
|
+
git commit -m "chore: fix security vulnerabilities"
|
|
126
|
+
git push
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Setup Checklist
|
|
132
|
+
|
|
133
|
+
### First Time Setup
|
|
134
|
+
|
|
135
|
+
- [ ] Clone repo: `git clone https://github.com/mattmck/huntr-cli.git`
|
|
136
|
+
- [ ] Install dependencies: `npm install` (hooks auto-setup)
|
|
137
|
+
- [ ] Configure `NPM_TOKEN` secret in GitHub
|
|
138
|
+
- [ ] (Optional) Configure `SLACK_WEBHOOK_URL` secret
|
|
139
|
+
|
|
140
|
+
### NPM Token Setup
|
|
141
|
+
|
|
142
|
+
1. Go to [npmjs.com](https://npmjs.com)
|
|
143
|
+
2. Profile → Access Tokens
|
|
144
|
+
3. Generate new token (Automation level)
|
|
145
|
+
4. Copy token (starts with `npm_`)
|
|
146
|
+
5. GitHub repo → Settings → Secrets and variables → Actions
|
|
147
|
+
6. New secret: name `NPM_TOKEN`, value = paste token
|
|
148
|
+
|
|
149
|
+
### Slack Setup (Optional)
|
|
150
|
+
|
|
151
|
+
1. Go to your Slack workspace settings
|
|
152
|
+
2. Create incoming webhook
|
|
153
|
+
3. Copy webhook URL
|
|
154
|
+
4. GitHub repo → Settings → Secrets → Actions
|
|
155
|
+
5. New secret: name `SLACK_WEBHOOK_URL`, value = webhook URL
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Publishing Workflow
|
|
160
|
+
|
|
161
|
+
### 1. Make Changes & Commit
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Create feature branch
|
|
165
|
+
git checkout -b feat/new-feature
|
|
166
|
+
|
|
167
|
+
# Make changes
|
|
168
|
+
npm run lint:fix # Format code
|
|
169
|
+
npm run build # Verify build works
|
|
170
|
+
|
|
171
|
+
# Commit
|
|
172
|
+
git add src/
|
|
173
|
+
git commit -m "feat: add new feature"
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### 2. Create Pull Request
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
git push origin feat/new-feature
|
|
180
|
+
# Go to GitHub, create PR
|
|
181
|
+
# Wait for CI to pass (all green checks)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### 3. Merge to Main
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Via GitHub UI or:
|
|
188
|
+
git checkout main
|
|
189
|
+
git pull origin main
|
|
190
|
+
git merge feat/new-feature
|
|
191
|
+
git push origin main
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### 4. Publish to npm
|
|
195
|
+
|
|
196
|
+
**Option A: Automatic (Recommended)**
|
|
197
|
+
```bash
|
|
198
|
+
# Create tag from main
|
|
199
|
+
git tag v1.1.0
|
|
200
|
+
git push origin v1.1.0
|
|
201
|
+
|
|
202
|
+
# Create release in GitHub (auto-publishes)
|
|
203
|
+
gh release create v1.1.0 --generate-notes
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**Option B: Manual**
|
|
207
|
+
1. Go to GitHub Actions
|
|
208
|
+
2. `Manual Publish` workflow
|
|
209
|
+
3. Enter version `1.1.0`
|
|
210
|
+
4. Select npm tag `latest`
|
|
211
|
+
5. Run
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Troubleshooting
|
|
216
|
+
|
|
217
|
+
### CI Fails on PR
|
|
218
|
+
|
|
219
|
+
**Check:** Which job failed?
|
|
220
|
+
- `lint` → Run `npm run lint:fix`
|
|
221
|
+
- `typecheck` → Fix TypeScript errors
|
|
222
|
+
- `build` → Run `npm run build` locally
|
|
223
|
+
- `test` → Check test output
|
|
224
|
+
|
|
225
|
+
**Fix locally, then:**
|
|
226
|
+
```bash
|
|
227
|
+
git add .
|
|
228
|
+
git commit -m "fix: resolve CI errors"
|
|
229
|
+
git push origin feature-branch
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Publish Fails
|
|
233
|
+
|
|
234
|
+
**Check logs:**
|
|
235
|
+
1. `Actions` → `Publish to npm` (or `Manual Publish`)
|
|
236
|
+
2. Click failed run
|
|
237
|
+
3. Click failed job
|
|
238
|
+
4. Read error message
|
|
239
|
+
|
|
240
|
+
**Common issues:**
|
|
241
|
+
- NPM_TOKEN missing/invalid → Check Settings → Secrets
|
|
242
|
+
- Version already published → Use new version
|
|
243
|
+
- TypeScript errors → Fix with `npm run typecheck`
|
|
244
|
+
- Lint errors → Fix with `npm run lint:fix`
|
|
245
|
+
|
|
246
|
+
### How to Re-run Failed Workflow
|
|
247
|
+
|
|
248
|
+
1. Go to `Actions` tab
|
|
249
|
+
2. Click workflow
|
|
250
|
+
3. Click the failed run
|
|
251
|
+
4. Click `Re-run failed jobs` (or `Re-run all jobs`)
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Workflow Configuration Files
|
|
256
|
+
|
|
257
|
+
| File | Purpose |
|
|
258
|
+
|------|---------|
|
|
259
|
+
| `.github/workflows/ci.yml` | CI pipeline |
|
|
260
|
+
| `.github/workflows/publish.yml` | Auto-publish on release |
|
|
261
|
+
| `.github/workflows/manual-publish.yml` | On-demand publish |
|
|
262
|
+
| `.github/workflows/security-audit.yml` | Daily security checks |
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Local Development Commands
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
# Lint
|
|
270
|
+
npm run lint # Check style
|
|
271
|
+
npm run lint:fix # Auto-fix style
|
|
272
|
+
|
|
273
|
+
# Typecheck
|
|
274
|
+
npm run typecheck # Check TS compilation
|
|
275
|
+
|
|
276
|
+
# Build
|
|
277
|
+
npm run build # Build to dist/
|
|
278
|
+
|
|
279
|
+
# Combined (what pre-push hook does)
|
|
280
|
+
npm run lint && npm run typecheck && npm run build
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Branch Protection Rules (Recommended)
|
|
286
|
+
|
|
287
|
+
Set up in GitHub Settings → Branches → Branch protection rules for `main`:
|
|
288
|
+
|
|
289
|
+
- ✅ Require status checks to pass before merging
|
|
290
|
+
- ✅ Require branches to be up to date before merging
|
|
291
|
+
- ✅ Require code reviews before merging
|
|
292
|
+
- ✅ Dismiss stale pull request approvals
|
|
293
|
+
- ✅ Require linear history
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Monitoring Dashboard
|
|
298
|
+
|
|
299
|
+
**View all workflows:** GitHub repo → `Actions` tab
|
|
300
|
+
|
|
301
|
+
**Recent runs:**
|
|
302
|
+
```bash
|
|
303
|
+
# Using GitHub CLI
|
|
304
|
+
gh run list --workflow=ci.yml -L 5
|
|
305
|
+
gh run list --workflow=publish.yml -L 5
|
|
306
|
+
gh run list --workflow=security-audit.yml -L 5
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
**Trigger manual workflows:**
|
|
310
|
+
```bash
|
|
311
|
+
gh workflow run security-audit.yml
|
|
312
|
+
gh workflow run manual-publish.yml -f version=1.1.0-beta.1 -f npm_tag=beta
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## CI/CD Status Badge
|
|
318
|
+
|
|
319
|
+
Add to README.md:
|
|
320
|
+
|
|
321
|
+
```markdown
|
|
322
|
+
[](https://github.com/mattmck/huntr-cli/actions)
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Result: [](https://github.com/mattmck/huntr-cli/actions)
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## Best Practices
|
|
330
|
+
|
|
331
|
+
1. **Always wait for CI to pass** before merging PRs
|
|
332
|
+
2. **Use conventional commits** in messages (feat:, fix:, etc.)
|
|
333
|
+
3. **Keep commits atomic** (one logical change per commit)
|
|
334
|
+
4. **Push to feature branch, create PR** (don't commit to main)
|
|
335
|
+
5. **Create release from main branch** only
|
|
336
|
+
6. **Review workflow logs** if something fails
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## Summary Diagram
|
|
341
|
+
|
|
342
|
+
```
|
|
343
|
+
Development
|
|
344
|
+
↓
|
|
345
|
+
Feature Branch
|
|
346
|
+
↓
|
|
347
|
+
Create PR
|
|
348
|
+
↓
|
|
349
|
+
[CI: lint, typecheck, build, test]
|
|
350
|
+
↓
|
|
351
|
+
Merge to main
|
|
352
|
+
↓
|
|
353
|
+
Create Release/Tag
|
|
354
|
+
↓
|
|
355
|
+
[Publish: build + publish to npm]
|
|
356
|
+
↓
|
|
357
|
+
✅ Live on npmjs.com
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## Need Help?
|
|
363
|
+
|
|
364
|
+
- **Workflow failed?** Check `Actions` tab logs
|
|
365
|
+
- **Want to publish?** Use Manual Publish workflow
|
|
366
|
+
- **CI errors?** Run locally with `npm run lint:fix && npm run typecheck && npm run build`
|
|
367
|
+
- **Secrets issues?** Check Settings → Secrets → Actions
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# NPM Publishing Guide
|
|
2
|
+
|
|
3
|
+
When you publish huntr-cli to npm, here's where it lives and how users install it.
|
|
4
|
+
|
|
5
|
+
## Where Your Package Lives
|
|
6
|
+
|
|
7
|
+
### npm Registry (npmjs.com)
|
|
8
|
+
|
|
9
|
+
When you run `npm publish`, your package is uploaded to the **npm registry** at:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
https://www.npmjs.com/package/huntr-cli
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This is the **official public npm registry** operated by GitHub (acquired by GitHub in 2020). Every time you publish a new version, it's stored here and immediately available to the world.
|
|
16
|
+
|
|
17
|
+
### Local npm Cache
|
|
18
|
+
|
|
19
|
+
When a user installs your package with `npm install -g huntr-cli`:
|
|
20
|
+
1. npm checks their local cache first (`~/.npm`)
|
|
21
|
+
2. If not cached, downloads from npmjs.com
|
|
22
|
+
3. Stores a local copy in their cache
|
|
23
|
+
|
|
24
|
+
### Global Installation Location
|
|
25
|
+
|
|
26
|
+
When installed globally (`-g` flag), the executable is placed in the user's global node_modules:
|
|
27
|
+
|
|
28
|
+
**macOS/Linux:**
|
|
29
|
+
```bash
|
|
30
|
+
~/.nvm/versions/node/v18.x.x/bin/huntr
|
|
31
|
+
# OR
|
|
32
|
+
/usr/local/bin/huntr
|
|
33
|
+
# OR
|
|
34
|
+
~/.npm/_npx/huntr-cli/bin/huntr
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Windows:**
|
|
38
|
+
```
|
|
39
|
+
C:\Users\username\AppData\Roaming\npm\huntr.cmd
|
|
40
|
+
C:\Users\username\AppData\Roaming\npm\huntr
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The `bin` field in your `package.json` tells npm where to create this symlink:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"name": "huntr-cli",
|
|
48
|
+
"bin": {
|
|
49
|
+
"huntr": "./dist/cli.js"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## How to Publish
|
|
55
|
+
|
|
56
|
+
### 1. Create npm Account
|
|
57
|
+
|
|
58
|
+
If you don't have one:
|
|
59
|
+
```bash
|
|
60
|
+
npm adduser
|
|
61
|
+
# Enter username, password, email
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Verify you're logged in:
|
|
65
|
+
```bash
|
|
66
|
+
npm whoami
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 2. Update Version in package.json
|
|
70
|
+
|
|
71
|
+
Update the version following semver (major.minor.patch):
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Manual update
|
|
75
|
+
"version": "1.0.0" → "1.0.1"
|
|
76
|
+
|
|
77
|
+
# OR use npm version command
|
|
78
|
+
npm version patch # 1.0.0 → 1.0.1
|
|
79
|
+
npm version minor # 1.0.0 → 1.1.0
|
|
80
|
+
npm version major # 1.0.0 → 2.0.0
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 3. Build the Project
|
|
84
|
+
|
|
85
|
+
The `prepublishOnly` script runs automatically before publishing:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"scripts": {
|
|
90
|
+
"build": "tsc",
|
|
91
|
+
"prepublishOnly": "npm run build"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
So just publish:
|
|
97
|
+
```bash
|
|
98
|
+
npm publish
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
It automatically builds to `dist/` before uploading.
|
|
102
|
+
|
|
103
|
+
### 4. Verify Publishing
|
|
104
|
+
|
|
105
|
+
Check that your package is live:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# View on npm
|
|
109
|
+
npm view huntr-cli
|
|
110
|
+
|
|
111
|
+
# Check latest version
|
|
112
|
+
npm view huntr-cli version
|
|
113
|
+
|
|
114
|
+
# View all versions
|
|
115
|
+
npm view huntr-cli versions
|
|
116
|
+
|
|
117
|
+
# Open in browser
|
|
118
|
+
npm view huntr-cli repository.url
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Or visit: https://www.npmjs.com/package/huntr-cli
|
|
122
|
+
|
|
123
|
+
## After Publishing
|
|
124
|
+
|
|
125
|
+
### Users Can Install Globally
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
npm install -g huntr-cli
|
|
129
|
+
huntr --version
|
|
130
|
+
huntr boards list
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Users Can Use with npx (No Installation)
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
npx huntr-cli me
|
|
137
|
+
npx huntr-cli boards list
|
|
138
|
+
npx huntr-cli jobs list <board-id>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
This runs the latest version without installing it globally.
|
|
142
|
+
|
|
143
|
+
### Distribute Shell Completions
|
|
144
|
+
|
|
145
|
+
For users who want bash/zsh completions, they can download from your GitHub repo:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# User's setup:
|
|
149
|
+
cd huntr-cli
|
|
150
|
+
cp completions/huntr.bash ~/.bash_completion.d/huntr
|
|
151
|
+
# or
|
|
152
|
+
cp completions/_huntr ~/.zsh/completions/_huntr
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Or you could add a `postinstall` script to automatically copy completions (optional):
|
|
156
|
+
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"scripts": {
|
|
160
|
+
"postinstall": "node scripts/install-completions.js"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## About GitHub Artifacts
|
|
166
|
+
|
|
167
|
+
You mentioned GitHub artifacts. These are **different from npm publishing**:
|
|
168
|
+
|
|
169
|
+
### GitHub Artifacts
|
|
170
|
+
- **Where:** GitHub Actions artifact storage (temporary)
|
|
171
|
+
- **What:** Build outputs (dist/, coverage/, etc.)
|
|
172
|
+
- **Lifetime:** Default 90 days, configurable
|
|
173
|
+
- **Access:** Only in the workflow or via GitHub API
|
|
174
|
+
- **Use case:** CI/CD testing, not distribution
|
|
175
|
+
|
|
176
|
+
### npm Registry
|
|
177
|
+
- **Where:** npmjs.com (permanent)
|
|
178
|
+
- **What:** Your published package
|
|
179
|
+
- **Lifetime:** Forever (unless you unpublish)
|
|
180
|
+
- **Access:** `npm install`, searchable on npmjs.com
|
|
181
|
+
- **Use case:** Public distribution
|
|
182
|
+
|
|
183
|
+
**GitHub Artifacts are NOT for distributing CLI tools to users.** npm is the standard for Node.js packages.
|
|
184
|
+
|
|
185
|
+
## Distribution Flow
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
GitHub Repo
|
|
189
|
+
↓
|
|
190
|
+
└─→ [npm publish] → npmjs.com ← [npm install -g] ← Users
|
|
191
|
+
└─→ GitHub Actions → GitHub Artifacts (temporary, CI only)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Optional: GitHub Releases
|
|
195
|
+
|
|
196
|
+
You can also create **GitHub Releases** with prebuilt binaries:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Create a release
|
|
200
|
+
gh release create v1.0.0 --title "Version 1.0.0"
|
|
201
|
+
|
|
202
|
+
# Upload artifacts to release
|
|
203
|
+
gh release upload v1.0.0 ./dist/huntr-cli.tar.gz
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Users could then download from: https://github.com/mattmck/huntr-cli/releases
|
|
207
|
+
|
|
208
|
+
But for Node.js CLIs, npm is the standard distribution method.
|
|
209
|
+
|
|
210
|
+
## Version Management
|
|
211
|
+
|
|
212
|
+
### Semantic Versioning
|
|
213
|
+
|
|
214
|
+
- **1.0.0** = major.minor.patch
|
|
215
|
+
- **1.0.1** = patch release (bug fix)
|
|
216
|
+
- **1.1.0** = minor release (new feature, backward compatible)
|
|
217
|
+
- **2.0.0** = major release (breaking change)
|
|
218
|
+
|
|
219
|
+
### Current Version
|
|
220
|
+
|
|
221
|
+
Your current version is `1.0.0` in package.json.
|
|
222
|
+
|
|
223
|
+
Next versions:
|
|
224
|
+
- Adding --fields, PDF, Excel = **1.1.0** (new features, backward compatible)
|
|
225
|
+
- Bug fixes = **1.0.1**
|
|
226
|
+
- Breaking change (e.g., rename command) = **2.0.0**
|
|
227
|
+
|
|
228
|
+
### Prerelease Versions
|
|
229
|
+
|
|
230
|
+
You can also publish prerelease versions:
|
|
231
|
+
```bash
|
|
232
|
+
npm version prerelease # 1.0.0 → 1.0.1-0
|
|
233
|
+
npm publish --tag beta
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Users can then install:
|
|
237
|
+
```bash
|
|
238
|
+
npm install -g huntr-cli@beta
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Checklist Before Publishing
|
|
242
|
+
|
|
243
|
+
- [ ] Update version in package.json
|
|
244
|
+
- [ ] Update CHANGELOG.md (if you have one)
|
|
245
|
+
- [ ] Run `npm run build` — ensure it compiles
|
|
246
|
+
- [ ] Run `npm run lint` — no linting errors
|
|
247
|
+
- [ ] Run `npm test` (if you have tests)
|
|
248
|
+
- [ ] Update README.md if needed
|
|
249
|
+
- [ ] Commit changes: `git commit -m "chore: v1.0.1"`
|
|
250
|
+
- [ ] Tag release: `git tag v1.0.1`
|
|
251
|
+
- [ ] Push to GitHub: `git push origin main --tags`
|
|
252
|
+
- [ ] Publish to npm: `npm publish`
|
|
253
|
+
- [ ] Verify on npmjs.com
|
|
254
|
+
|
|
255
|
+
## Unpublishing (if needed)
|
|
256
|
+
|
|
257
|
+
If you accidentally publish something broken, you can unpublish:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
# Unpublish a specific version
|
|
261
|
+
npm unpublish huntr-cli@1.0.0
|
|
262
|
+
|
|
263
|
+
# Unpublish entire package (only works within 24 hours)
|
|
264
|
+
npm unpublish huntr-cli --force
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
This is a last resort and not recommended. Better to publish a patch fix.
|
|
268
|
+
|
|
269
|
+
## Keeping npm Secure
|
|
270
|
+
|
|
271
|
+
- **Never commit `.npmrc`** — add to `.gitignore`
|
|
272
|
+
- **Use automation tokens** if publishing from CI/CD
|
|
273
|
+
- **Scope your package** if you want `npm install @mattmcknight/huntr-cli` (requires pro account)
|
|
274
|
+
- **Enable 2FA** on your npm account: `npm profile set-2fa auth-and-writes`
|
|
275
|
+
|
|
276
|
+
## Troubleshooting
|
|
277
|
+
|
|
278
|
+
### "You must be logged in to publish"
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
npm login
|
|
282
|
+
npm whoami # verify
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### "Package name already taken"
|
|
286
|
+
|
|
287
|
+
Your package.json name is used as-is. If `huntr-cli` is taken, you could use:
|
|
288
|
+
```json
|
|
289
|
+
{
|
|
290
|
+
"name": "@mattmcknight/huntr-cli",
|
|
291
|
+
"name": "huntr-cli-mcknight"
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### "build script not running"
|
|
296
|
+
|
|
297
|
+
Make sure `prepublishOnly` is in package.json scripts:
|
|
298
|
+
```json
|
|
299
|
+
{
|
|
300
|
+
"scripts": {
|
|
301
|
+
"build": "tsc",
|
|
302
|
+
"prepublishOnly": "npm run build"
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### "dist/ not uploading"
|
|
308
|
+
|
|
309
|
+
Check that `dist/` is NOT in `.npmignore`:
|
|
310
|
+
```bash
|
|
311
|
+
cat .npmignore # should NOT list dist/
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
If `.npmignore` exists and lists dist/, remove that line.
|
|
315
|
+
|
|
316
|
+
## Summary
|
|
317
|
+
|
|
318
|
+
**After publishing to npm:**
|
|
319
|
+
- Users run: `npm install -g huntr-cli`
|
|
320
|
+
- Package lives at: https://npmjs.com/package/huntr-cli
|
|
321
|
+
- Can be used globally: `huntr boards list`
|
|
322
|
+
- Can be used with npx: `npx huntr-cli boards list`
|
|
323
|
+
- GitHub Artifacts are for CI/CD, not distribution
|
|
324
|
+
- npm Registry is the official distribution channel
|