@nuzo/memory-cli 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ https://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the
13
+ copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other
16
+ entities that control, are controlled by, or are under common control with
17
+ that entity. For the purposes of this definition, "control" means (i) the
18
+ power, direct or indirect, to cause the direction or management of such
19
+ entity, whether by contract or otherwise, or (ii) ownership of fifty percent
20
+ (50%) or more of the outstanding shares, or (iii) beneficial ownership of
21
+ such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
24
+ permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation source,
28
+ and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical transformation
31
+ or translation of a Source form, including but not limited to compiled
32
+ object code, generated documentation, and conversions to other media types.
33
+
34
+ "Work" shall mean the work of authorship, whether in Source or Object form,
35
+ made available under the License, as indicated by a copyright notice that is
36
+ included in or attached to the work.
37
+
38
+ "Derivative Works" shall mean any work, whether in Source or Object form,
39
+ that is based on (or derived from) the Work and for which the editorial
40
+ revisions, annotations, elaborations, or other modifications represent, as a
41
+ whole, an original work of authorship. For the purposes of this License,
42
+ Derivative Works shall not include works that remain separable from, or
43
+ merely link (or bind by name) to the interfaces of, the Work and Derivative
44
+ Works thereof.
45
+
46
+ "Contribution" shall mean any work of authorship, including the original
47
+ version of the Work and any modifications or additions to that Work or
48
+ Derivative Works thereof, that is intentionally submitted to Licensor for
49
+ inclusion in the Work by the copyright owner or by an individual or Legal
50
+ Entity authorized to submit on behalf of the copyright owner. For the
51
+ purposes of this definition, "submitted" means any form of electronic,
52
+ verbal, or written communication sent to the Licensor or its representatives,
53
+ including but not limited to communication on electronic mailing lists,
54
+ source code control systems, and issue tracking systems that are managed by,
55
+ or on behalf of, the Licensor for the purpose of discussing and improving the
56
+ Work, but excluding communication that is conspicuously marked or otherwise
57
+ designated in writing by the copyright owner as "Not a Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any individual or Legal Entity on
60
+ behalf of whom a Contribution has been received by Licensor and subsequently
61
+ incorporated within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
64
+ License, each Contributor hereby grants to You a perpetual, worldwide,
65
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
66
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
67
+ sublicense, and distribute the Work and such Derivative Works in Source or
68
+ Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of this
71
+ License, each Contributor hereby grants to You a perpetual, worldwide,
72
+ non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
73
+ section) patent license to make, have made, use, offer to sell, sell, import,
74
+ and otherwise transfer the Work, where such license applies only to those
75
+ patent claims licensable by such Contributor that are necessarily infringed
76
+ by their Contribution(s) alone or by combination of their Contribution(s)
77
+ with the Work to which such Contribution(s) was submitted. If You institute
78
+ patent litigation against any entity (including a cross-claim or
79
+ counterclaim in a lawsuit) alleging that the Work or a Contribution
80
+ incorporated within the Work constitutes direct or contributory patent
81
+ infringement, then any patent licenses granted to You under this License for
82
+ that Work shall terminate as of the date such litigation is filed.
83
+
84
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
85
+ Derivative Works thereof in any medium, with or without modifications, and in
86
+ Source or Object form, provided that You meet the following conditions:
87
+
88
+ (a) You must give any other recipients of the Work or Derivative Works a copy
89
+ of this License; and
90
+
91
+ (b) You must cause any modified files to carry prominent notices stating that
92
+ You changed the files; and
93
+
94
+ (c) You must retain, in the Source form of any Derivative Works that You
95
+ distribute, all copyright, patent, trademark, and attribution notices from
96
+ the Source form of the Work, excluding those notices that do not pertain to
97
+ any part of the Derivative Works; and
98
+
99
+ (d) If the Work includes a "NOTICE" text file as part of its distribution,
100
+ then any Derivative Works that You distribute must include a readable copy of
101
+ the attribution notices contained within such NOTICE file, excluding those
102
+ notices that do not pertain to any part of the Derivative Works, in at least
103
+ one of the following places: within a NOTICE text file distributed as part of
104
+ the Derivative Works; within the Source form or documentation, if provided
105
+ along with the Derivative Works; or, within a display generated by the
106
+ Derivative Works, if and wherever such third-party notices normally appear.
107
+ The contents of the NOTICE file are for informational purposes only and do
108
+ not modify the License. You may add Your own attribution notices within
109
+ Derivative Works that You distribute, alongside or as an addendum to the
110
+ NOTICE text from the Work, provided that such additional attribution notices
111
+ cannot be construed as modifying the License.
112
+
113
+ You may add Your own copyright statement to Your modifications and may
114
+ provide additional or different license terms and conditions for use,
115
+ reproduction, or distribution of Your modifications, or for any such
116
+ Derivative Works as a whole, provided Your use, reproduction, and
117
+ distribution of the Work otherwise complies with the conditions stated in
118
+ this License.
119
+
120
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
121
+ Contribution intentionally submitted for inclusion in the Work by You to the
122
+ Licensor shall be under the terms and conditions of this License, without any
123
+ additional terms or conditions. Notwithstanding the above, nothing herein
124
+ shall supersede or modify the terms of any separate license agreement you may
125
+ have executed with Licensor regarding such Contributions.
126
+
127
+ 6. Trademarks. This License does not grant permission to use the trade names,
128
+ trademarks, service marks, or product names of the Licensor, except as
129
+ required for reasonable and customary use in describing the origin of the
130
+ Work and reproducing the content of the NOTICE file.
131
+
132
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
133
+ writing, Licensor provides the Work (and each Contributor provides its
134
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
135
+ KIND, either express or implied, including, without limitation, any warranties
136
+ or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
137
+ PARTICULAR PURPOSE. You are solely responsible for determining the
138
+ appropriateness of using or redistributing the Work and assume any risks
139
+ associated with Your exercise of permissions under this License.
140
+
141
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
142
+ tort (including negligence), contract, or otherwise, unless required by
143
+ applicable law (such as deliberate and grossly negligent acts) or agreed to
144
+ in writing, shall any Contributor be liable to You for damages, including any
145
+ direct, indirect, special, incidental, or consequential damages of any
146
+ character arising as a result of this License or out of the use or inability
147
+ to use the Work (including but not limited to damages for loss of goodwill,
148
+ work stoppage, computer failure or malfunction, or any and all other
149
+ commercial damages or losses), even if such Contributor has been advised of
150
+ the possibility of such damages.
151
+
152
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work
153
+ or Derivative Works thereof, You may choose to offer, and charge a fee for,
154
+ acceptance of support, warranty, indemnity, or other liability obligations
155
+ and/or rights consistent with this License. However, in accepting such
156
+ obligations, You may act only on Your own behalf and on Your sole
157
+ responsibility, not on behalf of any other Contributor, and only if You agree
158
+ to indemnify, defend, and hold each Contributor harmless for any liability
159
+ incurred by, or claims asserted against, such Contributor by reason of your
160
+ accepting any such warranty or additional liability.
161
+
162
+ END OF TERMS AND CONDITIONS
163
+
164
+ Copyright 2026 fabionfsc
165
+
166
+ Licensed under the Apache License, Version 2.0 (the "License");
167
+ you may not use this file except in compliance with the License.
168
+ You may obtain a copy of the License at
169
+
170
+ https://www.apache.org/licenses/LICENSE-2.0
171
+
172
+ Unless required by applicable law or agreed to in writing, software
173
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
174
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
175
+ See the License for the specific language governing permissions and
176
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # Nuzo CLI
2
+
3
+ The Nuzo CLI gives users direct control over local, auditable memory for AI
4
+ agents.
5
+
6
+ The public command is:
7
+
8
+ ```bash
9
+ nuzo memory
10
+ ```
11
+
12
+ Core workflows:
13
+
14
+ ```bash
15
+ nuzo memory init
16
+ nuzo memory remember "The demo project uses SQLite." --kind project_decision
17
+ nuzo memory recall "SQLite"
18
+ nuzo memory list
19
+ nuzo memory doctor
20
+ ```
21
+
22
+ Memory is stored locally under `~/.nuzo/memory/` by default. Nuzo does not use
23
+ telemetry or network access by default.
24
+
25
+ Documentation: https://nuzo.com.br
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from "commander";
3
+ export interface CliIO {
4
+ stdout(message: string): void;
5
+ stderr(message: string): void;
6
+ }
7
+ export declare const cliExitCodes: {
8
+ readonly success: 0;
9
+ readonly operationalError: 1;
10
+ readonly usageError: 2;
11
+ readonly internalError: 70;
12
+ };
13
+ export declare function createProgram(io?: CliIO): Command;
14
+ export declare function runCliProcess(argv: string[], io?: CliIO): Promise<number>;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,OAAO,EAAwC,MAAM,WAAW,CAAC;AAuB1E,MAAM,WAAW,KAAK;IACpB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AA4CD,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AAEX,wBAAgB,aAAa,CAAC,EAAE,GAAE,KAAiB,GAAG,OAAO,CAsY5D;AAMD,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EAAE,EACd,EAAE,GAAE,KAAiB,GACpB,OAAO,CAAC,MAAM,CAAC,CAuBjB"}
package/dist/index.js ADDED
@@ -0,0 +1,687 @@
1
+ #!/usr/bin/env node
2
+ import { createHash } from "node:crypto";
3
+ import { mkdirSync, readFileSync, realpathSync, statSync, writeFileSync } from "node:fs";
4
+ import { homedir } from "node:os";
5
+ import { dirname, join, resolve } from "node:path";
6
+ import { spawnSync } from "node:child_process";
7
+ import { fileURLToPath } from "node:url";
8
+ import { Command, CommanderError, InvalidArgumentError } from "commander";
9
+ import { createMemoryService, DefaultPolicyEngine, formatMemoryExportMarkdown, NuzoMemoryError, RandomIdGenerator, RegexSecretScanner, SQLiteMemoryDatabase, SystemClock, } from "@nuzo/memory-core";
10
+ const defaultStorePath = resolve(homedir(), ".nuzo", "memory", "memories.sqlite");
11
+ const defaultIO = {
12
+ stdout: (message) => console.log(message),
13
+ stderr: (message) => console.error(message),
14
+ };
15
+ export const cliExitCodes = {
16
+ success: 0,
17
+ operationalError: 1,
18
+ usageError: 2,
19
+ internalError: 70,
20
+ };
21
+ export function createProgram(io = defaultIO) {
22
+ const program = new Command()
23
+ .configureOutput({
24
+ writeOut: (message) => io.stdout(message.trimEnd()),
25
+ writeErr: (message) => io.stderr(message.trimEnd()),
26
+ })
27
+ .exitOverride();
28
+ program
29
+ .name("nuzo")
30
+ .description("Local-first, auditable memory for AI agents.")
31
+ .version("0.1.0");
32
+ const memory = program.command("memory").description("Manage local Nuzo stores.");
33
+ memory
34
+ .option("--store <path>", "Path to the SQLite memory store.")
35
+ .option("--scope <scope>", "Memory scope.");
36
+ memory
37
+ .command("init")
38
+ .description("Initialize the local memory store.")
39
+ .option("--project", "Initialize project-local memory in .nuzo/memory.", false)
40
+ .action(withErrorHandling(io, async (commandOptions) => {
41
+ const options = memory.opts();
42
+ const init = resolveInitContext(options, commandOptions);
43
+ ensureStoreDirectory(init.storePath);
44
+ if (!init.project) {
45
+ mkdirSync(join(dirname(init.storePath), "exports"), { recursive: true });
46
+ mkdirSync(join(dirname(init.storePath), "logs"), { recursive: true });
47
+ }
48
+ writeConfigIfMissing(init.configPath, init.configStorePath, init.scope);
49
+ if (init.projectRoot !== null) {
50
+ ensureProjectGitIgnore(init.projectRoot);
51
+ }
52
+ const database = new SQLiteMemoryDatabase({ path: init.storePath });
53
+ database.close();
54
+ io.stdout("Nuzo initialized");
55
+ io.stdout(`Store: ${init.storePath}`);
56
+ io.stdout(`Scope: ${init.scope}`);
57
+ io.stdout("Network: disabled");
58
+ }));
59
+ memory
60
+ .command("remember")
61
+ .description("Store a memory.")
62
+ .argument("<content>", "Memory content.")
63
+ .requiredOption("--kind <kind>", "Memory kind.")
64
+ .option("--tag <tag...>", "Memory tag. Can be used multiple times.")
65
+ .option("--source <source>", "Memory source.", "nuzo:cli")
66
+ .action(withErrorHandling(io, async (content, commandOptions) => {
67
+ const options = memory.opts();
68
+ const database = openDatabase(options);
69
+ try {
70
+ const service = createService(database);
71
+ const saved = await service.remember({
72
+ content,
73
+ kind: commandOptions.kind,
74
+ scope: resolveScope(options),
75
+ tags: commandOptions.tag ?? [],
76
+ source: commandOptions.source,
77
+ });
78
+ io.stdout(saved.id);
79
+ }
80
+ finally {
81
+ database.close();
82
+ }
83
+ }));
84
+ memory
85
+ .command("recall")
86
+ .description("Recall relevant memories.")
87
+ .argument("<query>", "Recall query.")
88
+ .option("--limit <number>", "Maximum number of results.", parsePositiveInteger, 8)
89
+ .option("--include-global", "Include user:default alongside the selected scope.", false)
90
+ .action(withErrorHandling(io, async (query, commandOptions) => {
91
+ const options = memory.opts();
92
+ const database = openDatabase(options);
93
+ try {
94
+ const service = createService(database);
95
+ const results = await service.recall({
96
+ query,
97
+ scope: resolveScope(options),
98
+ limit: commandOptions.limit,
99
+ includeGlobal: commandOptions.includeGlobal,
100
+ });
101
+ for (const result of results) {
102
+ io.stdout(`${result.memory.id}\t${result.score.toPrecision(4)}\t${result.memory.content}`);
103
+ }
104
+ }
105
+ finally {
106
+ database.close();
107
+ }
108
+ }));
109
+ memory
110
+ .command("list")
111
+ .description("List memories.")
112
+ .option("--tag <tag...>", "Filter by tag.")
113
+ .option("--include-archived", "Include archived memories.", false)
114
+ .action(withErrorHandling(io, async (commandOptions) => {
115
+ const options = memory.opts();
116
+ const database = openDatabase(options);
117
+ try {
118
+ const service = createService(database);
119
+ const listInput = {
120
+ includeArchived: commandOptions.includeArchived,
121
+ scope: resolveScope(options),
122
+ };
123
+ if (commandOptions.tag) {
124
+ listInput.tags = commandOptions.tag;
125
+ }
126
+ const memories = await service.list(listInput);
127
+ for (const item of memories) {
128
+ const archived = item.archivedAt ? " archived" : "";
129
+ io.stdout(`${item.id}\t${item.kind}${archived}\t${item.content}`);
130
+ }
131
+ }
132
+ finally {
133
+ database.close();
134
+ }
135
+ }));
136
+ memory
137
+ .command("update")
138
+ .description("Update a memory.")
139
+ .argument("<id>", "Memory ID.")
140
+ .option("--content <content>", "Replacement memory content.")
141
+ .option("--kind <kind>", "Replacement memory kind.")
142
+ .option("--scope <scope>", "Replacement memory scope.")
143
+ .option("--tag <tag...>", "Replacement memory tags.")
144
+ .option("--confidence <number>", "Replacement confidence between 0 and 1.", parseConfidence)
145
+ .action(withErrorHandling(io, async (id, commandOptions) => {
146
+ const options = memory.opts();
147
+ const database = openDatabase(options);
148
+ try {
149
+ const service = createService(database);
150
+ const updateInput = {
151
+ id,
152
+ actor: "nuzo:cli",
153
+ };
154
+ if (commandOptions.content !== undefined) {
155
+ updateInput.content = commandOptions.content;
156
+ }
157
+ if (commandOptions.kind !== undefined) {
158
+ updateInput.kind = commandOptions.kind;
159
+ }
160
+ if (commandOptions.scope !== undefined) {
161
+ updateInput.scope = commandOptions.scope;
162
+ }
163
+ if (commandOptions.tag !== undefined) {
164
+ updateInput.tags = commandOptions.tag;
165
+ }
166
+ if (commandOptions.confidence !== undefined) {
167
+ updateInput.confidence = commandOptions.confidence;
168
+ }
169
+ const updated = await service.update(updateInput);
170
+ io.stdout(updated.id);
171
+ }
172
+ finally {
173
+ database.close();
174
+ }
175
+ }));
176
+ memory
177
+ .command("forget")
178
+ .description("Archive or delete a memory.")
179
+ .argument("<id>", "Memory ID.")
180
+ .option("--archive", "Archive the memory. This is the default.", false)
181
+ .option("--delete", "Hard delete instead of archive.", false)
182
+ .option("--yes", "Confirm hard delete.", false)
183
+ .option("--reason <reason>", "Reason for forgetting.")
184
+ .action(withErrorHandling(io, async (id, commandOptions) => {
185
+ if (commandOptions.archive && commandOptions.delete) {
186
+ throw new NuzoMemoryError("MEMORY_FORGET_MODE_CONFLICT", "Choose either --archive or --delete, not both.", { id });
187
+ }
188
+ const options = memory.opts();
189
+ const database = openDatabase(options);
190
+ try {
191
+ const service = createService(database);
192
+ const forgetInput = {
193
+ id,
194
+ mode: commandOptions.delete ? "delete" : "archive",
195
+ confirm: commandOptions.yes,
196
+ actor: "nuzo:cli",
197
+ };
198
+ if (commandOptions.reason) {
199
+ forgetInput.reason = commandOptions.reason;
200
+ }
201
+ await service.forget(forgetInput);
202
+ io.stdout(commandOptions.delete ? "Deleted" : "Archived");
203
+ }
204
+ finally {
205
+ database.close();
206
+ }
207
+ }));
208
+ memory
209
+ .command("history")
210
+ .description("List audit events for a memory.")
211
+ .argument("<id>", "Memory ID.")
212
+ .action(withErrorHandling(io, async (id) => {
213
+ const options = memory.opts();
214
+ const database = openDatabase(options);
215
+ try {
216
+ const service = createService(database);
217
+ const events = await service.history(id);
218
+ for (const event of events) {
219
+ io.stdout([
220
+ event.createdAt.toISOString(),
221
+ event.eventType,
222
+ event.actor,
223
+ JSON.stringify(event.payload),
224
+ ].join("\t"));
225
+ }
226
+ }
227
+ finally {
228
+ database.close();
229
+ }
230
+ }));
231
+ memory
232
+ .command("forget-many")
233
+ .description("Preview or apply a filtered bulk archive/delete operation.")
234
+ .option("--scope <scope>", "Select one memory scope.")
235
+ .option("--tag <tag...>", "Select memories containing every tag.")
236
+ .option("--all", "Select all active memories.", false)
237
+ .option("--delete", "Hard delete instead of archive.", false)
238
+ .option("--apply", "Apply the operation. The default is dry-run.", false)
239
+ .option("--yes", "Confirm hard delete.", false)
240
+ .option("--reason <reason>", "Reason for forgetting.")
241
+ .action(withErrorHandling(io, async (commandOptions) => {
242
+ const options = memory.opts();
243
+ const database = openDatabase(options);
244
+ try {
245
+ const service = createService(database);
246
+ const forgetInput = {
247
+ tags: commandOptions.tag ?? [],
248
+ all: commandOptions.all,
249
+ mode: commandOptions.delete ? "delete" : "archive",
250
+ confirm: commandOptions.yes,
251
+ dryRun: !commandOptions.apply,
252
+ actor: "nuzo:cli",
253
+ };
254
+ if (commandOptions.scope !== undefined) {
255
+ forgetInput.scope = commandOptions.scope;
256
+ }
257
+ if (commandOptions.reason !== undefined) {
258
+ forgetInput.reason = commandOptions.reason;
259
+ }
260
+ const result = await service.forgetMany(forgetInput);
261
+ io.stdout([
262
+ result.dryRun ? "Preview" : "Applied",
263
+ `matched=${result.matched}`,
264
+ `affected=${result.affected}`,
265
+ `mode=${result.mode}`,
266
+ ].join("\t"));
267
+ for (const id of result.ids) {
268
+ io.stdout(id);
269
+ }
270
+ }
271
+ finally {
272
+ database.close();
273
+ }
274
+ }));
275
+ memory
276
+ .command("export")
277
+ .description("Export memories as a versioned document.")
278
+ .option("--path <path>", "Write export output to a file instead of stdout.")
279
+ .option("--format <format>", "Export format: json or markdown.", parseExportFormat)
280
+ .option("--tag <tag...>", "Filter by tag.")
281
+ .option("--include-archived", "Include archived memories.", false)
282
+ .action(withErrorHandling(io, async (commandOptions) => {
283
+ const options = memory.opts();
284
+ const database = openDatabase(options);
285
+ try {
286
+ const service = createService(database);
287
+ const exportInput = {
288
+ actor: "nuzo:cli",
289
+ scope: resolveScope(options),
290
+ includeArchived: commandOptions.includeArchived,
291
+ };
292
+ if (commandOptions.tag !== undefined) {
293
+ exportInput.tags = commandOptions.tag;
294
+ }
295
+ const document = await service.exportMemories(exportInput);
296
+ const format = commandOptions.format ?? inferExportFormat(commandOptions.path);
297
+ const output = formatExportDocument(document, format);
298
+ if (commandOptions.path) {
299
+ const exportPath = resolve(commandOptions.path);
300
+ ensureStoreDirectory(exportPath);
301
+ writeFileSync(exportPath, output, "utf8");
302
+ io.stdout(`Exported ${document.memories.length} memories to ${exportPath}`);
303
+ return;
304
+ }
305
+ io.stdout(output.trimEnd());
306
+ }
307
+ finally {
308
+ database.close();
309
+ }
310
+ }));
311
+ memory
312
+ .command("import")
313
+ .description("Import memories from a versioned JSON document.")
314
+ .argument("<path>", "Path to a Nuzo memory export JSON file.")
315
+ .option("--dry-run", "Validate and count memories without writing.", false)
316
+ .option("--scope <scope>", "Override imported memory scope.")
317
+ .action(withErrorHandling(io, async (path, commandOptions) => {
318
+ const options = memory.opts();
319
+ const database = openDatabase(options);
320
+ try {
321
+ const service = createService(database);
322
+ const document = readExportDocument(resolve(path));
323
+ const importInput = {
324
+ document,
325
+ actor: "nuzo:cli",
326
+ dryRun: commandOptions.dryRun,
327
+ };
328
+ if (commandOptions.scope !== undefined) {
329
+ importInput.scope = commandOptions.scope;
330
+ }
331
+ const result = await service.importMemories(importInput);
332
+ const skipped = result.skipped > 0 ? `, skipped ${result.skipped}` : "";
333
+ io.stdout(`${result.dryRun ? "Would import" : "Imported"} ${result.imported} memories${skipped}`);
334
+ }
335
+ finally {
336
+ database.close();
337
+ }
338
+ }));
339
+ memory
340
+ .command("doctor")
341
+ .description("Check the local memory environment.")
342
+ .action(withErrorHandling(io, async () => {
343
+ const options = memory.opts();
344
+ const report = createDoctorReport(options);
345
+ io.stdout(`Store: ${report.storePath}`);
346
+ io.stdout(`Store exists: ${report.storeExists ? "yes" : "no"}`);
347
+ io.stdout(`Store directory: ${report.storeDirectory}`);
348
+ io.stdout(`Store directory exists: ${report.storeDirectoryExists ? "yes" : "no"}`);
349
+ io.stdout(`Scope: ${report.scope}`);
350
+ io.stdout(`Network: ${report.network}`);
351
+ io.stdout(formatGitTracking(report.gitTracking));
352
+ if (report.gitTracking.status === "tracked") {
353
+ for (const trackedFile of report.gitTracking.trackedFiles) {
354
+ io.stdout(`Tracked memory file: ${trackedFile}`);
355
+ }
356
+ }
357
+ for (const warning of report.warnings) {
358
+ io.stdout(`Warning: ${warning}`);
359
+ }
360
+ io.stdout(`Status: ${report.warnings.length === 0 ? "ok" : "warning"}`);
361
+ }));
362
+ return program;
363
+ }
364
+ if (isMain()) {
365
+ process.exitCode = await runCliProcess(process.argv);
366
+ }
367
+ export async function runCliProcess(argv, io = defaultIO) {
368
+ process.exitCode = cliExitCodes.success;
369
+ const program = createProgram(io);
370
+ try {
371
+ await program.parseAsync(argv, { from: "node" });
372
+ return process.exitCode === cliExitCodes.operationalError
373
+ ? cliExitCodes.operationalError
374
+ : cliExitCodes.success;
375
+ }
376
+ catch (error) {
377
+ if (error instanceof CommanderError) {
378
+ if (error.code === "commander.helpDisplayed" ||
379
+ error.code === "commander.version") {
380
+ return cliExitCodes.success;
381
+ }
382
+ return cliExitCodes.usageError;
383
+ }
384
+ io.stderr("NUZO_INTERNAL_ERROR: Unexpected CLI failure.");
385
+ return cliExitCodes.internalError;
386
+ }
387
+ }
388
+ function withErrorHandling(io, action) {
389
+ return async (...args) => {
390
+ try {
391
+ await action(...args);
392
+ }
393
+ catch (error) {
394
+ if (error instanceof NuzoMemoryError) {
395
+ io.stderr(`${error.code}: ${error.message}`);
396
+ process.exitCode = cliExitCodes.operationalError;
397
+ return;
398
+ }
399
+ throw error;
400
+ }
401
+ };
402
+ }
403
+ function openDatabase(options) {
404
+ const storePath = resolveStorePath(options);
405
+ ensureStoreDirectory(storePath);
406
+ return new SQLiteMemoryDatabase({ path: storePath });
407
+ }
408
+ function createService(database) {
409
+ return createMemoryService({
410
+ store: database,
411
+ searchIndex: database,
412
+ auditLog: database,
413
+ clock: new SystemClock(),
414
+ ids: new RandomIdGenerator(),
415
+ policy: new DefaultPolicyEngine(new RegexSecretScanner()),
416
+ transactions: database,
417
+ });
418
+ }
419
+ function resolveStorePath(options) {
420
+ if (options.store !== undefined) {
421
+ return resolve(options.store);
422
+ }
423
+ return readProjectConfig()?.storage.path ?? defaultStorePath;
424
+ }
425
+ function resolveScope(options) {
426
+ if (options.scope !== undefined) {
427
+ return options.scope;
428
+ }
429
+ return readProjectConfig()?.default_scope ?? "user:default";
430
+ }
431
+ function readProjectConfig() {
432
+ const projectRoot = realpathSync(process.cwd());
433
+ const configPath = join(projectRoot, ".nuzo", "config.json");
434
+ if (!pathExists(configPath)) {
435
+ return null;
436
+ }
437
+ let value;
438
+ try {
439
+ value = JSON.parse(readFileSync(configPath, "utf8"));
440
+ }
441
+ catch {
442
+ throw new NuzoMemoryError("MEMORY_CONFIG_INVALID", "Project Nuzo config is not valid JSON.", { path: configPath });
443
+ }
444
+ if (!isRecord(value) ||
445
+ value.version !== 1 ||
446
+ typeof value.default_scope !== "string" ||
447
+ !isRecord(value.storage) ||
448
+ value.storage.driver !== "sqlite" ||
449
+ typeof value.storage.path !== "string") {
450
+ throw new NuzoMemoryError("MEMORY_CONFIG_INVALID", "Project Nuzo config has an unsupported shape.", { path: configPath });
451
+ }
452
+ return {
453
+ version: 1,
454
+ default_scope: value.default_scope,
455
+ storage: {
456
+ driver: "sqlite",
457
+ path: resolve(projectRoot, value.storage.path),
458
+ },
459
+ };
460
+ }
461
+ function resolveInitContext(options, commandOptions) {
462
+ if (commandOptions.project) {
463
+ if (options.store !== undefined) {
464
+ throw new NuzoMemoryError("MEMORY_INIT_STORE_CONFLICT", "Project init cannot be combined with a custom --store path.");
465
+ }
466
+ const projectRoot = realpathSync(process.cwd());
467
+ const nuzoRoot = join(projectRoot, ".nuzo");
468
+ return {
469
+ configPath: join(nuzoRoot, "config.json"),
470
+ configStorePath: ".nuzo/memory/memories.sqlite",
471
+ project: true,
472
+ projectRoot,
473
+ scope: projectScope(projectRoot),
474
+ storePath: join(nuzoRoot, "memory", "memories.sqlite"),
475
+ };
476
+ }
477
+ const storePath = resolve(options.store ?? defaultStorePath);
478
+ const configRoot = storePath === defaultStorePath
479
+ ? dirname(dirname(storePath))
480
+ : dirname(storePath);
481
+ return {
482
+ configPath: join(configRoot, "config.json"),
483
+ configStorePath: storePath,
484
+ project: false,
485
+ projectRoot: null,
486
+ scope: options.scope ?? "user:default",
487
+ storePath,
488
+ };
489
+ }
490
+ function projectScope(projectRoot) {
491
+ const digest = createHash("sha256").update(projectRoot).digest("hex").slice(0, 16);
492
+ return `project:${digest}`;
493
+ }
494
+ function ensureStoreDirectory(storePath) {
495
+ mkdirSync(dirname(storePath), { recursive: true });
496
+ }
497
+ function writeConfigIfMissing(configPath, configStorePath, scope) {
498
+ if (pathExists(configPath)) {
499
+ return;
500
+ }
501
+ mkdirSync(dirname(configPath), { recursive: true });
502
+ writeFileSync(configPath, `${JSON.stringify({
503
+ version: 1,
504
+ default_scope: scope,
505
+ storage: {
506
+ driver: "sqlite",
507
+ path: configStorePath,
508
+ },
509
+ recall: {
510
+ limit: 8,
511
+ include_global: true,
512
+ },
513
+ privacy: {
514
+ allow_network: false,
515
+ record_recall_events: false,
516
+ },
517
+ }, null, 2)}\n`, "utf8");
518
+ }
519
+ function ensureProjectGitIgnore(projectRoot) {
520
+ const path = join(projectRoot, ".gitignore");
521
+ const rules = [
522
+ ".nuzo/memory/",
523
+ ".nuzo/**/*.sqlite",
524
+ ".nuzo/**/*.sqlite-*",
525
+ ];
526
+ const existing = pathExists(path) ? readFileSync(path, "utf8") : "";
527
+ const lines = new Set(existing.split(/\r?\n/));
528
+ const missing = rules.filter((rule) => !lines.has(rule));
529
+ if (missing.length === 0) {
530
+ return;
531
+ }
532
+ const separator = existing.length > 0 && !existing.endsWith("\n") ? "\n" : "";
533
+ writeFileSync(path, `${existing}${separator}${missing.join("\n")}\n`, "utf8");
534
+ }
535
+ function pathExists(path) {
536
+ try {
537
+ statSync(path);
538
+ return true;
539
+ }
540
+ catch {
541
+ return false;
542
+ }
543
+ }
544
+ function isRecord(value) {
545
+ return typeof value === "object" && value !== null && !Array.isArray(value);
546
+ }
547
+ function createDoctorReport(options) {
548
+ const storePath = resolveStorePath(options);
549
+ const storeDirectory = dirname(storePath);
550
+ const gitTracking = findTrackedMemoryFiles();
551
+ const warnings = [];
552
+ if (!pathExists(storePath)) {
553
+ warnings.push("memory store has not been initialized");
554
+ }
555
+ if (!pathExists(storeDirectory)) {
556
+ warnings.push("memory store directory does not exist");
557
+ }
558
+ if (gitTracking.status === "tracked") {
559
+ warnings.push(`${gitTracking.trackedFiles.length} local memory file(s) are tracked by Git`);
560
+ }
561
+ if (gitTracking.status === "unavailable") {
562
+ warnings.push(`Git tracking check unavailable: ${gitTracking.reason}`);
563
+ }
564
+ return {
565
+ storePath,
566
+ storeExists: pathExists(storePath),
567
+ storeDirectory,
568
+ storeDirectoryExists: pathExists(storeDirectory),
569
+ scope: resolveScope(options),
570
+ network: "disabled",
571
+ gitTracking,
572
+ warnings,
573
+ };
574
+ }
575
+ function findTrackedMemoryFiles(cwd = process.cwd()) {
576
+ if (process.env.NUZO_DOCTOR_SKIP_GIT === "1") {
577
+ return {
578
+ status: "skipped",
579
+ reason: "NUZO_DOCTOR_SKIP_GIT=1",
580
+ trackedFiles: [],
581
+ };
582
+ }
583
+ const result = spawnSync("git", [
584
+ "ls-files",
585
+ "-z",
586
+ "--",
587
+ ".nuzo",
588
+ "*.sqlite",
589
+ "*.sqlite-*",
590
+ "*.memory.export.md",
591
+ "*.memory.export.json",
592
+ "memories.sqlite",
593
+ "memories.sqlite-*",
594
+ ], {
595
+ cwd,
596
+ encoding: "utf8",
597
+ });
598
+ if (result.error) {
599
+ return {
600
+ status: "unavailable",
601
+ reason: result.error.message,
602
+ trackedFiles: [],
603
+ };
604
+ }
605
+ if (result.status !== 0) {
606
+ const reason = result.stderr.trim().split(/\r?\n/)[0] || "not a Git worktree";
607
+ return {
608
+ status: "unavailable",
609
+ reason,
610
+ trackedFiles: [],
611
+ };
612
+ }
613
+ const trackedFiles = result.stdout.split("\0").filter(Boolean);
614
+ return trackedFiles.length === 0
615
+ ? { status: "clean", trackedFiles }
616
+ : { status: "tracked", trackedFiles };
617
+ }
618
+ function formatGitTracking(report) {
619
+ if (report.status === "skipped") {
620
+ return `Git tracking: skipped (${report.reason})`;
621
+ }
622
+ if (report.status === "unavailable") {
623
+ return `Git tracking: unavailable (${report.reason})`;
624
+ }
625
+ if (report.status === "tracked") {
626
+ return `Git tracking: warning (${report.trackedFiles.length} local memory file(s) tracked)`;
627
+ }
628
+ return "Git tracking: clean";
629
+ }
630
+ function readExportDocument(path) {
631
+ try {
632
+ return JSON.parse(readFileSync(path, "utf8"));
633
+ }
634
+ catch (error) {
635
+ if (error instanceof SyntaxError) {
636
+ throw new NuzoMemoryError("MEMORY_EXPORT_INVALID", "Memory export JSON is invalid.", {
637
+ path,
638
+ });
639
+ }
640
+ throw error;
641
+ }
642
+ }
643
+ function formatExportDocument(document, format) {
644
+ if (format === "markdown") {
645
+ return formatMemoryExportMarkdown(document);
646
+ }
647
+ return `${JSON.stringify(document, null, 2)}\n`;
648
+ }
649
+ function inferExportFormat(path) {
650
+ if (path?.toLowerCase().endsWith(".md")) {
651
+ return "markdown";
652
+ }
653
+ return "json";
654
+ }
655
+ function parseExportFormat(value) {
656
+ if (value === "json" || value === "markdown") {
657
+ return value;
658
+ }
659
+ throw new InvalidArgumentError("Expected export format to be json or markdown.");
660
+ }
661
+ function parsePositiveInteger(value) {
662
+ const parsed = Number.parseInt(value, 10);
663
+ if (!Number.isInteger(parsed) || parsed <= 0) {
664
+ throw new InvalidArgumentError("Expected a positive integer.");
665
+ }
666
+ return parsed;
667
+ }
668
+ function parseConfidence(value) {
669
+ const parsed = Number.parseFloat(value);
670
+ if (!Number.isFinite(parsed) || parsed < 0 || parsed > 1) {
671
+ throw new InvalidArgumentError("Expected a number between 0 and 1.");
672
+ }
673
+ return parsed;
674
+ }
675
+ function isMain() {
676
+ const entrypoint = process.argv[1];
677
+ if (entrypoint === undefined) {
678
+ return false;
679
+ }
680
+ try {
681
+ return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(entrypoint);
682
+ }
683
+ catch {
684
+ return false;
685
+ }
686
+ }
687
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAA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,IAAI,CAAC,CAAC,CAAC,CAAC;IACnC,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,YAAY,CAAC,UAAU,CAAC,CAAC;IACnF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@nuzo/memory-cli",
3
+ "version": "0.1.0",
4
+ "description": "Command line interface for Nuzo.",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "engines": {
8
+ "node": ">=22",
9
+ "npm": ">=10"
10
+ },
11
+ "bin": {
12
+ "nuzo": "dist/index.js"
13
+ },
14
+ "main": "dist/index.js",
15
+ "types": "dist/index.d.ts",
16
+ "files": [
17
+ "dist",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
21
+ "dependencies": {
22
+ "@nuzo/memory-core": "0.1.0",
23
+ "commander": "^14.0.2"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/fabionfsc/nuzo-memory.git",
31
+ "directory": "packages/cli"
32
+ },
33
+ "homepage": "https://nuzo.com.br/",
34
+ "bugs": {
35
+ "url": "https://github.com/fabionfsc/nuzo-memory/issues"
36
+ }
37
+ }