stackmem 1.0.18 → 1.0.19
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/cli.js +14 -4
- package/package.json +1 -1
- package/src/cli.ts +16 -4
package/dist/cli.js
CHANGED
|
@@ -522,13 +522,18 @@ async function cmdSearch(project, query) {
|
|
|
522
522
|
}
|
|
523
523
|
// --- cm resolve ------------------------------------------------------------
|
|
524
524
|
async function cmdResolve(project, memoryId) {
|
|
525
|
-
const { error } = await supabase
|
|
525
|
+
const { data, error } = await supabase
|
|
526
526
|
.from("memories")
|
|
527
527
|
.update({ resolved: true })
|
|
528
528
|
.eq("project", project)
|
|
529
|
-
.eq("id", memoryId)
|
|
529
|
+
.eq("id", memoryId)
|
|
530
|
+
.select("id");
|
|
530
531
|
if (error)
|
|
531
532
|
fail(`Failed to resolve memory: ${error.message}`);
|
|
533
|
+
if (!data || data.length === 0) {
|
|
534
|
+
console.log(`No memory found with ID [${memoryId}]`);
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
532
537
|
console.log(`Resolved memory [${memoryId}]`);
|
|
533
538
|
}
|
|
534
539
|
// --- cm delete -------------------------------------------------------------
|
|
@@ -539,13 +544,18 @@ async function cmdDelete(project, memoryId) {
|
|
|
539
544
|
.or(`source_id.eq.${memoryId},target_id.eq.${memoryId}`);
|
|
540
545
|
if (linksError)
|
|
541
546
|
fail(`Failed to delete memory links: ${linksError.message}`);
|
|
542
|
-
const { error } = await supabase
|
|
547
|
+
const { data, error } = await supabase
|
|
543
548
|
.from("memories")
|
|
544
549
|
.delete()
|
|
545
550
|
.eq("project", project)
|
|
546
|
-
.eq("id", memoryId)
|
|
551
|
+
.eq("id", memoryId)
|
|
552
|
+
.select("id");
|
|
547
553
|
if (error)
|
|
548
554
|
fail(`Failed to delete memory: ${error.message}`);
|
|
555
|
+
if (!data || data.length === 0) {
|
|
556
|
+
console.log(`No memory found with ID [${memoryId}]`);
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
549
559
|
console.log(`Deleted memory [${memoryId}]`);
|
|
550
560
|
}
|
|
551
561
|
// --- cm inspect ------------------------------------------------------------
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -617,14 +617,20 @@ async function cmdSearch(project: string, query: string) {
|
|
|
617
617
|
// --- cm resolve ------------------------------------------------------------
|
|
618
618
|
|
|
619
619
|
async function cmdResolve(project: string, memoryId: string) {
|
|
620
|
-
const { error } = await supabase
|
|
620
|
+
const { data, error } = await supabase
|
|
621
621
|
.from("memories")
|
|
622
622
|
.update({ resolved: true })
|
|
623
623
|
.eq("project", project)
|
|
624
|
-
.eq("id", memoryId)
|
|
624
|
+
.eq("id", memoryId)
|
|
625
|
+
.select("id");
|
|
625
626
|
|
|
626
627
|
if (error) fail(`Failed to resolve memory: ${error.message}`);
|
|
627
628
|
|
|
629
|
+
if (!data || data.length === 0) {
|
|
630
|
+
console.log(`No memory found with ID [${memoryId}]`);
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
|
|
628
634
|
console.log(`Resolved memory [${memoryId}]`);
|
|
629
635
|
}
|
|
630
636
|
|
|
@@ -638,14 +644,20 @@ async function cmdDelete(project: string, memoryId: string) {
|
|
|
638
644
|
|
|
639
645
|
if (linksError) fail(`Failed to delete memory links: ${linksError.message}`);
|
|
640
646
|
|
|
641
|
-
const { error } = await supabase
|
|
647
|
+
const { data, error } = await supabase
|
|
642
648
|
.from("memories")
|
|
643
649
|
.delete()
|
|
644
650
|
.eq("project", project)
|
|
645
|
-
.eq("id", memoryId)
|
|
651
|
+
.eq("id", memoryId)
|
|
652
|
+
.select("id");
|
|
646
653
|
|
|
647
654
|
if (error) fail(`Failed to delete memory: ${error.message}`);
|
|
648
655
|
|
|
656
|
+
if (!data || data.length === 0) {
|
|
657
|
+
console.log(`No memory found with ID [${memoryId}]`);
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
|
|
649
661
|
console.log(`Deleted memory [${memoryId}]`);
|
|
650
662
|
}
|
|
651
663
|
|