@imenam/mcp-feature-analyzer 1.0.2 → 1.0.4

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 (54) hide show
  1. package/README.md +336 -295
  2. package/dist/shared/schemas/analysis.schema.d.ts +61 -0
  3. package/dist/shared/schemas/analysis.schema.js +26 -0
  4. package/dist/shared/schemas/api.schema.d.ts +13 -0
  5. package/dist/shared/schemas/api.schema.js +8 -0
  6. package/dist/shared/schemas/ipc.schema.d.ts +1 -1
  7. package/dist/shared/schemas/ipc.schema.js +1 -0
  8. package/dist/src/core/agent-repo.d.ts +4 -0
  9. package/dist/src/core/agent-repo.js +172 -0
  10. package/dist/src/core/analysis-store.js +1 -0
  11. package/dist/src/core/gateway-exec.d.ts +27 -0
  12. package/dist/src/core/gateway-exec.js +115 -0
  13. package/dist/src/core/git.d.ts +27 -2
  14. package/dist/src/core/git.js +48 -34
  15. package/dist/src/core/ids.d.ts +1 -0
  16. package/dist/src/core/ids.js +1 -0
  17. package/dist/src/core/invariants.d.ts +3 -1
  18. package/dist/src/core/invariants.js +27 -1
  19. package/dist/src/core/locations.d.ts +22 -4
  20. package/dist/src/core/locations.js +88 -4
  21. package/dist/src/core/migrate.d.ts +2 -0
  22. package/dist/src/core/migrate.js +3 -1
  23. package/dist/src/core/refresh.d.ts +8 -2
  24. package/dist/src/core/refresh.js +19 -1
  25. package/dist/src/core/review-actions.d.ts +6 -1
  26. package/dist/src/core/review-actions.js +20 -0
  27. package/dist/src/core/role.d.ts +11 -0
  28. package/dist/src/core/role.js +9 -0
  29. package/dist/src/gui-worker.js +7 -1
  30. package/dist/src/index.js +139 -19
  31. package/dist/src/tools/add-explanations.d.ts +9 -0
  32. package/dist/src/tools/add-explanations.js +73 -0
  33. package/dist/src/tools/create-analysis.d.ts +3 -2
  34. package/dist/src/tools/create-analysis.js +5 -5
  35. package/dist/src/tools/delete-explanations.d.ts +4 -0
  36. package/dist/src/tools/delete-explanations.js +23 -0
  37. package/dist/src/tools/format.d.ts +3 -1
  38. package/dist/src/tools/format.js +5 -0
  39. package/dist/src/tools/get-analysis.js +6 -1
  40. package/dist/src/tools/get-diff.js +2 -1
  41. package/dist/src/tools/inputs.d.ts +14 -0
  42. package/dist/src/tools/inputs.js +20 -2
  43. package/dist/src/tools/refresh-analysis.d.ts +4 -3
  44. package/dist/src/tools/refresh-analysis.js +13 -12
  45. package/dist/src/tools/update-explanation.d.ts +7 -0
  46. package/dist/src/tools/update-explanation.js +57 -0
  47. package/dist/src/version.d.ts +1 -1
  48. package/dist/src/version.js +1 -1
  49. package/gui/dist/assets/index-BLyQW-EW.js +72 -0
  50. package/gui/dist/assets/index-CmSZOGwc.css +1 -0
  51. package/gui/dist/index.html +2 -2
  52. package/package.json +1 -1
  53. package/gui/dist/assets/index-Db7Hu3tM.js +0 -72
  54. package/gui/dist/assets/index-Du5eL78F.css +0 -1
@@ -0,0 +1,57 @@
1
+ import { AnalysisError } from "../core/errors.js";
2
+ import { resolveExplanationLocation } from "../core/locations.js";
3
+ import { explanationLine } from "./format.js";
4
+ import { readExplanationLocation } from "./inputs.js";
5
+ import { has, optionalString, rejectUnknownFields, requireString, requireText, textResult } from "./types.js";
6
+ const EDITABLE = ["title", "body", "path", "side", "start_line", "end_line"];
7
+ /**
8
+ * Modifie une explication. Un nouvel emplacement est résolu sur le snapshot et
9
+ * remet une explication `outdated` à `current`.
10
+ */
11
+ export function updateExplanation(store, args) {
12
+ rejectUnknownFields(args, ["analysis_id", "explanation_id", ...EDITABLE]);
13
+ const id = requireString(args, "analysis_id");
14
+ const explanationId = requireString(args, "explanation_id");
15
+ const given = EDITABLE.filter((field) => has(args, field));
16
+ if (given.length === 0) {
17
+ throw new Error(`Give at least one field to change: ${EDITABLE.join(", ")}.`);
18
+ }
19
+ const title = optionalString(args, "title");
20
+ const body = has(args, "body") ? requireText(args, "body") : undefined;
21
+ const location = readExplanationLocation(args);
22
+ const analysis = store.get(id);
23
+ const current = analysis.explanations.find((explanation) => explanation.id === explanationId);
24
+ if (!current) {
25
+ const known = analysis.explanations.map((explanation) => explanation.id).join(", ") || "none";
26
+ throw new AnalysisError(`Explanation "${explanationId}" not found in analysis "${id}". Existing explanations: ${known}.`);
27
+ }
28
+ const resolved = location === undefined ? undefined : resolveExplanationLocation(store.getSnapshot(id), analysis.files, location);
29
+ const previousStatus = current.status;
30
+ const updated = store.mutate(id, "agent", (draft) => {
31
+ if (draft.snapshotAt !== analysis.snapshotAt) {
32
+ throw new AnalysisError(`The diff of analysis "${id}" was recomputed while the explanation was validated. Send the update again.`);
33
+ }
34
+ const explanation = draft.explanations.find((entry) => entry.id === explanationId);
35
+ if (!explanation)
36
+ throw new AnalysisError(`Explanation "${explanationId}" was deleted in the meantime from analysis "${id}".`);
37
+ if (title !== undefined)
38
+ explanation.title = title;
39
+ if (body !== undefined)
40
+ explanation.body = body;
41
+ if (resolved) {
42
+ const { anchorText, ...newLocation } = resolved;
43
+ explanation.location = newLocation;
44
+ explanation.anchorText = anchorText;
45
+ explanation.status = "current";
46
+ }
47
+ });
48
+ const explanation = updated.explanations.find((entry) => entry.id === explanationId);
49
+ const lines = [`Updated explanation ${explanationId} (${given.join(", ")}):`, ` ${explanationLine(explanation)}`];
50
+ if (previousStatus === "outdated" && explanation.status === "current") {
51
+ lines.push("It was outdated; the new location made it current again.");
52
+ }
53
+ else if (explanation.status === "outdated") {
54
+ lines.push("It is still outdated: re-read the code with get_diff, then give its new location (path, side, start_line) and rewrite the body if the code changed, or delete it with delete_explanations.");
55
+ }
56
+ return { result: textResult(lines.join("\n")), analysisId: updated.id };
57
+ }
@@ -1 +1 @@
1
- export declare const APP_VERSION = "1.0.2";
1
+ export declare const APP_VERSION = "1.0.4";
@@ -1,2 +1,2 @@
1
1
  // Auto-generated version file - do not edit manually
2
- export const APP_VERSION = '1.0.2';
2
+ export const APP_VERSION = '1.0.4';