@hasna/mementos 0.4.35 → 0.4.36
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/index.js +50 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -5980,6 +5980,55 @@ program2.command("unpin <keyOrId>").description("Unpin a memory by key or partia
|
|
|
5980
5980
|
handleError(e);
|
|
5981
5981
|
}
|
|
5982
5982
|
});
|
|
5983
|
+
program2.command("archive <keyOrId>").description("Archive a memory by key or ID (hides from lists, keeps history)").option("-s, --scope <scope>", "Scope filter for key lookup").action((keyOrId, opts) => {
|
|
5984
|
+
try {
|
|
5985
|
+
const globalOpts = program2.opts();
|
|
5986
|
+
let memory = getMemory(resolvePartialId(getDatabase(), "memories", keyOrId) || keyOrId) || getMemoryByKey(keyOrId, opts.scope, globalOpts.agent);
|
|
5987
|
+
if (!memory) {
|
|
5988
|
+
console.error(chalk.red(`No memory found: ${keyOrId}`));
|
|
5989
|
+
process.exit(1);
|
|
5990
|
+
}
|
|
5991
|
+
updateMemory(memory.id, { status: "archived", version: memory.version });
|
|
5992
|
+
if (globalOpts.json) {
|
|
5993
|
+
outputJson({ archived: true, id: memory.id, key: memory.key });
|
|
5994
|
+
} else {
|
|
5995
|
+
console.log(chalk.green(`\u2713 Archived: ${chalk.bold(memory.key)} (${memory.id.slice(0, 8)})`));
|
|
5996
|
+
}
|
|
5997
|
+
} catch (e) {
|
|
5998
|
+
console.error(chalk.red(`archive failed: ${e instanceof Error ? e.message : String(e)}`));
|
|
5999
|
+
process.exit(1);
|
|
6000
|
+
}
|
|
6001
|
+
});
|
|
6002
|
+
program2.command("versions <keyOrId>").description("Show version history for a memory").option("-s, --scope <scope>", "Scope filter for key lookup").action((keyOrId, opts) => {
|
|
6003
|
+
try {
|
|
6004
|
+
const globalOpts = program2.opts();
|
|
6005
|
+
let memory = getMemory(resolvePartialId(getDatabase(), "memories", keyOrId) || keyOrId) || getMemoryByKey(keyOrId, opts.scope, globalOpts.agent);
|
|
6006
|
+
if (!memory) {
|
|
6007
|
+
console.error(chalk.red(`No memory found: ${keyOrId}`));
|
|
6008
|
+
process.exit(1);
|
|
6009
|
+
}
|
|
6010
|
+
const versions = getMemoryVersions(memory.id);
|
|
6011
|
+
if (globalOpts.json) {
|
|
6012
|
+
outputJson({ memory: { id: memory.id, key: memory.key, current_version: memory.version }, versions });
|
|
6013
|
+
return;
|
|
6014
|
+
}
|
|
6015
|
+
console.log(chalk.bold(`
|
|
6016
|
+
Version history: ${memory.key} (current: v${memory.version})
|
|
6017
|
+
`));
|
|
6018
|
+
if (versions.length === 0) {
|
|
6019
|
+
console.log(chalk.dim(" No previous versions."));
|
|
6020
|
+
return;
|
|
6021
|
+
}
|
|
6022
|
+
for (const v of versions) {
|
|
6023
|
+
console.log(` ${chalk.cyan(`v${v.version}`)} ${chalk.dim(v.created_at.slice(0, 16))} scope=${v.scope} imp=${v.importance}`);
|
|
6024
|
+
console.log(` ${v.value.slice(0, 120)}${v.value.length > 120 ? "..." : ""}`);
|
|
6025
|
+
}
|
|
6026
|
+
console.log("");
|
|
6027
|
+
} catch (e) {
|
|
6028
|
+
console.error(chalk.red(`versions failed: ${e instanceof Error ? e.message : String(e)}`));
|
|
6029
|
+
process.exit(1);
|
|
6030
|
+
}
|
|
6031
|
+
});
|
|
5983
6032
|
program2.command("tail").description("Watch for new/updated memories in real-time (like tail -f)").option("-s, --scope <scope>", "Scope filter: global, shared, private").option("-c, --category <cat>", "Category filter: preference, fact, knowledge, history").option("--agent <name>", "Agent filter").option("--project <path>", "Project filter").option("--interval <ms>", "Poll interval in milliseconds (default: 2000)", parseInt).option("--notify", "Send macOS notifications for each change").action((opts) => {
|
|
5984
6033
|
try {
|
|
5985
6034
|
const globalOpts = program2.opts();
|
|
@@ -6502,7 +6551,7 @@ function diffLines(oldText, newText) {
|
|
|
6502
6551
|
}
|
|
6503
6552
|
}
|
|
6504
6553
|
program2.command("completions <shell>").description("Output shell completion script (bash, zsh, fish)").action((shell) => {
|
|
6505
|
-
const commands = "save recall list update forget search stats export import clean inject context pin unpin doctor tail diff init agents projects bulk completions config backup restore report profile mcp";
|
|
6554
|
+
const commands = "save recall list update forget search stats export import clean inject context pin unpin archive versions doctor tail diff init agents projects bulk completions config backup restore report profile mcp";
|
|
6506
6555
|
const commandList = commands.split(" ");
|
|
6507
6556
|
switch (shell.toLowerCase()) {
|
|
6508
6557
|
case "bash": {
|