beads-map 0.2.1 → 0.2.3

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/app/page.tsx CHANGED
@@ -890,7 +890,7 @@ export default function Home() {
890
890
  {projectName}
891
891
  </h1>
892
892
  <span className="font-normal text-zinc-400 text-[15px] hidden sm:inline">
893
- Beads
893
+ heartbeads
894
894
  </span>
895
895
  {repoCount > 1 && (
896
896
  <span className="text-[10px] text-zinc-400 bg-zinc-100 rounded-full px-1.5 py-0.5 font-medium hidden sm:inline">
package/bin/beads-map.mjs CHANGED
@@ -10,6 +10,38 @@ import { fileURLToPath } from "url";
10
10
  const __dirname = fileURLToPath(new URL(".", import.meta.url));
11
11
  const viewerRoot = resolve(__dirname, "..");
12
12
 
13
+ // Load .env.local and .env from the user's working directory.
14
+ // Next.js only loads these from its own cwd (the package dir), not from where
15
+ // the user invoked the CLI. This ensures PUBLIC_URL, ATPROTO_JWK_PRIVATE, etc.
16
+ // are available when running `npx beads-map` from a project directory.
17
+ for (const envFile of [".env.local", ".env"]) {
18
+ const envPath = join(process.cwd(), envFile);
19
+ if (existsSync(envPath)) {
20
+ try {
21
+ const content = readFileSync(envPath, "utf-8");
22
+ for (const line of content.split("\n")) {
23
+ const trimmed = line.trim();
24
+ if (!trimmed || trimmed.startsWith("#")) continue;
25
+ const eqIdx = trimmed.indexOf("=");
26
+ if (eqIdx === -1) continue;
27
+ const key = trimmed.slice(0, eqIdx).trim();
28
+ let val = trimmed.slice(eqIdx + 1).trim();
29
+ // Strip surrounding quotes
30
+ if ((val.startsWith('"') && val.endsWith('"')) ||
31
+ (val.startsWith("'") && val.endsWith("'"))) {
32
+ val = val.slice(1, -1);
33
+ }
34
+ // Don't override existing env vars (explicit shell vars win)
35
+ if (!(key in process.env)) {
36
+ process.env[key] = val;
37
+ }
38
+ }
39
+ } catch {
40
+ // ignore read errors
41
+ }
42
+ }
43
+ }
44
+
13
45
  // Parse CLI args
14
46
  const args = process.argv.slice(2);
15
47
  let port = 3000;
@@ -136,23 +136,23 @@ export const createClient = async () => {
136
136
  const localhostUrl = `http://127.0.0.1:${env.PORT}`;
137
137
  const enc = encodeURIComponent;
138
138
 
139
- // Detect if we're running on localhost (dev mode)
140
- const isLocalDev = process.env.NODE_ENV !== "production";
141
-
142
- // Use localhost URL in development, production URL otherwise
143
- const url = isLocalDev ? localhostUrl : publicUrl || localhostUrl;
139
+ // Confidential client mode is determined by having both PUBLIC_URL and a JWK
140
+ // private key — not by NODE_ENV. This lets remote deployments work regardless
141
+ // of how Next.js was started (next dev vs next start).
142
+ const hasJwk = !!env.ATPROTO_JWK_PRIVATE;
143
+ const hasPublicUrl = !!publicUrl;
144
144
 
145
145
  let keyset = null;
146
146
  try {
147
- // Only load keyset for production (confidential client)
148
- if (!isLocalDev && publicUrl) {
147
+ if (hasJwk && hasPublicUrl) {
149
148
  keyset = await getKeyset();
150
149
  }
151
150
  } catch (err) {
152
151
  console.error("Error getting keyset:", err);
153
152
  }
154
153
 
155
- const isConfidentialClient = keyset !== null && !!publicUrl && !isLocalDev;
154
+ const isConfidentialClient = keyset !== null && hasPublicUrl;
155
+ const url = isConfidentialClient ? publicUrl : localhostUrl;
156
156
 
157
157
  // Build client metadata based on client type
158
158
  const clientMetadata: Record<string, unknown> = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beads-map",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Interactive dependency graph viewer for beads (bd) issues",
5
5
  "keywords": [
6
6
  "beads",