dblx 0.1.68 → 0.1.80

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
@@ -145,6 +145,13 @@ dblx create comment --thread <thread-id> --body "Hello"
145
145
  dblx set comment <comment-id> --body "Updated text"
146
146
  ```
147
147
 
148
+ ### Closing A Thread
149
+
150
+ ```bash
151
+ dblx create comment --thread <thread-id> --body "Implemented and pushed."
152
+ dblx set thread <thread-id> --archived true
153
+ ```
154
+
148
155
  ### Members
149
156
 
150
157
  ```bash
package/dist/index.js CHANGED
@@ -2628,6 +2628,17 @@ function inferThreadUrl(apiUrl, threadId) {
2628
2628
  function relatedThreadLabel(thread) {
2629
2629
  return `${thread.thread.id.slice(0, 8)} ${thread.thread.body}`;
2630
2630
  }
2631
+ function groupAttachmentsByComment(attachments) {
2632
+ const map = new Map;
2633
+ for (const a2 of attachments) {
2634
+ if (!a2.thread_comment_id)
2635
+ continue;
2636
+ const list = map.get(a2.thread_comment_id) ?? [];
2637
+ list.push(a2);
2638
+ map.set(a2.thread_comment_id, list);
2639
+ }
2640
+ return map;
2641
+ }
2631
2642
  var getCommand = new Command("get").description("Read data from dblebox").addCommand(new Command("threads").description("List or search your threads").argument("[thread-id]", "Thread ID").option("--q <query>", "Filter by partial title/body text").option("--json", "Output as JSON").option("--archived", "Include archived threads").option("--snoozed", "Include snoozed threads").action(async (threadId, opts) => {
2632
2643
  const api = getApi();
2633
2644
  if (threadId) {
@@ -2659,8 +2670,12 @@ Comments:`);
2659
2670
  if (data2.comments.length === 0) {
2660
2671
  console.log("(none)");
2661
2672
  } else {
2673
+ const byComment = groupAttachmentsByComment(data2.attachments ?? []);
2662
2674
  for (const comment of data2.comments) {
2663
2675
  console.log(`- [${comment.created_at}] @${comment.creator_username}: ${comment.body}`);
2676
+ for (const a2 of byComment.get(comment.id) ?? []) {
2677
+ console.log(` \uD83D\uDCCE ${a2.filename} ${a2.url}`);
2678
+ }
2664
2679
  }
2665
2680
  }
2666
2681
  console.log(`
@@ -2761,12 +2776,27 @@ Children:`);
2761
2776
  output(data.comments, { json: true });
2762
2777
  return;
2763
2778
  }
2764
- const rows = data.comments.map((c2) => ({
2765
- id: c2.id.slice(0, 8),
2766
- user: c2.creator_username,
2767
- body: c2.body.length > 60 ? c2.body.slice(0, 57) + "..." : c2.body,
2768
- created_at: c2.created_at
2769
- }));
2779
+ const byComment = groupAttachmentsByComment(data.attachments ?? []);
2780
+ const rows = data.comments.flatMap((c2) => {
2781
+ const base = {
2782
+ id: c2.id.slice(0, 8),
2783
+ user: c2.creator_username,
2784
+ body: c2.body.length > 60 ? c2.body.slice(0, 57) + "..." : c2.body,
2785
+ created_at: c2.created_at
2786
+ };
2787
+ const commentAttachments = byComment.get(c2.id) ?? [];
2788
+ if (!commentAttachments.length)
2789
+ return [base];
2790
+ return [
2791
+ base,
2792
+ ...commentAttachments.map((a2) => ({
2793
+ id: "",
2794
+ user: "",
2795
+ body: `\uD83D\uDCCE ${a2.filename} ${a2.url}`,
2796
+ created_at: ""
2797
+ }))
2798
+ ];
2799
+ });
2770
2800
  output(rows, { json: false });
2771
2801
  })).addCommand(new Command("members").description("List members of a thread").argument("<thread-id>", "Thread ID").option("--json", "Output as JSON").action(async (threadId, opts) => {
2772
2802
  const api = getApi();
@@ -2946,7 +2976,7 @@ var inviteCommand = new Command("invite").description("Invite collaborators").ad
2946
2976
  // package.json
2947
2977
  var package_default = {
2948
2978
  name: "dblx",
2949
- version: "0.1.68",
2979
+ version: "0.1.80",
2950
2980
  description: "CLI for dblebox — thread-first communication",
2951
2981
  type: "module",
2952
2982
  bin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dblx",
3
- "version": "0.1.68",
3
+ "version": "0.1.80",
4
4
  "description": "CLI for dblebox — thread-first communication",
5
5
  "type": "module",
6
6
  "bin": {