• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dialoguedb / client-nodejs / 26549370681

28 May 2026 01:39AM UTC coverage: 83.537%. First build
26549370681

Pull #78

github

web-flow
Merge 5e701cd7f into 8b7bce4c7
Pull Request #78: add cli build

938 of 1116 branches covered (84.05%)

Branch coverage included in aggregate %.

0 of 216 new or added lines in 6 files covered. (0.0%)

1112 of 1338 relevant lines covered (83.11%)

38.24 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/cli/memory.ts
1
import { Command } from "commander";
NEW
2
import { createMemory } from "../methods/createMemory";
×
NEW
3
import { getMemory } from "../methods/getMemory";
×
NEW
4
import * as memoryApi from "../api/memory";
×
NEW
5
import {
×
6
  output,
7
  parseCSV,
8
  parseIntStrict,
9
  parseJSON,
10
  resolveContent,
11
  withErrorHandler,
12
} from "./shared";
13

NEW
14
export function registerMemoryCommands(program: Command): void {
×
NEW
15
  const memory = program.command("memory").description("Manage memories");
×
16

NEW
17
  memory
×
18
    .command("create")
19
    .description("Create a new memory")
20
    .option("--value <value>", "Value (string)")
21
    .option("--value-json <json>", "Value (JSON)")
22
    .option("--stdin", "Read value from stdin (as string)")
23
    .option("--id <id>", "Optional memory ID")
24
    .option("--namespace <namespace>", "Namespace")
25
    .option("--label <label>", "Label")
26
    .option("--description <description>", "Description")
27
    .option("--tags <csv>", "Tags (comma-separated)")
28
    .option("--metadata <json>", "Metadata (JSON object of primitives)")
29
    .action(
30
      withErrorHandler(async (opts) => {
31
        let value: unknown;
NEW
32
        if (opts.valueJson) {
×
NEW
33
          value = parseJSON("value-json", opts.valueJson);
×
34
        } else {
NEW
35
          value = await resolveContent({
×
36
            content: opts.value,
37
            stdin: opts.stdin,
38
          });
39
        }
40

NEW
41
        const m = await createMemory({
×
42
          value: value as any,
43
          ...(opts.id && { id: opts.id }),
×
44
          ...(opts.namespace && { namespace: opts.namespace }),
×
45
          ...(opts.label && { label: opts.label }),
×
46
          ...(opts.description && { description: opts.description }),
×
47
          ...(opts.tags && { tags: parseCSV(opts.tags) }),
×
48
          ...(opts.metadata && {
×
49
            metadata: parseJSON("metadata", opts.metadata) as Record<
50
              string,
51
              string | number | boolean
52
            >,
53
          }),
54
        });
NEW
55
        output(m);
×
56
      })
57
    );
58

NEW
59
  memory
×
60
    .command("get <id>")
61
    .description("Get a memory by ID")
62
    .option("--namespace <namespace>", "Namespace")
63
    .action(
64
      withErrorHandler(async (id: string, opts) => {
NEW
65
        const m = await getMemory({
×
66
          id,
67
          ...(opts.namespace && { namespace: opts.namespace }),
×
68
        });
NEW
69
        if (!m) {
×
NEW
70
          process.stderr.write(`Memory ${id} not found\n`);
×
NEW
71
          process.exit(1);
×
72
        }
NEW
73
        output(m);
×
74
      })
75
    );
76

NEW
77
  memory
×
78
    .command("list")
79
    .description("List memories")
80
    .option("--namespace <namespace>", "Namespace")
81
    .option("--limit <n>", "Limit")
82
    .option("--order <asc|desc>", "Sort order")
83
    .option("--created <date>", "Filter by exact created date")
84
    .option("--start-date <date>", "Filter by start date")
85
    .option("--end-date <date>", "Filter by end date")
86
    .option("--next <token>", "Pagination cursor")
87
    .action(
88
      withErrorHandler(async (opts) => {
NEW
89
        const filters: Record<string, unknown> = {};
×
NEW
90
        if (opts.namespace) filters.namespace = opts.namespace;
×
NEW
91
        if (opts.limit) filters.limit = parseIntStrict("limit", opts.limit);
×
NEW
92
        if (opts.order) filters.order = opts.order;
×
NEW
93
        if (opts.created) filters.created = opts.created;
×
NEW
94
        if (opts.startDate) filters.startDate = opts.startDate;
×
NEW
95
        if (opts.endDate) filters.endDate = opts.endDate;
×
NEW
96
        if (opts.next) filters.next = opts.next;
×
NEW
97
        const res = await memoryApi.list(filters as any);
×
NEW
98
        output(res);
×
99
      })
100
    );
101

NEW
102
  memory
×
103
    .command("delete <id>")
104
    .description("Delete a memory by ID")
105
    .option("--namespace <namespace>", "Namespace")
106
    .action(
107
      withErrorHandler(async (id: string, opts) => {
NEW
108
        await memoryApi.remove({
×
109
          id,
110
          ...(opts.namespace && { namespace: opts.namespace }),
×
111
        });
NEW
112
        output({ deleted: id });
×
113
      })
114
    );
115

NEW
116
  memory
×
117
    .command("update <id>")
118
    .description("Update a memory's tags")
119
    .requiredOption("--tags <csv>", "Tags (comma-separated)")
120
    .option("--namespace <namespace>", "Namespace")
121
    .action(
122
      withErrorHandler(async (id: string, opts) => {
NEW
123
        const updated = await memoryApi.update({
×
124
          id,
125
          tags: parseCSV(opts.tags),
126
          ...(opts.namespace && { namespace: opts.namespace }),
×
127
        });
NEW
128
        output(updated);
×
129
      })
130
    );
131
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc