@revfleet/hscli 0.8.7 → 0.8.10

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 (75) hide show
  1. package/CHANGELOG.md +204 -0
  2. package/CONTRIBUTING.md +120 -0
  3. package/README.md +14 -6
  4. package/brand/readme-hero.svg +25 -0
  5. package/dist/cli.js +10 -0
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/account/index.js +5 -6
  8. package/dist/commands/account/index.js.map +1 -1
  9. package/dist/commands/api/index.js +43 -3
  10. package/dist/commands/api/index.js.map +1 -1
  11. package/dist/commands/auth/index.js +32 -6
  12. package/dist/commands/auth/index.js.map +1 -1
  13. package/dist/commands/cms/hubdb.js +31 -0
  14. package/dist/commands/cms/hubdb.js.map +1 -1
  15. package/dist/commands/cms/index.js +27 -0
  16. package/dist/commands/cms/index.js.map +1 -1
  17. package/dist/commands/cms/source-code.js +21 -0
  18. package/dist/commands/cms/source-code.js.map +1 -1
  19. package/dist/commands/communication-preferences/index.js +11 -12
  20. package/dist/commands/communication-preferences/index.js.map +1 -1
  21. package/dist/commands/crm/shared.d.ts +1 -0
  22. package/dist/commands/crm/shared.js +3 -4
  23. package/dist/commands/crm/shared.js.map +1 -1
  24. package/dist/commands/events/index.js +7 -8
  25. package/dist/commands/events/index.js.map +1 -1
  26. package/dist/commands/marketing/index.js +3 -4
  27. package/dist/commands/marketing/index.js.map +1 -1
  28. package/dist/commands/settings/index.js +12 -13
  29. package/dist/commands/settings/index.js.map +1 -1
  30. package/dist/core/http.d.ts +27 -0
  31. package/dist/core/http.js +87 -18
  32. package/dist/core/http.js.map +1 -1
  33. package/dist/core/plugins.d.ts +5 -2
  34. package/dist/core/plugins.js +18 -1
  35. package/dist/core/plugins.js.map +1 -1
  36. package/dist/core/telemetry-context.d.ts +13 -0
  37. package/dist/core/telemetry-context.js +30 -0
  38. package/dist/core/telemetry-context.js.map +1 -0
  39. package/dist/mcp/hubspot-modules.d.ts +30 -0
  40. package/dist/mcp/hubspot-modules.js +305 -0
  41. package/dist/mcp/hubspot-modules.js.map +1 -0
  42. package/dist/mcp/server.d.ts +2 -0
  43. package/dist/mcp/server.js +30 -26
  44. package/dist/mcp/server.js.map +1 -1
  45. package/docs/ARCHITECTURE.md +39 -0
  46. package/docs/CAPABILITY_LIBRARY.md +638 -0
  47. package/docs/CMS_SETUP.md +349 -0
  48. package/docs/COMMAND_COMPATIBILITY.md +24 -0
  49. package/docs/COMMAND_TREE.md +183 -0
  50. package/docs/COMMERCE_SETUP.md +400 -0
  51. package/docs/COMPARISON.md +146 -0
  52. package/docs/COOKBOOK.md +800 -0
  53. package/docs/INTEGRATIONS_NOTIFICATIONS_SETUP.md +352 -0
  54. package/docs/MARKETING_SETUP.md +503 -0
  55. package/docs/MCP.md +171 -0
  56. package/docs/OPERATIONAL_PLAYBOOKS.md +322 -0
  57. package/docs/OPERATIONS_SETUP.md +362 -0
  58. package/docs/PLUGIN_GUIDE.md +158 -0
  59. package/docs/POLICY_EXAMPLE.json +57 -0
  60. package/docs/PORTAL_SETUP.md +683 -0
  61. package/docs/PUBLISHING.md +154 -0
  62. package/docs/RELEASE_GOVERNANCE.md +34 -0
  63. package/docs/REPORTING_SETUP.md +310 -0
  64. package/docs/ROADMAP-DATE-BASED-API.md +103 -0
  65. package/docs/ROADMAP_PHASE1_TO_3.md +96 -0
  66. package/docs/SAFETY_MODEL.md +37 -0
  67. package/docs/SALES_SETUP.md +369 -0
  68. package/docs/SERVICE_SETUP.md +403 -0
  69. package/docs/TESTING_PLAN.md +89 -0
  70. package/docs/TIERS.md +320 -0
  71. package/docs/TUTORIALS/audit-portal-writes.md +150 -0
  72. package/docs/TUTORIALS/secure-agent-writes.md +177 -0
  73. package/docs/TUTORIALS/trace-replay-repro.md +147 -0
  74. package/docs/WHY_HOW_WHAT.md +81 -0
  75. package/package.json +7 -2
@@ -0,0 +1,154 @@
1
+ # Publishing runbook
2
+
3
+ How to cut a new release of `@revfleet/hscli` on npm. Written for the maintainer (currently Luigi / `lvermeulen94@gmail.com`) and for any assistant helping the release.
4
+
5
+ ## Prerequisites
6
+
7
+ - Write access to `npmjs.com/package/@revfleet/hscli` (check `npm owner ls @revfleet/hscli`).
8
+ - Write access to `github.com/revfleet/hscli` (push to `main`, create tags).
9
+ - Working `gh` CLI, logged in (`gh auth status` shows the `revfleet` org).
10
+ - A terminal session where you can respond to a **passkey prompt** from your password manager. The npm account is protected by a passkey (WebAuthn / platform authenticator), not a TOTP code. `npm publish` will fail interactively with `EOTP` if the passkey prompt can't reach you.
11
+
12
+ ## Release flow
13
+
14
+ ### 1. Land all changes on a feature branch
15
+
16
+ ```bash
17
+ cd /Users/louisv/Pro-Desktop/Projets/hscli-main
18
+ git checkout -b <branch-name>
19
+ # ... commits ...
20
+ git push -u origin <branch-name>
21
+ ```
22
+
23
+ ### 2. Verify CI locally before opening a PR
24
+
25
+ ```bash
26
+ npm run typecheck
27
+ npm run lint
28
+ npm test
29
+ ```
30
+
31
+ All three should be clean. CI runs the same checks across Node 20 and 22.
32
+
33
+ ### 3. Bump the version
34
+
35
+ Edit `package.json`:
36
+
37
+ ```json
38
+ {
39
+ "version": "X.Y.Z"
40
+ }
41
+ ```
42
+
43
+ Patch-bump for docs-only / internal fixes, minor for new surface (tools, commands), major for breaking changes.
44
+
45
+ ### 4. Update `CHANGELOG.md`
46
+
47
+ Add a new section at the top:
48
+
49
+ ```markdown
50
+ ## X.Y.Z - YYYY-MM-DD
51
+
52
+ <one-paragraph summary>
53
+
54
+ ### New
55
+
56
+ - ...
57
+
58
+ ### Fixes
59
+
60
+ - ...
61
+
62
+ ### Tests / Docs
63
+
64
+ - ...
65
+ ```
66
+
67
+ Follow the shape of recent entries — tie every change to a file path when useful.
68
+
69
+ ### 5. Commit, push, open PR
70
+
71
+ ```bash
72
+ git add package.json CHANGELOG.md src/ tests/ docs/ README.md
73
+ git commit -m "<conventional commit message>"
74
+ git push
75
+ gh pr create --title "..." --body "..."
76
+ ```
77
+
78
+ ### 6. Wait for CI green
79
+
80
+ ```bash
81
+ gh pr checks <pr-number>
82
+ ```
83
+
84
+ Both `lint-test-build (20)` and `lint-test-build (22)` must pass.
85
+
86
+ ### 7. Merge + tag
87
+
88
+ ```bash
89
+ gh pr merge <pr-number> --squash --delete-branch
90
+ git checkout main
91
+ git fetch origin
92
+ git reset --hard origin/main
93
+ git tag -a vX.Y.Z -m "vX.Y.Z — <short description>"
94
+ git push origin vX.Y.Z
95
+ ```
96
+
97
+ ### 8. `npm publish` — the passkey gotcha
98
+
99
+ **Only the maintainer running an interactive terminal on their own machine can do this step.** Automated agents can't, because npm's 2FA is a passkey.
100
+
101
+ ```bash
102
+ npm publish
103
+ ```
104
+
105
+ Expected flow:
106
+
107
+ 1. `npm publish` prints the tarball contents + metadata.
108
+ 2. It hangs briefly, waiting for 2FA. On a passkey-only account it will print:
109
+ ```
110
+ npm error code EOTP
111
+ npm error This operation requires a one-time password...
112
+ ```
113
+ 3. Your password manager / browser should have surfaced a passkey prompt at the same time. Approve it.
114
+ 4. If the prompt didn't surface, re-run with `--otp=<code>` — but your npm account doesn't issue codes, so this path isn't available. You have to fix the passkey prompt instead (Chrome/Safari browser extension, OS-native passkey UI, or `1Password` / `Bitwarden` browser extension depending on your setup).
115
+
116
+ If the passkey prompt is dismissed or times out, re-run `npm publish`.
117
+
118
+ **Alternative: one-time npm token.** If you need to publish from a non-interactive environment (CI, remote agent), you can generate a temporary automation token at npmjs.com → Access Tokens → "Automation" (bypasses 2FA by design). Scope it to `@revfleet/hscli` only, set a short expiry, and delete it after use. Store it in the environment where the publish runs (`npm config set //registry.npmjs.org/:_authToken=<token>` or `NODE_AUTH_TOKEN`). Do NOT commit this token.
119
+
120
+ ### 9. Verify the release
121
+
122
+ ```bash
123
+ npm view @revfleet/hscli version # should print X.Y.Z
124
+ npm view @revfleet/hscli dist-tags # 'latest' should point at X.Y.Z
125
+ ```
126
+
127
+ Also confirm the GitHub Release exists at `https://github.com/revfleet/hscli/releases/tag/vX.Y.Z`. If the `release.yml` GitHub Action is set up, pushing the tag should have triggered it automatically.
128
+
129
+ ## Common failure modes
130
+
131
+ | Error | Cause | Fix |
132
+ |---|---|---|
133
+ | `EOTP` at publish | Passkey prompt didn't reach you | Re-run `npm publish` from a terminal where the browser / OS can surface the passkey UI |
134
+ | `E403 Forbidden` on the first publish of a new version | Name conflict / too-similar-to-existing-package | Rename under a scope (`@revfleet/<name>`) |
135
+ | `E404` during `npm publish` | Scope doesn't exist on npm | Create it at npmjs.com/~yourname → "Create org" |
136
+ | `EUSAGE` in CI | `package-lock.json` out of sync with `package.json` | Regenerate lock with `rm -rf node_modules package-lock.json && npm install` |
137
+ | `release:verify` fails checksums step | `dist/` doesn't match `release/checksums.sha256` | Run `npm run build` then `npm run release:checksums` and commit |
138
+ | GitHub tag-push triggers release workflow but attestation step fails | Attestations require a public repo | The workflow has `continue-on-error: true` on that step; the tarball still publishes |
139
+
140
+ ## Deprecating a bad release
141
+
142
+ If a published version is broken:
143
+
144
+ ```bash
145
+ npm deprecate @revfleet/hscli@X.Y.Z "Broken release — use X.Y.(Z+1). See CHANGELOG."
146
+ ```
147
+
148
+ Do NOT `npm unpublish` past 72 hours — npm blocks it, and even within 72 hours unpublishing disrupts anyone who cached the tarball. Deprecation + a patch release is the right move.
149
+
150
+ ## Keeping the passkey flow manageable
151
+
152
+ - Keep the password manager extension installed in your default browser. If Chrome/Safari doesn't see the passkey, publish fails.
153
+ - Every now and then (once a quarter), generate a short-lived automation token specifically for planned maintenance. Revoke immediately after.
154
+ - Don't switch the npm account away from passkey 2FA. Passkeys are more secure than TOTP and the "automation token" escape hatch is sufficient for the 1 hour/quarter you need CI publish.
@@ -0,0 +1,34 @@
1
+ # Release governance
2
+
3
+ > See also: [TESTING_PLAN.md](TESTING_PLAN.md) · [COMMAND_COMPATIBILITY.md](COMMAND_COMPATIBILITY.md) · [SECURITY.md](../SECURITY.md) · [PUBLISHING.md](PUBLISHING.md)
4
+
5
+ ## Versioning & Compatibility
6
+ - Use semantic versioning.
7
+ - Do not remove or rename commands without a major version bump.
8
+ - Keep JSON response envelopes stable (`ok/data` and `ok/error`).
9
+
10
+ ## Required Release Gates
11
+ 1. `npm run typecheck`
12
+ 2. `npm test`
13
+ 3. `npm run build`
14
+ 4. `npm run release:checksums`
15
+ 5. `shasum -a 256 -c release/checksums.sha256`
16
+ 6. `npm audit --audit-level=low`
17
+
18
+ Use one command for local release validation:
19
+
20
+ ```bash
21
+ npm run release:verify
22
+ ```
23
+
24
+ ## Security Gates
25
+ - No plaintext secrets in logs/tests/docs.
26
+ - Policy-controlled destructive commands in production profiles.
27
+ - `--force` required for writes and `--dry-run` available for preview.
28
+
29
+ ## Publishing Checklist
30
+ 1. Update `CHANGELOG.md`
31
+ 2. Confirm command compatibility notes
32
+ 3. Tag release in git
33
+ 4. Publish release artifacts with checksums
34
+ 5. Announce breaking changes (if any) with migration guidance
@@ -0,0 +1,310 @@
1
+ # Reporting & Analytics Setup Guide
2
+
3
+ > See also: [PORTAL_SETUP.md](PORTAL_SETUP.md) · [MARKETING_SETUP.md](MARKETING_SETUP.md) · [SALES_SETUP.md](SALES_SETUP.md) · [OPERATIONS_SETUP.md](OPERATIONS_SETUP.md)
4
+
5
+ Complete configuration guide for HubSpot reporting and analytics. Covers dashboards, custom reports, attribution, analytics tools, and report sharing.
6
+
7
+ **Prerequisites:**
8
+ - Portal authenticated (`hscli auth whoami`)
9
+ - Users & Teams configured (see [PORTAL_SETUP.md](./PORTAL_SETUP.md))
10
+ - CRM data populated (contacts, deals, tickets, etc.)
11
+
12
+ ---
13
+
14
+ ## 1. Dashboards
15
+
16
+ **Where:** Reports > Dashboards
17
+
18
+ ### 1.1 Dashboard Configuration
19
+
20
+ | Setting | What to configure | Why it matters |
21
+ |---------|-------------------|----------------|
22
+ | Dashboard name | Descriptive name per audience (e.g., "Sales Leadership", "Marketing Overview") | Quick identification |
23
+ | Visibility | Private, team, or everyone | Access control |
24
+ | Default dashboard | Which dashboard loads first per user | Immediate visibility of key metrics |
25
+ | Layout | 1, 2, or 3 column grid | Information density |
26
+ | Date range | Default date filter (this month, this quarter, custom) | Consistent time window |
27
+ | Filters | Dashboard-level filters (owner, team, pipeline) | Interactive exploration |
28
+
29
+ ### 1.2 Recommended Dashboards
30
+
31
+ | Dashboard | Audience | Key reports |
32
+ |-----------|----------|-------------|
33
+ | Executive Summary | C-suite | Revenue, pipeline, conversion rates, NPS |
34
+ | Marketing Performance | Marketing team | Traffic, leads, email metrics, campaign ROI |
35
+ | Sales Pipeline | Sales leadership | Pipeline value, stage conversion, forecast |
36
+ | Sales Rep Activity | Sales managers | Calls, emails, meetings, deals per rep |
37
+ | Service Overview | Service leadership | Tickets, resolution time, CSAT, SLA compliance |
38
+ | Revenue Operations | RevOps | Funnel, lifecycle stage conversion, data quality |
39
+ | Website Analytics | Marketing/Content | Traffic, top pages, conversion rates, SEO |
40
+ | ABM Dashboard | ABM team | Target account engagement, pipeline by tier |
41
+
42
+ ### 1.3 Dashboard Best Practices
43
+
44
+ | Practice | Why |
45
+ |----------|-----|
46
+ | One dashboard per audience | Different teams need different views |
47
+ | 8–12 reports per dashboard | Focused, not overwhelming |
48
+ | Lead with KPIs at top | Most important metrics first |
49
+ | Include trend charts | Context over point-in-time numbers |
50
+ | Add comparison periods | Month-over-month, year-over-year |
51
+ | Set recurring email delivery | Automated reporting cadence |
52
+
53
+ ---
54
+
55
+ ## 2. Custom Reports
56
+
57
+ **Where:** Reports > Reports > Create Report
58
+
59
+ ### 2.1 Report Types
60
+
61
+ | Type | Description | Best for |
62
+ |------|-------------|----------|
63
+ | Single object | One CRM object (contacts, deals, etc.) | Simple counts, lists, breakdowns |
64
+ | Cross-object | Multiple related objects | Contacts with deals, deals with tickets |
65
+ | Funnel | Stage-to-stage conversion | Sales funnel, lifecycle progression |
66
+ | Attribution | Multi-touch revenue attribution | Marketing ROI |
67
+ | Custom report builder | Drag-and-drop visual builder | Complex multi-dimensional reports |
68
+ | Dataset-based | Built on Operations Hub datasets | Advanced calculated metrics |
69
+
70
+ ### 2.2 Visualization Types
71
+
72
+ | Chart type | Best for | Example |
73
+ |------------|----------|---------|
74
+ | Bar chart | Comparisons | Deals by stage, leads by source |
75
+ | Line chart | Trends over time | Monthly revenue, traffic growth |
76
+ | Area chart | Volume trends | Cumulative deals over time |
77
+ | Pie/donut | Proportions | Lead source distribution |
78
+ | KPI/number | Single metric | Total revenue, open tickets |
79
+ | Table | Detailed data | Contact list with properties |
80
+ | Pivot table | Multi-dimensional | Revenue by rep by quarter |
81
+ | Funnel | Stage progression | Lead → MQL → SQL → Customer |
82
+ | Combo chart | Dual axis | Revenue (bars) + deal count (line) |
83
+
84
+ ### 2.3 Common Custom Reports
85
+
86
+ | Report | Objects | Metrics | Dimensions |
87
+ |--------|---------|---------|------------|
88
+ | Pipeline velocity | Deals | Average days in stage | Pipeline stage |
89
+ | Lead source ROI | Contacts + Deals | Revenue, conversion rate | Original source |
90
+ | Rep performance | Deals | Total revenue, win rate, avg deal size | Owner |
91
+ | Ticket resolution | Tickets | Avg time to close, volume | Priority, category |
92
+ | Email engagement | Marketing emails | Open rate, click rate, unsubscribes | Campaign, date |
93
+ | Landing page conversion | Landing pages | Views, submissions, conversion rate | Page, source |
94
+ | MQL → SQL conversion | Contacts | Conversion rate, time to convert | Source, date |
95
+ | Customer lifecycle | Contacts | Count per lifecycle stage | Stage, date |
96
+
97
+ ---
98
+
99
+ ## 3. Attribution Reporting
100
+
101
+ **Where:** Reports > Attribution (Marketing Hub Enterprise / CMS Hub Enterprise)
102
+
103
+ ### 3.1 Attribution Models
104
+
105
+ | Model | Description | Best for |
106
+ |-------|-------------|----------|
107
+ | First touch | 100% credit to first interaction | Understanding acquisition channels |
108
+ | Last touch | 100% credit to last interaction before conversion | Understanding closing channels |
109
+ | Linear | Equal credit to all touchpoints | Balanced view of all interactions |
110
+ | U-shaped | 40% first, 40% last, 20% middle | Valuing both discovery and conversion |
111
+ | W-shaped | 30% first, 30% lead create, 30% deal create, 10% middle | Full funnel visibility |
112
+ | Time decay | More credit to recent interactions | Recency-weighted analysis |
113
+ | Full path | 22.5% each for 4 key stages, 10% remaining | Most comprehensive model |
114
+ | Custom | Define your own weights | Tailored to your business |
115
+
116
+ ### 3.2 Attribution Configuration
117
+
118
+ | Setting | What to configure | Why it matters |
119
+ |---------|-------------------|----------------|
120
+ | Content types | Which interactions to track (pages, emails, ads, etc.) | Attribution scope |
121
+ | Conversion events | What counts as a conversion (form submit, deal create) | Define success metrics |
122
+ | Lookback window | How far back to attribute (30, 60, 90 days) | Attribution time frame |
123
+ | Revenue attribution | Connect deal revenue to marketing touchpoints | Marketing ROI |
124
+
125
+ ### 3.3 Contact vs. Revenue Attribution
126
+
127
+ | Type | Question it answers | Data needed |
128
+ |------|-------------------|-------------|
129
+ | Contact attribution | "Which channels create the most leads?" | Contacts + interactions |
130
+ | Revenue attribution | "Which channels drive the most revenue?" | Contacts + deals + interactions |
131
+
132
+ ---
133
+
134
+ ## 4. Analytics Tools
135
+
136
+ **Where:** Reports > Analytics Tools
137
+
138
+ ### 4.1 Traffic Analytics
139
+
140
+ | Report | What it shows | Where |
141
+ |--------|--------------|-------|
142
+ | Sources | Traffic by channel (organic, paid, social, email, direct) | Analytics > Traffic |
143
+ | Topic clusters | SEO performance by topic | Analytics > Traffic > Topics |
144
+ | Pages | Performance per page (views, bounce rate, time on page) | Analytics > Traffic > Pages |
145
+ | UTM parameters | Campaign tracking performance | Analytics > Traffic > UTM |
146
+
147
+ ### 4.2 Contact Analytics
148
+
149
+ | Report | What it shows | Where |
150
+ |--------|--------------|-------|
151
+ | Contact create attribution | How contacts were created | Analytics > Contacts |
152
+ | Lifecycle stage funnel | Conversion through stages | Analytics > Contacts > Lifecycle |
153
+ | List performance | Growth and engagement per list | Analytics > Contacts > Lists |
154
+
155
+ ### 4.3 Sales Analytics
156
+
157
+ | Report | What it shows | Where |
158
+ |--------|--------------|-------|
159
+ | Deal forecast | Weighted pipeline by category | Reports > Sales Analytics |
160
+ | Sales activities | Calls, emails, meetings per rep | Reports > Sales Analytics |
161
+ | Deal velocity | Time in each pipeline stage | Reports > Sales Analytics |
162
+ | Win/loss analysis | Win rate by source, rep, product | Reports > Sales Analytics |
163
+ | Quota attainment | Actual vs. target per rep | Reports > Sales Analytics |
164
+
165
+ ### 4.4 Service Analytics
166
+
167
+ | Report | What it shows | Where |
168
+ |--------|--------------|-------|
169
+ | Ticket volume | Tickets created over time | Reports > Service Analytics |
170
+ | Resolution time | Average time to close by priority | Reports > Service Analytics |
171
+ | SLA performance | % tickets meeting SLA targets | Reports > Service Analytics |
172
+ | Agent performance | Tickets handled, resolution time per agent | Reports > Service Analytics |
173
+ | CSAT/NPS trends | Customer satisfaction over time | Reports > Service Analytics |
174
+
175
+ ---
176
+
177
+ ## 5. Report Sharing & Scheduling
178
+
179
+ **Where:** Reports > Dashboards > Share/Email
180
+
181
+ ### 5.1 Sharing Options
182
+
183
+ | Method | Configuration | Use case |
184
+ |--------|--------------|----------|
185
+ | Dashboard sharing | Share with specific users, teams, or everyone | Ongoing access |
186
+ | Scheduled email | Recurring dashboard email (daily, weekly, monthly) | Automated reporting |
187
+ | Slack integration | Send reports to Slack channels | Real-time team visibility |
188
+ | Export | PDF, CSV, XLSX export | Offline analysis, presentations |
189
+ | Embed | Embed dashboard in external page | Portal or intranet |
190
+
191
+ ### 5.2 Scheduled Report Configuration
192
+
193
+ | Setting | What to configure | Why it matters |
194
+ |---------|-------------------|----------------|
195
+ | Recipients | Email addresses (internal + external) | Who receives the report |
196
+ | Frequency | Daily, weekly, monthly | Reporting cadence |
197
+ | Day/time | When the email is sent | Convenient delivery |
198
+ | Subject line | Custom email subject | Clear identification |
199
+ | Message | Optional note with context | Explain what to look for |
200
+ | Dashboard filters | Pre-set filters for the emailed version | Relevant data per audience |
201
+
202
+ ---
203
+
204
+ ## 6. Goals & Tracking
205
+
206
+ **Where:** Reports > Goals
207
+
208
+ ### 6.1 Goal Types
209
+
210
+ | Goal type | Metric | Example |
211
+ |-----------|--------|---------|
212
+ | Revenue | Deal revenue closed | $500K/quarter |
213
+ | Deals | Number of deals closed | 20 deals/month |
214
+ | Contacts | New contacts created | 500 leads/month |
215
+ | Calls | Calls logged | 50 calls/week per rep |
216
+ | Meetings | Meetings booked | 15 meetings/week per rep |
217
+ | Custom | Any numeric property | Custom KPIs |
218
+
219
+ ### 6.2 Goal Configuration
220
+
221
+ | Setting | What to configure | Why it matters |
222
+ |---------|-------------------|----------------|
223
+ | Goal name | Descriptive name | Identification |
224
+ | Contributors | Users, teams, or pipelines | Who is responsible |
225
+ | Target value | Numeric target per period | Clear objective |
226
+ | Duration | Monthly, quarterly, annual | Time-bounded targets |
227
+ | Tracking property | Which CRM property to measure | Accurate measurement |
228
+ | Pipeline filter | Which pipeline(s) count | Relevant scope |
229
+
230
+ ---
231
+
232
+ ## 7. Custom Behavioral Events
233
+
234
+ **Where:** Reports > Analytics > Custom Behavioral Events (Marketing Hub Enterprise)
235
+
236
+ ### 7.1 Event Configuration
237
+
238
+ | Setting | What to configure | Why it matters |
239
+ |---------|-------------------|----------------|
240
+ | Event name | Descriptive name (e.g., "Pricing Page Viewed") | Clear identification |
241
+ | Event properties | Custom data with the event (plan type, feature viewed) | Granular analysis |
242
+ | Tracking method | JavaScript API, HTTP API, or integration | Implementation approach |
243
+ | Completion trigger | API call when event occurs | Real-time tracking |
244
+
245
+ ### 7.2 Event Use Cases
246
+
247
+ | Event | Tracking method | Purpose |
248
+ |-------|----------------|---------|
249
+ | Product feature usage | JavaScript API in app | Product-led metrics |
250
+ | Pricing page interaction | JavaScript tracking | Purchase intent signals |
251
+ | API usage | HTTP API from backend | Developer engagement |
252
+ | In-app NPS response | HTTP API from app | Product satisfaction |
253
+ | Onboarding step completion | HTTP API from app | Activation tracking |
254
+
255
+ ---
256
+
257
+ ## Setup Checklist
258
+
259
+ ### Dashboards
260
+ ```
261
+ [ ] Executive summary dashboard created
262
+ [ ] Marketing performance dashboard created
263
+ [ ] Sales pipeline dashboard created
264
+ [ ] Service overview dashboard created
265
+ [ ] Dashboard permissions set per team
266
+ [ ] Default dashboard assigned per role
267
+ ```
268
+
269
+ ### Custom Reports
270
+ ```
271
+ [ ] Key reports built for each department
272
+ [ ] Pipeline velocity report created
273
+ [ ] Lead source ROI report created
274
+ [ ] Rep performance report created
275
+ [ ] Ticket resolution report created
276
+ [ ] Reports added to appropriate dashboards
277
+ ```
278
+
279
+ ### Attribution
280
+ ```
281
+ [ ] Attribution model selected (start with linear or U-shaped)
282
+ [ ] Content types configured
283
+ [ ] Conversion events defined
284
+ [ ] Lookback window set
285
+ [ ] Revenue attribution enabled (if deals exist)
286
+ ```
287
+
288
+ ### Analytics Tools
289
+ ```
290
+ [ ] Traffic analytics reviewed and bookmarked
291
+ [ ] UTM parameter convention established
292
+ [ ] Contact analytics baseline recorded
293
+ [ ] Sales analytics reports reviewed
294
+ ```
295
+
296
+ ### Sharing & Scheduling
297
+ ```
298
+ [ ] Weekly dashboard email scheduled for leadership
299
+ [ ] Monthly dashboard email scheduled for stakeholders
300
+ [ ] Slack integration configured for key metrics
301
+ [ ] Export templates created for board reporting
302
+ ```
303
+
304
+ ### Goals
305
+ ```
306
+ [ ] Revenue goals set per rep and team
307
+ [ ] Activity goals set (calls, meetings) per rep
308
+ [ ] Goals visible on dashboards
309
+ [ ] Monthly goal review process established
310
+ ```
@@ -0,0 +1,103 @@
1
+ # Roadmap: Date-based API versioning migration
2
+
3
+ Status: **planning** (targeted for v0.9.x series, 2026-H2)
4
+ Owner: hscli maintainer
5
+ Last updated: 2026-04-22
6
+
7
+ ## Context
8
+
9
+ HubSpot announced ([Spring 2026 Spotlight](https://developers.hubspot.com/changelog), 2026-04-14) that date-based API versioning is now GA. Going forward, public API endpoints will use `/YYYY-MM/` segments instead of `/v1/`, `/v2/`, `/v3/`, `/v4/`. Example:
10
+
11
+ ```
12
+ Today: /crm/v3/objects/contacts
13
+ Future: /crm/2026-03/objects/contacts
14
+ ```
15
+
16
+ HubSpot has not (as of 2026-04-22) published a deprecation timeline for the numeric `vN` routes, and existing `/crm/v3/...` calls continue to work. This is forward-looking planning, not a response to a live incident.
17
+
18
+ ## Why `hscli` can't just swap paths wholesale
19
+
20
+ Three reasons:
21
+
22
+ 1. **Coverage completeness.** `hscli` claims 1,180 endpoints. Every one of them has a hand-rolled path in the codebase. Migrating them all in a single PR is a multi-thousand-line diff; reviewability is near zero.
23
+ 2. **Per-endpoint cutover cadence.** HubSpot is unlikely to flip every endpoint to date-based versioning on the same day. Each endpoint will have its own migration window, and during that window both `/v3/` and `/2026-03/` will be valid — possibly with *different response shapes*.
24
+ 3. **Backward compatibility for users.** A scripted user who pins `@revfleet/hscli@0.7.x` must keep working as long as HubSpot keeps the `/vN/` routes live. We don't want to force callers onto a new hscli major just because we migrated internally.
25
+
26
+ ## Proposed approach: `apiVersion` client option + version table
27
+
28
+ ### 1. Path builder layer
29
+
30
+ Introduce a helper `resolveVersionedPath({ area, date? })` that takes a logical endpoint and returns a concrete path. Example:
31
+
32
+ ```ts
33
+ // Old — hand-rolled, hardcoded
34
+ await client.request(`/crm/v3/objects/${objectType}/batch/read`);
35
+
36
+ // New — explicit
37
+ await client.request(
38
+ resolveVersionedPath("crm", "2026-03", `objects/${objectType}/batch/read`),
39
+ );
40
+ // → "/crm/2026-03/objects/contacts/batch/read" (if 2026-03 is selected)
41
+ // → "/crm/v3/objects/contacts/batch/read" (if v3 is selected)
42
+ ```
43
+
44
+ The signature we want is small enough to retrofit incrementally.
45
+
46
+ ### 2. Version preference table
47
+
48
+ Store a per-area version preference in `src/core/api-versions.ts`:
49
+
50
+ ```ts
51
+ export const API_VERSIONS: Record<string, { current: string; fallback: string }> = {
52
+ crm: { current: "v3", fallback: "v3" },
53
+ marketing: { current: "v3", fallback: "v3" },
54
+ automation: { current: "v4", fallback: "v4" },
55
+ // When HubSpot flips CRM to date-based:
56
+ // crm: { current: "2026-03", fallback: "v3" },
57
+ };
58
+ ```
59
+
60
+ `fallback` is what we'd retry with on `404`/`ENDPOINT_NOT_AVAILABLE`, so we can roll forward aggressively without breaking on portals where HubSpot hasn't cut over yet.
61
+
62
+ ### 3. Response-shape adapter
63
+
64
+ HubSpot may reshape response envelopes in the date-based endpoints. We'll add a small adapter layer in `src/core/api-shapes.ts` that normalizes responses back to the v3 shape our commands expect, gated per `(area, version)` tuple. Start with an identity adapter and add transformations only when actual drift surfaces.
65
+
66
+ ### 4. Capability probe extension
67
+
68
+ The existing `hscli doctor capabilities` + cache file at `~/.revfleet/capabilities.json` already fingerprints endpoints by `portalId + scopes`. Add an additional dimension: `preferredVersion`. When a probe notices a newer `/YYYY-MM/` variant returning 200, cache that preference and future calls opt in automatically.
69
+
70
+ ### 5. Opt-in flag before default
71
+
72
+ Ship the migration in three phases:
73
+
74
+ - **Phase A (v0.8.x):** Version table exists. Defaults still resolve to `vN`. `--api-version 2026-03` flag + `HSCLI_API_VERSION` env var accepted for callers that want to exercise date-based paths manually.
75
+ - **Phase B (v0.9.x):** For each area HubSpot has promoted, flip `current` to the date-based version. Keep `fallback` pointing at `vN` so the capability probe can retry. Log both paths in trace telemetry when a fallback happens.
76
+ - **Phase C (v1.0):** Drop the `fallback` and delete any v3 path helpers HubSpot has formally deprecated. Breaking change justified by HubSpot's own deprecation.
77
+
78
+ ## Effort estimate
79
+
80
+ - Phase A scaffolding (version table, `resolveVersionedPath`, flag wiring): **1–2 days**
81
+ - Retrofitting 1,180 callsites to use `resolveVersionedPath` (mechanical refactor): **2–3 days** (spread across v0.8.x patches)
82
+ - Adapter layer + capability probe extension: **1 day each**
83
+ - Per-area cutover (Phase B): **hours per area, weeks of calendar time** — driven by HubSpot's own schedule
84
+
85
+ ## Non-goals
86
+
87
+ - **Not rebuilding the client.** The request/retry/rate-limit layer doesn't need to change.
88
+ - **Not anticipating HubSpot's every reshaping.** We add adapters when drift is observed, not pre-emptively.
89
+ - **Not breaking v0.x callers.** Anyone on v0.7.x today should still work against their portal in 2027 unless HubSpot removes the v3 endpoint entirely.
90
+
91
+ ## Open questions
92
+
93
+ - **What's HubSpot's removal timeline for `/v3/`?** Unknown as of 2026-04-22. The changelog says "GA" but not "deprecated". We'll revisit when that announcement lands.
94
+ - **Will date-based versioning apply to the Search API?** The HubSpot Remote MCP server is built on CRM Search; any date-based cutover there affects us through the `search_crm_objects` compat tool too.
95
+ - **Legacy `/contacts/v1/`, `/deals/v1/` etc.** — these predate the v1/v2/v3/v4 system. Likely to be removed before the numeric-to-date migration completes. Track separately.
96
+
97
+ ## Action items (not yet started)
98
+
99
+ - [ ] Add `src/core/api-versions.ts` with the version table.
100
+ - [ ] Add `resolveVersionedPath()` helper + unit tests.
101
+ - [ ] Add `--api-version <YYYY-MM>` global CLI flag + `HSCLI_API_VERSION` env.
102
+ - [ ] Retrofit the top-20-most-called endpoints first (`contacts`, `companies`, `deals`, `tickets`, `owners`, `properties`, associations, pipelines) as proof of concept in a dedicated PR.
103
+ - [ ] Watch the HubSpot changelog for the first per-area "GA on date-based versioning" notice and flip that area's `current` in a follow-up.