@creator-notes/cnotes 0.40.0 → 0.42.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.
@@ -1,150 +0,0 @@
1
- import { ApiClient } from "../lib/api-client.js";
2
- import { resolveConfig } from "../lib/config.js";
3
- import { handleError } from "../lib/errors.js";
4
- import { outputJson, outputTable, truncate } from "../lib/output.js";
5
- function sourceLabel(s) {
6
- return s === "conversation" ? "conv" : "notes";
7
- }
8
- function formatFacts(facts, cfg, source) {
9
- let filtered = facts;
10
- if (source) {
11
- filtered = facts.filter((f) => f.source === source);
12
- }
13
- if (cfg.quiet) {
14
- for (const f of filtered) {
15
- console.log(f.fact);
16
- }
17
- return;
18
- }
19
- if (filtered.length === 0) {
20
- console.log("No facts found.");
21
- return;
22
- }
23
- const rows = filtered.map((f) => [
24
- sourceLabel(f.source),
25
- f.source_node_name || "—",
26
- f.target_node_name || "—",
27
- truncate(f.fact, 80),
28
- ]);
29
- outputTable(["SOURCE", "FROM", "TO", "FACT"], rows);
30
- }
31
- function formatEntities(entities, cfg, source) {
32
- let filtered = entities;
33
- if (source) {
34
- filtered = entities.filter((e) => e.source === source);
35
- }
36
- if (cfg.quiet) {
37
- for (const e of filtered) {
38
- console.log(e.name);
39
- }
40
- return;
41
- }
42
- if (filtered.length === 0) {
43
- console.log("No entities found.");
44
- return;
45
- }
46
- const rows = filtered.map((e) => [
47
- sourceLabel(e.source),
48
- e.entity_type || "—",
49
- e.name,
50
- truncate(e.summary || "—", 50),
51
- ]);
52
- outputTable(["SOURCE", "TYPE", "NAME", "SUMMARY"], rows);
53
- }
54
- export function registerMemoryCommands(program) {
55
- const memory = program
56
- .command("memory")
57
- .alias("mem")
58
- .description("Browse Zep knowledge graph — facts and entities");
59
- memory
60
- .command("query")
61
- .description("Search facts and entities by relevance")
62
- .argument("<query>", "Search query")
63
- .option("--limit <n>", "Maximum results per category", "10")
64
- .option("--source <type>", "Filter by source: conversation | notes")
65
- .addHelpText("after", `
66
- Examples:
67
- $ cnotes memory query "billing flow"
68
- $ cnotes memory query "Acme Corp" --source notes --limit 20 --json
69
- `)
70
- .action(async (query, opts) => {
71
- const cfg = resolveConfig(program.opts());
72
- const api = new ApiClient(cfg.serverUrl, cfg.token);
73
- try {
74
- const data = await api.post("/api/zep/query", {
75
- workspaceId: cfg.workspaceId,
76
- query,
77
- limit: parseInt(opts.limit, 10),
78
- });
79
- if (cfg.json) {
80
- outputJson(data);
81
- return;
82
- }
83
- const sr = data.searchResults;
84
- if (sr.facts.length > 0) {
85
- console.log(`\n Facts (${sr.facts.length} matches)\n`);
86
- formatFacts(sr.facts, cfg, opts.source);
87
- }
88
- if (sr.entities.length > 0) {
89
- console.log(`\n Entities (${sr.entities.length} matches)\n`);
90
- formatEntities(sr.entities, cfg, opts.source);
91
- }
92
- if (sr.facts.length === 0 && sr.entities.length === 0) {
93
- console.log("No results found.");
94
- }
95
- console.log(`\n Totals: ${data.totals.facts} facts (${data.totals.userFacts} conv, ${data.totals.knowledgeFacts} notes) · ${data.totals.entities} entities`);
96
- }
97
- catch (error) {
98
- handleError(error, cfg.json);
99
- }
100
- });
101
- memory
102
- .command("facts")
103
- .description("List all workspace facts")
104
- .option("--source <type>", "Filter by source: conversation | notes")
105
- .action(async (opts) => {
106
- const cfg = resolveConfig(program.opts());
107
- const api = new ApiClient(cfg.serverUrl, cfg.token);
108
- try {
109
- const data = await api.post("/api/zep/query", {
110
- workspaceId: cfg.workspaceId,
111
- query: "all facts",
112
- limit: 1,
113
- });
114
- if (cfg.json) {
115
- outputJson(data.allFacts);
116
- return;
117
- }
118
- formatFacts(data.allFacts, cfg, opts.source);
119
- console.log(`\n ${data.totals.facts} total (${data.totals.userFacts} conv, ${data.totals.knowledgeFacts} notes)`);
120
- }
121
- catch (error) {
122
- handleError(error, cfg.json);
123
- }
124
- });
125
- memory
126
- .command("entities")
127
- .description("List all workspace entities (people, topics, orgs)")
128
- .option("--source <type>", "Filter by source: conversation | notes")
129
- .action(async (opts) => {
130
- const cfg = resolveConfig(program.opts());
131
- const api = new ApiClient(cfg.serverUrl, cfg.token);
132
- try {
133
- const data = await api.post("/api/zep/query", {
134
- workspaceId: cfg.workspaceId,
135
- query: "all entities",
136
- limit: 1,
137
- });
138
- if (cfg.json) {
139
- outputJson(data.allEntities);
140
- return;
141
- }
142
- formatEntities(data.allEntities, cfg, opts.source);
143
- console.log(`\n ${data.totals.entities} total (${data.totals.userEntities} conv, ${data.totals.knowledgeEntities} notes)`);
144
- }
145
- catch (error) {
146
- handleError(error, cfg.json);
147
- }
148
- });
149
- }
150
- //# sourceMappingURL=memory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/commands/memory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAqCrE,SAAS,WAAW,CAAC,CAAS;IAC5B,OAAO,CAAC,KAAK,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;AACjD,CAAC;AAED,SAAS,WAAW,CAClB,KAAgB,EAChB,GAAsC,EACtC,MAAe;IAEf,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,MAAM,EAAE,CAAC;QACX,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;QACd,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;YACzB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC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H,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,CAAmB,gBAAgB,EAAE;gBAC9D,WAAW,EAAE,GAAG,CAAC,WAAW;gBAC5B,KAAK,EAAE,cAAc;gBACrB,KAAK,EAAE,CAAC;aACT,CAAC,CAAC;YAEH,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;gBACb,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBAC7B,OAAO;YACT,CAAC;YAED,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACnD,OAAO,CAAC,GAAG,CACT,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,WAAW,IAAI,CAAC,MAAM,CAAC,YAAY,UAAU,IAAI,CAAC,MAAM,CAAC,iBAAiB,SAAS,CAC/G,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
package/dist/lib/env.d.ts DELETED
@@ -1,14 +0,0 @@
1
- /**
2
- * Read a cnotes environment variable, honoring the pre-rename `CN_` prefix as a
3
- * fallback.
4
- *
5
- * The cn→cnotes rename moved the env contract from `CN_*` to `CNOTES_*`. New
6
- * config (`.mcp.json`, the Claude Desktop / Codex install templates) writes the
7
- * `CNOTES_*` form, but MCP configs written before the rename still carry `CN_*`
8
- * — so we read `CNOTES_<suffix>` first and fall back to `CN_<suffix>` until the
9
- * user re-runs `cnotes mcp setup-*` (which rewrites the config to the new form).
10
- *
11
- * Pass the suffix only, e.g. `cnotesEnv("SERVER")` for CNOTES_SERVER/CN_SERVER.
12
- */
13
- export declare function cnotesEnv(suffix: string): string | undefined;
14
- //# sourceMappingURL=env.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/lib/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE5D"}
package/dist/lib/env.js DELETED
@@ -1,16 +0,0 @@
1
- /**
2
- * Read a cnotes environment variable, honoring the pre-rename `CN_` prefix as a
3
- * fallback.
4
- *
5
- * The cn→cnotes rename moved the env contract from `CN_*` to `CNOTES_*`. New
6
- * config (`.mcp.json`, the Claude Desktop / Codex install templates) writes the
7
- * `CNOTES_*` form, but MCP configs written before the rename still carry `CN_*`
8
- * — so we read `CNOTES_<suffix>` first and fall back to `CN_<suffix>` until the
9
- * user re-runs `cnotes mcp setup-*` (which rewrites the config to the new form).
10
- *
11
- * Pass the suffix only, e.g. `cnotesEnv("SERVER")` for CNOTES_SERVER/CN_SERVER.
12
- */
13
- export function cnotesEnv(suffix) {
14
- return process.env[`CNOTES_${suffix}`] ?? process.env[`CN_${suffix}`];
15
- }
16
- //# sourceMappingURL=env.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/lib/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,MAAM,EAAE,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,MAAM,EAAE,CAAC,CAAC;AACxE,CAAC"}