@sendhoney/cli 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +13 -11
  2. package/bin/sendhoney +8 -7
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -11,7 +11,9 @@ SendHoney platform CLI for authenticated API, CRUD, release, and ThunderCompute
11
11
  npm install -g @sendhoney/cli
12
12
 
13
13
  # npm (pinned)
14
- npm install -g @sendhoney/cli@0.1.11
14
+ npm install -g @sendhoney/cli@0.1.13
15
+
16
+ sendhoney --version # should print 0.1.13
15
17
 
16
18
  # Homebrew
17
19
  brew tap sendhoney/tap && brew install sendhoney
@@ -110,7 +112,7 @@ sendhoney widget install --org-id ORG_ID --widget-type both --file ./dist/index.
110
112
 
111
113
  ## Authentication
112
114
 
113
- `sendhoney login` uses Keycloak Authorization Code + PKCE and refreshes expired access tokens automatically. Use `SENDHONEY_TOKEN` for CI / service accounts.
115
+ `sendhoney login` uses Keycloak Authorization Code + PKCE and refreshes expired access tokens automatically. On success it prints the authenticated user, resolved `orgId`, and organization data. Use `SENDHONEY_TOKEN` for CI / service accounts.
114
116
 
115
117
  Credentials are stored in `$XDG_CONFIG_HOME/sendhoney/config.json` (or `~/.config/sendhoney/config.json`) with mode `0600`; tokens are never printed by the CLI. After browser login, the CLI exchanges the PKCE code, hydrates the Keycloak user profile and current organization, and stores the resolved `orgId` in the local session. `sendhoney widget install` can therefore use the saved organization without a second ID lookup.
116
118
 
@@ -131,7 +133,7 @@ The expert interface is the Go program in `apps/sendhoney-tui`. It shares this c
131
133
  ## Publishing
132
134
 
133
135
  Maintained in the `sendhoney-api-monorepo-oatpp-v2` repo under `apps/sendhoney-cli`.
134
- Publish to npmjs using the `staging` dist-tag so `latest` remains unchanged:
136
+ Publish through npm staged packages. Staging does not use a `staging` dist-tag:
135
137
 
136
138
  1. Stage the package (uploaded to npm staging, not yet public):
137
139
  ```bash
@@ -139,19 +141,19 @@ Publish to npmjs using the `staging` dist-tag so `latest` remains unchanged:
139
141
  cd apps/sendhoney-cli
140
142
  ./scripts/publish-sendhoney-cli.sh
141
143
  ```
142
- 2. Verify the staged version:
143
- ```bash
144
- npm view @sendhoney/cli dist-tags versions
145
- ```
146
- 3. Promote the verified version:
144
+ 2. Review and approve the stage at:
145
+ https://www.npmjs.com/settings/sendhoney/staged-packages
146
+
147
+ 3. After approval, install the released version:
147
148
  ```bash
148
- npm dist-tag add @sendhoney/cli@VERSION latest
149
+ npm install -g @sendhoney/cli@VERSION
150
+ npm view @sendhoney/cli version
149
151
  ```
150
152
 
151
- Alternatively, run the publish script which stages and prints the promotion link:
153
+ The repository script stages the package, verifies the returned stage ID, and prints the review link:
152
154
 
153
155
  ```bash
154
156
  ./scripts/publish-sendhoney-cli.sh
155
157
  ```
156
158
 
157
- npm disallows republishing an already-published version, so always bump `version` in `package.json` before staging.
159
+ npm disallows republishing an already-published version, so always bump `version` in `package.json` before staging. Do not run `npm publish` or `npm dist-tag add` for staged releases.
package/bin/sendhoney CHANGED
@@ -41,17 +41,18 @@ function escapeHtml(value) {
41
41
  }
42
42
 
43
43
  function loginCallbackPage(success, organization = {}) {
44
- const title = success ? 'Return to your terminal' : 'Sign-in could not be completed'
44
+ const title = success ? 'CLI connected' : 'Sign-in could not be completed'
45
45
  const message = success
46
- ? 'SendHoney received the authorization. The CLI is exchanging it securely now; return to your terminal for the final login result.'
46
+ ? 'Your SendHoney workspace is ready. Return to your terminal to continue.'
47
47
  : 'The SendHoney CLI could not complete sign-in. Close this window and try again from your terminal.'
48
48
  const icon = success ? '✓' : '!'
49
- const accent = success ? '#0f766e' : '#b42318'
49
+ const accent = success ? '#2563eb' : '#b42318'
50
50
  const logo = organization.logoUrl || organization.logo_url || organization.logo || organization.organization?.logoUrl || organization.organization?.logo_url || organization.organization?.logo
51
51
  const logoUrl = /^https?:\/\//i.test(String(logo || '')) ? escapeHtml(logo) : ''
52
52
  const clientName = escapeHtml(organization.name || organization.companyName || organization.organization?.name || 'Your workspace')
53
- const clientBrand = success && logoUrl ? `<div class="client-brand"><img src="${logoUrl}" alt="${clientName} logo"><span>${clientName}</span></div>` : ''
54
- return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${title} · SendHoney</title><style>*,*:before,*:after{box-sizing:border-box}body{margin:0;min-height:100vh;display:grid;place-items:center;padding:24px;background:#f7fbfb;color:#102a2a;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}.card{width:min(100%,480px);padding:40px;border:1px solid #d9e9e7;border-radius:24px;background:#fff;box-shadow:0 20px 60px #0f766e18;text-align:center}.brand,.client-brand{display:inline-flex;align-items:center;gap:10px;color:#0f766e;font-size:18px;font-weight:800;letter-spacing:-.02em}.brand{margin-bottom:16px}.client-brand{margin:0 auto 28px;padding:10px 14px;border:1px solid #d9e9e7;border-radius:14px;color:#214040;font-size:14px}.client-brand img{width:30px;height:30px;object-fit:contain;border-radius:8px}.mark{display:grid;place-items:center;width:32px;height:32px;border-radius:10px;background:#0f766e;color:#fff;font-size:20px}.status{display:grid;place-items:center;width:64px;height:64px;margin:0 auto 22px;border-radius:20px;background:${accent}18;color:${accent};font-size:32px;font-weight:800}.title{margin:0;font-size:30px;letter-spacing:-.04em}.message{margin:14px auto 0;max-width:30rem;color:#587070;font-size:16px;line-height:1.6}.hint{margin-top:28px;color:#789090;font-size:13px}</style></head><body><main class="card"><div class="brand"><span class="mark">SH</span><span>SendHoney</span></div>${clientBrand}<div class="status">${icon}</div><h1 class="title">${title}</h1><p class="message">${message}</p><p class="hint">You may safely close this tab.</p></main></body></html>`
53
+ const clientBrand = success && logoUrl ? `<div class="client-brand"><img src="${logoUrl}" alt="${clientName} logo"><span><small>Connected workspace</small><strong>${clientName}</strong></span></div>` : ''
54
+ const sendHoneyLogo = `<svg class="logo-mark" viewBox="0 0 40 40" aria-label="SendHoney logo" role="img"><defs><linearGradient id="sh-bg" x1="0" y1="0" x2="1" y2="1"><stop offset="0%" stop-color="#60A5FA"/><stop offset="100%" stop-color="#2563EB"/></linearGradient><linearGradient id="sh-fg" x1="0" y1="0" x2="1" y2="1"><stop offset="0%" stop-color="#ffffff" stop-opacity=".34"/><stop offset="100%" stop-color="#1D4ED8" stop-opacity=".16"/></linearGradient></defs><rect x="2.8" y="2.8" width="34.4" height="34.4" rx="10" fill="url(#sh-bg)" stroke="#93C5FD" stroke-width="1.5" transform="rotate(6 20 20)"/><rect x="2.8" y="2.8" width="34.4" height="34.4" rx="10" fill="url(#sh-fg)"/><text x="20" y="25" fill="white" font-size="13" font-weight="900" font-family="Inter,system-ui,sans-serif" text-anchor="middle">SH</text></svg>`
55
+ return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${title} · SendHoney</title><style>*,*:before,*:after{box-sizing:border-box}body{margin:0;min-height:100vh;display:grid;place-items:center;padding:24px;background:linear-gradient(135deg,#eff6ff,#f8fbff 55%,#eef2ff);color:#0f172a;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}.card{width:min(100%,500px);padding:44px;border:1px solid #dbeafe;border-radius:28px;background:rgba(255,255,255,.96);box-shadow:0 24px 70px rgba(37,99,235,.14);text-align:center}.brand{display:inline-flex;align-items:center;gap:11px;margin-bottom:24px;color:#1d4ed8;font-size:20px;font-weight:800;letter-spacing:-.03em}.logo-mark{width:40px;height:40px}.client-brand{display:flex;align-items:center;gap:11px;width:max-content;max-width:100%;margin:0 auto 28px;padding:10px 14px;border:1px solid #dbeafe;border-radius:14px;color:#1e3a8a;font-size:14px;text-align:left}.client-brand img{width:32px;height:32px;object-fit:contain;border-radius:8px}.client-brand span{display:grid;gap:2px}.client-brand small{color:#64748b;font-size:11px;font-weight:600}.client-brand strong{font-size:14px}.status{display:grid;place-items:center;width:64px;height:64px;margin:0 auto 22px;border-radius:20px;background:${accent}18;color:${accent};font-size:32px;font-weight:800}.title{margin:0;font-size:30px;letter-spacing:-.04em}.message{margin:14px auto 0;max-width:30rem;color:#475569;font-size:16px;line-height:1.6}.hint{margin-top:28px;color:#64748b;font-size:13px}</style></head><body><main class="card"><div class="brand">${sendHoneyLogo}<span>SendHoney</span></div>${clientBrand}<div class="status">${icon}</div><h1 class="title">${title}</h1><p class="message">${message}</p><p class="hint">You may safely close this tab.</p></main></body></html>`
55
56
  }
56
57
 
57
58
  async function browserLogin(args, config) {
@@ -88,7 +89,7 @@ async function browserLogin(args, config) {
88
89
  openBrowser(loginUrl)
89
90
  stdout.write(`Opening Keycloak login in your browser (${callback})\n`)
90
91
  })
91
- return json({ ok: true, authenticated: true, orgId: result.session.orgId || undefined, apiUrl: result.session.apiUrl })
92
+ return json({ ok: true, authenticated: true, user: result.session.user, organization: result.session.organization, orgId: result.session.orgId || undefined, apiUrl: result.session.apiUrl })
92
93
  }
93
94
 
94
95
  async function refreshToken(config) {
@@ -413,7 +414,7 @@ async function login(args) {
413
414
  const body = await response.json().catch(() => ({}))
414
415
  if (!response.ok || !body.access_token) die(`login failed (${response.status}): ${body.error_description || body.error || 'no access token'}`)
415
416
  const session = await persistLoginSession(config, args, { authUrl, realm, clientId }, body)
416
- json({ ok: true, username, authenticated: true, orgId: session.orgId || undefined, apiUrl: session.apiUrl })
417
+ json({ ok: true, username, authenticated: true, user: session.user, organization: session.organization, orgId: session.orgId || undefined, apiUrl: session.apiUrl })
417
418
  }
418
419
 
419
420
  async function main() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendhoney/cli",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "SendHoney platform CLI for authenticated API, CRUD, release, and ThunderCompute operations.",
5
5
  "private": false,
6
6
  "bin": { "sendhoney": "bin/sendhoney" },