@tasklumina/cli 1.0.0 → 1.0.2
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/dist/index.js +105 -63
- package/package.json +5 -9
package/dist/index.js
CHANGED
|
@@ -507,8 +507,8 @@ var listLists = (
|
|
|
507
507
|
var listListItems = (
|
|
508
508
|
/* GraphQL */
|
|
509
509
|
`
|
|
510
|
-
query ListListItems($listId: ID
|
|
511
|
-
listListItems(listId: $listId) {
|
|
510
|
+
query ListListItems($listId: ID!, $completed: Boolean) {
|
|
511
|
+
listListItems(listId: $listId, completed: $completed) {
|
|
512
512
|
id
|
|
513
513
|
listId
|
|
514
514
|
name
|
|
@@ -518,6 +518,8 @@ var listListItems = (
|
|
|
518
518
|
tags
|
|
519
519
|
link
|
|
520
520
|
customFields
|
|
521
|
+
completed
|
|
522
|
+
completedBy
|
|
521
523
|
position
|
|
522
524
|
createdAt
|
|
523
525
|
updatedAt
|
|
@@ -949,6 +951,8 @@ var createListItem = (
|
|
|
949
951
|
tags
|
|
950
952
|
link
|
|
951
953
|
customFields
|
|
954
|
+
completed
|
|
955
|
+
completedBy
|
|
952
956
|
position
|
|
953
957
|
createdAt
|
|
954
958
|
updatedAt
|
|
@@ -970,6 +974,8 @@ var updateListItem = (
|
|
|
970
974
|
tags
|
|
971
975
|
link
|
|
972
976
|
customFields
|
|
977
|
+
completed
|
|
978
|
+
completedBy
|
|
973
979
|
position
|
|
974
980
|
createdAt
|
|
975
981
|
updatedAt
|
|
@@ -1718,9 +1724,9 @@ categoriesCommand.command("create").description("Create a category").argument("<
|
|
|
1718
1724
|
try {
|
|
1719
1725
|
validateStringLength(name, "Name", 100);
|
|
1720
1726
|
if (opts.color) validateHexColor(opts.color);
|
|
1721
|
-
const
|
|
1722
|
-
if (opts.color)
|
|
1723
|
-
const data = await graphql(createCategory, { input
|
|
1727
|
+
const input = { id: randomUUID(), name, position: Date.now() };
|
|
1728
|
+
if (opts.color) input.color = opts.color;
|
|
1729
|
+
const data = await graphql(createCategory, { input });
|
|
1724
1730
|
if (isJsonMode()) {
|
|
1725
1731
|
printJson(data.createCategory);
|
|
1726
1732
|
return;
|
|
@@ -1736,10 +1742,10 @@ categoriesCommand.command("update").description("Update a category").argument("<
|
|
|
1736
1742
|
validateUuid(id, "Category ID");
|
|
1737
1743
|
if (opts.name) validateStringLength(opts.name, "Name", 100);
|
|
1738
1744
|
if (opts.color) validateHexColor(opts.color);
|
|
1739
|
-
const
|
|
1740
|
-
if (opts.name)
|
|
1741
|
-
if (opts.color)
|
|
1742
|
-
const data = await graphql(updateCategory, { input
|
|
1745
|
+
const input = { id };
|
|
1746
|
+
if (opts.name) input.name = opts.name;
|
|
1747
|
+
if (opts.color) input.color = opts.color;
|
|
1748
|
+
const data = await graphql(updateCategory, { input });
|
|
1743
1749
|
if (isJsonMode()) {
|
|
1744
1750
|
printJson(data.updateCategory);
|
|
1745
1751
|
return;
|
|
@@ -1811,9 +1817,9 @@ tagsCommand.command("update").description("Update a tag").argument("<id>", "Tag
|
|
|
1811
1817
|
try {
|
|
1812
1818
|
validateUuid(id, "Tag ID");
|
|
1813
1819
|
if (opts.name) validateStringLength(opts.name, "Tag name", 100);
|
|
1814
|
-
const
|
|
1815
|
-
if (opts.name)
|
|
1816
|
-
const data = await graphql(updateTag, { input
|
|
1820
|
+
const input = { id };
|
|
1821
|
+
if (opts.name) input.name = opts.name;
|
|
1822
|
+
const data = await graphql(updateTag, { input });
|
|
1817
1823
|
if (isJsonMode()) {
|
|
1818
1824
|
printJson(data.updateTag);
|
|
1819
1825
|
return;
|
|
@@ -1958,16 +1964,16 @@ contactsCommand.command("create").description("Create a contact").argument("<nam
|
|
|
1958
1964
|
contactsCommand.command("update").description("Update a contact").argument("<id>", "Contact ID").option("--name <name>", "New name").option("--email <email>", "New email").action(async (id, opts) => {
|
|
1959
1965
|
try {
|
|
1960
1966
|
validateUuid(id, "Contact ID");
|
|
1961
|
-
const
|
|
1967
|
+
const input = { id };
|
|
1962
1968
|
if (opts.name) {
|
|
1963
1969
|
validateStringLength(opts.name, "Name", 200);
|
|
1964
|
-
|
|
1970
|
+
input.name = opts.name;
|
|
1965
1971
|
}
|
|
1966
1972
|
if (opts.email) {
|
|
1967
1973
|
validateEmail(opts.email);
|
|
1968
|
-
|
|
1974
|
+
input.email = opts.email;
|
|
1969
1975
|
}
|
|
1970
|
-
const data = await graphql(updateContact, { input
|
|
1976
|
+
const data = await graphql(updateContact, { input });
|
|
1971
1977
|
if (isJsonMode()) {
|
|
1972
1978
|
printJson(data.updateContact);
|
|
1973
1979
|
return;
|
|
@@ -2034,9 +2040,9 @@ prefsCommand.command("set").description("Update a preference").option("--theme <
|
|
|
2034
2040
|
if (opts.defaultView) validateView(opts.defaultView);
|
|
2035
2041
|
if (opts.defaultPriority && opts.defaultPriority !== "none") validatePriority(opts.defaultPriority);
|
|
2036
2042
|
if (opts.defaultColor && opts.defaultColor !== "none") validateHexColor(opts.defaultColor);
|
|
2037
|
-
const
|
|
2038
|
-
if (opts.theme)
|
|
2039
|
-
if (opts.defaultView)
|
|
2043
|
+
const input = {};
|
|
2044
|
+
if (opts.theme) input.theme = opts.theme;
|
|
2045
|
+
if (opts.defaultView) input.defaultView = opts.defaultView;
|
|
2040
2046
|
if (opts.archiveDelay) {
|
|
2041
2047
|
const delay = parseInt(opts.archiveDelay, 10);
|
|
2042
2048
|
if (isNaN(delay) || delay < 0 || delay > 8760) {
|
|
@@ -2044,22 +2050,22 @@ prefsCommand.command("set").description("Update a preference").option("--theme <
|
|
|
2044
2050
|
process.exitCode = 1;
|
|
2045
2051
|
return;
|
|
2046
2052
|
}
|
|
2047
|
-
|
|
2053
|
+
input.archiveDelay = delay;
|
|
2048
2054
|
}
|
|
2049
|
-
if (opts.defaultPriority)
|
|
2050
|
-
if (opts.defaultCategory)
|
|
2051
|
-
if (opts.defaultColor)
|
|
2052
|
-
if (Object.keys(
|
|
2055
|
+
if (opts.defaultPriority) input.defaultPriority = opts.defaultPriority === "none" ? "" : opts.defaultPriority;
|
|
2056
|
+
if (opts.defaultCategory) input.defaultCategoryId = opts.defaultCategory === "none" ? "" : opts.defaultCategory;
|
|
2057
|
+
if (opts.defaultColor) input.defaultColor = opts.defaultColor === "none" ? "" : opts.defaultColor;
|
|
2058
|
+
if (Object.keys(input).length === 0) {
|
|
2053
2059
|
printError("Provide at least one option: --theme, --default-view, --archive-delay, --default-priority, --default-category, --default-color");
|
|
2054
2060
|
process.exitCode = 1;
|
|
2055
2061
|
return;
|
|
2056
2062
|
}
|
|
2057
|
-
const data = await graphql(updatePreferences, { input
|
|
2063
|
+
const data = await graphql(updatePreferences, { input });
|
|
2058
2064
|
if (isJsonMode()) {
|
|
2059
2065
|
printJson(data.updatePreferences);
|
|
2060
2066
|
return;
|
|
2061
2067
|
}
|
|
2062
|
-
for (const [key, value] of Object.entries(
|
|
2068
|
+
for (const [key, value] of Object.entries(input)) {
|
|
2063
2069
|
printSuccess(`Updated preference: ${key} = ${value}`);
|
|
2064
2070
|
}
|
|
2065
2071
|
} catch (err) {
|
|
@@ -2178,7 +2184,6 @@ colorRulesCommand.command("remove").description("Remove a color rule").argument(
|
|
|
2178
2184
|
|
|
2179
2185
|
// src/commands/lists.ts
|
|
2180
2186
|
import { Command as Command9 } from "commander";
|
|
2181
|
-
import { randomUUID as randomUUID6 } from "crypto";
|
|
2182
2187
|
import { confirm as confirm6 } from "@inquirer/prompts";
|
|
2183
2188
|
var listsCommand = new Command9("lists").description("Manage lists").action(async () => {
|
|
2184
2189
|
try {
|
|
@@ -2200,12 +2205,13 @@ var listsCommand = new Command9("lists").description("Manage lists").action(asyn
|
|
|
2200
2205
|
process.exitCode = 1;
|
|
2201
2206
|
}
|
|
2202
2207
|
});
|
|
2203
|
-
listsCommand.command("show").description("Show a list with items").argument("<id>", "List ID").action(async (id) => {
|
|
2208
|
+
listsCommand.command("show").description("Show a list with items").argument("<id>", "List ID").option("--completed", "Show completed items (default: active)").action(async (id, opts) => {
|
|
2204
2209
|
try {
|
|
2205
2210
|
validateUuid(id, "List ID");
|
|
2211
|
+
const completed = opts.completed === true ? true : false;
|
|
2206
2212
|
const [listsData, itemsData] = await Promise.all([
|
|
2207
2213
|
graphql(listLists),
|
|
2208
|
-
graphql(listListItems, { listId: id })
|
|
2214
|
+
graphql(listListItems, { listId: id, completed })
|
|
2209
2215
|
]);
|
|
2210
2216
|
const list = listsData.listLists.find((l) => l.id === id || l.id.startsWith(id));
|
|
2211
2217
|
if (!list) {
|
|
@@ -2224,11 +2230,21 @@ listsCommand.command("show").description("Show a list with items").argument("<id
|
|
|
2224
2230
|
console.log(`Color: ${list.color || "\u2014"}`);
|
|
2225
2231
|
console.log(`Items: ${list.itemCount}`);
|
|
2226
2232
|
console.log(`Created: ${formatDate(list.createdAt)}`);
|
|
2227
|
-
|
|
2233
|
+
console.log(`Showing: ${completed ? "Completed" : "Active"} items`);
|
|
2234
|
+
if (itemsData.listListItems.length === 0) {
|
|
2235
|
+
console.log(`
|
|
2236
|
+
No ${completed ? "completed" : "active"} items.`);
|
|
2237
|
+
} else {
|
|
2228
2238
|
console.log("\nItems:");
|
|
2229
2239
|
printTable(
|
|
2230
|
-
["ID", "Name", "Qty", "Category"],
|
|
2231
|
-
itemsData.listListItems.map((i) => [
|
|
2240
|
+
["ID", "Name", "Qty", "Category", "Done"],
|
|
2241
|
+
itemsData.listListItems.map((i) => [
|
|
2242
|
+
truncateId(i.id),
|
|
2243
|
+
i.name,
|
|
2244
|
+
i.quantity != null ? String(i.quantity) : "\u2014",
|
|
2245
|
+
i.category || "\u2014",
|
|
2246
|
+
i.completed ? `\u2713 ${i.completedBy || ""}`.trim() : "\u2014"
|
|
2247
|
+
])
|
|
2232
2248
|
);
|
|
2233
2249
|
}
|
|
2234
2250
|
} catch (err) {
|
|
@@ -2241,11 +2257,11 @@ listsCommand.command("create").description("Create a list").argument("<name>", "
|
|
|
2241
2257
|
validateStringLength(name, "Name", 200);
|
|
2242
2258
|
if (opts.desc) validateStringLength(opts.desc, "Description", 2e3);
|
|
2243
2259
|
if (opts.color) validateHexColor(opts.color);
|
|
2244
|
-
const
|
|
2245
|
-
if (opts.desc)
|
|
2246
|
-
if (opts.icon)
|
|
2247
|
-
if (opts.color)
|
|
2248
|
-
const data = await graphql(createList, { input
|
|
2260
|
+
const input = { name };
|
|
2261
|
+
if (opts.desc) input.description = opts.desc;
|
|
2262
|
+
if (opts.icon) input.icon = opts.icon;
|
|
2263
|
+
if (opts.color) input.color = opts.color;
|
|
2264
|
+
const data = await graphql(createList, { input });
|
|
2249
2265
|
if (isJsonMode()) {
|
|
2250
2266
|
printJson(data.createList);
|
|
2251
2267
|
return;
|
|
@@ -2262,12 +2278,12 @@ listsCommand.command("update").description("Update a list").argument("<id>", "Li
|
|
|
2262
2278
|
if (opts.name) validateStringLength(opts.name, "Name", 200);
|
|
2263
2279
|
if (opts.desc) validateStringLength(opts.desc, "Description", 2e3);
|
|
2264
2280
|
if (opts.color) validateHexColor(opts.color);
|
|
2265
|
-
const
|
|
2266
|
-
if (opts.name)
|
|
2267
|
-
if (opts.desc)
|
|
2268
|
-
if (opts.icon)
|
|
2269
|
-
if (opts.color)
|
|
2270
|
-
const data = await graphql(updateList, { input
|
|
2281
|
+
const input = { id };
|
|
2282
|
+
if (opts.name) input.name = opts.name;
|
|
2283
|
+
if (opts.desc) input.description = opts.desc;
|
|
2284
|
+
if (opts.icon) input.icon = opts.icon;
|
|
2285
|
+
if (opts.color) input.color = opts.color;
|
|
2286
|
+
const data = await graphql(updateList, { input });
|
|
2271
2287
|
if (isJsonMode()) {
|
|
2272
2288
|
printJson(data.updateList);
|
|
2273
2289
|
return;
|
|
@@ -2305,11 +2321,11 @@ listsCommand.command("add-item").description("Add an item to a list").argument("
|
|
|
2305
2321
|
validateStringLength(name, "Name", 500);
|
|
2306
2322
|
if (opts.qty) validateQuantity(opts.qty);
|
|
2307
2323
|
if (opts.link) validateUrl(opts.link);
|
|
2308
|
-
const
|
|
2309
|
-
if (opts.qty)
|
|
2310
|
-
if (opts.category)
|
|
2311
|
-
if (opts.link)
|
|
2312
|
-
const data = await graphql(createListItem, { input
|
|
2324
|
+
const input = { listId, name };
|
|
2325
|
+
if (opts.qty) input.quantity = validateQuantity(opts.qty);
|
|
2326
|
+
if (opts.category) input.category = opts.category;
|
|
2327
|
+
if (opts.link) input.link = opts.link;
|
|
2328
|
+
const data = await graphql(createListItem, { input });
|
|
2313
2329
|
if (isJsonMode()) {
|
|
2314
2330
|
printJson(data.createListItem);
|
|
2315
2331
|
return;
|
|
@@ -2326,16 +2342,8 @@ listsCommand.command("bulk-add").description("Add multiple items to a list").arg
|
|
|
2326
2342
|
for (const name of items) {
|
|
2327
2343
|
validateStringLength(name, "Item name", 500);
|
|
2328
2344
|
}
|
|
2329
|
-
const itemInputs = items.map((name, i) => ({
|
|
2330
|
-
id: randomUUID6(),
|
|
2331
|
-
listId,
|
|
2332
|
-
name,
|
|
2333
|
-
tags: [],
|
|
2334
|
-
customFields: "{}",
|
|
2335
|
-
position: Date.now() + i
|
|
2336
|
-
}));
|
|
2337
2345
|
const data = await graphql(bulkCreateListItems, {
|
|
2338
|
-
input: { listId,
|
|
2346
|
+
input: { listId, names: items }
|
|
2339
2347
|
});
|
|
2340
2348
|
if (isJsonMode()) {
|
|
2341
2349
|
printJson(data.bulkCreateListItems);
|
|
@@ -2354,12 +2362,12 @@ listsCommand.command("update-item").description("Update a list item").argument("
|
|
|
2354
2362
|
if (opts.name) validateStringLength(opts.name, "Name", 500);
|
|
2355
2363
|
if (opts.qty) validateQuantity(opts.qty);
|
|
2356
2364
|
if (opts.link) validateUrl(opts.link);
|
|
2357
|
-
const
|
|
2358
|
-
if (opts.name)
|
|
2359
|
-
if (opts.qty)
|
|
2360
|
-
if (opts.category)
|
|
2361
|
-
if (opts.link)
|
|
2362
|
-
const data = await graphql(updateListItem, { input
|
|
2365
|
+
const input = { id: itemId, listId: opts.list };
|
|
2366
|
+
if (opts.name) input.name = opts.name;
|
|
2367
|
+
if (opts.qty) input.quantity = validateQuantity(opts.qty);
|
|
2368
|
+
if (opts.category) input.category = opts.category;
|
|
2369
|
+
if (opts.link) input.link = opts.link;
|
|
2370
|
+
const data = await graphql(updateListItem, { input });
|
|
2363
2371
|
if (isJsonMode()) {
|
|
2364
2372
|
printJson(data.updateListItem);
|
|
2365
2373
|
return;
|
|
@@ -2392,6 +2400,40 @@ listsCommand.command("remove-item").description("Remove a list item").argument("
|
|
|
2392
2400
|
process.exitCode = 1;
|
|
2393
2401
|
}
|
|
2394
2402
|
});
|
|
2403
|
+
listsCommand.command("check").description("Mark a list item as complete").argument("<item-id>", "Item ID").requiredOption("--list <list-id>", "List ID").action(async (itemId, opts) => {
|
|
2404
|
+
try {
|
|
2405
|
+
validateUuid(itemId, "Item ID");
|
|
2406
|
+
validateUuid(opts.list, "List ID");
|
|
2407
|
+
const data = await graphql(updateListItem, {
|
|
2408
|
+
input: { id: itemId, listId: opts.list, completed: true }
|
|
2409
|
+
});
|
|
2410
|
+
if (isJsonMode()) {
|
|
2411
|
+
printJson(data.updateListItem);
|
|
2412
|
+
return;
|
|
2413
|
+
}
|
|
2414
|
+
printSuccess(`Marked complete: ${data.updateListItem.name}`);
|
|
2415
|
+
} catch (err) {
|
|
2416
|
+
printError(err.message);
|
|
2417
|
+
process.exitCode = 1;
|
|
2418
|
+
}
|
|
2419
|
+
});
|
|
2420
|
+
listsCommand.command("uncheck").description("Mark a list item as active (not complete)").argument("<item-id>", "Item ID").requiredOption("--list <list-id>", "List ID").action(async (itemId, opts) => {
|
|
2421
|
+
try {
|
|
2422
|
+
validateUuid(itemId, "Item ID");
|
|
2423
|
+
validateUuid(opts.list, "List ID");
|
|
2424
|
+
const data = await graphql(updateListItem, {
|
|
2425
|
+
input: { id: itemId, listId: opts.list, completed: false }
|
|
2426
|
+
});
|
|
2427
|
+
if (isJsonMode()) {
|
|
2428
|
+
printJson(data.updateListItem);
|
|
2429
|
+
return;
|
|
2430
|
+
}
|
|
2431
|
+
printSuccess(`Marked active: ${data.updateListItem.name}`);
|
|
2432
|
+
} catch (err) {
|
|
2433
|
+
printError(err.message);
|
|
2434
|
+
process.exitCode = 1;
|
|
2435
|
+
}
|
|
2436
|
+
});
|
|
2395
2437
|
|
|
2396
2438
|
// src/commands/shares.ts
|
|
2397
2439
|
import { Command as Command10 } from "commander";
|
package/package.json
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tasklumina/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Task Lumina CLI — manage tasks, notes, categories, and shares from the terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/clehinger/Task-Lumina.git",
|
|
10
|
-
"directory": "cli"
|
|
11
|
-
},
|
|
7
|
+
"homepage": "https://tasklumina.com",
|
|
12
8
|
"keywords": [
|
|
13
9
|
"tasklumina",
|
|
14
10
|
"cli",
|
|
@@ -30,15 +26,15 @@
|
|
|
30
26
|
"prepublishOnly": "npm run build"
|
|
31
27
|
},
|
|
32
28
|
"dependencies": {
|
|
29
|
+
"@inquirer/prompts": "^7.3.2",
|
|
33
30
|
"chalk": "^5.4.1",
|
|
34
31
|
"cli-table3": "^0.6.5",
|
|
35
32
|
"commander": "^13.1.0",
|
|
36
|
-
"@inquirer/prompts": "^7.3.2",
|
|
37
33
|
"keytar": "^7.9.0"
|
|
38
34
|
},
|
|
39
35
|
"devDependencies": {
|
|
36
|
+
"@types/node": "^22.0.0",
|
|
40
37
|
"tsup": "^8.4.0",
|
|
41
|
-
"typescript": "~5.7.0"
|
|
42
|
-
"@types/node": "^22.0.0"
|
|
38
|
+
"typescript": "~5.7.0"
|
|
43
39
|
}
|
|
44
40
|
}
|