@imenam/mcp-documentor 1.0.71 → 1.0.74
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/dist/src/core/conflict-inspector.d.ts +63 -0
- package/dist/src/core/conflict-inspector.js +157 -0
- package/dist/src/core/git-sync.d.ts +113 -8
- package/dist/src/core/git-sync.js +296 -45
- package/dist/src/core/merge-drivers/merge-config.d.ts +1 -0
- package/dist/src/core/merge-drivers/merge-config.js +68 -0
- package/dist/src/core/merge-drivers/merge-doc.d.ts +1 -0
- package/dist/src/core/merge-drivers/merge-doc.js +105 -0
- package/dist/src/core/merge-drivers/text-merge.d.ts +15 -0
- package/dist/src/core/merge-drivers/text-merge.js +53 -0
- package/dist/src/core/merge-drivers/three-way.d.ts +34 -0
- package/dist/src/core/merge-drivers/three-way.js +86 -0
- package/dist/src/gui-worker.js +21 -0
- package/dist/src/index.js +146 -12
- package/dist/src/tools/conflicts.d.ts +12 -0
- package/dist/src/tools/conflicts.js +190 -0
- package/dist/src/tools/sync.js +55 -11
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/gui/dist/assets/{arc-Carsq0k3.js → arc-BNuZ3dSL.js} +1 -1
- package/gui/dist/assets/{architectureDiagram-3BPJPVTR-caqcwdTw.js → architectureDiagram-3BPJPVTR-D8g3tPQx.js} +1 -1
- package/gui/dist/assets/{blockDiagram-GPEHLZMM-0wUO8k2I.js → blockDiagram-GPEHLZMM-limhup8_.js} +1 -1
- package/gui/dist/assets/{c4Diagram-AAUBKEIU-DS6q7fMy.js → c4Diagram-AAUBKEIU-Ct39JMIy.js} +1 -1
- package/gui/dist/assets/channel-uoEIgtym.js +1 -0
- package/gui/dist/assets/{chunk-2J33WTMH-CrJc-G6D.js → chunk-2J33WTMH-BkLJTezj.js} +1 -1
- package/gui/dist/assets/{chunk-4BX2VUAB-C5vtPFbB.js → chunk-4BX2VUAB-CR5NbhDR.js} +1 -1
- package/gui/dist/assets/{chunk-55IACEB6-BchyQUFM.js → chunk-55IACEB6-CtQYMnJS.js} +1 -1
- package/gui/dist/assets/{chunk-727SXJPM-BCIaWtKq.js → chunk-727SXJPM-B2q7tUn8.js} +1 -1
- package/gui/dist/assets/{chunk-AQP2D5EJ-BEQJDJt5.js → chunk-AQP2D5EJ-Bbcnrfrp.js} +1 -1
- package/gui/dist/assets/{chunk-FMBD7UC4-IfQ3QtrC.js → chunk-FMBD7UC4-D8gd4zRe.js} +1 -1
- package/gui/dist/assets/{chunk-ND2GUHAM-4Du33w7t.js → chunk-ND2GUHAM-DiZKzZtG.js} +1 -1
- package/gui/dist/assets/{chunk-QZHKN3VN-HR0CP6fa.js → chunk-QZHKN3VN-CrKx-e2_.js} +1 -1
- package/gui/dist/assets/classDiagram-4FO5ZUOK-DmhYb54l.js +1 -0
- package/gui/dist/assets/classDiagram-v2-Q7XG4LA2-DmhYb54l.js +1 -0
- package/gui/dist/assets/{cose-bilkent-S5V4N54A-C9Re3ENx.js → cose-bilkent-S5V4N54A-BDUCVkTl.js} +1 -1
- package/gui/dist/assets/{dagre-BM42HDAG-DZmcvMMp.js → dagre-BM42HDAG-DkoYBHXK.js} +1 -1
- package/gui/dist/assets/{diagram-2AECGRRQ-EyJrAGht.js → diagram-2AECGRRQ-BT1YJHon.js} +1 -1
- package/gui/dist/assets/{diagram-5GNKFQAL-CHd3T9_b.js → diagram-5GNKFQAL-C00r6F35.js} +1 -1
- package/gui/dist/assets/{diagram-KO2AKTUF-CIyFrZSR.js → diagram-KO2AKTUF-B4wcN5a_.js} +1 -1
- package/gui/dist/assets/{diagram-LMA3HP47-BlkJALyz.js → diagram-LMA3HP47-B9FqCfel.js} +1 -1
- package/gui/dist/assets/{diagram-OG6HWLK6-P8LA7IZE.js → diagram-OG6HWLK6-COPCDzdG.js} +1 -1
- package/gui/dist/assets/{erDiagram-TEJ5UH35-BPywgWN1.js → erDiagram-TEJ5UH35-BGQGT2wN.js} +1 -1
- package/gui/dist/assets/{flowDiagram-I6XJVG4X-ByL0kGiV.js → flowDiagram-I6XJVG4X-A7jKWUpi.js} +1 -1
- package/gui/dist/assets/{ganttDiagram-6RSMTGT7-_pnaYCU4.js → ganttDiagram-6RSMTGT7-NhFkpY-x.js} +1 -1
- package/gui/dist/assets/{gitGraphDiagram-PVQCEYII-DN67CDGs.js → gitGraphDiagram-PVQCEYII-z0AqyYG4.js} +1 -1
- package/gui/dist/assets/{index-Bjc5MOe1.js → index-Dub5OLKk.js} +98 -98
- package/gui/dist/assets/index-QkCDSQ2A.css +1 -0
- package/gui/dist/assets/{infoDiagram-5YYISTIA-Bm5LEpzH.js → infoDiagram-5YYISTIA-D69UR9u9.js} +1 -1
- package/gui/dist/assets/{ishikawaDiagram-YF4QCWOH-DUYSULkT.js → ishikawaDiagram-YF4QCWOH-DSTqIoro.js} +1 -1
- package/gui/dist/assets/{journeyDiagram-JHISSGLW-BvJ1_f0L.js → journeyDiagram-JHISSGLW-CekXdcoE.js} +1 -1
- package/gui/dist/assets/{kanban-definition-UN3LZRKU-DDYKg6RY.js → kanban-definition-UN3LZRKU-CseGvFK9.js} +1 -1
- package/gui/dist/assets/{linear-HlpG9u6P.js → linear-BtVl_9_C.js} +1 -1
- package/gui/dist/assets/{mindmap-definition-RKZ34NQL-CPa_wo_s.js → mindmap-definition-RKZ34NQL-XLjQIU37.js} +1 -1
- package/gui/dist/assets/{pieDiagram-4H26LBE5-BWo0c4DP.js → pieDiagram-4H26LBE5-BcvUzWoW.js} +1 -1
- package/gui/dist/assets/{quadrantDiagram-W4KKPZXB-CLahU-6B.js → quadrantDiagram-W4KKPZXB-BzoYEmNW.js} +1 -1
- package/gui/dist/assets/{requirementDiagram-4Y6WPE33-BoYbgzQ7.js → requirementDiagram-4Y6WPE33-icKC1_Nd.js} +1 -1
- package/gui/dist/assets/{sankeyDiagram-5OEKKPKP-CGm79aMo.js → sankeyDiagram-5OEKKPKP-mi3i-2dZ.js} +1 -1
- package/gui/dist/assets/{sequenceDiagram-3UESZ5HK-BkknTD52.js → sequenceDiagram-3UESZ5HK-XrcDkRlM.js} +1 -1
- package/gui/dist/assets/{stateDiagram-AJRCARHV-DSBurgwC.js → stateDiagram-AJRCARHV-UXaqrCNT.js} +1 -1
- package/gui/dist/assets/stateDiagram-v2-BHNVJYJU-Bhdu4lv4.js +1 -0
- package/gui/dist/assets/{timeline-definition-PNZ67QCA-CBHyrGuz.js → timeline-definition-PNZ67QCA-yd6607p6.js} +1 -1
- package/gui/dist/assets/{vennDiagram-CIIHVFJN-Dn9fr_bR.js → vennDiagram-CIIHVFJN-BsRqUcIp.js} +1 -1
- package/gui/dist/assets/{wardley-L42UT6IY-nMuySeAb.js → wardley-L42UT6IY-BmdA7yk0.js} +1 -1
- package/gui/dist/assets/{wardleyDiagram-YWT4CUSO-Byn2STLI.js → wardleyDiagram-YWT4CUSO-CRdmckD8.js} +1 -1
- package/gui/dist/assets/{xychartDiagram-2RQKCTM6-Bi-Y9wp5.js → xychartDiagram-2RQKCTM6-DWpNIQY-.js} +1 -1
- package/gui/dist/index.html +2 -2
- package/package.json +65 -65
- package/gui/dist/assets/channel-D51HexOc.js +0 -1
- package/gui/dist/assets/classDiagram-4FO5ZUOK-CU0dQ3zy.js +0 -1
- package/gui/dist/assets/classDiagram-v2-Q7XG4LA2-CU0dQ3zy.js +0 -1
- package/gui/dist/assets/index-hjkEDRmc.css +0 -1
- package/gui/dist/assets/stateDiagram-v2-BHNVJYJU-DfKn22XF.js +0 -1
package/dist/src/tools/sync.js
CHANGED
|
@@ -7,6 +7,15 @@ function err(text) {
|
|
|
7
7
|
return { content: [{ type: "text", text }], isError: true };
|
|
8
8
|
}
|
|
9
9
|
const NOT_CONFIGURED = "Sync is not configured. Set MCP_DOCUMENTOR_SYNC_REMOTE (and MCP_DOCUMENTOR_SYNC_TOKEN) in the server environment.";
|
|
10
|
+
/**
|
|
11
|
+
* Names the sides in absolute terms. Git's own "ours"/"theirs" swap meaning
|
|
12
|
+
* between a merge and a rebase, so they are never surfaced to the agent.
|
|
13
|
+
*/
|
|
14
|
+
function describeOperation(operation) {
|
|
15
|
+
return operation === "rebase"
|
|
16
|
+
? "A rebase is in progress: your local commits are being replayed on top of the remote."
|
|
17
|
+
: "A merge is in progress: the remote commits are being merged into your branch.";
|
|
18
|
+
}
|
|
10
19
|
export async function syncStatus(syncEngine) {
|
|
11
20
|
try {
|
|
12
21
|
if (!syncEngine.isConfigured())
|
|
@@ -14,6 +23,7 @@ export async function syncStatus(syncEngine) {
|
|
|
14
23
|
const s = await syncEngine.status();
|
|
15
24
|
const lines = [
|
|
16
25
|
`Branch: ${s.branch}`,
|
|
26
|
+
s.operation === "none" ? "No merge or rebase in progress." : describeOperation(s.operation),
|
|
17
27
|
`Ahead: ${s.ahead} commit(s) · Behind: ${s.behind} commit(s)`,
|
|
18
28
|
s.conflicted.length > 0 ? `Conflicted files (${s.conflicted.length}):\n - ${s.conflicted.join("\n - ")}` : "No conflicts.",
|
|
19
29
|
s.dirty.length > 0 ? `Uncommitted changes (${s.dirty.length}):\n - ${s.dirty.join("\n - ")}` : "Working tree clean.",
|
|
@@ -24,16 +34,23 @@ export async function syncStatus(syncEngine) {
|
|
|
24
34
|
return err(`Error getting sync status: ${e instanceof Error ? e.message : String(e)}`);
|
|
25
35
|
}
|
|
26
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* A pull commits uncommitted local edits before rebasing over them - worth
|
|
39
|
+
* saying, since the caller did not ask for a commit.
|
|
40
|
+
*/
|
|
41
|
+
function autoCommitNote(autoCommitted) {
|
|
42
|
+
return autoCommitted
|
|
43
|
+
? "Your uncommitted local changes were committed first so they could be replayed on top of the remote.\n"
|
|
44
|
+
: "";
|
|
45
|
+
}
|
|
27
46
|
function describePull(res) {
|
|
28
47
|
switch (res.status) {
|
|
29
48
|
case "up-to-date":
|
|
30
49
|
return "Already up to date — nothing to pull.";
|
|
31
50
|
case "updated":
|
|
32
|
-
return
|
|
33
|
-
case "diverged":
|
|
34
|
-
return `You have uncommitted local changes while the remote has ${res.behind} new commit(s). No changes applied — your local data is intact. Run push_docs to commit and publish your changes, then pull again to merge.`;
|
|
51
|
+
return `${autoCommitNote(res.autoCommitted)}Pulled ${res.changed.length} changed file(s):\n - ${res.changed.join("\n - ")}`;
|
|
35
52
|
case "conflict":
|
|
36
|
-
return
|
|
53
|
+
return `${autoCommitNote(res.autoCommitted)}Conflict in ${res.conflicted.length} file(s):\n - ${res.conflicted.join("\n - ")}\nResolve with resolve_sync_conflict (side "local" keeps this machine version, "remote" keeps the other machine version), or edit these markdown files directly. Then run push_docs.`;
|
|
37
54
|
}
|
|
38
55
|
}
|
|
39
56
|
/** Reindex embeddings for new docs after a successful merge. Best-effort. */
|
|
@@ -82,9 +99,9 @@ export async function syncDocs(syncEngine, storageEngine, embeddingEngine, embed
|
|
|
82
99
|
const v = PushDocsArgs.parse(args);
|
|
83
100
|
const pull = await syncEngine.pull();
|
|
84
101
|
const reindexNote = await reindexAfterPull(pull, storageEngine, embeddingEngine, embeddingStore);
|
|
85
|
-
// Don't push over a
|
|
86
|
-
if (pull.status === "
|
|
87
|
-
return ok(`Pull step:\n${describePull(pull)}${reindexNote}\n\nPush skipped until the
|
|
102
|
+
// Don't push over a conflict — surface it so the caller can resolve first.
|
|
103
|
+
if (pull.status === "conflict") {
|
|
104
|
+
return ok(`Pull step:\n${describePull(pull)}${reindexNote}\n\nPush skipped until the conflict is resolved.`);
|
|
88
105
|
}
|
|
89
106
|
const push = await syncEngine.push(v.message);
|
|
90
107
|
return ok(`Pull step: ${describePull(pull)}${reindexNote}\n\nPush step: ${push.message}`);
|
|
@@ -93,19 +110,46 @@ export async function syncDocs(syncEngine, storageEngine, embeddingEngine, embed
|
|
|
93
110
|
return err(`Error syncing docs: ${e instanceof Error ? e.message : String(e)}`);
|
|
94
111
|
}
|
|
95
112
|
}
|
|
96
|
-
const ResolveConflictArgs = z
|
|
97
|
-
|
|
113
|
+
const ResolveConflictArgs = z
|
|
114
|
+
.object({
|
|
115
|
+
side: z.enum(["local", "remote"]).optional(),
|
|
116
|
+
// Legacy spelling. "mine"/"theirs" mirrored git's flags, which invert under
|
|
117
|
+
// a rebase - accepted for compatibility, mapped onto the absolute names.
|
|
118
|
+
strategy: z.enum(["local", "remote", "mine", "theirs"]).optional(),
|
|
98
119
|
paths: z.array(z.string()).optional(),
|
|
120
|
+
})
|
|
121
|
+
.refine((v) => v.side !== undefined || v.strategy !== undefined, {
|
|
122
|
+
message: 'Provide "side": either "local" or "remote".',
|
|
99
123
|
});
|
|
124
|
+
function normalizeSide(v) {
|
|
125
|
+
if (v.side)
|
|
126
|
+
return v.side;
|
|
127
|
+
return v.strategy === "remote" || v.strategy === "theirs" ? "remote" : "local";
|
|
128
|
+
}
|
|
100
129
|
export async function resolveSyncConflict(syncEngine, args) {
|
|
101
130
|
try {
|
|
102
131
|
if (!syncEngine.isConfigured())
|
|
103
132
|
return err(NOT_CONFIGURED);
|
|
104
133
|
const v = ResolveConflictArgs.parse(args);
|
|
105
|
-
const
|
|
134
|
+
const side = normalizeSide(v);
|
|
135
|
+
const { resolved, operation } = await syncEngine.resolveConflict(side, v.paths);
|
|
106
136
|
if (resolved.length === 0)
|
|
107
137
|
return ok("No conflicted files to resolve.");
|
|
108
|
-
|
|
138
|
+
const kept = side === "local" ? "the local version (this machine)" : "the incoming remote version";
|
|
139
|
+
const lines = [`Resolved ${resolved.length} file(s) keeping ${kept}:`, ` - ${resolved.join("\n - ")}`];
|
|
140
|
+
// Everything staged means the merge or rebase can be carried to completion
|
|
141
|
+
// right away; leaving it half-finished would block the next sync.
|
|
142
|
+
const finish = await syncEngine.continueOperation();
|
|
143
|
+
if (finish.remaining.length > 0) {
|
|
144
|
+
lines.push(``, `Still conflicted (${finish.remaining.length}):`, ` - ${finish.remaining.join("\n - ")}`, `Resolve these too, then run resolve_sync_conflict or push_docs again.`);
|
|
145
|
+
}
|
|
146
|
+
else if (finish.done && finish.operation !== "none") {
|
|
147
|
+
lines.push(``, `The ${finish.operation} is complete. Run push_docs to publish.`);
|
|
148
|
+
}
|
|
149
|
+
else if (finish.error) {
|
|
150
|
+
lines.push(``, `The ${finish.operation} could not be completed: ${finish.error}`);
|
|
151
|
+
}
|
|
152
|
+
return ok(lines.join("\n"));
|
|
109
153
|
}
|
|
110
154
|
catch (e) {
|
|
111
155
|
return err(`Error resolving conflict: ${e instanceof Error ? e.message : String(e)}`);
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const APP_VERSION = "1.0.
|
|
1
|
+
export declare const APP_VERSION = "1.0.74";
|
package/dist/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Auto-generated version file - do not edit manually
|
|
2
|
-
export const APP_VERSION = '1.0.
|
|
2
|
+
export const APP_VERSION = '1.0.74';
|
|
@@ -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-
|
|
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-Dub5OLKk.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};
|