beadscope 0.5.0 → 0.6.0

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 (125) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/fallback-build-manifest.json +3 -3
  4. package/.next/next-server.js.nft.json +1 -1
  5. package/.next/prerender-manifest.json +4 -4
  6. package/.next/required-server-files.js +8 -8
  7. package/.next/required-server-files.json +8 -8
  8. package/.next/server/app/_global-error.html +1 -1
  9. package/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  14. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/_not-found.html +2 -2
  16. package/.next/server/app/_not-found.rsc +4 -4
  17. package/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
  18. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +4 -4
  19. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  20. package/.next/server/app/api/config/route.js.nft.json +1 -1
  21. package/.next/server/app/api/fs/route.js.nft.json +1 -1
  22. package/.next/server/app/api/p/[projectId]/activity/route.js.nft.json +1 -1
  23. package/.next/server/app/api/p/[projectId]/attachments/[...path]/route.js.nft.json +1 -1
  24. package/.next/server/app/api/p/[projectId]/attachments/route.js.nft.json +1 -1
  25. package/.next/server/app/api/p/[projectId]/beads/[id]/archive/route.js.nft.json +1 -1
  26. package/.next/server/app/api/p/[projectId]/beads/[id]/assist/route.js.nft.json +1 -1
  27. package/.next/server/app/api/p/[projectId]/beads/[id]/comments/route.js.nft.json +1 -1
  28. package/.next/server/app/api/p/[projectId]/beads/[id]/deps/route.js.nft.json +1 -1
  29. package/.next/server/app/api/p/[projectId]/beads/[id]/gate/route.js.nft.json +1 -1
  30. package/.next/server/app/api/p/[projectId]/beads/[id]/human/route.js.nft.json +1 -1
  31. package/.next/server/app/api/p/[projectId]/beads/[id]/route.js.nft.json +1 -1
  32. package/.next/server/app/api/p/[projectId]/beads/[id]/status/route.js.nft.json +1 -1
  33. package/.next/server/app/api/p/[projectId]/beads/route.js.nft.json +1 -1
  34. package/.next/server/app/api/p/[projectId]/beads/stream/route.js.nft.json +1 -1
  35. package/.next/server/app/api/p/[projectId]/doctor/route.js.nft.json +1 -1
  36. package/.next/server/app/api/p/[projectId]/gamification/route.js.nft.json +1 -1
  37. package/.next/server/app/api/p/[projectId]/insights/route.js.nft.json +1 -1
  38. package/.next/server/app/api/p/[projectId]/order/route.js.nft.json +1 -1
  39. package/.next/server/app/api/p/[projectId]/publish/route.js.nft.json +1 -1
  40. package/.next/server/app/api/projects/[id]/route.js.nft.json +1 -1
  41. package/.next/server/app/api/projects/route.js.nft.json +1 -1
  42. package/.next/server/app/api/telemetry/route.js.nft.json +1 -1
  43. package/.next/server/app/api/update/check/route.js +3 -3
  44. package/.next/server/app/api/update/check/route.js.nft.json +1 -1
  45. package/.next/server/app/api/update/run/route.js +3 -3
  46. package/.next/server/app/api/update/run/route.js.nft.json +1 -1
  47. package/.next/server/app/api/viewer-mode/route.js.nft.json +1 -1
  48. package/.next/server/app/index.html +2 -2
  49. package/.next/server/app/index.rsc +7 -7
  50. package/.next/server/app/index.segments/__PAGE__.segment.rsc +7 -7
  51. package/.next/server/app/index.segments/_full.segment.rsc +7 -7
  52. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  53. package/.next/server/app/p/[projectId]/page.js.nft.json +1 -1
  54. package/.next/server/app/p/[projectId]/page_client-reference-manifest.js +1 -1
  55. package/.next/server/app/page.js.nft.json +1 -1
  56. package/.next/server/app/page_client-reference-manifest.js +1 -1
  57. package/.next/server/chunks/[root-of-the-server]__0190u3x31o2kc._.js +1 -1
  58. package/.next/server/chunks/[root-of-the-server]__0190u3x31o2kc._.js.map +1 -1
  59. package/.next/server/chunks/[root-of-the-server]__1-f7qk3-8a266._.js +1 -1
  60. package/.next/server/chunks/[root-of-the-server]__1zrubp2jc8bi0._.js +1 -1
  61. package/.next/server/chunks/_004qegokrf7fy._.js +1 -1
  62. package/.next/server/chunks/_004qegokrf7fy._.js.map +1 -1
  63. package/.next/server/chunks/_0vx1iev9xu_vx._.js +1 -1
  64. package/.next/server/chunks/_0vx1iev9xu_vx._.js.map +1 -1
  65. package/.next/server/chunks/_10s9tyeasgb0i._.js +1 -1
  66. package/.next/server/chunks/_10s9tyeasgb0i._.js.map +1 -1
  67. package/.next/server/chunks/_146xyuw6iu78n._.js +1 -1
  68. package/.next/server/chunks/_146xyuw6iu78n._.js.map +1 -1
  69. package/.next/server/chunks/_1n-6yntr59hz-._.js +1 -1
  70. package/.next/server/chunks/_1n-6yntr59hz-._.js.map +1 -1
  71. package/.next/server/chunks/_1tji4d-rsralm._.js +1 -1
  72. package/.next/server/chunks/lib_beads-view_ts_1fvxcrevh9zu_._.js +1 -1
  73. package/.next/server/chunks/lib_beads-view_ts_1fvxcrevh9zu_._.js.map +1 -1
  74. package/.next/server/chunks/lib_config_ts_0zrjxh_mm8sv8._.js +1 -1
  75. package/.next/server/chunks/lib_config_ts_0zrjxh_mm8sv8._.js.map +1 -1
  76. package/.next/server/chunks/lib_self-update_ts_1s_0im4leryko._.js +1 -1
  77. package/.next/server/chunks/lib_self-update_ts_1s_0im4leryko._.js.map +1 -1
  78. package/.next/server/chunks/ssr/[root-of-the-server]__10sjsc4ko7y98._.js +1 -1
  79. package/.next/server/chunks/ssr/[root-of-the-server]__10sjsc4ko7y98._.js.map +1 -1
  80. package/.next/server/chunks/ssr/[root-of-the-server]__1xizcyi5hek65._.js +7 -7
  81. package/.next/server/chunks/ssr/[root-of-the-server]__1xizcyi5hek65._.js.map +1 -1
  82. package/.next/server/chunks/ssr/_0_ky_k50rh6-9._.js +1 -1
  83. package/.next/server/chunks/ssr/_0_ky_k50rh6-9._.js.map +1 -1
  84. package/.next/server/chunks/ssr/_16j7dxy5pqj44._.js +291 -0
  85. package/.next/server/chunks/ssr/_16j7dxy5pqj44._.js.map +1 -0
  86. package/.next/server/chunks/ssr/_1bulx6_unf6c7._.js +3 -0
  87. package/.next/server/chunks/ssr/_1bulx6_unf6c7._.js.map +1 -0
  88. package/.next/server/chunks/ssr/_1mzldxegsozij._.js +1 -1
  89. package/.next/server/chunks/ssr/_1mzldxegsozij._.js.map +1 -1
  90. package/.next/server/chunks/ssr/_1obdc2e416ry-._.js +3 -0
  91. package/.next/server/chunks/ssr/_1obdc2e416ry-._.js.map +1 -0
  92. package/.next/server/chunks/ssr/components_launcher_tsx_1i40oht1v6miz._.js +1 -1
  93. package/.next/server/chunks/ssr/components_launcher_tsx_1i40oht1v6miz._.js.map +1 -1
  94. package/.next/server/chunks/ssr/components_providers_tsx_0thx-xfvr_dtx._.js.map +1 -1
  95. package/.next/server/middleware-build-manifest.js +3 -3
  96. package/.next/server/middleware.js.nft.json +1 -1
  97. package/.next/server/pages/404.html +2 -2
  98. package/.next/server/pages/500.html +1 -1
  99. package/.next/server/preview-props.json +3 -3
  100. package/.next/server/server-reference-manifest.js +1 -1
  101. package/.next/server/server-reference-manifest.json +1 -1
  102. package/.next/static/chunks/0gexf4-utluu4.js +1 -0
  103. package/.next/static/chunks/23nopl40nheqr.js +1 -0
  104. package/.next/static/chunks/2c10hhzk7mgkf.js +58 -0
  105. package/.next/static/chunks/2n4lv4u0xo5oz.css +3 -0
  106. package/.next/static/chunks/3m8u_309a1_fw.js +1 -0
  107. package/.next/static/chunks/3tepw2noo82tm.js +1 -0
  108. package/README.md +91 -25
  109. package/bin/beadscope.mjs +75 -32
  110. package/package.json +2 -1
  111. package/.next/server/chunks/ssr/_02mwe4ucwaopu._.js +0 -291
  112. package/.next/server/chunks/ssr/_02mwe4ucwaopu._.js.map +0 -1
  113. package/.next/server/chunks/ssr/_1020o02v8ucmf._.js +0 -3
  114. package/.next/server/chunks/ssr/_1020o02v8ucmf._.js.map +0 -1
  115. package/.next/server/chunks/ssr/_1i_x4qkev3tax._.js +0 -3
  116. package/.next/server/chunks/ssr/_1i_x4qkev3tax._.js.map +0 -1
  117. package/.next/static/chunks/07balm4l-kilq.js +0 -1
  118. package/.next/static/chunks/0lf_v5uyq3i9q.js +0 -1
  119. package/.next/static/chunks/21v6r4y8vgqng.css +0 -3
  120. package/.next/static/chunks/2xh00k9l33qnb.js +0 -1
  121. package/.next/static/chunks/3yk880zca6oid.js +0 -58
  122. package/.next/static/chunks/3yqhmu1hny1_2.js +0 -1
  123. /package/.next/static/{CNwJGIAhEiVMAkf3ebvok → BoR0CvHf7BXhmN1hRjwWk}/_buildManifest.js +0 -0
  124. /package/.next/static/{CNwJGIAhEiVMAkf3ebvok → BoR0CvHf7BXhmN1hRjwWk}/_clientMiddlewareManifest.js +0 -0
  125. /package/.next/static/{CNwJGIAhEiVMAkf3ebvok → BoR0CvHf7BXhmN1hRjwWk}/_ssgManifest.js +0 -0
package/bin/beadscope.mjs CHANGED
@@ -45,7 +45,7 @@ const STOP_GRACE_MS = 4000;
45
45
  /** A server started this recently is trusted on its PID alone (still booting). */
46
46
  const STARTUP_GRACE_MS = 60000;
47
47
 
48
- const COMMANDS = ["start", "stop", "status", "logs", "run"];
48
+ const COMMANDS = ["start", "stop", "status", "logs", "run", "add"];
49
49
 
50
50
  function printHelp(stream = process.stdout) {
51
51
  stream.write(`
@@ -66,8 +66,12 @@ Commands:
66
66
  -f, --follow Keep printing new output (Ctrl+C to quit).
67
67
  -n, --lines <n> How many lines to show (default 50).
68
68
  run Run the server in the foreground; Ctrl+C stops it.
69
+ add [path] Add a beads repo (a folder with a .beads directory) to the Beadscope
70
+ that is already running, then print its URL. Uses the current folder
71
+ unless you give a path. It never starts a server, so it works with
72
+ a Beadscope run by a login service. Add --port if it is not on 3000.
69
73
 
70
- Options (start, run):
74
+ Options (start, run, add):
71
75
  -p, --port <n> Port to use (default 3000, or $PORT). Auto-picks a free
72
76
  port if the default is busy; with an explicit --port it
73
77
  fails instead of moving.
@@ -102,6 +106,8 @@ function parseArgs(argv) {
102
106
  opts.host = a.slice("--host=".length);
103
107
  } else if (!a.startsWith("-") && opts.command === undefined) {
104
108
  opts.command = a; // first bare word is the subcommand
109
+ } else if (!a.startsWith("-") && opts.arg === undefined) {
110
+ opts.arg = a; // second bare word: the folder for `add`
105
111
  }
106
112
  }
107
113
  opts.portExplicit = portExplicit;
@@ -247,39 +253,44 @@ function openBrowser(url) {
247
253
  }
248
254
 
249
255
  /** If invoked from a .beads project, register it and return its board path. */
256
+ /** Register `dir` with the server at host:port (POST /api/projects). Resolves the project entry. */
257
+ function registerProject(host, port, dir) {
258
+ const body = JSON.stringify({ path: dir });
259
+ return new Promise((resolve, reject) => {
260
+ const req = http.request(
261
+ {
262
+ host,
263
+ port,
264
+ path: "/api/projects",
265
+ method: "POST",
266
+ headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(body) },
267
+ },
268
+ (res) => {
269
+ let data = "";
270
+ res.on("data", (c) => (data += c));
271
+ res.on("end", () => {
272
+ let json = null;
273
+ try {
274
+ json = JSON.parse(data);
275
+ } catch {
276
+ /* not JSON: reported below */
277
+ }
278
+ if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300 && json) resolve(json);
279
+ else reject(new Error((json && json.error) || `add project failed (${res.statusCode})`));
280
+ });
281
+ },
282
+ );
283
+ req.on("error", reject);
284
+ req.write(body);
285
+ req.end();
286
+ });
287
+ }
288
+
289
+ /** Where to send the browser: the project for the folder `start` ran in, else the picker. */
250
290
  async function targetPath(host, port) {
251
291
  try {
252
292
  if (!fs.existsSync(path.join(invocationCwd, ".beads"))) return "/";
253
- const body = JSON.stringify({ path: invocationCwd });
254
- const entry = await new Promise((resolve, reject) => {
255
- const req = http.request(
256
- {
257
- host,
258
- port,
259
- path: "/api/projects",
260
- method: "POST",
261
- headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(body) },
262
- },
263
- (res) => {
264
- let data = "";
265
- res.on("data", (c) => (data += c));
266
- res.on("end", () => {
267
- if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
268
- try {
269
- resolve(JSON.parse(data));
270
- } catch (e) {
271
- reject(e);
272
- }
273
- } else {
274
- reject(new Error(`add project failed (${res.statusCode})`));
275
- }
276
- });
277
- },
278
- );
279
- req.on("error", reject);
280
- req.write(body);
281
- req.end();
282
- });
293
+ const entry = await registerProject(host, port, invocationCwd);
283
294
  return entry && entry.id ? `/p/${encodeURIComponent(entry.id)}` : "/";
284
295
  } catch {
285
296
  return "/"; // fall back to the picker
@@ -613,6 +624,36 @@ async function cmdLogs(opts) {
613
624
  }, 500);
614
625
  }
615
626
 
627
+ /** `beadscope add [path]`: register a repo with the Beadscope that is already running. */
628
+ async function cmdAdd(opts) {
629
+ const raw = opts.arg ?? ".";
630
+ const dir = path.resolve(invocationCwd, raw === "~" ? os.homedir() : raw.replace(/^~\//, os.homedir() + "/"));
631
+ if (!fs.existsSync(path.join(dir, ".beads"))) {
632
+ console.error(`No .beads directory in ${dir}. Run \`bd init\` there first.`);
633
+ process.exit(1);
634
+ }
635
+
636
+ // A server started with `start` is found from its state file. One that something else runs
637
+ // (a login service) has none, so fall back to the default host and port, or --port.
638
+ const running = opts.portExplicit ? null : await getRunning();
639
+ const host = running ? running.host : opts.host;
640
+ const port = running ? running.port : opts.port;
641
+ if (!(await portInUse(host, port))) {
642
+ console.error(`Beadscope is not running at http://${host}:${port}/.`);
643
+ console.error("Start it with `beadscope start`, or pass --port if it is on another port.");
644
+ process.exit(1);
645
+ }
646
+
647
+ try {
648
+ const entry = await registerProject(host, port, dir);
649
+ const url = new URL(`/p/${encodeURIComponent(entry.id)}`, `http://${host}:${port}`).href;
650
+ console.log(`\n ${entry.name} is in Beadscope → ${url}\n`);
651
+ } catch (err) {
652
+ console.error(`Could not add ${dir}: ${err.message}`);
653
+ process.exit(1);
654
+ }
655
+ }
656
+
616
657
  async function cmdRun(opts) {
617
658
  ensureBuild();
618
659
 
@@ -709,6 +750,8 @@ async function main() {
709
750
  return cmdLogs(opts);
710
751
  case "run":
711
752
  return cmdRun(opts);
753
+ case "add":
754
+ return cmdAdd(opts);
712
755
  default:
713
756
  console.error(
714
757
  `Unknown command: ${JSON.stringify(opts.command)} (expected one of: ${COMMANDS.join(", ")})`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beadscope",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "A local web UI for the beads (bd) issue tracker",
5
5
  "keywords": [
6
6
  "beads",
@@ -44,6 +44,7 @@
44
44
  "start": "next start",
45
45
  "serve": "node scripts/serve.mjs",
46
46
  "lint": "eslint",
47
+ "test:browser": "node scripts/run-browser-tests.mjs",
47
48
  "prepack": "next build"
48
49
  },
49
50
  "dependencies": {