@imenam/mcp-documentor 1.0.85 → 1.0.87

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 (87) hide show
  1. package/README.md +323 -329
  2. package/dist/shared/read-only.js +1 -0
  3. package/dist/shared/schemas/doc.schema.d.ts +2 -1
  4. package/dist/shared/schemas/doc.schema.js +12 -1
  5. package/dist/src/cli/setup-mcp.js +2 -5
  6. package/dist/src/core/code-source.d.ts +33 -22
  7. package/dist/src/core/code-source.js +92 -69
  8. package/dist/src/core/embedding-engine.d.ts +1 -1
  9. package/dist/src/core/embedding-engine.js +3 -3
  10. package/dist/src/core/embedding-store.d.ts +1 -1
  11. package/dist/src/core/embedding-store.js +4 -4
  12. package/dist/src/core/github-code-api.d.ts +28 -0
  13. package/dist/src/core/github-code-api.js +92 -31
  14. package/dist/src/core/local-state.d.ts +49 -0
  15. package/dist/src/core/local-state.js +78 -0
  16. package/dist/src/core/migrate-code-sources.d.ts +17 -0
  17. package/dist/src/core/migrate-code-sources.js +157 -0
  18. package/dist/src/core/path-resolver.d.ts +29 -9
  19. package/dist/src/core/path-resolver.js +18 -42
  20. package/dist/src/core/project-settings.d.ts +21 -0
  21. package/dist/src/core/project-settings.js +63 -0
  22. package/dist/src/core/storage-engine.d.ts +12 -2
  23. package/dist/src/core/storage-engine.js +35 -15
  24. package/dist/src/gui-worker.js +70 -2
  25. package/dist/src/index.js +165 -11
  26. package/dist/src/tools/check-freshness.d.ts +2 -1
  27. package/dist/src/tools/check-freshness.js +1 -2
  28. package/dist/src/tools/code-sources.d.ts +102 -0
  29. package/dist/src/tools/code-sources.js +260 -0
  30. package/dist/src/tools/move-doc.js +20 -6
  31. package/dist/src/version.d.ts +1 -1
  32. package/dist/src/version.js +16 -2
  33. package/gui/dist/assets/{arc-CdXRzMBT.js → arc-DBgCQU2O.js} +1 -1
  34. package/gui/dist/assets/{architectureDiagram-3BPJPVTR-CGUnwe_I.js → architectureDiagram-3BPJPVTR-BIPBAzZr.js} +1 -1
  35. package/gui/dist/assets/{blockDiagram-GPEHLZMM-BCI5_vQE.js → blockDiagram-GPEHLZMM-BE9WwuyF.js} +1 -1
  36. package/gui/dist/assets/{c4Diagram-AAUBKEIU-Bm9a6HGg.js → c4Diagram-AAUBKEIU-V1_4ktIt.js} +1 -1
  37. package/gui/dist/assets/channel-B_cci0fU.js +1 -0
  38. package/gui/dist/assets/{chunk-2J33WTMH-c7xNwExL.js → chunk-2J33WTMH-DskG-Kmf.js} +1 -1
  39. package/gui/dist/assets/{chunk-4BX2VUAB-CmcU4Q0o.js → chunk-4BX2VUAB-DaPhidEI.js} +1 -1
  40. package/gui/dist/assets/{chunk-55IACEB6-K8rRjNKN.js → chunk-55IACEB6-C9r6WDFM.js} +1 -1
  41. package/gui/dist/assets/{chunk-727SXJPM-DMPnL1bv.js → chunk-727SXJPM-BA-aC8US.js} +1 -1
  42. package/gui/dist/assets/{chunk-AQP2D5EJ-BeRIIft8.js → chunk-AQP2D5EJ-ByBp3whV.js} +1 -1
  43. package/gui/dist/assets/{chunk-FMBD7UC4-CN4It-fp.js → chunk-FMBD7UC4-CzqUByx7.js} +1 -1
  44. package/gui/dist/assets/{chunk-ND2GUHAM-Dy-ZqPua.js → chunk-ND2GUHAM-C0_B2ryQ.js} +1 -1
  45. package/gui/dist/assets/{chunk-QZHKN3VN-CaV4seJw.js → chunk-QZHKN3VN-B3eEwjDh.js} +1 -1
  46. package/gui/dist/assets/classDiagram-4FO5ZUOK-BqlcJ5BP.js +1 -0
  47. package/gui/dist/assets/classDiagram-v2-Q7XG4LA2-BqlcJ5BP.js +1 -0
  48. package/gui/dist/assets/{cose-bilkent-S5V4N54A-B1qt_j1Z.js → cose-bilkent-S5V4N54A-D_i0I2pU.js} +1 -1
  49. package/gui/dist/assets/{dagre-BM42HDAG-4x5JEBQG.js → dagre-BM42HDAG-DtEVPK_z.js} +1 -1
  50. package/gui/dist/assets/{diagram-2AECGRRQ-Q7TvjRjv.js → diagram-2AECGRRQ-BftnXa5w.js} +1 -1
  51. package/gui/dist/assets/{diagram-5GNKFQAL-Dguj26bf.js → diagram-5GNKFQAL-Dh9-kl_u.js} +1 -1
  52. package/gui/dist/assets/{diagram-KO2AKTUF-DBv6MoZF.js → diagram-KO2AKTUF-CvB0BWCa.js} +1 -1
  53. package/gui/dist/assets/{diagram-LMA3HP47-mfVXwL5q.js → diagram-LMA3HP47-CDy-J1uy.js} +1 -1
  54. package/gui/dist/assets/{diagram-OG6HWLK6-Bn3_yQWG.js → diagram-OG6HWLK6-iY9FwkIF.js} +1 -1
  55. package/gui/dist/assets/{erDiagram-TEJ5UH35-Bp4wnBw7.js → erDiagram-TEJ5UH35-BT2_IX8D.js} +1 -1
  56. package/gui/dist/assets/{flowDiagram-I6XJVG4X-CGk72E1Q.js → flowDiagram-I6XJVG4X-DaixWyMx.js} +1 -1
  57. package/gui/dist/assets/{ganttDiagram-6RSMTGT7-C1WQIgpu.js → ganttDiagram-6RSMTGT7-DSo3cQPH.js} +1 -1
  58. package/gui/dist/assets/{gitGraphDiagram-PVQCEYII-DSIs1ZqI.js → gitGraphDiagram-PVQCEYII-BfFT7Lds.js} +1 -1
  59. package/gui/dist/assets/index-CxCC1gxu.css +1 -0
  60. package/gui/dist/assets/{index-T7ZLHNgs.js → index-DPGmAc6z.js} +107 -105
  61. package/gui/dist/assets/{infoDiagram-5YYISTIA-DzHdfk5Y.js → infoDiagram-5YYISTIA-BxbxNxe2.js} +1 -1
  62. package/gui/dist/assets/{ishikawaDiagram-YF4QCWOH-DLxqTmDU.js → ishikawaDiagram-YF4QCWOH-DpopzqZr.js} +1 -1
  63. package/gui/dist/assets/{journeyDiagram-JHISSGLW-DYUPmZnf.js → journeyDiagram-JHISSGLW-DrOlFzIk.js} +1 -1
  64. package/gui/dist/assets/{kanban-definition-UN3LZRKU-f6km2MDT.js → kanban-definition-UN3LZRKU-vH81lYXy.js} +1 -1
  65. package/gui/dist/assets/{linear-DHhAaAXH.js → linear-BipFpFah.js} +1 -1
  66. package/gui/dist/assets/{mindmap-definition-RKZ34NQL-nergVxV3.js → mindmap-definition-RKZ34NQL-DsTxCLgj.js} +1 -1
  67. package/gui/dist/assets/{pieDiagram-4H26LBE5-D4IJAdGz.js → pieDiagram-4H26LBE5-Bbq2ZWQU.js} +1 -1
  68. package/gui/dist/assets/{quadrantDiagram-W4KKPZXB-B5yYdOsV.js → quadrantDiagram-W4KKPZXB-BdTSaEo4.js} +1 -1
  69. package/gui/dist/assets/{requirementDiagram-4Y6WPE33-BrhJp07G.js → requirementDiagram-4Y6WPE33-BndI8YZy.js} +1 -1
  70. package/gui/dist/assets/{sankeyDiagram-5OEKKPKP-CUBA4e7F.js → sankeyDiagram-5OEKKPKP-ofBkVITf.js} +1 -1
  71. package/gui/dist/assets/{sequenceDiagram-3UESZ5HK-DP0-rUie.js → sequenceDiagram-3UESZ5HK-Cjj2UrN9.js} +1 -1
  72. package/gui/dist/assets/{stateDiagram-AJRCARHV-_BnVcpam.js → stateDiagram-AJRCARHV-CzPrXUuz.js} +1 -1
  73. package/gui/dist/assets/stateDiagram-v2-BHNVJYJU-DAq4ObN9.js +1 -0
  74. package/gui/dist/assets/{timeline-definition-PNZ67QCA-crbYjsrq.js → timeline-definition-PNZ67QCA-Cz4X-IOO.js} +1 -1
  75. package/gui/dist/assets/{vennDiagram-CIIHVFJN-EOqENtE1.js → vennDiagram-CIIHVFJN-BwIgXJcZ.js} +1 -1
  76. package/gui/dist/assets/{wardley-L42UT6IY-B1FVq-_Y.js → wardley-L42UT6IY-keQS0aNZ.js} +1 -1
  77. package/gui/dist/assets/{wardleyDiagram-YWT4CUSO-D1DZwIH_.js → wardleyDiagram-YWT4CUSO-DhykSgbD.js} +1 -1
  78. package/gui/dist/assets/{xychartDiagram-2RQKCTM6-B6Wr8_OJ.js → xychartDiagram-2RQKCTM6-DFTqc4cj.js} +1 -1
  79. package/gui/dist/index.html +2 -2
  80. package/package.json +2 -3
  81. package/scripts/migrate-paths-to-relative.js +196 -192
  82. package/gui/dist/assets/channel-f0BgDIcS.js +0 -1
  83. package/gui/dist/assets/classDiagram-4FO5ZUOK-tGvt4n1B.js +0 -1
  84. package/gui/dist/assets/classDiagram-v2-Q7XG4LA2-tGvt4n1B.js +0 -1
  85. package/gui/dist/assets/index-QkCDSQ2A.css +0 -1
  86. package/gui/dist/assets/stateDiagram-v2-BHNVJYJU-B5Vwq56z.js +0 -1
  87. package/scripts/generate-version.js +0 -20
@@ -0,0 +1,260 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { mapWithConcurrency } from "../core/concurrency.js";
4
+ import { createCodeSource, getGitHubApi, getGitHubToken, invalidateCodeSources } from "../core/code-source.js";
5
+ import { getBranchHead, getRepositoryInfo, getTokenLogin, GitHubApiError, listBranches, parseRepoSpec, searchRepositories, } from "../core/github-code-api.js";
6
+ import { CodeSourceConfigSchema, readCodeSourceConfig, writeCodeSourceConfig, } from "../core/project-settings.js";
7
+ import { computeFreshness, DOC_CONCURRENCY } from "./check-freshness.js";
8
+ /** The only variable the GitHub token is read from. It is never stored nor settable elsewhere. */
9
+ export const GITHUB_TOKEN_VAR = "MCP_DOCUMENTOR_CODE_TOKEN";
10
+ const errorMessage = (err) => (err instanceof Error ? err.message : String(err));
11
+ function assertKnownProject(storageEngine, project) {
12
+ if (!storageEngine.getConfig().projects.includes(project)) {
13
+ throw new Error(`Project "${project}" does not exist.`);
14
+ }
15
+ }
16
+ function describeRoot(localState, project) {
17
+ const roots = localState.getCodeRoots();
18
+ const own = roots.byProject[project];
19
+ if (own !== undefined)
20
+ return { codeRoot: own, codeRootOrigin: "project", defaultCodeRoot: roots.default };
21
+ if (roots.default !== undefined)
22
+ return { codeRoot: roots.default, codeRootOrigin: "default", defaultCodeRoot: roots.default };
23
+ return {};
24
+ }
25
+ /**
26
+ * Turns a failed branch lookup into what the user has to fix: the branch when the repository
27
+ * answers, the repository otherwise. Other failures (network, rate limit) keep their message.
28
+ */
29
+ async function describeUnreachableSource(config, err) {
30
+ if (!(err instanceof GitHubApiError) || (err.status !== 404 && err.status !== 422))
31
+ return errorMessage(err);
32
+ const [owner, repo] = config.repo.split("/");
33
+ try {
34
+ const info = await getRepositoryInfo(owner, repo, getGitHubToken());
35
+ return `Branch “${config.branch ?? info.defaultBranch}” not found — freshness unavailable`;
36
+ }
37
+ catch {
38
+ return `Repository ${config.repo} not found, or not visible with ${GITHUB_TOKEN_VAR}`;
39
+ }
40
+ }
41
+ /** Every project's code source and code root, with GitHub ones checked against their branch. */
42
+ export async function listCodeSources(storageEngine, localState) {
43
+ const projects = storageEngine.getConfig().projects;
44
+ return mapWithConcurrency(projects, DOC_CONCURRENCY, async (project) => {
45
+ const root = describeRoot(localState, project);
46
+ let config;
47
+ try {
48
+ config = readCodeSourceConfig(storageEngine.getProjectDir(project));
49
+ }
50
+ catch (err) {
51
+ return { project, ...root, error: errorMessage(err) };
52
+ }
53
+ if (config.kind === "local")
54
+ return { project, config, ...root };
55
+ try {
56
+ await getGitHubApi(project)?.resolveRef();
57
+ return { project, config, ...root };
58
+ }
59
+ catch (err) {
60
+ return { project, config, ...root, error: await describeUnreachableSource(config, err) };
61
+ }
62
+ });
63
+ }
64
+ /**
65
+ * Checks a repository: whether it exists for the configured token, its branches, and the commit
66
+ * the chosen branch — or the default one — points at.
67
+ */
68
+ export async function inspectRepository(input) {
69
+ let owner;
70
+ let name;
71
+ let suffixBranch;
72
+ try {
73
+ ({ owner, repo: name, ref: suffixBranch } = parseRepoSpec(input.repo));
74
+ }
75
+ catch (err) {
76
+ return { ok: false, field: "repo", error: errorMessage(err) };
77
+ }
78
+ const token = getGitHubToken();
79
+ let repo;
80
+ let branches;
81
+ try {
82
+ [repo, branches] = await Promise.all([getRepositoryInfo(owner, name, token), listBranches(owner, name, token)]);
83
+ }
84
+ catch (err) {
85
+ return { ok: false, field: "repo", error: errorMessage(err) };
86
+ }
87
+ const branch = input.branch || suffixBranch || repo.defaultBranch;
88
+ try {
89
+ const head = await getBranchHead(owner, name, branch, token);
90
+ return { ok: true, repo, branches, branch, head };
91
+ }
92
+ catch (err) {
93
+ const missing = err instanceof GitHubApiError && (err.status === 404 || err.status === 422);
94
+ const error = missing ? `Branch “${branch}” does not exist in ${repo.fullName}` : errorMessage(err);
95
+ return { ok: false, field: "branch", error, repo, branches };
96
+ }
97
+ }
98
+ /** Suggestions shown while a repository is typed. */
99
+ const SEARCH_LIMIT = 8;
100
+ /** Repositories matching what is typed in the repository field — empty below two characters. */
101
+ export async function searchRepositoriesForInput(term) {
102
+ const trimmed = term.trim().replace(/^https?:\/\/github\.com\//i, "").replace(/\.git$/i, "");
103
+ if (trimmed.replace("/", "").length < 2)
104
+ return [];
105
+ return searchRepositories(trimmed, getGitHubToken(), SEARCH_LIMIT);
106
+ }
107
+ /** Checks that a code root is an existing folder given as an absolute path. */
108
+ export function inspectCodeRoot(root) {
109
+ if (!path.isAbsolute(root))
110
+ return { ok: false, error: "Expected an absolute path" };
111
+ try {
112
+ if (!fs.statSync(root).isDirectory())
113
+ return { ok: false, error: "Not a folder" };
114
+ }
115
+ catch {
116
+ return { ok: false, error: "Folder not found on this machine" };
117
+ }
118
+ return { ok: true };
119
+ }
120
+ /**
121
+ * The root a project would use with `codeRoot`: undefined keeps the current one, an empty string
122
+ * means the machine default, anything else is the project's own root.
123
+ */
124
+ function rootFor(localState, project, codeRoot) {
125
+ if (codeRoot === undefined)
126
+ return localState.getCodeRoot(project);
127
+ return codeRoot.trim() === "" ? localState.getCodeRoots().default : codeRoot.trim();
128
+ }
129
+ export async function previewCodeSource(storageEngine, localState, project, rawConfig, codeRoot) {
130
+ assertKnownProject(storageEngine, project);
131
+ const config = CodeSourceConfigSchema.parse(rawConfig);
132
+ const source = createCodeSource(project, config, { root: rootFor(localState, project, codeRoot) });
133
+ const listings = (await storageEngine.listDocsDetailed(project)).filter((l) => l.tracked_files.length > 0);
134
+ const preview = { label: source.label, docs: listings.length, upToDate: 0, stale: 0, unverifiable: 0, broken: 0 };
135
+ const reports = await mapWithConcurrency(listings, DOC_CONCURRENCY, (listing) => computeFreshness(listing.tracked_files, project, source));
136
+ for (const report of reports) {
137
+ if (report.sourceError)
138
+ preview.sourceError = report.sourceError;
139
+ if (report.status === "up_to_date")
140
+ preview.upToDate++;
141
+ else if (report.status === "stale")
142
+ preview.stale++;
143
+ else if (report.status === "broken")
144
+ preview.broken++;
145
+ else if (report.status === "unverifiable")
146
+ preview.unverifiable++;
147
+ }
148
+ return preview;
149
+ }
150
+ /**
151
+ * Sets a code root on this machine: the project's own one, or the machine default when `project`
152
+ * is undefined. An empty root removes it — a project then uses the default.
153
+ */
154
+ export function setCodeRoot(storageEngine, localState, root, project) {
155
+ const trimmed = root.trim();
156
+ if (trimmed !== "") {
157
+ const check = inspectCodeRoot(trimmed);
158
+ if (!check.ok)
159
+ throw new Error(`Invalid code root "${trimmed}": ${check.error}`);
160
+ }
161
+ const value = trimmed === "" ? undefined : path.resolve(trimmed);
162
+ if (project === undefined) {
163
+ localState.setDefaultCodeRoot(value);
164
+ invalidateCodeSources();
165
+ }
166
+ else {
167
+ assertKnownProject(storageEngine, project);
168
+ localState.setProjectCodeRoot(project, value);
169
+ invalidateCodeSources(project);
170
+ }
171
+ return value;
172
+ }
173
+ /**
174
+ * Saves a project's code source and, when `codeRoot` is given, its code root on this machine (see
175
+ * `setCodeRoot`). The next operation on that project reads them.
176
+ */
177
+ export function saveCodeSource(storageEngine, localState, project, rawConfig, codeRoot) {
178
+ assertKnownProject(storageEngine, project);
179
+ const config = CodeSourceConfigSchema.parse(rawConfig);
180
+ if (codeRoot !== undefined)
181
+ setCodeRoot(storageEngine, localState, codeRoot, project);
182
+ writeCodeSourceConfig(storageEngine.getProjectDir(project), config);
183
+ invalidateCodeSources(project);
184
+ return config;
185
+ }
186
+ export async function getGitHubTokenStatus() {
187
+ const token = getGitHubToken();
188
+ if (!token)
189
+ return { variable: GITHUB_TOKEN_VAR, configured: false };
190
+ try {
191
+ return { variable: GITHUB_TOKEN_VAR, configured: true, login: await getTokenLogin(token) };
192
+ }
193
+ catch (err) {
194
+ return { variable: GITHUB_TOKEN_VAR, configured: true, error: errorMessage(err) };
195
+ }
196
+ }
197
+ // --- Agent tools ---
198
+ function describeSourceLine(source) {
199
+ const config = source.config;
200
+ const head = !config
201
+ ? "settings unreadable"
202
+ : config.kind === "github"
203
+ ? `GitHub ${config.repo} · ${config.branch ?? "default branch"}`
204
+ : "local working copy";
205
+ const root = source.codeRoot
206
+ ? `code root ${source.codeRoot} (${source.codeRootOrigin === "project" ? "project setting" : "machine default"})`
207
+ : "no code root on this machine";
208
+ const status = source.error ? ` — ⚠ ${source.error}` : "";
209
+ return `- **${source.project}**: ${head}; ${root}${status}`;
210
+ }
211
+ export async function getCodeSourceTool(storageEngine, localState, args) {
212
+ const project = args?.project;
213
+ if (project)
214
+ assertKnownProject(storageEngine, project);
215
+ const all = await listCodeSources(storageEngine, localState);
216
+ const shown = project ? all.filter((s) => s.project === project) : all;
217
+ const defaultRoot = localState.getCodeRoots().default;
218
+ const token = getGitHubToken() ? `${GITHUB_TOKEN_VAR} is set` : `${GITHUB_TOKEN_VAR} is not set (public repositories only)`;
219
+ const text = `Code sources${project ? ` — project "${project}"` : ""}:\n\n${shown.map(describeSourceLine).join("\n")}\n\n` +
220
+ `Machine default code root: ${defaultRoot ?? "none"}. GitHub token: ${token}.\n` +
221
+ `The code source is shared by every machine (synced with the docs); code roots belong to this machine.`;
222
+ return { content: [{ type: "text", text }] };
223
+ }
224
+ export async function setCodeSourceTool(storageEngine, localState, args) {
225
+ const { project, kind, repo, branch } = (args ?? {});
226
+ if (!project)
227
+ throw new Error("project is required");
228
+ assertKnownProject(storageEngine, project);
229
+ let config;
230
+ if (kind === "local") {
231
+ config = { kind: "local" };
232
+ }
233
+ else if (kind === "github") {
234
+ if (!repo)
235
+ throw new Error('repo is required when kind is "github"');
236
+ const inspection = await inspectRepository({ repo, branch });
237
+ if (!inspection.ok)
238
+ throw new Error(inspection.error);
239
+ config = { kind: "github", repo: inspection.repo.fullName, ...(branch && { branch: inspection.branch }) };
240
+ }
241
+ else {
242
+ throw new Error('kind must be "local" or "github"');
243
+ }
244
+ saveCodeSource(storageEngine, localState, project, config);
245
+ const where = config.kind === "github" ? `GitHub ${config.repo} · ${config.branch ?? "default branch"}` : "its local working copy";
246
+ return { content: [{ type: "text", text: `Project "${project}" now reads its code from ${where}.` }] };
247
+ }
248
+ export function setCodeRootTool(storageEngine, localState, args) {
249
+ const { path: root, project } = (args ?? {});
250
+ if (root === undefined)
251
+ throw new Error("path is required (an empty string removes the root)");
252
+ const value = setCodeRoot(storageEngine, localState, root, project);
253
+ const target = project ? `project "${project}"` : "this machine (default)";
254
+ const text = value
255
+ ? `Code root of ${target} set to ${value}.`
256
+ : project
257
+ ? `Project "${project}" now uses the machine default code root (${localState.getCodeRoots().default ?? "none"}).`
258
+ : "Default code root removed on this machine.";
259
+ return { content: [{ type: "text", text }] };
260
+ }
@@ -1,29 +1,43 @@
1
1
  import { MoveDocArgsSchema } from "../../shared/schemas/doc.schema.js";
2
- import { resolveDocInProject, isScopeError, scopeErrorResult } from "../core/project-scope.js";
2
+ import { resolveDocInProject, assertProject, isScopeError, scopeErrorResult } from "../core/project-scope.js";
3
3
  export async function moveDoc(storageEngine, embeddingEngine, args) {
4
4
  try {
5
5
  const validated = MoveDocArgsSchema.parse(args);
6
6
  const resolved = await resolveDocInProject(storageEngine, validated.path, validated.project, "move");
7
7
  if (isScopeError(resolved))
8
8
  return scopeErrorResult(resolved);
9
- const resolvedProject = validated.project;
10
- const moved = await storageEngine.moveDoc(validated.path, validated.new_path, resolvedProject);
9
+ const project = validated.project;
10
+ const newProject = validated.new_project ?? project;
11
+ const newPath = validated.new_path ?? validated.path;
12
+ const targetError = assertProject(storageEngine, newProject);
13
+ if (targetError)
14
+ return scopeErrorResult(targetError);
15
+ if (newProject === project && newPath === validated.path) {
16
+ return {
17
+ isError: true,
18
+ content: [{ type: "text", text: `"${validated.path}" is already at this path in project "${project}" — nothing to move.` }],
19
+ };
20
+ }
21
+ const moved = await storageEngine.moveDoc(validated.path, project, newPath, newProject);
11
22
  if (!moved) {
12
23
  return {
13
24
  isError: true,
14
25
  content: [{ type: "text", text: `Failed to move "${validated.path}".` }],
15
26
  };
16
27
  }
17
- await embeddingEngine.moveEmbedding(validated.path, validated.new_path, resolvedProject);
18
- const rewritten = await storageEngine.rewriteLinks(validated.path, validated.new_path, resolvedProject);
28
+ await embeddingEngine.moveEmbedding(validated.path, project, newPath, newProject);
29
+ const rewritten = await storageEngine.rewriteLinks(validated.path, project, newPath, newProject);
19
30
  const rewriteNote = rewritten.length > 0
20
31
  ? `\n\nLiens mis à jour automatiquement dans ${rewritten.length} doc(s) :\n${rewritten.map((id) => ` - ${id}`).join("\n")}`
21
32
  : "\n\nAucune référence existante à mettre à jour.";
33
+ const crossProjectNote = newProject !== project
34
+ ? `\n\nLes fichiers suivis (tracked_files) sont désormais résolus depuis la source de code du projet "${newProject}" — lancer check_freshness pour vérifier qu'ils y existent.`
35
+ : "";
22
36
  return {
23
37
  content: [
24
38
  {
25
39
  type: "text",
26
- text: `Documentation entry moved successfully.\nFrom: "${validated.path}"\nTo: "${validated.new_path}"${rewriteNote}`,
40
+ text: `Documentation entry moved successfully.\nFrom: "${project}:${validated.path}"\nTo: "${newProject}:${newPath}"${rewriteNote}${crossProjectNote}`,
27
41
  },
28
42
  ],
29
43
  };
@@ -1 +1 @@
1
- export declare const APP_VERSION = "1.0.85";
1
+ export declare const APP_VERSION: string;
@@ -1,2 +1,16 @@
1
- // Auto-generated version file - do not edit manually
2
- export const APP_VERSION = '1.0.85';
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ // Lit la version dans le premier package.json trouvé en remontant depuis ce module.
5
+ function readPackageVersion() {
6
+ let dir = path.dirname(fileURLToPath(import.meta.url));
7
+ while (!existsSync(path.join(dir, "package.json"))) {
8
+ const parent = path.dirname(dir);
9
+ if (parent === dir)
10
+ throw new Error("package.json introuvable");
11
+ dir = parent;
12
+ }
13
+ const pkg = JSON.parse(readFileSync(path.join(dir, "package.json"), "utf8"));
14
+ return pkg.version;
15
+ }
16
+ export const APP_VERSION = readPackageVersion();
@@ -1 +1 @@
1
- import{a0 as ln,a1 as an,a2 as y,a3 as tn,a4 as H,a5 as q,a6 as _,a7 as un,a8 as rn,a9 as L,aa as o,ab as B,ac as sn,ad as on,ae as fn}from"./index-T7ZLHNgs.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,C,a){var O=I-l,i=D-h,n=C-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function W(l,h,I,D,v,A,C){var a=l-I,O=h-D,i=(C?A:-A)/L(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,F=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*L(fn(0,T*T*R-P*P)),j=(P*g-m*S)/R,z=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=j-F,e=z-t,r=w-F,G=p-t;return x*x+e*e>r*r+G*G&&(j=w,z=p),{cx:j,cy:z,x01:-n,y01:-d,x11:j*(v/T-1),y11:z*(v/T-1)}}function hn(){var l=cn,h=yn,I=B(0),D=null,v=gn,A=dn,C=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,F=un(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(F>tn-y)a.moveTo(s*H(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*H(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=F,S=F,j=C.apply(this,arguments)/2,z=j>y&&(D?+D.apply(this,arguments):L(u*u+s*s)),w=_(un(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(z>y){var G=sn(z/u*q(j)),M=sn(z/s*q(j));(P-=G*2)>y?(G*=t?1:-1,R+=G,T-=G):(P=0,R=T=(f+c)/2),(S-=M*2)>y?(M*=t?1:-1,m+=M,g-=M):(S=0,m=g=(f+c)/2)}var J=s*H(m),K=s*q(m),N=u*H(T),Q=u*q(T);if(w>y){var U=s*H(g),V=s*q(g),X=u*H(R),Y=u*q(R),E;if(F<rn)if(E=pn(J,K,X,Y,U,V,N,Q)){var Z=J-E[0],$=K-E[1],b=U-E[0],k=V-E[1],nn=1/q(on((Z*b+$*k)/(L(Z*Z+$*$)*L(b*b+k*k)))/2),en=L(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=W(X,Y,J,K,s,x,t),r=W(U,V,N,Q,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(J,K),a.arc(0,0,s,m,g,!t)):a.moveTo(J,K),!(u>y)||!(P>y)?a.lineTo(N,Q):p>y?(e=W(N,Q,U,V,u,-p,t),r=W(J,K,X,Y,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-rn/2;return[H(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:B(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:B(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:B(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:B(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:B(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:B(+n),i):A},i.padAngle=function(n){return arguments.length?(C=typeof n=="function"?n:B(+n),i):C},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
1
+ import{a0 as ln,a1 as an,a2 as y,a3 as tn,a4 as H,a5 as q,a6 as _,a7 as un,a8 as rn,a9 as L,aa as o,ab as B,ac as sn,ad as on,ae as fn}from"./index-DPGmAc6z.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,C,a){var O=I-l,i=D-h,n=C-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function W(l,h,I,D,v,A,C){var a=l-I,O=h-D,i=(C?A:-A)/L(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,F=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*L(fn(0,T*T*R-P*P)),j=(P*g-m*S)/R,z=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=j-F,e=z-t,r=w-F,G=p-t;return x*x+e*e>r*r+G*G&&(j=w,z=p),{cx:j,cy:z,x01:-n,y01:-d,x11:j*(v/T-1),y11:z*(v/T-1)}}function hn(){var l=cn,h=yn,I=B(0),D=null,v=gn,A=dn,C=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,F=un(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(F>tn-y)a.moveTo(s*H(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*H(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=F,S=F,j=C.apply(this,arguments)/2,z=j>y&&(D?+D.apply(this,arguments):L(u*u+s*s)),w=_(un(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(z>y){var G=sn(z/u*q(j)),M=sn(z/s*q(j));(P-=G*2)>y?(G*=t?1:-1,R+=G,T-=G):(P=0,R=T=(f+c)/2),(S-=M*2)>y?(M*=t?1:-1,m+=M,g-=M):(S=0,m=g=(f+c)/2)}var J=s*H(m),K=s*q(m),N=u*H(T),Q=u*q(T);if(w>y){var U=s*H(g),V=s*q(g),X=u*H(R),Y=u*q(R),E;if(F<rn)if(E=pn(J,K,X,Y,U,V,N,Q)){var Z=J-E[0],$=K-E[1],b=U-E[0],k=V-E[1],nn=1/q(on((Z*b+$*k)/(L(Z*Z+$*$)*L(b*b+k*k)))/2),en=L(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=W(X,Y,J,K,s,x,t),r=W(U,V,N,Q,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(J,K),a.arc(0,0,s,m,g,!t)):a.moveTo(J,K),!(u>y)||!(P>y)?a.lineTo(N,Q):p>y?(e=W(N,Q,U,V,u,-p,t),r=W(J,K,X,Y,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-rn/2;return[H(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:B(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:B(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:B(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:B(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:B(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:B(+n),i):A},i.padAngle=function(n){return arguments.length?(C=typeof n=="function"?n:B(+n),i):C},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};