@graphmemory/server 1.1.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.
Files changed (123) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +216 -0
  3. package/dist/api/index.js +473 -0
  4. package/dist/api/rest/code.js +78 -0
  5. package/dist/api/rest/docs.js +80 -0
  6. package/dist/api/rest/embed.js +47 -0
  7. package/dist/api/rest/files.js +64 -0
  8. package/dist/api/rest/graph.js +71 -0
  9. package/dist/api/rest/index.js +371 -0
  10. package/dist/api/rest/knowledge.js +239 -0
  11. package/dist/api/rest/skills.js +285 -0
  12. package/dist/api/rest/tasks.js +273 -0
  13. package/dist/api/rest/tools.js +157 -0
  14. package/dist/api/rest/validation.js +196 -0
  15. package/dist/api/rest/websocket.js +71 -0
  16. package/dist/api/tools/code/get-file-symbols.js +30 -0
  17. package/dist/api/tools/code/get-symbol.js +22 -0
  18. package/dist/api/tools/code/list-files.js +18 -0
  19. package/dist/api/tools/code/search-code.js +27 -0
  20. package/dist/api/tools/code/search-files.js +22 -0
  21. package/dist/api/tools/context/get-context.js +19 -0
  22. package/dist/api/tools/docs/cross-references.js +76 -0
  23. package/dist/api/tools/docs/explain-symbol.js +55 -0
  24. package/dist/api/tools/docs/find-examples.js +52 -0
  25. package/dist/api/tools/docs/get-node.js +24 -0
  26. package/dist/api/tools/docs/get-toc.js +22 -0
  27. package/dist/api/tools/docs/list-snippets.js +46 -0
  28. package/dist/api/tools/docs/list-topics.js +18 -0
  29. package/dist/api/tools/docs/search-files.js +22 -0
  30. package/dist/api/tools/docs/search-snippets.js +43 -0
  31. package/dist/api/tools/docs/search.js +27 -0
  32. package/dist/api/tools/file-index/get-file-info.js +21 -0
  33. package/dist/api/tools/file-index/list-all-files.js +28 -0
  34. package/dist/api/tools/file-index/search-all-files.js +24 -0
  35. package/dist/api/tools/knowledge/add-attachment.js +31 -0
  36. package/dist/api/tools/knowledge/create-note.js +20 -0
  37. package/dist/api/tools/knowledge/create-relation.js +29 -0
  38. package/dist/api/tools/knowledge/delete-note.js +19 -0
  39. package/dist/api/tools/knowledge/delete-relation.js +23 -0
  40. package/dist/api/tools/knowledge/find-linked-notes.js +25 -0
  41. package/dist/api/tools/knowledge/get-note.js +20 -0
  42. package/dist/api/tools/knowledge/list-notes.js +18 -0
  43. package/dist/api/tools/knowledge/list-relations.js +17 -0
  44. package/dist/api/tools/knowledge/remove-attachment.js +19 -0
  45. package/dist/api/tools/knowledge/search-notes.js +25 -0
  46. package/dist/api/tools/knowledge/update-note.js +34 -0
  47. package/dist/api/tools/skills/add-attachment.js +31 -0
  48. package/dist/api/tools/skills/bump-usage.js +19 -0
  49. package/dist/api/tools/skills/create-skill-link.js +25 -0
  50. package/dist/api/tools/skills/create-skill.js +26 -0
  51. package/dist/api/tools/skills/delete-skill-link.js +23 -0
  52. package/dist/api/tools/skills/delete-skill.js +20 -0
  53. package/dist/api/tools/skills/find-linked-skills.js +25 -0
  54. package/dist/api/tools/skills/get-skill.js +21 -0
  55. package/dist/api/tools/skills/link-skill.js +23 -0
  56. package/dist/api/tools/skills/list-skills.js +20 -0
  57. package/dist/api/tools/skills/recall-skills.js +18 -0
  58. package/dist/api/tools/skills/remove-attachment.js +19 -0
  59. package/dist/api/tools/skills/search-skills.js +25 -0
  60. package/dist/api/tools/skills/update-skill.js +58 -0
  61. package/dist/api/tools/tasks/add-attachment.js +31 -0
  62. package/dist/api/tools/tasks/create-task-link.js +25 -0
  63. package/dist/api/tools/tasks/create-task.js +26 -0
  64. package/dist/api/tools/tasks/delete-task-link.js +23 -0
  65. package/dist/api/tools/tasks/delete-task.js +20 -0
  66. package/dist/api/tools/tasks/find-linked-tasks.js +25 -0
  67. package/dist/api/tools/tasks/get-task.js +20 -0
  68. package/dist/api/tools/tasks/link-task.js +23 -0
  69. package/dist/api/tools/tasks/list-tasks.js +25 -0
  70. package/dist/api/tools/tasks/move-task.js +38 -0
  71. package/dist/api/tools/tasks/remove-attachment.js +19 -0
  72. package/dist/api/tools/tasks/search-tasks.js +25 -0
  73. package/dist/api/tools/tasks/update-task.js +58 -0
  74. package/dist/cli/index.js +617 -0
  75. package/dist/cli/indexer.js +275 -0
  76. package/dist/graphs/attachment-types.js +74 -0
  77. package/dist/graphs/code-types.js +10 -0
  78. package/dist/graphs/code.js +204 -0
  79. package/dist/graphs/docs.js +231 -0
  80. package/dist/graphs/file-index-types.js +10 -0
  81. package/dist/graphs/file-index.js +310 -0
  82. package/dist/graphs/file-lang.js +119 -0
  83. package/dist/graphs/knowledge-types.js +32 -0
  84. package/dist/graphs/knowledge.js +768 -0
  85. package/dist/graphs/manager-types.js +87 -0
  86. package/dist/graphs/skill-types.js +10 -0
  87. package/dist/graphs/skill.js +1016 -0
  88. package/dist/graphs/task-types.js +17 -0
  89. package/dist/graphs/task.js +972 -0
  90. package/dist/lib/access.js +67 -0
  91. package/dist/lib/embedder.js +235 -0
  92. package/dist/lib/events-log.js +401 -0
  93. package/dist/lib/file-import.js +328 -0
  94. package/dist/lib/file-mirror.js +461 -0
  95. package/dist/lib/frontmatter.js +17 -0
  96. package/dist/lib/jwt.js +146 -0
  97. package/dist/lib/mirror-watcher.js +637 -0
  98. package/dist/lib/multi-config.js +393 -0
  99. package/dist/lib/parsers/code.js +214 -0
  100. package/dist/lib/parsers/codeblock.js +33 -0
  101. package/dist/lib/parsers/docs.js +199 -0
  102. package/dist/lib/parsers/languages/index.js +15 -0
  103. package/dist/lib/parsers/languages/registry.js +68 -0
  104. package/dist/lib/parsers/languages/types.js +2 -0
  105. package/dist/lib/parsers/languages/typescript.js +306 -0
  106. package/dist/lib/project-manager.js +458 -0
  107. package/dist/lib/promise-queue.js +22 -0
  108. package/dist/lib/search/bm25.js +167 -0
  109. package/dist/lib/search/code.js +103 -0
  110. package/dist/lib/search/docs.js +106 -0
  111. package/dist/lib/search/file-index.js +31 -0
  112. package/dist/lib/search/files.js +61 -0
  113. package/dist/lib/search/knowledge.js +101 -0
  114. package/dist/lib/search/skills.js +104 -0
  115. package/dist/lib/search/tasks.js +103 -0
  116. package/dist/lib/team.js +89 -0
  117. package/dist/lib/watcher.js +67 -0
  118. package/dist/ui/assets/index-D6oxrVF7.js +1759 -0
  119. package/dist/ui/assets/index-kKd4mVrh.css +1 -0
  120. package/dist/ui/favicon.svg +1 -0
  121. package/dist/ui/icons.svg +24 -0
  122. package/dist/ui/index.html +14 -0
  123. package/package.json +89 -0
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.scanTeamDir = scanTeamDir;
37
+ exports.ensureAuthorInTeam = ensureAuthorInTeam;
38
+ const fs = __importStar(require("fs"));
39
+ const path = __importStar(require("path"));
40
+ const frontmatter_1 = require("./frontmatter");
41
+ /**
42
+ * Scan `.team/` directory for team member markdown files.
43
+ * Each file: `.team/{id}.md` with frontmatter { name, email }.
44
+ */
45
+ function scanTeamDir(teamDir) {
46
+ if (!fs.existsSync(teamDir))
47
+ return [];
48
+ const members = [];
49
+ for (const entry of fs.readdirSync(teamDir, { withFileTypes: true })) {
50
+ if (!entry.isFile() || !entry.name.endsWith('.md'))
51
+ continue;
52
+ const id = entry.name.replace(/\.md$/, '');
53
+ try {
54
+ const raw = fs.readFileSync(path.join(teamDir, entry.name), 'utf-8');
55
+ const { frontmatter: fm } = (0, frontmatter_1.parseMarkdown)(raw);
56
+ members.push({
57
+ id,
58
+ name: fm.name ?? id,
59
+ email: fm.email ?? '',
60
+ });
61
+ }
62
+ catch (err) {
63
+ process.stderr.write(`[team] Failed to parse team member file "${entry.name}": ${err}\n`);
64
+ }
65
+ }
66
+ return members;
67
+ }
68
+ /**
69
+ * Ensure the author from config exists as a team member file.
70
+ * Creates `.team/{id}.md` if it doesn't exist. The id is derived from the author name (slugified).
71
+ */
72
+ function ensureAuthorInTeam(teamDir, author) {
73
+ if (!author.name)
74
+ return;
75
+ const id = author.name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '');
76
+ if (!id)
77
+ return;
78
+ const filePath = path.join(teamDir, `${id}.md`);
79
+ if (fs.existsSync(filePath))
80
+ return;
81
+ try {
82
+ fs.mkdirSync(teamDir, { recursive: true });
83
+ const content = (0, frontmatter_1.serializeMarkdown)({ name: author.name, email: author.email }, `# ${author.name}\n`);
84
+ fs.writeFileSync(filePath, content, 'utf-8');
85
+ }
86
+ catch (err) {
87
+ process.stderr.write(`[team] Failed to create team member file for "${author.name}": ${err}\n`);
88
+ }
89
+ }
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.startWatcher = startWatcher;
7
+ const chokidar_1 = __importDefault(require("chokidar"));
8
+ const micromatch_1 = __importDefault(require("micromatch"));
9
+ const path_1 = __importDefault(require("path"));
10
+ /** Directories that are always excluded from watching (heavy, never useful). */
11
+ const ALWAYS_IGNORED = ['.git', 'node_modules', '.next', '.nuxt', '.turbo', 'dist', 'build', '.graph-memory', '.notes', '.tasks', '.skills'];
12
+ // chokidar 5: watch the directory directly — glob patterns don't fire 'add' for existing files
13
+ function startWatcher(dir, handlers, pattern = '**/*.md', excludePatterns) {
14
+ const matches = (filePath) => {
15
+ const rel = path_1.default.relative(dir, filePath);
16
+ if (excludePatterns && excludePatterns.length > 0 && micromatch_1.default.isMatch(rel, excludePatterns))
17
+ return false;
18
+ return micromatch_1.default.isMatch(rel, pattern);
19
+ };
20
+ // chokidar 5 `ignored` accepts a function — use micromatch for glob exclude patterns
21
+ // plus always skip heavy directories (.git, node_modules, etc.)
22
+ const alwaysIgnoredSet = new Set(ALWAYS_IGNORED.map(d => path_1.default.join(dir, d)));
23
+ const ignored = (filePath) => {
24
+ // Always ignore heavy directories by exact basename match
25
+ if (alwaysIgnoredSet.has(filePath))
26
+ return true;
27
+ // User-defined exclude patterns (glob-based)
28
+ if (excludePatterns && excludePatterns.length > 0) {
29
+ const rel = path_1.default.relative(dir, filePath);
30
+ if (micromatch_1.default.isMatch(rel, excludePatterns))
31
+ return true;
32
+ }
33
+ return false;
34
+ };
35
+ let resolveReady;
36
+ const whenReady = new Promise(resolve => {
37
+ resolveReady = resolve;
38
+ });
39
+ const watcher = chokidar_1.default.watch(dir, {
40
+ ignoreInitial: false,
41
+ persistent: true,
42
+ ignored,
43
+ });
44
+ watcher.on('add', (filePath) => {
45
+ if (matches(filePath))
46
+ handlers.onAdd(filePath);
47
+ });
48
+ watcher.on('change', (filePath) => {
49
+ if (matches(filePath))
50
+ handlers.onChange(filePath);
51
+ });
52
+ watcher.on('unlink', (filePath) => {
53
+ if (matches(filePath))
54
+ handlers.onUnlink(filePath);
55
+ });
56
+ watcher.on('ready', () => {
57
+ process.stderr.write(`[watcher] Ready. Watching ${dir}\n`);
58
+ resolveReady();
59
+ });
60
+ watcher.on('error', (err) => {
61
+ process.stderr.write(`[watcher] Watch error: ${err}\n`);
62
+ });
63
+ return {
64
+ whenReady,
65
+ close: () => watcher.close(),
66
+ };
67
+ }