@hasna/mementos 0.4.35 → 0.4.37
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 +52 -3
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -4785,7 +4785,7 @@ program2.command("recall <key>").description("Recall a memory by key").option("-
|
|
|
4785
4785
|
handleError(e);
|
|
4786
4786
|
}
|
|
4787
4787
|
});
|
|
4788
|
-
program2.command("list").description("List memories with optional filters").option("-s, --scope <scope>", "Scope filter").option("-c, --category <cat>", "Category filter").option("--tags <tags>", "Comma-separated tags filter").option("--importance-min <n>", "Minimum importance", parseInt).option("--pinned", "Show only pinned").option("--agent <name>", "Agent filter").option("--project <path>", "Project filter").option("--limit <n>", "Max results", parseInt).option("--offset <n>", "Offset for pagination", parseInt).option("--status <status>", "Status filter: active, archived, expired").option("--format <fmt>", "Output format: compact (default), json, csv, yaml").action((opts) => {
|
|
4788
|
+
program2.command("list").description("List memories with optional filters").option("-s, --scope <scope>", "Scope filter").option("-c, --category <cat>", "Category filter").option("--tags <tags>", "Comma-separated tags filter").option("--importance-min <n>", "Minimum importance", parseInt).option("--pinned", "Show only pinned").option("--agent <name>", "Agent filter").option("--project <path>", "Project filter").option("--session <id>", "Session ID filter").option("--limit <n>", "Max results", parseInt).option("--offset <n>", "Offset for pagination", parseInt).option("--status <status>", "Status filter: active, archived, expired").option("--format <fmt>", "Output format: compact (default), json, csv, yaml").action((opts) => {
|
|
4789
4789
|
try {
|
|
4790
4790
|
const globalOpts = program2.opts();
|
|
4791
4791
|
const agentId = opts.agent || globalOpts.agent;
|
|
@@ -4807,7 +4807,7 @@ program2.command("list").description("List memories with optional filters").opti
|
|
|
4807
4807
|
limit: opts.limit || 50,
|
|
4808
4808
|
offset: opts.offset,
|
|
4809
4809
|
status: opts.status,
|
|
4810
|
-
session_id: globalOpts.session
|
|
4810
|
+
session_id: opts.session || globalOpts.session
|
|
4811
4811
|
};
|
|
4812
4812
|
const memories = listMemories(filter);
|
|
4813
4813
|
const fmt = getOutputFormat(opts.format);
|
|
@@ -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": {
|