@wirecat/cli-memo 0.23.0 → 0.24.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/README.md +24 -21
- package/dist/actions/command.d.ts.map +1 -1
- package/dist/actions/command.js +12 -13
- package/dist/actions/command.js.map +1 -1
- package/dist/agents/command.d.ts.map +1 -1
- package/dist/agents/command.js +3 -2
- package/dist/agents/command.js.map +1 -1
- package/dist/answers/command.js +6 -6
- package/dist/answers/command.js.map +1 -1
- package/dist/author.d.ts +11 -0
- package/dist/author.d.ts.map +1 -0
- package/dist/author.js +16 -0
- package/dist/author.js.map +1 -0
- package/dist/bin/memo.js +4 -2
- package/dist/bin/memo.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/context/command.d.ts.map +1 -1
- package/dist/context/command.js +3 -3
- package/dist/context/command.js.map +1 -1
- package/dist/context/context.js +1 -1
- package/dist/discovery/command.d.ts +2 -0
- package/dist/discovery/command.d.ts.map +1 -1
- package/dist/discovery/command.js +18 -10
- package/dist/discovery/command.js.map +1 -1
- package/dist/examples.d.ts +5 -0
- package/dist/examples.d.ts.map +1 -0
- package/dist/examples.js +128 -0
- package/dist/examples.js.map +1 -0
- package/dist/facts/command.d.ts.map +1 -1
- package/dist/facts/command.js +18 -17
- package/dist/facts/command.js.map +1 -1
- package/dist/install/postinstall.d.ts +7 -0
- package/dist/install/postinstall.d.ts.map +1 -0
- package/dist/install/postinstall.js +28 -0
- package/dist/install/postinstall.js.map +1 -0
- package/dist/knowledge/command.d.ts.map +1 -1
- package/dist/knowledge/command.js +106 -61
- package/dist/knowledge/command.js.map +1 -1
- package/dist/knowledge/key-documents.d.ts +29 -0
- package/dist/knowledge/key-documents.d.ts.map +1 -0
- package/dist/knowledge/key-documents.js +76 -0
- package/dist/knowledge/key-documents.js.map +1 -0
- package/dist/knowledge/meeting-projects-command.js +4 -4
- package/dist/knowledge/meeting-projects-command.js.map +1 -1
- package/dist/mail/messages-command.d.ts +4 -0
- package/dist/mail/messages-command.d.ts.map +1 -0
- package/dist/mail/messages-command.js +32 -0
- package/dist/mail/messages-command.js.map +1 -0
- package/dist/mcp/command.js +1 -1
- package/dist/mcp/command.js.map +1 -1
- package/dist/mcp/knowledge.js +3 -3
- package/dist/mcp/knowledge.js.map +1 -1
- package/dist/mcp/server.js +9 -9
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/task-relations.d.ts +3 -3
- package/dist/mcp/task-relations.d.ts.map +1 -1
- package/dist/mcp/task-relations.js +17 -8
- package/dist/mcp/task-relations.js.map +1 -1
- package/dist/mcp/vocabulary.d.ts +2 -3
- package/dist/mcp/vocabulary.d.ts.map +1 -1
- package/dist/mcp/vocabulary.js +23 -18
- package/dist/mcp/vocabulary.js.map +1 -1
- package/dist/memories/command.d.ts +1 -0
- package/dist/memories/command.d.ts.map +1 -1
- package/dist/memories/command.js +22 -20
- package/dist/memories/command.js.map +1 -1
- package/dist/notes/about.d.ts +11 -2
- package/dist/notes/about.d.ts.map +1 -1
- package/dist/notes/about.js +34 -30
- package/dist/notes/about.js.map +1 -1
- package/dist/notes/bound.d.ts +3 -0
- package/dist/notes/bound.d.ts.map +1 -1
- package/dist/notes/bound.js +9 -1
- package/dist/notes/bound.js.map +1 -1
- package/dist/notes/command.d.ts.map +1 -1
- package/dist/notes/command.js +17 -60
- package/dist/notes/command.js.map +1 -1
- package/dist/notes/folders-command.d.ts.map +1 -1
- package/dist/notes/folders-command.js +12 -6
- package/dist/notes/folders-command.js.map +1 -1
- package/dist/notes/list.d.ts +22 -0
- package/dist/notes/list.d.ts.map +1 -0
- package/dist/notes/list.js +24 -0
- package/dist/notes/list.js.map +1 -0
- package/dist/notes/search.d.ts.map +1 -1
- package/dist/notes/search.js +2 -2
- package/dist/notes/search.js.map +1 -1
- package/dist/options.d.ts +2 -0
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +2 -0
- package/dist/options.js.map +1 -1
- package/dist/people/command.js +2 -2
- package/dist/program.d.ts +5 -0
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +35 -6
- package/dist/program.js.map +1 -1
- package/dist/run/auto.d.ts.map +1 -1
- package/dist/run/auto.js +11 -13
- package/dist/run/auto.js.map +1 -1
- package/dist/run/import.d.ts +2 -2
- package/dist/run/import.d.ts.map +1 -1
- package/dist/run/import.js +66 -27
- package/dist/run/import.js.map +1 -1
- package/dist/run/lock.d.ts +1 -1
- package/dist/run/lock.d.ts.map +1 -1
- package/dist/run/lock.js +1 -1
- package/dist/run/lock.js.map +1 -1
- package/dist/search/command.d.ts +15 -20
- package/dist/search/command.d.ts.map +1 -1
- package/dist/search/command.js +96 -47
- package/dist/search/command.js.map +1 -1
- package/dist/tags/command.d.ts.map +1 -1
- package/dist/tags/command.js +17 -7
- package/dist/tags/command.js.map +1 -1
- package/dist/tasks/command.d.ts.map +1 -1
- package/dist/tasks/command.js +16 -6
- package/dist/tasks/command.js.map +1 -1
- package/dist/tasks/relations-command.d.ts.map +1 -1
- package/dist/tasks/relations-command.js +8 -21
- package/dist/tasks/relations-command.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/vocabulary/command.d.ts.map +1 -1
- package/dist/vocabulary/command.js +44 -32
- package/dist/vocabulary/command.js.map +1 -1
- package/install/postinstall.mjs +9 -0
- package/package.json +8 -4
- package/skills/cli-memo/SKILL.md +49 -0
- package/dist/mail/command.d.ts +0 -4
- package/dist/mail/command.d.ts.map +0 -1
- package/dist/mail/command.js +0 -105
- package/dist/mail/command.js.map +0 -1
package/dist/mcp/vocabulary.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
1
2
|
import * as v from "valibot";
|
|
2
3
|
import { define } from "./tool.js";
|
|
3
4
|
const bounded = (maximum) => v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(maximum)));
|
|
@@ -15,36 +16,40 @@ export const vocabularyTools = {
|
|
|
15
16
|
input: v.object(options),
|
|
16
17
|
run: (store, args) => store.knowledge.vocabulary(args),
|
|
17
18
|
}),
|
|
18
|
-
|
|
19
|
-
title: "
|
|
20
|
-
description: "
|
|
19
|
+
vocabulary_check: define({
|
|
20
|
+
title: "Check vocabulary names",
|
|
21
|
+
description: "With a name: the existing canonical tag or topic, or lexical candidates to review, before creating a label. Without one: a bounded lexical comparison of canonical names and aliases; an incomplete scan does not prove uniqueness. Similarity never merges records, and this tool accepts, merges and creates nothing.",
|
|
21
22
|
writes: false,
|
|
22
23
|
input: v.object({
|
|
23
24
|
...options,
|
|
25
|
+
name: v.optional(v.pipe(v.string(), v.minLength(1), v.maxLength(200))),
|
|
24
26
|
minSimilarity: v.optional(v.pipe(v.number(), v.minValue(0.65), v.maxValue(1))),
|
|
25
27
|
maxComparisons: bounded(100000),
|
|
26
28
|
limit: bounded(200),
|
|
27
29
|
}),
|
|
28
|
-
run: (store,
|
|
30
|
+
run: (store, { name, kind, scope, minSimilarity, maxComparisons, limit, ...budget }) => {
|
|
31
|
+
if (name === undefined)
|
|
32
|
+
return store.knowledge.auditVocabulary({
|
|
33
|
+
...budget,
|
|
34
|
+
...(kind === undefined ? {} : { kind }),
|
|
35
|
+
...(scope === undefined ? {} : { scope }),
|
|
36
|
+
...(minSimilarity === undefined ? {} : { minSimilarity }),
|
|
37
|
+
...(maxComparisons === undefined ? {} : { maxComparisons }),
|
|
38
|
+
...(limit === undefined ? {} : { limit }),
|
|
39
|
+
});
|
|
40
|
+
if (kind === "project" || scope !== undefined)
|
|
41
|
+
throw new CliError("validation_error", "a new name is a tag or topic: kind tag or topic, no scope");
|
|
42
|
+
if (minSimilarity !== undefined || maxComparisons !== undefined || limit !== undefined)
|
|
43
|
+
throw new CliError("validation_error", "minSimilarity, maxComparisons and limit check the whole vocabulary: no name");
|
|
44
|
+
return store.knowledge.tagPreflight(name, { ...budget, ...(kind === undefined ? {} : { kind }) });
|
|
45
|
+
},
|
|
29
46
|
}),
|
|
30
|
-
|
|
31
|
-
title: "
|
|
47
|
+
vocabulary_show: define({
|
|
48
|
+
title: "Show a canonical name",
|
|
32
49
|
description: "Resolve only exact names and explicit aliases. Ambiguous matches remain candidates; never infer identity from similarity.",
|
|
33
50
|
writes: false,
|
|
34
51
|
input: v.object({ name: v.pipe(v.string(), v.minLength(1), v.maxLength(200)), ...options }),
|
|
35
52
|
run: (store, { name, ...args }) => store.knowledge.resolveVocabulary(name, args),
|
|
36
53
|
}),
|
|
37
|
-
vocabulary_preflight: define({
|
|
38
|
-
title: "Review a proposed label",
|
|
39
|
-
description: "Find the existing canonical tag/topic or lexical candidates to review before creating a label. Similarity never merges records and this tool creates nothing.",
|
|
40
|
-
writes: false,
|
|
41
|
-
input: v.object({
|
|
42
|
-
name: v.pipe(v.string(), v.minLength(1), v.maxLength(200)),
|
|
43
|
-
kind: v.optional(v.picklist(["tag", "topic"])),
|
|
44
|
-
maxEntries: bounded(20000),
|
|
45
|
-
maxReadBytes: bounded(16777216),
|
|
46
|
-
}),
|
|
47
|
-
run: (store, { name, ...args }) => store.knowledge.tagPreflight(name, args),
|
|
48
|
-
}),
|
|
49
54
|
};
|
|
50
55
|
//# sourceMappingURL=vocabulary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vocabulary.js","sourceRoot":"","sources":["../../src/mcp/vocabulary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAElC,MAAM,OAAO,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,OAA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AAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAA;QACnG,CAAC;KACF,CAAC;IACF,eAAe,EAAE,MAAM,CAAC;QACtB,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EACT,2HAA2H;QAC7H,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;QAC3F,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC;KACjF,CAAC;CACH,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Streams } from "@wirecat/cli-base";
|
|
2
2
|
import type { Command } from "commander";
|
|
3
3
|
export declare const memoriesCommand: (program: Command, streams: Streams, env: NodeJS.ProcessEnv) => void;
|
|
4
|
+
export declare const searchMemoriesCommand: (search: Command, streams: Streams, env: NodeJS.ProcessEnv) => void;
|
|
4
5
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/memories/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/memories/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAgBxC,eAAO,MAAM,eAAe,YAAa,OAAO,WAAW,OAAO,OAAO,MAAM,CAAC,UAAU,KAAG,IAuE5F,CAAA;AAED,eAAO,MAAM,qBAAqB,WAAY,OAAO,WAAW,OAAO,OAAO,MAAM,CAAC,UAAU,KAAG,IAsBjG,CAAA"}
|
package/dist/memories/command.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MEMORY_KINDS, MEMORY_SCOPES, MEMORY_STATUSES } from "@wirecat/cli-messaging/store";
|
|
2
|
+
import { authorOf, byOption } from "../author.js";
|
|
2
3
|
import { oneOf, positive } from "../options.js";
|
|
3
4
|
import { pageOf } from "../page.js";
|
|
4
5
|
import { answering } from "../records/run.js";
|
|
@@ -7,10 +8,8 @@ export const memoriesCommand = (program, streams, env) => {
|
|
|
7
8
|
const run = answering(streams, env);
|
|
8
9
|
const memories = program
|
|
9
10
|
.command("memories")
|
|
10
|
-
.description("
|
|
11
|
-
memories
|
|
12
|
-
.command("add")
|
|
13
|
-
.description("Write a memory of your own; it is confirmed at once")
|
|
11
|
+
.description("what agents and you concluded, with evidence; you confirm an agent's");
|
|
12
|
+
byOption(memories.command("add").description("write a memory; an agent's waits as proposed until you confirm it"))
|
|
14
13
|
.argument("<text...>", "what is true, in a sentence or two")
|
|
15
14
|
.requiredOption("--kind <kind>", MEMORY_KINDS.join(", "), oneOf(MEMORY_KINDS))
|
|
16
15
|
.requiredOption("--scope <scope>", MEMORY_SCOPES.join(" or "), oneOf(MEMORY_SCOPES))
|
|
@@ -23,10 +22,10 @@ export const memoriesCommand = (program, streams, env) => {
|
|
|
23
22
|
scope: options.scope,
|
|
24
23
|
evidence: options.evidence,
|
|
25
24
|
...(options.subject === undefined ? {} : { subject: options.subject }),
|
|
26
|
-
},
|
|
25
|
+
}, authorOf(env, options.asOwner))));
|
|
27
26
|
memories
|
|
28
27
|
.command("list")
|
|
29
|
-
.description("
|
|
28
|
+
.description("memories, newest first")
|
|
30
29
|
.option("--status <status>", MEMORY_STATUSES.join(", "), oneOf(MEMORY_STATUSES))
|
|
31
30
|
.option("--kind <kind>", MEMORY_KINDS.join(", "), oneOf(MEMORY_KINDS))
|
|
32
31
|
.option("--scope <scope>", MEMORY_SCOPES.join(" or "), oneOf(MEMORY_SCOPES))
|
|
@@ -36,32 +35,35 @@ export const memoriesCommand = (program, streams, env) => {
|
|
|
36
35
|
.action(({ json, ...filters }) => run(json, (store) => pageOf(filters.limit, (limit) => store.memories.list({ ...filters, limit }))));
|
|
37
36
|
memories
|
|
38
37
|
.command("show")
|
|
39
|
-
.description("
|
|
38
|
+
.description("one memory with its evidence")
|
|
40
39
|
.argument("<ref>", "memory:<id>")
|
|
41
40
|
.option("--json", "print JSON")
|
|
42
41
|
.action((ref, options) => run(options.json, (store) => store.memories.get(ref)));
|
|
43
|
-
memories
|
|
44
|
-
.command("search")
|
|
45
|
-
.description("Memories holding every word, best first")
|
|
46
|
-
.argument("<words...>", "the words to find")
|
|
47
|
-
.option("--scope <scope>", MEMORY_SCOPES.join(" or "), oneOf(MEMORY_SCOPES))
|
|
48
|
-
.option("--limit <n>", "most memories, up to 500", positive, 20)
|
|
49
|
-
.option("--json", "print JSON")
|
|
50
|
-
.action((words, options) => run(options.json, (store) => pageOf(options.limit, (limit) => store.memories.search(words.join(" "), {
|
|
51
|
-
limit,
|
|
52
|
-
...(options.scope === undefined ? {} : { scope: options.scope }),
|
|
53
|
-
}), { fallback: 20, cap: 200 })));
|
|
54
42
|
memories
|
|
55
43
|
.command("confirm")
|
|
56
|
-
.description("
|
|
44
|
+
.description("stand behind a memory: its evidence was checked now")
|
|
57
45
|
.argument("<ref>", "memory:<id>")
|
|
58
46
|
.option("--json", "print JSON")
|
|
59
47
|
.action((ref, options) => run(options.json, (store) => store.memories.confirm(ref)));
|
|
60
48
|
memories
|
|
61
49
|
.command("stale")
|
|
62
|
-
.description("
|
|
50
|
+
.description("mark a memory whose evidence no longer holds")
|
|
63
51
|
.argument("<ref>", "memory:<id>")
|
|
64
52
|
.option("--json", "print JSON")
|
|
65
53
|
.action((ref, options) => run(options.json, (store) => store.memories.markStale(ref)));
|
|
66
54
|
};
|
|
55
|
+
export const searchMemoriesCommand = (search, streams, env) => {
|
|
56
|
+
const run = answering(streams, env);
|
|
57
|
+
search
|
|
58
|
+
.command("memories")
|
|
59
|
+
.description("memories holding every word, best first")
|
|
60
|
+
.argument("<words...>", "the words to find")
|
|
61
|
+
.option("--scope <scope>", MEMORY_SCOPES.join(" or "), oneOf(MEMORY_SCOPES))
|
|
62
|
+
.option("--limit <n>", "most memories, up to 500", positive, 20)
|
|
63
|
+
.option("--json", "print JSON")
|
|
64
|
+
.action((words, options) => run(options.json, (store) => pageOf(options.limit, (limit) => store.memories.search(words.join(" "), {
|
|
65
|
+
limit,
|
|
66
|
+
...(options.scope === undefined ? {} : { scope: options.scope }),
|
|
67
|
+
}), { fallback: 20, cap: 200 })));
|
|
68
|
+
};
|
|
67
69
|
//# sourceMappingURL=command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/memories/command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAe,MAAM,8BAA8B,CAAA;AAExG,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAWzC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAE,OAAgB,EAAE,GAAsB,EAAQ,EAAE;IAClG,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;IACnC,MAAM,QAAQ,GAAG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AAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAAe,EAAE,OAAgB,EAAE,GAAsB,EAAQ,EAAE;IACvG,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;IACnC,MAAM;SACH,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,yCAAyC,CAAC;SACtD,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;SAC3C,MAAM,CAAC,iBAAiB,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;SAC3E,MAAM,CAAC,aAAa,EAAE,0BAA0B,EAAE,QAAQ,EAAE,EAAE,CAAC;SAC/D,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC;SAC9B,MAAM,CAAC,CAAC,KAAe,EAAE,OAAmE,EAAE,EAAE,CAC/F,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAC1B,MAAM,CACJ,OAAO,CAAC,KAAK,EACb,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACrC,KAAK;QACL,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;KACjE,CAAC,EACJ,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAC3B,CACF,CACF,CAAA;AACL,CAAC,CAAA"}
|
package/dist/notes/about.d.ts
CHANGED
|
@@ -27,7 +27,16 @@ export interface NotesAbout {
|
|
|
27
27
|
})[];
|
|
28
28
|
hasMore: boolean;
|
|
29
29
|
}
|
|
30
|
-
/**
|
|
30
|
+
/** How a note reaches its subject: says it is about it, links it, links a note about it, or names it in a link. */
|
|
31
|
+
export type Via = "about" | "link" | "through" | "name";
|
|
32
|
+
export type Found = {
|
|
33
|
+
note: Note;
|
|
34
|
+
anchor: string | null;
|
|
35
|
+
text: string | null;
|
|
36
|
+
via: Via;
|
|
37
|
+
};
|
|
38
|
+
/** Every live note that reaches a subject through the links the store holds — never a name found in plain text. */
|
|
39
|
+
export declare const notesReaching: (store: MessageStore, subject: Subject) => Promise<Found[]>;
|
|
40
|
+
/** What notes say about a subject, split by how each reaches it. */
|
|
31
41
|
export declare const notesAbout: (store: MessageStore, subject: Subject, limit?: number) => Promise<NotesAbout>;
|
|
32
|
-
export declare const aboutText: (answer: NotesAbout) => string;
|
|
33
42
|
//# sourceMappingURL=about.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"about.d.ts","sourceRoot":"","sources":["../../src/notes/about.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,YAAY,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAA;AAC5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAEnD,2EAA2E;AAC3E,eAAO,MAAM,eAAe,cAAe,MAAM,KAAG,OAA8C,CAAA;AAElG,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,iDAAiD;IACjD,KAAK,EAAE,OAAO,EAAE,CAAA;IAChB,4CAA4C;IAC5C,OAAO,E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,GAAG,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAA;AAEvD,MAAM,MAAM,KAAK,GAAG;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,GAAG,EAAE,GAAG,CAAA;CAAE,CAAA;AAIxF,mHAAmH;AACnH,eAAO,MAAM,aAAa,UAAiB,YAAY,WAAW,OAAO,KAAG,OAAO,CAAC,KAAK,EAAE,CAmD1F,CAAA;AAED,oEAAoE;AACpE,eAAO,MAAM,UAAU,UAAiB,YAAY,WAAW,OAAO,qBAAe,OAAO,CAAC,UAAU,CAkBtG,CAAA"}
|
package/dist/notes/about.js
CHANGED
|
@@ -11,60 +11,64 @@ const refOf = (note, anchor = null) => ({
|
|
|
11
11
|
modifiedAt: note.updatedAt,
|
|
12
12
|
...(anchor === null ? {} : { anchor }),
|
|
13
13
|
});
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const PAGE = 500;
|
|
15
|
+
/** Every live note that reaches a subject through the links the store holds — never a name found in plain text. */
|
|
16
|
+
export const notesReaching = async (store, subject) => {
|
|
16
17
|
const refs = [
|
|
17
18
|
subject.ref,
|
|
18
19
|
...(subject.person?.identities.map((identity) => formatReference({ type: "contact", provider: identity.provider, id: identity.id })) ?? []),
|
|
19
20
|
];
|
|
20
|
-
const live = async (links) => {
|
|
21
|
+
const live = async (links, via) => {
|
|
21
22
|
const found = [];
|
|
22
23
|
for (const link of links) {
|
|
23
24
|
if (!isNoteReference(link.from))
|
|
24
25
|
continue;
|
|
25
26
|
const note = await store.notes.resolveNote(link.from);
|
|
26
27
|
if (note && note.deletedAt === null)
|
|
27
|
-
found.push({ note, anchor: link.anchor, text: link.targetText });
|
|
28
|
+
found.push({ note, anchor: link.anchor, text: link.targetText, via });
|
|
28
29
|
}
|
|
29
30
|
return found;
|
|
30
31
|
};
|
|
32
|
+
const aboutOne = async (ref) => {
|
|
33
|
+
const notes = [];
|
|
34
|
+
for (let offset = 0;; offset += PAGE) {
|
|
35
|
+
const page = await store.notes.notes({ about: ref, limit: PAGE, offset });
|
|
36
|
+
notes.push(...page.items);
|
|
37
|
+
if (!page.hasMore)
|
|
38
|
+
return notes;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
31
41
|
// A written note's first subject is the note's own, not a link, so only `notes({ about })` sees all of them.
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
42
|
+
const about = (await Promise.all(refs.map(aboutOne)))
|
|
43
|
+
.flat()
|
|
44
|
+
.map((note) => ({ note, anchor: null, text: null, via: "about" }));
|
|
45
|
+
const linking = await live((await Promise.all(refs.map((to) => store.notes.links({ to })))).flat().filter((link) => link.kind === "links-to"), "link");
|
|
35
46
|
const through = await live((await Promise.all(about.map(({ note }) => store.notes.links({ to: note.ref }))))
|
|
36
47
|
.flat()
|
|
37
|
-
.filter((link) => link.kind === "links-to"));
|
|
48
|
+
.filter((link) => link.kind === "links-to"), "through");
|
|
38
49
|
const names = new Set([subject.person?.name, ...(subject.person?.identities.map(({ name }) => name) ?? [])]
|
|
39
50
|
.filter((name) => !!name?.trim())
|
|
40
51
|
.map(fold));
|
|
41
52
|
const waiting = names.size === 0
|
|
42
53
|
? []
|
|
43
|
-
: await live((await store.notes.links({ unresolved: true })).filter((link) => names.has(fold(link.targetText ?? ""))));
|
|
44
|
-
|
|
45
|
-
|
|
54
|
+
: await live((await store.notes.links({ unresolved: true })).filter((link) => names.has(fold(link.targetText ?? ""))), "name");
|
|
55
|
+
return [...about, ...linking, ...through, ...waiting];
|
|
56
|
+
};
|
|
57
|
+
/** What notes say about a subject, split by how each reaches it. */
|
|
58
|
+
export const notesAbout = async (store, subject, limit = 20) => {
|
|
59
|
+
const found = await notesReaching(store, subject);
|
|
60
|
+
const unique = (via) => [
|
|
61
|
+
...new Map(found.filter((item) => item.via === via).map((item) => [`${item.note.ref}#${item.anchor ?? ""}`, item])).values(),
|
|
62
|
+
].sort((a, b) => b.note.updatedAt.localeCompare(a.note.updatedAt));
|
|
63
|
+
const [about, linking, through, waiting] = ["about", "link", "through", "name"].map(unique);
|
|
46
64
|
return {
|
|
47
65
|
subject: subject.ref,
|
|
48
66
|
name: subject.person?.name ?? null,
|
|
49
|
-
about: (
|
|
50
|
-
linking: (
|
|
51
|
-
throughNotes: (
|
|
52
|
-
waiting: (
|
|
53
|
-
hasMore:
|
|
67
|
+
about: (about ?? []).slice(0, limit).map(({ note }) => refOf(note)),
|
|
68
|
+
linking: (linking ?? []).slice(0, limit).map(({ note, anchor }) => refOf(note, anchor)),
|
|
69
|
+
throughNotes: (through ?? []).slice(0, limit).map(({ note, anchor }) => refOf(note, anchor)),
|
|
70
|
+
waiting: (waiting ?? []).slice(0, limit).map(({ note, text }) => ({ ...refOf(note), text: text ?? "" })),
|
|
71
|
+
hasMore: [about, linking, through, waiting].some((list) => (list ?? []).length > limit),
|
|
54
72
|
};
|
|
55
73
|
};
|
|
56
|
-
export const aboutText = (answer) => {
|
|
57
|
-
const line = (note) => ` ${note.ref}${(note.path ?? note.title) ? ` ${note.path ?? note.title}` : ""}${note.anchor ? ` ${note.anchor}` : ""}`;
|
|
58
|
-
const section = (title, notes) => (notes.length ? [title, ...notes.map(line), ""] : []);
|
|
59
|
-
const who = answer.name ?? answer.subject;
|
|
60
|
-
return [
|
|
61
|
-
...(answer.about.length ? section("About", answer.about) : [`No note about ${who}.`, ""]),
|
|
62
|
-
...section("Linking them", answer.linking),
|
|
63
|
-
...section("Linking a note about them", answer.throughNotes),
|
|
64
|
-
...section("Written with their name, but two people share it — link one with tg contacts link", answer.waiting),
|
|
65
|
-
...(answer.hasMore ? ["More were found; raise --limit to see them."] : []),
|
|
66
|
-
]
|
|
67
|
-
.join("\n")
|
|
68
|
-
.trimEnd();
|
|
69
|
-
};
|
|
70
74
|
//# sourceMappingURL=about.js.map
|
package/dist/notes/about.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"about.js","sourceRoot":"","sources":["../../src/notes/about.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAIxD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAiB,EAAW,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"about.js","sourceRoot":"","sources":["../../src/notes/about.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAIxD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAiB,EAAW,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;AA2BlG,MAAM,IAAI,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;AAEvG,MAAM,KAAK,GAAG,CAAC,IAAU,EAAE,MAAM,GAAkB,IAAI,EAAW,EAAE,CAAC,CAAC;IACpE,GAAG,EAAE,IAAI,CAAC,GAAG;IACb,MAAM,EAAE,IAAI,CAAC,MAAM;IACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;IACvB,IAAI,EAAE,IAAI,CAAC,IAAI;IACf,KAAK,EAAE,IAAI,CAAC,KAAK;IACjB,UAAU,EAAE,IAAI,CAAC,SAAS;IAC1B,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;CACvC,CAAC,CAAA;AAOF,MAAM,IAAI,GAAG,GAAG,CAAA;AAEhB,mHAAmH;AACnH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,KAAmB,EAAE,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EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;QACxG,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC;KACxF,CAAA;AACH,CAAC,CAAA"}
|
package/dist/notes/bound.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type NoteFolder } from "./folders.js";
|
|
|
3
3
|
export type BoundFolder = NoteFolder & {
|
|
4
4
|
id: string;
|
|
5
5
|
};
|
|
6
|
+
export declare const unboundReason: (path: string) => string;
|
|
6
7
|
/**
|
|
7
8
|
* The configured folders the store knows; `only` narrows them by path or id.
|
|
8
9
|
* `strict` refuses a folder with no id — an import must not invent one — while a read just leaves it out.
|
|
@@ -11,6 +12,8 @@ export declare const boundFolders: (store: MessageStore, env: NodeJS.ProcessEnv,
|
|
|
11
12
|
only?: string[];
|
|
12
13
|
strict?: boolean;
|
|
13
14
|
}) => Promise<BoundFolder[]>;
|
|
15
|
+
/** Folder ids for folders named by id, even one only another computer has, or by a configured path. */
|
|
16
|
+
export declare const folderIds: (store: MessageStore, env: NodeJS.ProcessEnv, selected: string[]) => Promise<string[]>;
|
|
14
17
|
/** The folder a file lies in, and its path inside it. */
|
|
15
18
|
export declare const folderOfFile: (folders: BoundFolder[], file: string) => {
|
|
16
19
|
folder: BoundFolder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bound.d.ts","sourceRoot":"","sources":["../../src/notes/bound.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEhE,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,cAAc,CAAA;AAE3D,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"bound.d.ts","sourceRoot":"","sources":["../../src/notes/bound.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEhE,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,cAAc,CAAA;AAE3D,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAA;AAErD,eAAO,MAAM,aAAa,SAAU,MAAM,WAC+E,CAAA;AAIzH;;;GAGG;AACH,eAAO,MAAM,YAAY,UAChB,YAAY,OACd,MAAM,CAAC,UAAU,qBACG;IAAE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,KAC7D,OAAO,CAAC,WAAW,EAAE,CAgBvB,CAAA;AAED,uGAAuG;AACvG,eAAO,MAAM,SAAS,UAAiB,YAAY,OAAO,MAAM,CAAC,UAAU,YAAY,MAAM,EAAE,KAAG,OAAO,CAAC,MAAM,EAAE,CAKjH,CAAA;AAED,yDAAyD;AACzD,eAAO,MAAM,YAAY,YAAa,WAAW,EAAE,QAAQ,MAAM,KAAG;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAKtG,CAAA"}
|
package/dist/notes/bound.js
CHANGED
|
@@ -2,7 +2,8 @@ import { resolve } from "node:path";
|
|
|
2
2
|
import { CliError } from "@wirecat/cli-base";
|
|
3
3
|
import { loadConfig } from "../config.js";
|
|
4
4
|
import { noteFolders } from "./folders.js";
|
|
5
|
-
const
|
|
5
|
+
export const unboundReason = (path) => `${path} has no folder id — memo folders add ${path}, or memo folders attach <id> ${path} if another computer made one`;
|
|
6
|
+
const unbound = (path) => new CliError("configuration_error", unboundReason(path));
|
|
6
7
|
/**
|
|
7
8
|
* The configured folders the store knows; `only` narrows them by path or id.
|
|
8
9
|
* `strict` refuses a folder with no id — an import must not invent one — while a read just leaves it out.
|
|
@@ -26,6 +27,13 @@ export const boundFolders = async (store, env, { only, strict = true } = {}) =>
|
|
|
26
27
|
return [];
|
|
27
28
|
});
|
|
28
29
|
};
|
|
30
|
+
/** Folder ids for folders named by id, even one only another computer has, or by a configured path. */
|
|
31
|
+
export const folderIds = async (store, env, selected) => {
|
|
32
|
+
const known = new Set((await store.notes.folders()).map(({ id }) => id));
|
|
33
|
+
const paths = selected.filter((value) => !known.has(value));
|
|
34
|
+
const bound = paths.length ? await boundFolders(store, env, { only: paths }) : [];
|
|
35
|
+
return [...new Set([...selected.filter((value) => known.has(value)), ...bound.map(({ id }) => id)])];
|
|
36
|
+
};
|
|
29
37
|
/** The folder a file lies in, and its path inside it. */
|
|
30
38
|
export const folderOfFile = (folders, file) => {
|
|
31
39
|
const at = resolve(file);
|
package/dist/notes/bound.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bound.js","sourceRoot":"","sources":["../../src/notes/bound.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAmB,WAAW,EAAE,MAAM,cAAc,CAAA;AAI3D,MAAM,
|
|
1
|
+
{"version":3,"file":"bound.js","sourceRoot":"","sources":["../../src/notes/bound.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAmB,WAAW,EAAE,MAAM,cAAc,CAAA;AAI3D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,EAAE,CAC5C,GAAG,IAAI,wCAAw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AC,UAAU,CAAC,GAAG,SAAS,CAAC,IAAI,GAAG,CAAC,CAAC,CAAA;IAC/E,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE,sCAAsC,CAAC,CAAA;IACzF,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAA;AAC3D,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/notes/command.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAE1D,OAAO,EAAE,KAAK,OAAO,EAAwB,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/notes/command.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAE1D,OAAO,EAAE,KAAK,OAAO,EAAwB,MAAM,WAAW,CAAA;AA2C9D,eAAO,MAAM,YAAY,YAAa,OAAO,WAAW,OAAO,OAAO,MAAM,CAAC,UAAU,KAAG,IAiNzF,CAAA"}
|
package/dist/notes/command.js
CHANGED
|
@@ -3,18 +3,18 @@ import { CliError } from "@wirecat/cli-base";
|
|
|
3
3
|
import { openStore } from "@wirecat/cli-messaging/store";
|
|
4
4
|
import { InvalidArgumentError } from "commander";
|
|
5
5
|
import { loadConfig } from "../config.js";
|
|
6
|
-
import { positive } from "../options.js";
|
|
6
|
+
import { collect, positive } from "../options.js";
|
|
7
7
|
import { importNotesMap } from "../people/notes-map.js";
|
|
8
8
|
import { subjectOf } from "../people/subject.js";
|
|
9
9
|
import { printing } from "../records/run.js";
|
|
10
10
|
import { SAVE_HELP } from "../save-help.js";
|
|
11
11
|
import { meetingReference } from "../store/scope.js";
|
|
12
|
-
import {
|
|
12
|
+
import { isNoteReference } from "./about.js";
|
|
13
13
|
import { boundFolders, folderOfFile } from "./bound.js";
|
|
14
14
|
import { DIALECTS } from "./dialects/index.js";
|
|
15
|
-
import {
|
|
16
|
-
import { folderNotes, importNotes } from "./import.js";
|
|
15
|
+
import { folderNotes } from "./import.js";
|
|
17
16
|
import { exportInternal, exportTarget, internalNotes } from "./internal.js";
|
|
17
|
+
import { listNotes } from "./list.js";
|
|
18
18
|
import { loadFolderState } from "./state.js";
|
|
19
19
|
const formatOf = (value) => {
|
|
20
20
|
if (!DIALECTS.includes(value))
|
|
@@ -26,10 +26,6 @@ const sourceOf = (value) => {
|
|
|
26
26
|
throw new InvalidArgumentError("choose file or internal");
|
|
27
27
|
return value;
|
|
28
28
|
};
|
|
29
|
-
const importText = (results) => results
|
|
30
|
-
.map((result) => `${result.folder}: ${result.notes} notes, ${result.changed} changed, ${result.renamed} moved, ${result.deleted} gone` +
|
|
31
|
-
(result.deletionsSkipped === undefined ? "" : `\nDeletions skipped: ${result.deletionsSkipped}`))
|
|
32
|
-
.join("\n");
|
|
33
29
|
const textOf = (options, given) => {
|
|
34
30
|
const sources = [given, options.text, options.file].filter((value) => value !== undefined);
|
|
35
31
|
if (sources.length !== 1)
|
|
@@ -45,7 +41,7 @@ const noteOf = async (store, env, reference) => {
|
|
|
45
41
|
const { folder, path } = folderOfFile(await boundFolders(store, env, { strict: false }), reference);
|
|
46
42
|
const found = (await folderNotes(store, folder.id)).find((note) => note.path === path);
|
|
47
43
|
if (!found)
|
|
48
|
-
throw new CliError("not_found", `${reference} is not imported — memo notes
|
|
44
|
+
throw new CliError("not_found", `${reference} is not imported — memo sync --notes`);
|
|
49
45
|
return found;
|
|
50
46
|
};
|
|
51
47
|
export const notesCommand = (program, streams, env) => {
|
|
@@ -60,49 +56,10 @@ export const notesCommand = (program, streams, env) => {
|
|
|
60
56
|
await store.close();
|
|
61
57
|
}
|
|
62
58
|
};
|
|
63
|
-
const notes = program
|
|
64
|
-
.command("notes")
|
|
65
|
-
.description("Notes: files from your folders, and notes you write here about messages, people and projects");
|
|
66
|
-
notes
|
|
67
|
-
.command("import")
|
|
68
|
-
.description("Bring the folders' notes, their links and tags into the shared store — only what changed")
|
|
69
|
-
.option("--folder <path-or-id...>", "only these configured folders")
|
|
70
|
-
.option("--ignore <path...>", "files or folders inside them to skip, added to notes.ignore — a path or a glob")
|
|
71
|
-
.option("--no-embed", "skip embedding the notes for search by meaning this run")
|
|
72
|
-
.option("--json", "print JSON")
|
|
73
|
-
.action(async (options) => {
|
|
74
|
-
const results = await withStore(async (store) => {
|
|
75
|
-
const config = loadConfig(env).notes;
|
|
76
|
-
const folders = await boundFolders(store, env, options.folder === undefined ? {} : { only: options.folder });
|
|
77
|
-
if (folders.length === 0)
|
|
78
|
-
throw new CliError("configuration_error", "no folders of notes — memo folders add <path>");
|
|
79
|
-
const ignore = [...(config?.ignore ?? []), ...(options.ignore ?? [])];
|
|
80
|
-
const imported = [];
|
|
81
|
-
for (const folder of folders)
|
|
82
|
-
imported.push(await importNotes(store, folder, { ignore, env }));
|
|
83
|
-
await importNotesMap(store, env, folders);
|
|
84
|
-
const embedded = await embedNoteChunks(store, { embed: options.embed && config?.embed !== false, env });
|
|
85
|
-
if (embedded.notEmbedded !== undefined)
|
|
86
|
-
streams.diagnostic(`Not searchable by meaning: ${embedded.notEmbedded}\n`);
|
|
87
|
-
else if (embedded.left)
|
|
88
|
-
streams.diagnostic(`${embedded.chunks} chunks embedded; run again to embed the rest\n`);
|
|
89
|
-
return imported;
|
|
90
|
-
});
|
|
91
|
-
print(options.json, results, importText(results));
|
|
92
|
-
});
|
|
93
|
-
notes
|
|
94
|
-
.command("about")
|
|
95
|
-
.description("Notes about a person, project or note, and the notes that link them — through links, never a name in plain text")
|
|
96
|
-
.argument("<subject>", "<messenger>:<name or id>, person:<uid>, organization:<id>, project:<id>, note:<id> or document:<id>")
|
|
97
|
-
.option("--limit <n>", "most notes of each kind", positive, 20)
|
|
98
|
-
.option("--json", "print JSON")
|
|
99
|
-
.action(async (subject, options) => {
|
|
100
|
-
const answer = await withStore(async (store) => notesAbout(store, await subjectOf(store, subject), options.limit));
|
|
101
|
-
print(options.json, answer, aboutText(answer));
|
|
102
|
-
});
|
|
59
|
+
const notes = program.command("notes").description("notes from your folders, and notes you write here");
|
|
103
60
|
notes
|
|
104
61
|
.command("show")
|
|
105
|
-
.description("
|
|
62
|
+
.description("one note: its text, tags, what it links and what links it")
|
|
106
63
|
.addHelpText("after", SAVE_HELP)
|
|
107
64
|
.argument("<note>", "note:<id>, document:<id>, or a file in a configured folder")
|
|
108
65
|
.option("--json", "print JSON")
|
|
@@ -134,33 +91,33 @@ export const notesCommand = (program, streams, env) => {
|
|
|
134
91
|
});
|
|
135
92
|
notes
|
|
136
93
|
.command("list")
|
|
137
|
-
.description("
|
|
138
|
-
.option("--about <subject>", "only notes about this: <messenger>:<name or id> or a typed reference")
|
|
94
|
+
.description("notes, newest first")
|
|
95
|
+
.option("--about <subject>", "only notes about or linking this: <messenger>:<name or id> or a typed reference")
|
|
139
96
|
.option("--source <source>", "file or internal", sourceOf)
|
|
140
97
|
.option("--search <text>", "only notes holding this text, as written")
|
|
141
98
|
.option("--offset <n>", "skip this many", Number, 0)
|
|
142
99
|
.option("--limit <n>", "most notes, at most 500", positive, 20)
|
|
143
100
|
.option("--json", "print JSON")
|
|
144
101
|
.action(async (options) => {
|
|
145
|
-
const page = await withStore(async (store) => store
|
|
102
|
+
const page = await withStore(async (store) => listNotes(store, {
|
|
146
103
|
limit: options.limit,
|
|
147
104
|
offset: options.offset,
|
|
148
|
-
...(options.about === undefined ? {} : { about:
|
|
105
|
+
...(options.about === undefined ? {} : { about: await subjectOf(store, options.about) }),
|
|
149
106
|
...(options.source === undefined ? {} : { source: options.source }),
|
|
150
107
|
...(options.search === undefined ? {} : { search: options.search }),
|
|
151
108
|
}));
|
|
152
109
|
print(options.json, page, page.items
|
|
153
|
-
.map((note) => `${note.ref} ${note.source} ${note.path ?? note.title ?? note.text.split("\n")[0]}`)
|
|
110
|
+
.map((note) => `${note.ref} ${note.source}${note.via ? ` ${note.via}` : ""} ${note.path ?? note.title ?? note.text.split("\n")[0]}${note.anchors?.length ? ` ${note.anchors.join(" ")}` : ""}${note.linkText ? ` as "${note.linkText}"` : ""}`)
|
|
154
111
|
.join("\n") || "No notes.");
|
|
155
112
|
});
|
|
156
113
|
notes
|
|
157
114
|
.command("add")
|
|
158
|
-
.description("
|
|
115
|
+
.description("write a note of your own about messages, people, projects or other notes")
|
|
159
116
|
.argument("[text]", "the note; or --text, or --file")
|
|
160
117
|
.option("--text <text>", "the note")
|
|
161
118
|
.option("--file <path>", "read the note from a file; - reads stdin")
|
|
162
119
|
.option("--title <title>", "a title")
|
|
163
|
-
.option("--about <subject
|
|
120
|
+
.option("--about <subject>", "what it is about: <messenger>:<name or id>, msg:, chat:, person:, organization:, project:, task:, note:, document:, meeting:; repeat for more", collect)
|
|
164
121
|
.option("--meeting <id>", "also about this meeting, by its store id, with --provider and --account")
|
|
165
122
|
.option("--provider <provider>", "the meeting's provider")
|
|
166
123
|
.option("--account <account>", "the meeting's account")
|
|
@@ -189,7 +146,7 @@ export const notesCommand = (program, streams, env) => {
|
|
|
189
146
|
});
|
|
190
147
|
notes
|
|
191
148
|
.command("edit")
|
|
192
|
-
.description("
|
|
149
|
+
.description("change a note you wrote here; a file's note is edited in its file")
|
|
193
150
|
.argument("<id>", "note:<id> or its id")
|
|
194
151
|
.requiredOption("--revision <n>", "its current revision, so an edit made meanwhile is not lost", positive)
|
|
195
152
|
.option("--text <text>", "the new text")
|
|
@@ -210,7 +167,7 @@ export const notesCommand = (program, streams, env) => {
|
|
|
210
167
|
});
|
|
211
168
|
notes
|
|
212
169
|
.command("remove")
|
|
213
|
-
.description("
|
|
170
|
+
.description("delete a note you wrote here; a file it was exported to stays")
|
|
214
171
|
.argument("<id>", "note:<id> or its id")
|
|
215
172
|
.option("--json", "print JSON")
|
|
216
173
|
.action(async (id, options) => {
|
|
@@ -219,7 +176,7 @@ export const notesCommand = (program, streams, env) => {
|
|
|
219
176
|
});
|
|
220
177
|
notes
|
|
221
178
|
.command("export")
|
|
222
|
-
.description("
|
|
179
|
+
.description("write the notes you wrote here as files, never overwriting one you edited")
|
|
223
180
|
.option("--to <dir>", "the folder to write to (default: notes.export.dir)")
|
|
224
181
|
.option("--format <format>", `the files' format: ${DIALECTS.join(", ")}`, formatOf)
|
|
225
182
|
.option("--json", "print JSON")
|