pindrop 0.1.5 → 0.1.6

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/README.md CHANGED
@@ -7,7 +7,7 @@ Works in any coding agent (Claude Code, Codex, Cursor, Antigravity, Gemini CLI,
7
7
  ## Quick start
8
8
 
9
9
  ```sh
10
- npx -y pindrop init
10
+ npx -y pindrop@latest init
11
11
  ```
12
12
 
13
13
  Or install globally:
@@ -23,6 +23,7 @@ On first run, `pindrop` opens PinDrop in your browser (PKCE OAuth), saves creden
23
23
 
24
24
  ```sh
25
25
  pindrop create [url] # create (or reuse) a project review link
26
+ pindrop link [projectId] # save .pindrop.json in this repo for your team
26
27
  pindrop projects # list active projects
27
28
  pindrop pins # list open pins for this repo
28
29
  pindrop pin 4 --screenshot # full context + save screenshot locally
package/cli.mjs CHANGED
@@ -15,10 +15,15 @@ import {
15
15
  saveLinkedProject,
16
16
  } from "./lib/auth.mjs";
17
17
  import { CliError, callPinDropTool, callSandboxApi } from "./lib/client.mjs";
18
- import { inferProjectHint, inferSiteUrl } from "./lib/project.mjs";
18
+ import {
19
+ inferProjectHint,
20
+ inferSiteUrl,
21
+ readRepoProjectConfig,
22
+ writeRepoProjectConfig,
23
+ } from "./lib/project.mjs";
19
24
  import { installSkillFiles } from "./lib/skill.mjs";
20
25
 
21
- const VERSION = "0.1.5";
26
+ const VERSION = "0.1.6";
22
27
 
23
28
  function parseArgv(argv) {
24
29
  const positionals = [];
@@ -146,10 +151,14 @@ function parsePinNumber(raw) {
146
151
  return n;
147
152
  }
148
153
 
154
+ function resolveSavedProjectLink(mcpUrl) {
155
+ return readRepoProjectConfig() ?? getLinkedProject(mcpUrl);
156
+ }
157
+
149
158
  async function resolveProjectIdForPin({ mcpUrl, flags, autoLogin }) {
150
159
  const explicit = flagStr(flags, "project", "p", "project-id");
151
160
  if (explicit) return explicit;
152
- const linked = getLinkedProject(mcpUrl);
161
+ const linked = resolveSavedProjectLink(mcpUrl);
153
162
  if (linked?.projectId && !flagStr(flags, "hint")) {
154
163
  return linked.projectId;
155
164
  }
@@ -201,7 +210,7 @@ function writeProjectNextSteps(projectId) {
201
210
  `Next: send the review link (no client account or script tag needed).\n`,
202
211
  );
203
212
  process.stdout.write(
204
- `Commands: npx -y pindrop pins${flag} · npx -y pindrop pin <n> --screenshot${flag} · npx -y pindrop resolve <n>${flag} --comment "<what changed>"\n`,
213
+ `Commands: npx -y pindrop@latest pins${flag} · npx -y pindrop@latest pin <n> --screenshot${flag} · npx -y pindrop@latest resolve <n>${flag} --comment "<what changed>"\n`,
205
214
  );
206
215
  }
207
216
 
@@ -216,6 +225,7 @@ Usage:
216
225
 
217
226
  pindrop projects List active PinDrop projects
218
227
  pindrop create [url] [--open] Create (or reuse) a review link for a live URL
228
+ pindrop link [projectId] Save .pindrop.json in this repo for your team
219
229
  pindrop open [n] [--project <id>] Open the review link (or pin #n) in your browser
220
230
  pindrop pins [--watch] [--once] [--project <id>] [--resolved] [--full] [--json]
221
231
  List (or live-watch) pins for this repo
@@ -420,8 +430,10 @@ export async function runCli(argv = process.argv.slice(2)) {
420
430
  if (p.projectId) process.stdout.write(`Project ID: ${p.projectId}\n`);
421
431
  if (shouldOpen) process.stderr.write(`Opened review link in your browser.\n`);
422
432
  for (const r of skillResults) {
423
- if (r.status === "installed") {
424
- process.stdout.write(`Installed skill: ${r.path}\n`);
433
+ if (r.status === "installed" || r.status === "updated") {
434
+ process.stdout.write(
435
+ `${r.status === "updated" ? "Updated" : "Installed"} skill: ${r.path}\n`,
436
+ );
425
437
  }
426
438
  }
427
439
  writeProjectNextSteps(p.projectId);
@@ -436,6 +448,8 @@ export async function runCli(argv = process.argv.slice(2)) {
436
448
  args: {},
437
449
  autoLogin,
438
450
  openBrowser,
451
+ pairId,
452
+ onPairingWaiting: announcePairingWait,
439
453
  onAuthorizeUrl: announceBrowserAuth,
440
454
  });
441
455
  if (asJson) {
@@ -525,6 +539,40 @@ export async function runCli(argv = process.argv.slice(2)) {
525
539
  return 0;
526
540
  }
527
541
 
542
+ case "link": {
543
+ const explicitProject = positionals[1] || flagStr(flags, "project", "p", "project-id");
544
+ const existingLink = resolveSavedProjectLink(mcpUrl);
545
+ let projectId = explicitProject || existingLink?.projectId || null;
546
+ let shareUrl = explicitProject ? null : existingLink?.shareUrl || null;
547
+ let targetUrl = explicitProject ? null : existingLink?.targetUrl || null;
548
+
549
+ if (!projectId) {
550
+ projectId = await resolveProjectIdForPin({ mcpUrl, flags, autoLogin });
551
+ }
552
+ if (!shareUrl) {
553
+ shareUrl = `https://www.pindrop.page/s/${encodeURIComponent(projectId)}`;
554
+ }
555
+ const written = writeRepoProjectConfig(process.cwd(), {
556
+ projectId,
557
+ shareUrl,
558
+ targetUrl,
559
+ });
560
+ saveLinkedProject(mcpUrl, process.cwd(), {
561
+ projectId,
562
+ shareUrl,
563
+ targetUrl,
564
+ });
565
+ if (asJson) {
566
+ printJson({ ok: true, ...written });
567
+ } else {
568
+ process.stdout.write(`Linked repo to project ${projectId} -> ${written.path}\n`);
569
+ process.stdout.write(
570
+ `Commit .pindrop.json (no secrets) so teammates automatically target this project.\n`,
571
+ );
572
+ }
573
+ return 0;
574
+ }
575
+
528
576
  case "open": {
529
577
  if (positionals[1]) {
530
578
  const pinNumber = parsePinNumber(positionals[1]);
@@ -545,7 +593,7 @@ export async function runCli(argv = process.argv.slice(2)) {
545
593
  return 0;
546
594
  }
547
595
  const explicitProject = flagStr(flags, "project", "p", "project-id");
548
- const linked = !explicitProject ? getLinkedProject(mcpUrl) : null;
596
+ const linked = !explicitProject ? resolveSavedProjectLink(mcpUrl) : null;
549
597
  let url = linked?.shareUrl || null;
550
598
  let projectId = explicitProject || linked?.projectId || null;
551
599
  if (!url) {
@@ -562,7 +610,9 @@ export async function runCli(argv = process.argv.slice(2)) {
562
610
  case "pins": {
563
611
  const explicitProject = flagStr(flags, "project", "p", "project-id");
564
612
  const linkedProject =
565
- !explicitProject && !flagStr(flags, "hint") ? getLinkedProject(mcpUrl)?.projectId : undefined;
613
+ !explicitProject && !flagStr(flags, "hint")
614
+ ? resolveSavedProjectLink(mcpUrl)?.projectId
615
+ : undefined;
566
616
  const projectId = explicitProject || linkedProject;
567
617
  const hint = projectId ? undefined : flagStr(flags, "hint") || inferProjectHint();
568
618
  const limit = flagInt(flags, "limit", "n");
@@ -648,6 +698,8 @@ export async function runCli(argv = process.argv.slice(2)) {
648
698
  args,
649
699
  autoLogin,
650
700
  openBrowser,
701
+ pairId,
702
+ onPairingWaiting: announcePairingWait,
651
703
  onAuthorizeUrl: announceBrowserAuth,
652
704
  });
653
705
  if (asJson) {
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.5",
23
+ "User-Agent": "pindrop-cli/0.1.6",
24
24
  },
25
25
  body: JSON.stringify({
26
26
  jsonrpc: "2.0",
@@ -171,7 +171,7 @@ export async function callSandboxApi({
171
171
  headers: {
172
172
  Accept: "application/json",
173
173
  Authorization: `Sandbox ${claimCode}`,
174
- "User-Agent": "pindrop-cli/0.1.5",
174
+ "User-Agent": "pindrop-cli/0.1.6",
175
175
  ...(body !== undefined ? { "Content-Type": "application/json" } : {}),
176
176
  },
177
177
  ...(body !== undefined ? { body: JSON.stringify(body) } : {}),
package/lib/project.mjs CHANGED
@@ -1,6 +1,60 @@
1
1
  import { execFileSync } from "node:child_process";
2
- import { existsSync, readFileSync } from "node:fs";
3
- import { basename, join } from "node:path";
2
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
3
+ import { basename, dirname, join, resolve } from "node:path";
4
+
5
+ export const REPO_CONFIG_FILENAME = ".pindrop.json";
6
+
7
+ export function readRepoProjectConfig(cwd = process.cwd()) {
8
+ let dir = resolve(cwd);
9
+ for (let depth = 0; depth < 25; depth += 1) {
10
+ const file = join(dir, REPO_CONFIG_FILENAME);
11
+ if (existsSync(file)) {
12
+ try {
13
+ const parsed = JSON.parse(readFileSync(file, "utf8"));
14
+ const projectId =
15
+ typeof parsed?.projectId === "string" && parsed.projectId.trim().length > 0
16
+ ? parsed.projectId.trim()
17
+ : null;
18
+ if (projectId) {
19
+ return {
20
+ path: file,
21
+ projectId,
22
+ shareUrl:
23
+ typeof parsed.shareUrl === "string" && parsed.shareUrl.trim().length > 0
24
+ ? parsed.shareUrl.trim()
25
+ : null,
26
+ targetUrl:
27
+ typeof parsed.targetUrl === "string" && parsed.targetUrl.trim().length > 0
28
+ ? parsed.targetUrl.trim()
29
+ : null,
30
+ };
31
+ }
32
+ } catch {
33
+ // Ignore malformed .pindrop.json and fall back to other project hints.
34
+ }
35
+ return null;
36
+ }
37
+ if (existsSync(join(dir, ".git"))) break;
38
+ const parent = dirname(dir);
39
+ if (parent === dir) break;
40
+ dir = parent;
41
+ }
42
+ return null;
43
+ }
44
+
45
+ export function writeRepoProjectConfig(cwd, { projectId, shareUrl, targetUrl }) {
46
+ if (!projectId || typeof projectId !== "string" || !projectId.trim()) {
47
+ throw new Error("projectId is required to write .pindrop.json.");
48
+ }
49
+ const file = join(resolve(cwd), REPO_CONFIG_FILENAME);
50
+ const payload = {
51
+ projectId: projectId.trim(),
52
+ ...(shareUrl ? { shareUrl } : {}),
53
+ ...(targetUrl ? { targetUrl } : {}),
54
+ };
55
+ writeFileSync(file, JSON.stringify(payload, null, 2) + "\n", "utf8");
56
+ return { path: file, ...payload };
57
+ }
4
58
 
5
59
  const IGNORED_HOSTS = new Set([
6
60
  "localhost",
package/lib/skill.mjs CHANGED
@@ -1,9 +1,23 @@
1
+ import { createHash } from "node:crypto";
1
2
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
3
  import { homedir } from "node:os";
3
4
  import { dirname, join } from "node:path";
4
5
  import { fileURLToPath } from "node:url";
5
6
 
6
7
  const SKILL_SOURCE_PATH = fileURLToPath(new URL("../skill/SKILL.md", import.meta.url));
8
+ const MANAGED_SKILL_MARKER = /<!--\s*pindrop-skill-managed:\s*[^\s>]+\s*-->/;
9
+ // Unmodified SHA-256 digests of earlier bundled SKILL.md releases (v0.1.0-v0.1.5)
10
+ // that predate the managed marker, so re-running `pindrop init` / `skill install`
11
+ // upgrades them cleanly without clobbering user-edited skills.
12
+ const KNOWN_BUNDLED_SKILL_HASHES = new Set([
13
+ "c985698acaf0efb14f28d1c1f3766a429bfac0c74a1067435282691970cd57e1",
14
+ ]);
15
+
16
+ function isManagedBundledSkill(content) {
17
+ if (MANAGED_SKILL_MARKER.test(content)) return true;
18
+ const digest = createHash("sha256").update(content, "utf8").digest("hex");
19
+ return KNOWN_BUNDLED_SKILL_HASHES.has(digest);
20
+ }
7
21
 
8
22
  export function readBundledSkill() {
9
23
  return readFileSync(SKILL_SOURCE_PATH, "utf8");
@@ -83,20 +97,22 @@ export function installSkillFiles({
83
97
  const results = [];
84
98
 
85
99
  for (const target of targets) {
100
+ let wasManagedUpdate = false;
86
101
  if (existsSync(target.path)) {
87
102
  const existing = readFileSync(target.path, "utf8");
88
103
  if (existing === content) {
89
104
  results.push({ ...target, status: "unchanged" });
90
105
  continue;
91
106
  }
92
- if (!force) {
107
+ if (!force && !isManagedBundledSkill(existing)) {
93
108
  results.push({ ...target, status: "skipped_modified" });
94
109
  continue;
95
110
  }
111
+ wasManagedUpdate = !force && isManagedBundledSkill(existing);
96
112
  }
97
113
  mkdirSync(dirname(target.path), { recursive: true });
98
114
  writeFileSync(target.path, content, "utf8");
99
- results.push({ ...target, status: "installed" });
115
+ results.push({ ...target, status: wasManagedUpdate ? "updated" : "installed" });
100
116
  }
101
117
 
102
118
  return results;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pindrop",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
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": {
package/skill/SKILL.md CHANGED
@@ -53,3 +53,7 @@ equivalent when already connected.
53
53
  list open pins, and resolve each immediately with `--new-text "<replacement>"`
54
54
  (change no code).
55
55
  - If the user asks "anything from the client?", run `pindrop pins` first.
56
+ - For teams sharing a repo, `.pindrop.json` (created with `pindrop link`) pins
57
+ the repo to its PinDrop project without storing credentials.
58
+
59
+ <!-- pindrop-skill-managed: v2 -->