pindrop 0.1.0 → 0.1.2
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/cli.mjs +1 -1
- package/lib/auth.mjs +100 -32
- package/lib/client.mjs +1 -1
- package/package.json +3 -3
package/cli.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { CliError, callPinDropTool } from "./lib/client.mjs";
|
|
|
13
13
|
import { inferProjectHint, inferSiteUrl } from "./lib/project.mjs";
|
|
14
14
|
import { installSkillFiles } from "./lib/skill.mjs";
|
|
15
15
|
|
|
16
|
-
const VERSION = "0.1.
|
|
16
|
+
const VERSION = "0.1.2";
|
|
17
17
|
|
|
18
18
|
function parseArgv(argv) {
|
|
19
19
|
const positionals = [];
|
package/lib/auth.mjs
CHANGED
|
@@ -177,27 +177,113 @@ export async function discoverOAuth(mcpUrl, fetchImpl = fetch) {
|
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
const CALLBACK_PAGES = {
|
|
181
|
+
connected: {
|
|
182
|
+
ok: true,
|
|
183
|
+
tab: "PinDrop CLI connected",
|
|
184
|
+
headline: "Connected.",
|
|
185
|
+
lead: "Head back to your terminal. The PinDrop CLI takes it from here.",
|
|
186
|
+
},
|
|
187
|
+
cancelled: {
|
|
188
|
+
ok: false,
|
|
189
|
+
tab: "PinDrop sign-in cancelled",
|
|
190
|
+
headline: "Not connected.",
|
|
191
|
+
lead: "Authorization was denied.",
|
|
192
|
+
},
|
|
193
|
+
invalid: {
|
|
194
|
+
ok: false,
|
|
195
|
+
tab: "PinDrop sign-in failed",
|
|
196
|
+
headline: "Not connected.",
|
|
197
|
+
lead: "State mismatch or missing authorization code.",
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
function escapeHtml(value) {
|
|
202
|
+
return String(value).replace(/[&<>"']/g, (c) => `&#${c.charCodeAt(0)};`);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function callbackHtml(kind, { detail, port } = {}) {
|
|
206
|
+
const page = CALLBACK_PAGES[kind];
|
|
207
|
+
const { ok } = page;
|
|
208
|
+
const lead = detail ? escapeHtml(detail) : page.lead;
|
|
209
|
+
const glyph = ok
|
|
210
|
+
? `<path d="M5 12.5l4.2 4.2L19 7" stroke="currentColor" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round"/>`
|
|
211
|
+
: `<path d="M7 7l10 10M17 7L7 17" stroke="currentColor" stroke-width="2.6" stroke-linecap="round"/>`;
|
|
212
|
+
const meta = ok ? `pindrop cli · 127.0.0.1:${port}` : "no token saved";
|
|
182
213
|
return `<!doctype html>
|
|
183
214
|
<html lang="en">
|
|
184
215
|
<head>
|
|
185
216
|
<meta charset="utf-8" />
|
|
186
217
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
187
|
-
<
|
|
218
|
+
<meta name="referrer" content="no-referrer" />
|
|
219
|
+
<title>${page.tab}</title>
|
|
220
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
221
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
222
|
+
<link href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap" rel="stylesheet" />
|
|
188
223
|
<style>
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
224
|
+
:root {
|
|
225
|
+
--paper: #ffffff; --raised: #faf7f3; --bg: #f5f1eb;
|
|
226
|
+
--ink: #1d1a17; --ink-2: #5b554d; --ink-3: #8b857c; --rule-2: #e2dbd1;
|
|
227
|
+
--radius-pin: 50% 50% 50% 14%;
|
|
228
|
+
--ease-out: cubic-bezier(.23,1,.32,1);
|
|
229
|
+
--ease-land: cubic-bezier(.34,1.56,.64,1);
|
|
230
|
+
--sans: Geist, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
|
|
231
|
+
--mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
232
|
+
}
|
|
233
|
+
* { box-sizing: border-box; }
|
|
234
|
+
html, body { margin: 0; }
|
|
235
|
+
body { background: var(--raised); color: var(--ink); font: 400 13.5px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
|
|
236
|
+
.kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px; background: var(--paper); box-shadow: 0 0 0 1px var(--rule-2), 0 1px 0 var(--rule-2); font: 500 11px/1 var(--mono); color: var(--ink-2); }
|
|
237
|
+
.closes { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ink-3); }
|
|
238
|
+
.closes > span:last-child { margin-left: 4px; }
|
|
239
|
+
.cmd { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 9px; background: var(--paper); box-shadow: 0 0 0 1px var(--rule-2); font: 400 12.5px/1 var(--mono); color: var(--ink); margin-top: 18px; animation: up 260ms var(--ease-out) 240ms both; }
|
|
240
|
+
.cmd span { color: var(--ink-3); user-select: none; }
|
|
241
|
+
.cmd code { font: inherit; user-select: all; }
|
|
242
|
+
.live { width: 7px; height: 7px; border-radius: 50%; background: var(--state); box-shadow: 0 0 0 3px rgb(var(--state-rgb) / .16); }
|
|
243
|
+
@keyframes fade { from { opacity: 0; } }
|
|
244
|
+
@keyframes draw { to { stroke-dashoffset: 0; } }
|
|
245
|
+
@keyframes up { from { opacity: 0; transform: translateY(6px); } }
|
|
246
|
+
|
|
247
|
+
.p { min-height: 100dvh; display: grid; place-items: center; padding: 56px 16px 120px; text-align: center; overflow: hidden; --state: #1f9d55; --state-rgb: 31 157 85; --state-deep: 20 90 50; }
|
|
248
|
+
.p[data-state="error"] { --state: #c8361a; --state-rgb: 200 54 26; --state-deep: 140 40 15; }
|
|
249
|
+
.p-stage { position: relative; width: 152px; height: 152px; margin: 0 auto 44px; }
|
|
250
|
+
.p-ground { position: absolute; left: -26px; bottom: -22px; width: 120px; height: 22px; border-radius: 50%; background: radial-gradient(closest-side, rgba(60,40,30,.22), transparent); opacity: .85; animation: p-ground 480ms var(--ease-land) both; }
|
|
251
|
+
@keyframes p-ground { from { opacity: 0; transform: scale(.4); } }
|
|
252
|
+
.p-ring { position: absolute; left: -2px; bottom: -14px; width: 60px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 2px rgb(var(--state-rgb) / .4); opacity: 0; animation: p-ring 520ms var(--ease-out) 200ms forwards; }
|
|
253
|
+
@keyframes p-ring { 0% { opacity: .9; transform: scale(.5); } 100% { opacity: 0; transform: scale(2.6); } }
|
|
254
|
+
.p-pin { position: relative; width: 152px; height: 152px; border-radius: var(--radius-pin); background: var(--state); color: var(--paper); border: 6px solid var(--paper); box-shadow: 0 34px 50px -24px rgb(var(--state-deep) / .5), 0 8px 18px -8px rgb(var(--state-deep) / .3); display: grid; place-items: center; transform-origin: 22px 140px; animation: p-drop 480ms var(--ease-land) both; }
|
|
255
|
+
@keyframes p-drop { from { opacity: 0; transform: translateY(-72px) scale(.94, 1.06); } }
|
|
256
|
+
.p-pin svg { width: 62px; height: 62px; }
|
|
257
|
+
.p-pin path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw 240ms var(--ease-out) 300ms forwards; }
|
|
258
|
+
.p-title { margin: 0; font: 600 clamp(46px, 9vw, 76px)/.98 var(--sans); letter-spacing: -.048em; text-wrap: balance; animation: up 260ms var(--ease-out) 140ms both; }
|
|
259
|
+
.p-lead { margin: 16px auto 0; max-width: 360px; font-size: 16px; color: var(--ink-2); text-wrap: pretty; overflow-wrap: anywhere; animation: up 260ms var(--ease-out) 190ms both; }
|
|
260
|
+
.p-meta { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px 18px; margin-top: 30px; animation: up 260ms var(--ease-out) 290ms both; }
|
|
261
|
+
.p-meta code { display: inline-flex; align-items: center; gap: 7px; font: 400 12px/1 var(--mono); color: var(--ink-3); }
|
|
262
|
+
|
|
263
|
+
@media (prefers-reduced-motion: reduce) {
|
|
264
|
+
.p-pin, .p-ground, .p-title, .p-lead, .p-meta, .cmd { animation: fade 200ms ease-out both !important; transform: none !important; }
|
|
265
|
+
.p-ring { display: none; }
|
|
266
|
+
.p-pin path { animation: none; stroke-dashoffset: 0; }
|
|
267
|
+
}
|
|
194
268
|
</style>
|
|
195
269
|
</head>
|
|
196
270
|
<body>
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
<p
|
|
271
|
+
<main class="p" data-state="${ok ? "ok" : "error"}">
|
|
272
|
+
<div>
|
|
273
|
+
<div class="p-stage" aria-hidden="true">
|
|
274
|
+
<span class="p-ground"></span>
|
|
275
|
+
<span class="p-ring"></span>
|
|
276
|
+
<div class="p-pin"><svg viewBox="0 0 24 24" fill="none">${glyph}</svg></div>
|
|
277
|
+
</div>
|
|
278
|
+
<h1 class="p-title">${page.headline}</h1>
|
|
279
|
+
<p class="p-lead">${lead}${ok ? "" : "<br>Run this in your terminal to try again:"}</p>
|
|
280
|
+
${ok ? "" : `<div class="cmd"><span aria-hidden="true">$</span><code>pindrop login</code></div>`}
|
|
281
|
+
<div class="p-meta"><code><span class="live"></span>${meta}</code><span class="closes"><span class="kbd" id="mod">⌘</span><span class="kbd">W</span><span>closes this tab</span></span></div>
|
|
200
282
|
</div>
|
|
283
|
+
</main>
|
|
284
|
+
<script>
|
|
285
|
+
if (!/Mac|iPhone|iPad/.test(navigator.platform)) document.getElementById("mod").textContent = "Ctrl";
|
|
286
|
+
</script>
|
|
201
287
|
</body>
|
|
202
288
|
</html>`;
|
|
203
289
|
}
|
|
@@ -226,13 +312,7 @@ function startCallbackServer(expectedState, timeoutMs = LOGIN_TIMEOUT_MS) {
|
|
|
226
312
|
|
|
227
313
|
if (error) {
|
|
228
314
|
res.writeHead(400, { "Content-Type": "text/html; charset=utf-8" });
|
|
229
|
-
res.end(
|
|
230
|
-
callbackHtml(
|
|
231
|
-
"PinDrop sign-in cancelled",
|
|
232
|
-
errorDesc || error || "Authorization was denied.",
|
|
233
|
-
false,
|
|
234
|
-
),
|
|
235
|
-
);
|
|
315
|
+
res.end(callbackHtml("cancelled", { detail: errorDesc || error }));
|
|
236
316
|
if (!settled) {
|
|
237
317
|
settled = true;
|
|
238
318
|
clearTimeout(timer);
|
|
@@ -244,24 +324,12 @@ function startCallbackServer(expectedState, timeoutMs = LOGIN_TIMEOUT_MS) {
|
|
|
244
324
|
|
|
245
325
|
if (!code || state !== expectedState) {
|
|
246
326
|
res.writeHead(400, { "Content-Type": "text/html; charset=utf-8" });
|
|
247
|
-
res.end(
|
|
248
|
-
callbackHtml(
|
|
249
|
-
"Invalid OAuth callback",
|
|
250
|
-
"State mismatch or missing authorization code. Try running pindrop login again.",
|
|
251
|
-
false,
|
|
252
|
-
),
|
|
253
|
-
);
|
|
327
|
+
res.end(callbackHtml("invalid"));
|
|
254
328
|
return;
|
|
255
329
|
}
|
|
256
330
|
|
|
257
331
|
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
258
|
-
res.end(
|
|
259
|
-
callbackHtml(
|
|
260
|
-
"PinDrop CLI connected",
|
|
261
|
-
"You can close this tab and return to your terminal or coding agent.",
|
|
262
|
-
true,
|
|
263
|
-
),
|
|
264
|
-
);
|
|
332
|
+
res.end(callbackHtml("connected", { port: req.socket.localPort }));
|
|
265
333
|
if (!settled) {
|
|
266
334
|
settled = true;
|
|
267
335
|
clearTimeout(timer);
|
package/lib/client.mjs
CHANGED
|
@@ -20,7 +20,7 @@ async function postMcp(mcpUrl, token, toolName, args, fetchImpl = fetch) {
|
|
|
20
20
|
"Content-Type": "application/json",
|
|
21
21
|
Accept: "application/json, text/event-stream",
|
|
22
22
|
Authorization: `Bearer ${token}`,
|
|
23
|
-
"User-Agent": "pindrop-cli/0.1.
|
|
23
|
+
"User-Agent": "pindrop-cli/0.1.2",
|
|
24
24
|
},
|
|
25
25
|
body: JSON.stringify({
|
|
26
26
|
jsonrpc: "2.0",
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pindrop",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Zero-dependency CLI for PinDrop visual client feedback pins. Browser OAuth login, instant project creation, pin context & screenshots, and agent skill setup.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"pindrop": "
|
|
7
|
+
"pindrop": "cli.mjs"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"cli.mjs",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "https://github.com/Quirk2237/pindrop.git",
|
|
20
|
+
"url": "git+https://github.com/Quirk2237/pindrop.git",
|
|
21
21
|
"directory": "packages/pindrop-cli"
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://www.pindrop.page/guide",
|