@sechroom/cli 2026.6.34 → 2026.6.35
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/index.js +44 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -844,6 +844,50 @@ Examples:
|
|
|
844
844
|
cmd.optsWithGlobals().json
|
|
845
845
|
);
|
|
846
846
|
});
|
|
847
|
+
memory.command("update <memoryId>").description("Update metadata only \u2014 title/tags/type/confidence (PATCH /memories/{memoryId}/metadata; omitted = unchanged)").option("--title <text>", "Set the title").option("--tag <tag...>", "Set the full tag list (replaces existing); repeatable").option("--add-tag <tag...>", "Add tag(s) to the existing set (repeatable)").option("--remove-tag <tag...>", "Remove tag(s) from the existing set (repeatable)").option("--type <type>", "Set the memory type (e.g. reference, note, document)").option("--confidence <n>", "Set confidence (0..1)", (v) => Number(v)).option("--memory-source <src>", "Set the memory's own Source field").option("--bump-version", "Bump the version chain (use for a content reinterpretation, e.g. a type promotion)", false).option("--source <source>", "Contributing lane stamp (attribution)", "cli").action(async (memoryId, opts, cmd) => {
|
|
848
|
+
const cfg = resolveConfig(cmd.optsWithGlobals());
|
|
849
|
+
const json = cmd.optsWithGlobals().json;
|
|
850
|
+
const hasTagOps = Boolean(opts.tag || opts.addTag || opts.removeTag);
|
|
851
|
+
const hasAny = opts.title !== void 0 || hasTagOps || opts.type !== void 0 || opts.confidence !== void 0 || opts.memorySource !== void 0 || Boolean(opts.bumpVersion);
|
|
852
|
+
if (!hasAny)
|
|
853
|
+
fail("nothing to update \u2014 pass at least one of --title / --tag / --add-tag / --remove-tag / --type / --confidence / --memory-source.");
|
|
854
|
+
let tags;
|
|
855
|
+
if (hasTagOps) {
|
|
856
|
+
let base;
|
|
857
|
+
if (opts.tag) base = opts.tag;
|
|
858
|
+
else {
|
|
859
|
+
const current = await runApi("Reading current tags", async () => {
|
|
860
|
+
const client = await makeClient(cfg);
|
|
861
|
+
return client.GET("/memories/{memoryId}", { params: { path: { memoryId } } });
|
|
862
|
+
});
|
|
863
|
+
base = current?.item?.tags ?? current?.tags ?? [];
|
|
864
|
+
}
|
|
865
|
+
const set = new Set(base);
|
|
866
|
+
for (const t of opts.addTag ?? []) set.add(t);
|
|
867
|
+
for (const t of opts.removeTag ?? []) set.delete(t);
|
|
868
|
+
tags = [...set];
|
|
869
|
+
}
|
|
870
|
+
const body = {
|
|
871
|
+
memoryId,
|
|
872
|
+
source: opts.source,
|
|
873
|
+
bumpVersion: Boolean(opts.bumpVersion)
|
|
874
|
+
};
|
|
875
|
+
if (opts.title !== void 0) body.title = opts.title;
|
|
876
|
+
if (tags !== void 0) body.tags = tags;
|
|
877
|
+
if (opts.type !== void 0) body.type = opts.type;
|
|
878
|
+
if (opts.confidence !== void 0) body.confidence = opts.confidence;
|
|
879
|
+
if (opts.memorySource !== void 0) body.memorySource = opts.memorySource;
|
|
880
|
+
const data = await runApi("Updating metadata", async () => {
|
|
881
|
+
const client = await makeClient(cfg);
|
|
882
|
+
return client.PATCH("/memories/{memoryId}/metadata", {
|
|
883
|
+
params: { path: { memoryId } },
|
|
884
|
+
body
|
|
885
|
+
});
|
|
886
|
+
});
|
|
887
|
+
const changed = data?.changed ?? [];
|
|
888
|
+
const summary = changed.length > 0 ? `updated ${changed.join(", ")}` : "no changes";
|
|
889
|
+
emitAction(`${summary} on ${style.bold(memoryId)} \u2192 v${style.bold(String(data?.version ?? "?"))}`, data, json);
|
|
890
|
+
});
|
|
847
891
|
memory.command("archive <memoryId>").description("Archive a memory (POST /memories/{memoryId}/archive)").option("--source <source>", "Source / lane stamp", "cli").action(async (memoryId, opts, cmd) => {
|
|
848
892
|
const cfg = resolveConfig(cmd.optsWithGlobals());
|
|
849
893
|
const data = await runApi("Archiving memory", async () => {
|
package/package.json
CHANGED