dblx 0.1.49 → 0.1.50
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 +5 -0
- package/dist/index.js +77 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,9 +31,14 @@ You can also set `DBLEBOX_API_KEY` and `DBLEBOX_API_URL` environment variables i
|
|
|
31
31
|
dblx threads list # list your threads
|
|
32
32
|
dblx threads list --archived # include archived
|
|
33
33
|
dblx threads list --snoozed # include snoozed
|
|
34
|
+
dblx threads search "plan" # search by partial text
|
|
35
|
+
dblx threads search "plan" --archived --snoozed
|
|
34
36
|
dblx threads create --title "New thread" # create a thread
|
|
35
37
|
dblx threads create --title "..." --comment "First message"
|
|
38
|
+
dblx threads create --title "..." --note "Draft spec..."
|
|
36
39
|
dblx threads update <id> --title "New title"
|
|
40
|
+
dblx threads note <id> # read thread note
|
|
41
|
+
dblx threads note <id> --set "Updated note"
|
|
37
42
|
dblx threads archive <id>
|
|
38
43
|
dblx threads unarchive <id>
|
|
39
44
|
dblx threads snooze <id> --until 2026-03-01T09:00:00
|
package/dist/index.js
CHANGED
|
@@ -2088,21 +2088,32 @@ function getConfigPath() {
|
|
|
2088
2088
|
}
|
|
2089
2089
|
function loadConfig() {
|
|
2090
2090
|
const envKey = process.env.DBLEBOX_API_KEY;
|
|
2091
|
+
const envUrl = process.env.DBLEBOX_API_URL;
|
|
2091
2092
|
if (envKey) {
|
|
2092
2093
|
return {
|
|
2093
2094
|
api_key: envKey,
|
|
2094
|
-
api_url:
|
|
2095
|
+
api_url: envUrl || DEFAULT_API_URL
|
|
2095
2096
|
};
|
|
2096
2097
|
}
|
|
2097
|
-
|
|
2098
|
-
|
|
2098
|
+
let fileConfig = null;
|
|
2099
|
+
if (existsSync(configPath)) {
|
|
2100
|
+
try {
|
|
2101
|
+
const raw = readFileSync(configPath, "utf-8");
|
|
2102
|
+
fileConfig = JSON.parse(raw);
|
|
2103
|
+
} catch {
|
|
2104
|
+
return null;
|
|
2105
|
+
}
|
|
2099
2106
|
}
|
|
2100
|
-
|
|
2101
|
-
const raw = readFileSync(configPath, "utf-8");
|
|
2102
|
-
return JSON.parse(raw);
|
|
2103
|
-
} catch {
|
|
2107
|
+
if (!fileConfig) {
|
|
2104
2108
|
return null;
|
|
2105
2109
|
}
|
|
2110
|
+
if (envUrl) {
|
|
2111
|
+
return {
|
|
2112
|
+
api_key: fileConfig.api_key,
|
|
2113
|
+
api_url: envUrl
|
|
2114
|
+
};
|
|
2115
|
+
}
|
|
2116
|
+
return fileConfig;
|
|
2106
2117
|
}
|
|
2107
2118
|
function saveConfig(config) {
|
|
2108
2119
|
const dir = join(configPath, "..");
|
|
@@ -2533,6 +2544,15 @@ var authCommand = new Command("auth").description("Manage authentication").addCo
|
|
|
2533
2544
|
}));
|
|
2534
2545
|
|
|
2535
2546
|
// src/commands/threads.ts
|
|
2547
|
+
function threadRows(threads) {
|
|
2548
|
+
return threads.map((t) => ({
|
|
2549
|
+
id: t.id.slice(0, 8),
|
|
2550
|
+
body: t.body.length > 60 ? t.body.slice(0, 57) + "..." : t.body,
|
|
2551
|
+
unread: t.unread ? "*" : "",
|
|
2552
|
+
archived: t.archived ? "archived" : "",
|
|
2553
|
+
snoozed: t.snoozed ? "snoozed" : ""
|
|
2554
|
+
}));
|
|
2555
|
+
}
|
|
2536
2556
|
var threadsCommand = new Command("threads").description("Manage threads").addCommand(new Command("list").description("List your threads").option("--json", "Output as JSON").option("--archived", "Include archived threads").option("--snoozed", "Include snoozed threads").action(async (opts) => {
|
|
2537
2557
|
const api = getApi();
|
|
2538
2558
|
const { data, error } = await api.api.cli.v1.threads.get({
|
|
@@ -2547,27 +2567,39 @@ var threadsCommand = new Command("threads").description("Manage threads").addCom
|
|
|
2547
2567
|
output(data.threads, { json: true });
|
|
2548
2568
|
return;
|
|
2549
2569
|
}
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
body: t.body.length > 60 ? t.body.slice(0, 57) + "..." : t.body,
|
|
2553
|
-
unread: t.unread ? "*" : "",
|
|
2554
|
-
archived: t.archived ? "archived" : "",
|
|
2555
|
-
snoozed: t.snoozed ? "snoozed" : ""
|
|
2556
|
-
}));
|
|
2557
|
-
output(rows, { json: false });
|
|
2558
|
-
})).addCommand(new Command("create").description("Create a new thread").requiredOption("--title <title>", "Thread title").option("--comment <text>", "Optional first comment").option("--json", "Output as JSON").action(async (opts) => {
|
|
2570
|
+
output(threadRows(data.threads), { json: false });
|
|
2571
|
+
})).addCommand(new Command("search").description("Search threads by partial text").argument("<query>", "Partial title/body text to match").option("--json", "Output as JSON").option("--archived", "Include archived threads").option("--snoozed", "Include snoozed threads").action(async (query, opts) => {
|
|
2559
2572
|
const api = getApi();
|
|
2573
|
+
const { data, error } = await api.api.cli.v1.threads.get({
|
|
2574
|
+
query: {
|
|
2575
|
+
q: query,
|
|
2576
|
+
archived: opts.archived ? "true" : undefined,
|
|
2577
|
+
snoozed: opts.snoozed ? "true" : undefined
|
|
2578
|
+
}
|
|
2579
|
+
});
|
|
2580
|
+
if (error)
|
|
2581
|
+
throw error;
|
|
2582
|
+
if (opts.json) {
|
|
2583
|
+
output(data.threads, { json: true });
|
|
2584
|
+
return;
|
|
2585
|
+
}
|
|
2586
|
+
output(threadRows(data.threads), { json: false });
|
|
2587
|
+
})).addCommand(new Command("create").description("Create a new thread").requiredOption("--title <title>", "Thread title").option("--comment <text>", "Optional first comment").option("--note <content>", "Create and attach a block note with content").option("--json", "Output as JSON").action(async (opts) => {
|
|
2588
|
+
const api = getApi();
|
|
2589
|
+
const noteContent = opts.note !== undefined ? opts.note : undefined;
|
|
2560
2590
|
const { data, error } = await api.api.cli.v1.threads.post({
|
|
2561
2591
|
body: opts.title,
|
|
2562
|
-
comment: opts.comment
|
|
2592
|
+
comment: opts.comment,
|
|
2593
|
+
note_content: noteContent
|
|
2563
2594
|
});
|
|
2564
2595
|
if (error)
|
|
2565
2596
|
throw error;
|
|
2566
2597
|
if (opts.json) {
|
|
2567
|
-
output(data
|
|
2598
|
+
output(data, { json: true });
|
|
2568
2599
|
return;
|
|
2569
2600
|
}
|
|
2570
|
-
|
|
2601
|
+
const noteSuffix = data.note ? ` (note ${data.note.id.slice(0, 8)} attached)` : "";
|
|
2602
|
+
console.log(`Created thread ${data.thread.id.slice(0, 8)}: ${data.thread.body}${noteSuffix}`);
|
|
2571
2603
|
})).addCommand(new Command("update").description("Update a thread title").argument("<id>", "Thread ID").requiredOption("--title <title>", "New title").option("--json", "Output as JSON").action(async (id, opts) => {
|
|
2572
2604
|
const api = getApi();
|
|
2573
2605
|
const { data, error } = await api.api.cli.v1.threads({ id }).put({
|
|
@@ -2580,6 +2612,31 @@ var threadsCommand = new Command("threads").description("Manage threads").addCom
|
|
|
2580
2612
|
return;
|
|
2581
2613
|
}
|
|
2582
2614
|
console.log(`Updated thread ${data.thread.id.slice(0, 8)}: ${data.thread.body}`);
|
|
2615
|
+
})).addCommand(new Command("note").description("Read or update a thread block note").argument("<id>", "Thread ID").option("--set <content>", "Set note content").option("--json", "Output as JSON").action(async (id, opts) => {
|
|
2616
|
+
const api = getApi();
|
|
2617
|
+
if (opts.set !== undefined) {
|
|
2618
|
+
const { data: data2, error: error2 } = await api.api.cli.v1.threads({ id }).note.put({ content: opts.set });
|
|
2619
|
+
if (error2)
|
|
2620
|
+
throw error2;
|
|
2621
|
+
if (opts.json) {
|
|
2622
|
+
output(data2, { json: true });
|
|
2623
|
+
return;
|
|
2624
|
+
}
|
|
2625
|
+
console.log("Note updated.");
|
|
2626
|
+
return;
|
|
2627
|
+
}
|
|
2628
|
+
const { data, error } = await api.api.cli.v1.threads({ id }).note.get();
|
|
2629
|
+
if (error)
|
|
2630
|
+
throw error;
|
|
2631
|
+
if (opts.json) {
|
|
2632
|
+
output(data, { json: true });
|
|
2633
|
+
return;
|
|
2634
|
+
}
|
|
2635
|
+
if (!data.note) {
|
|
2636
|
+
console.log("No thread note.");
|
|
2637
|
+
return;
|
|
2638
|
+
}
|
|
2639
|
+
console.log(data.note.content || "(empty)");
|
|
2583
2640
|
})).addCommand(new Command("archive").description("Archive a thread").argument("<id>", "Thread ID").action(async (id) => {
|
|
2584
2641
|
const api = getApi();
|
|
2585
2642
|
const { error } = await api.api.cli.v1.threads({ id }).archive.put({
|
|
@@ -2776,7 +2833,7 @@ var todayCommand = new Command("today").description("Today view — threads and
|
|
|
2776
2833
|
// package.json
|
|
2777
2834
|
var package_default = {
|
|
2778
2835
|
name: "dblx",
|
|
2779
|
-
version: "0.1.
|
|
2836
|
+
version: "0.1.50",
|
|
2780
2837
|
description: "CLI for dblebox — thread-first communication",
|
|
2781
2838
|
type: "module",
|
|
2782
2839
|
bin: {
|