@justyork/repo-mind 0.4.0 → 0.7.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.
- package/README.md +5 -2
- package/dist/ab-demo/compute-pass.d.ts +24 -0
- package/dist/ab-demo/compute-pass.js +80 -0
- package/dist/ab-demo/live-answer.d.ts +6 -0
- package/dist/ab-demo/live-answer.js +89 -0
- package/dist/ab-demo/live-eval.d.ts +19 -0
- package/dist/ab-demo/live-eval.js +192 -0
- package/dist/ab-demo/paths.d.ts +1 -0
- package/dist/ab-demo/paths.js +3 -0
- package/dist/ab-demo/record-transcript.d.ts +9 -0
- package/dist/ab-demo/record-transcript.js +97 -0
- package/dist/ab-demo/types.d.ts +57 -0
- package/dist/ab-demo/validate-questions.d.ts +5 -0
- package/dist/ab-demo/validate-questions.js +32 -0
- package/dist/agent-write-gate.d.ts +7 -0
- package/dist/agent-write-gate.js +33 -0
- package/dist/cli.js +102 -0
- package/dist/commands/ab-eval.d.ts +11 -0
- package/dist/commands/ab-eval.js +103 -0
- package/dist/commands/publish.d.ts +11 -0
- package/dist/commands/publish.js +91 -0
- package/dist/git/git-exec.d.ts +19 -0
- package/dist/git/git-exec.js +89 -0
- package/dist/git/publish-pr.d.ts +33 -0
- package/dist/git/publish-pr.js +121 -0
- package/dist/index/slug.d.ts +2 -0
- package/dist/index/slug.js +15 -0
- package/dist/mcp/server.js +40 -0
- package/dist/publish/batch-publish.d.ts +29 -0
- package/dist/publish/batch-publish.js +106 -0
- package/dist/tools/create-draft.d.ts +32 -0
- package/dist/tools/create-draft.js +163 -0
- package/package.json +7 -1
- package/ui/dist/assets/{arc-C6B0IXf5.js → arc-DufwQU06.js} +1 -1
- package/ui/dist/assets/{architectureDiagram-3BPJPVTR-BwcC0zwn.js → architectureDiagram-3BPJPVTR-CI2fjjSo.js} +1 -1
- package/ui/dist/assets/{blockDiagram-GPEHLZMM-DIhdWMA6.js → blockDiagram-GPEHLZMM-DVBIs-Z6.js} +1 -1
- package/ui/dist/assets/{c4Diagram-AAUBKEIU-DAe6bsUB.js → c4Diagram-AAUBKEIU-rhAX_HrB.js} +1 -1
- package/ui/dist/assets/channel-Q_-BqwUT.js +1 -0
- package/ui/dist/assets/{chunk-2J33WTMH-Cy3md3pb.js → chunk-2J33WTMH-CxWSQi5S.js} +1 -1
- package/ui/dist/assets/{chunk-4BX2VUAB-CzL8eUDD.js → chunk-4BX2VUAB-BEM-vVbU.js} +1 -1
- package/ui/dist/assets/{chunk-55IACEB6-CbthXzDA.js → chunk-55IACEB6-TcrLDHYx.js} +1 -1
- package/ui/dist/assets/{chunk-727SXJPM-B7ZW-l9j.js → chunk-727SXJPM-D8g4OcIW.js} +1 -1
- package/ui/dist/assets/{chunk-AQP2D5EJ-Vaux-7Ld.js → chunk-AQP2D5EJ-CSvrR8rQ.js} +1 -1
- package/ui/dist/assets/{chunk-FMBD7UC4-C6P2YSWU.js → chunk-FMBD7UC4-C14JNc29.js} +1 -1
- package/ui/dist/assets/{chunk-ND2GUHAM-gSNqdDAn.js → chunk-ND2GUHAM-Cnb0VFKm.js} +1 -1
- package/ui/dist/assets/{chunk-QZHKN3VN-DPPMoZqF.js → chunk-QZHKN3VN-D2pqmAXN.js} +1 -1
- package/ui/dist/assets/classDiagram-4FO5ZUOK-CPrZx4R4.js +1 -0
- package/ui/dist/assets/classDiagram-v2-Q7XG4LA2-CPrZx4R4.js +1 -0
- package/ui/dist/assets/{cose-bilkent-S5V4N54A-Ca4nXCOA.js → cose-bilkent-S5V4N54A-Cli2Sbvt.js} +1 -1
- package/ui/dist/assets/{dagre-BM42HDAG-C-4Y4Jyn.js → dagre-BM42HDAG-gUsVuy4s.js} +1 -1
- package/ui/dist/assets/{diagram-2AECGRRQ-CNv_WVZk.js → diagram-2AECGRRQ-DTKi_1b6.js} +1 -1
- package/ui/dist/assets/{diagram-5GNKFQAL-CNwYGvCw.js → diagram-5GNKFQAL-8Bj0k_-k.js} +1 -1
- package/ui/dist/assets/{diagram-KO2AKTUF-CEULTL49.js → diagram-KO2AKTUF-CKOX2fpv.js} +1 -1
- package/ui/dist/assets/{diagram-LMA3HP47-sGQpPW5i.js → diagram-LMA3HP47-B12JvpF3.js} +1 -1
- package/ui/dist/assets/{diagram-OG6HWLK6-BBEtEBkh.js → diagram-OG6HWLK6-DKeTI9IH.js} +1 -1
- package/ui/dist/assets/editor-DZbRkvnr.js +211 -0
- package/ui/dist/assets/{erDiagram-TEJ5UH35-B4mEdVPJ.js → erDiagram-TEJ5UH35-oDb31edH.js} +1 -1
- package/ui/dist/assets/{flowDiagram-I6XJVG4X-7-OngwLn.js → flowDiagram-I6XJVG4X-SPf3KLS-.js} +1 -1
- package/ui/dist/assets/{ganttDiagram-6RSMTGT7-Bq3z_Nvr.js → ganttDiagram-6RSMTGT7-D8oPEcrt.js} +1 -1
- package/ui/dist/assets/{gitGraphDiagram-PVQCEYII-BjMdjnGR.js → gitGraphDiagram-PVQCEYII-eI9Yp7d7.js} +1 -1
- package/ui/dist/assets/{graph-CwHQTpjf.js → graph-DqCH9VKs.js} +1 -1
- package/ui/dist/assets/{infoDiagram-5YYISTIA-ByORmROU.js → infoDiagram-5YYISTIA-CQ6dtyj3.js} +1 -1
- package/ui/dist/assets/{ishikawaDiagram-YF4QCWOH-B7yRHlcY.js → ishikawaDiagram-YF4QCWOH-BHnOZ8-9.js} +1 -1
- package/ui/dist/assets/{journeyDiagram-JHISSGLW-J5mLr9YH.js → journeyDiagram-JHISSGLW-0t985reH.js} +1 -1
- package/ui/dist/assets/{kanban-definition-UN3LZRKU-B3GyGD8X.js → kanban-definition-UN3LZRKU-vPlhgwPS.js} +1 -1
- package/ui/dist/assets/main-Io6jccwi.js +232 -0
- package/ui/dist/assets/{mermaid.core-C57NVZG0.js → mermaid.core-C2wn2wM5.js} +4 -4
- package/ui/dist/assets/{mindmap-definition-RKZ34NQL-CkcXt9tU.js → mindmap-definition-RKZ34NQL-COKv8bQN.js} +1 -1
- package/ui/dist/assets/{pieDiagram-4H26LBE5-Y7B3kCyQ.js → pieDiagram-4H26LBE5-CgVeawD6.js} +1 -1
- package/ui/dist/assets/{quadrantDiagram-W4KKPZXB-CXKUOw1G.js → quadrantDiagram-W4KKPZXB-Bwpr8PxN.js} +1 -1
- package/ui/dist/assets/{requirementDiagram-4Y6WPE33-DBmmmiXs.js → requirementDiagram-4Y6WPE33-Cc8HFBxl.js} +1 -1
- package/ui/dist/assets/{sankeyDiagram-5OEKKPKP-BNADiaE4.js → sankeyDiagram-5OEKKPKP-B_1nSAK5.js} +1 -1
- package/ui/dist/assets/{sequenceDiagram-3UESZ5HK-CctElOC5.js → sequenceDiagram-3UESZ5HK-hsYrUJza.js} +1 -1
- package/ui/dist/assets/{stateDiagram-AJRCARHV-D40_7g7Y.js → stateDiagram-AJRCARHV-BMf4FL5O.js} +1 -1
- package/ui/dist/assets/stateDiagram-v2-BHNVJYJU-BpaPdu-O.js +1 -0
- package/ui/dist/assets/{theme-DxqwV6dp.js → theme-Dl8H1UuW.js} +1 -1
- package/ui/dist/assets/theme-PE9lQ4bz.css +1 -0
- package/ui/dist/assets/{timeline-definition-PNZ67QCA-DMVhUcek.js → timeline-definition-PNZ67QCA-Cf3u1h2_.js} +1 -1
- package/ui/dist/assets/{vennDiagram-CIIHVFJN-Ci0RqPuV.js → vennDiagram-CIIHVFJN-2uKO3x22.js} +1 -1
- package/ui/dist/assets/visual-editor-D1uYYGOW.js +47 -0
- package/ui/dist/assets/{wardley-L42UT6IY-Chn0BKir.js → wardley-L42UT6IY-BjLaoVtm.js} +1 -1
- package/ui/dist/assets/{wardleyDiagram-YWT4CUSO-BLdXlrC5.js → wardleyDiagram-YWT4CUSO-DlrUKeJk.js} +1 -1
- package/ui/dist/assets/{xychartDiagram-2RQKCTM6-C4gOVVe1.js → xychartDiagram-2RQKCTM6-Bzbb3cqD.js} +1 -1
- package/ui/dist/graph.html +3 -3
- package/ui/dist/index.html +4 -4
- package/ui/dist/assets/channel-C8Q7-wTd.js +0 -1
- package/ui/dist/assets/classDiagram-4FO5ZUOK-pYCdSDhT.js +0 -1
- package/ui/dist/assets/classDiagram-v2-Q7XG4LA2-pYCdSDhT.js +0 -1
- package/ui/dist/assets/editor-BcAuZsp8.js +0 -211
- package/ui/dist/assets/main-Du7fLv5Y.js +0 -244
- package/ui/dist/assets/stateDiagram-v2-BHNVJYJU-DSc6L6rE.js +0 -1
- package/ui/dist/assets/theme-BJgORXba.css +0 -1
- package/ui/dist/assets/visual-editor-UWcMGp6p.js +0 -39
package/ui/dist/assets/{journeyDiagram-JHISSGLW-J5mLr9YH.js → journeyDiagram-JHISSGLW-0t985reH.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as gt}from"./chunk-FMBD7UC4-
|
|
1
|
+
import{g as gt}from"./chunk-FMBD7UC4-C14JNc29.js";import{a as mt,g as lt,h as xt,d as kt}from"./chunk-ND2GUHAM-Cnb0VFKm.js";import{g as _t,s as vt,a as bt,b as wt,p as Tt,o as St,_ as s,c as R,d as $t,y as Mt}from"./mermaid.core-C2wn2wM5.js";import{s as X}from"./transform-BwXaE9hv.js";import{d as it}from"./arc-DufwQU06.js";import"./main-Io6jccwi.js";import"./theme-Dl8H1UuW.js";import"./editor-DZbRkvnr.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`:
|
|
2
2
|
`+_.showPosition()+`
|
|
3
3
|
Expecting `+z.join(", ")+", got '"+(this.terminals_[b]||b)+"'":H="Parse error on line "+(C+1)+": Unexpected "+(b==D?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(H,{text:_.match,token:this.terminals_[b]||b,line:_.yylineno,loc:Y,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+b);switch(T[0]){case 1:l.push(b),d.push(_.yytext),c.push(_.yylloc),l.push(T[1]),b=null,Q=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=d[d.length-M],F._$={first_line:c[c.length-(M||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(M||1)].first_column,last_column:c[c.length-1].last_column},ft&&(F._$.range=[c[c.length-(M||1)].range[0],c[c.length-1].range[1]]),q=this.performAction.apply(F,[k,Q,C,I.yy,T[1],d,c].concat(dt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),d=d.slice(0,-1*M),c=c.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),d.push(F.$),c.push(F._$),et=v[l[l.length-2]][l[l.length-1]],l.push(et);break;case 3:return!0}}return!0},"parse")},m=(function(){var h={EOF:1,parseError:s(function(n,l){if(this.yy.parser)this.yy.parser.parseError(n,l);else throw new Error(n)},"parseError"),setInput:s(function(r,n){return this.yy=n||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var n=r.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:s(function(r){var n=r.length,l=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var d=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===y.length?this.yylloc.first_column:0)+y[y.length-l.length].length-l[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:s(function(r){this.unput(this.match.slice(r))},"less"),pastInput:s(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var r=this.pastInput(),n=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as c,l as te,c as W,H as fe,ae as ye,af as be,ag as me,X as _e,F as Y,h as G,q as ke,J as Ee,U as Se,V as le,W as ce}from"./mermaid.core-
|
|
1
|
+
import{_ as c,l as te,c as W,H as fe,ae as ye,af as be,ag as me,X as _e,F as Y,h as G,q as ke,J as Ee,U as Se,V as le,W as ce}from"./mermaid.core-C2wn2wM5.js";import{g as Ne}from"./chunk-FMBD7UC4-C14JNc29.js";import"./main-Io6jccwi.js";import"./theme-Dl8H1UuW.js";import"./editor-DZbRkvnr.js";import"./transform-BwXaE9hv.js";var $=(function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],k=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],U=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],H=[1,35],M=[1,36],A=[1,6,7,11,13,16,17,20,23],j=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:U}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(P,[2,14],{7:H,11:M}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:U}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:j}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:H,11:M}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:j}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var q=m.yylloc;e.push(q);var de=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||m.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var E,R,v,Q,F={},X,I,oe,K;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((E===null||typeof E>"u")&&(E=ae()),v=B[R]&&B[R][E]),typeof v>"u"||!v.length||!v[0]){var Z="";K=[];for(X in B[R])this.terminals_[X]&&X>ue&&K.push("'"+this.terminals_[X]+"'");m.showPosition?Z="Parse error on line "+(z+1)+`:
|
|
2
2
|
`+m.showPosition()+`
|
|
3
3
|
Expecting `+K.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Z="Parse error on line "+(z+1)+": Unexpected "+(E==re?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(Z,{text:m.match,token:this.terminals_[E]||E,line:m.yylineno,loc:q,expected:K})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+R+", token: "+E);switch(v[0]){case 1:a.push(E),u.push(m.yytext),e.push(m.yylloc),a.push(v[1]),E=null,ie=m.yyleng,l=m.yytext,z=m.yylineno,q=m.yylloc;break;case 2:if(I=this.productions_[v[1]][1],F.$=u[u.length-I],F._$={first_line:e[e.length-(I||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(I||1)].first_column,last_column:e[e.length-1].last_column},de&&(F._$.range=[e[e.length-(I||1)].range[0],e[e.length-1].range[1]]),Q=this.performAction.apply(F,[l,ie,z,T.yy,v[1],u,e].concat(ge)),typeof Q<"u")return Q;I&&(a=a.slice(0,-1*I*2),u=u.slice(0,-1*I),e=e.slice(0,-1*I)),a.push(this.productions_[v[1]][0]),u.push(F.$),e.push(F._$),oe=B[a[a.length-2]][a[a.length-1]],a.push(oe);break;case 3:return!0}}return!0},"parse")},y=(function(){var _={EOF:1,parseError:c(function(n,a){if(this.yy.parser)this.yy.parser.parseError(n,a);else throw new Error(n)},"parseError"),setInput:c(function(s,n){return this.yy=n||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:c(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var n=s.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:c(function(s){var n=s.length,a=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var o=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===o.length?this.yylloc.first_column:0)+o[o.length-a.length].length-a[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:c(function(){return this._more=!0,this},"more"),reject:c(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:c(function(s){this.unput(this.match.slice(s))},"less"),pastInput:c(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:c(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:c(function(){var s=this.pastInput(),n=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-C2wn2wM5.js","assets/transform-BwXaE9hv.js","assets/editor-DZbRkvnr.js","assets/visual-editor-D1uYYGOW.js","assets/theme-Dl8H1UuW.js","assets/theme-PE9lQ4bz.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{p as Fe,s as je,e as Ie,g as Oe,a as Be,l as O,b as Ke,c as Ge,d as z,f as ze,h as Je,i as Ve,j as Xe,k as Ye,m as Qe,n as Ze,r as et,o as tt,q as pe,t as nt,v as st,w as rt,x as it,y as j,z as fe,A as at,B as ot,C as lt}from"./theme-Dl8H1UuW.js";import{m as Ee}from"./editor-DZbRkvnr.js";const dt={"wiki-page":"Wiki",adr:"ADR","feature-spec":"Feature specs","glossary-term":"Glossary","open-question":"Open questions","agent-instruction":"Agent instructions"},ct={"wiki-page":"W",adr:"A","feature-spec":"S","glossary-term":"G","open-question":"?","agent-instruction":"◎"},B="folder:";function ut(e){return e.startsWith(B)?e.slice(B.length).slice(0,1).toUpperCase():ct[e]??e.slice(0,1).toUpperCase()}function J(e){if(e.startsWith(B)){const n=e.slice(B.length);return n==="__root__"?"General":n.split(/[-_/]/).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}return dt[e]??e}function pt(e,n){var T,w,L,$;e.className="workspace-main workspace-dashboard",e.innerHTML=`
|
|
3
|
+
<div class="dashboard-header">
|
|
4
|
+
<h1 class="doc-title">Health & publish</h1>
|
|
5
|
+
<div class="workspace-actions">
|
|
6
|
+
<button type="button" id="dash-export" class="btn-ghost">Export agents.md</button>
|
|
7
|
+
<button type="button" id="dash-refresh" class="btn-ghost">Refresh</button>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
<div id="dash-check" class="dashboard-section"></div>
|
|
11
|
+
<div id="dash-links" class="dashboard-section"></div>
|
|
12
|
+
<div class="dashboard-section">
|
|
13
|
+
<h2>Prepare docs</h2>
|
|
14
|
+
<p class="dashboard-hint">Markdown files without RepoMind frontmatter. Add frontmatter to index them for MCP and the catalog.</p>
|
|
15
|
+
<div class="dashboard-actions">
|
|
16
|
+
<button type="button" id="dash-prepare-all" class="btn-primary btn-sm">Prepare all</button>
|
|
17
|
+
<button type="button" id="dash-sync-links" class="btn-ghost btn-sm">Sync all links</button>
|
|
18
|
+
</div>
|
|
19
|
+
<ul id="dash-unprepared" class="queue-list"></ul>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="dashboard-section">
|
|
22
|
+
<h2>Publish queue</h2>
|
|
23
|
+
<ul id="dash-queue" class="queue-list"></ul>
|
|
24
|
+
</div>
|
|
25
|
+
`;const t=e.querySelector("#dash-check"),s=e.querySelector("#dash-links"),c=e.querySelector("#dash-unprepared"),a=e.querySelector("#dash-queue");function o(p){const i=p.ok?"check-ok":"check-fail",g=p.ok?"All checks passed":`${p.violations.length} issue(s)`;let d=`
|
|
26
|
+
<h2>Schema check</h2>
|
|
27
|
+
<p class="check-status ${i}">${g}</p>
|
|
28
|
+
`;if(p.violations.length>0){d+='<ul class="violation-list">';for(const h of p.violations)d+=`<li><code>${D(h.path)}</code> — ${D(h.message)}</li>`;d+="</ul>"}if(p.warnings.length>0){d+='<h3 class="warnings-title">Warnings</h3><ul class="warning-list">';for(const h of p.warnings)d+=`<li>${D(h)}</li>`;d+="</ul>"}t.innerHTML=d}function v(p){let i=`
|
|
29
|
+
<h2>Link health</h2>
|
|
30
|
+
<div class="link-health-stats">
|
|
31
|
+
<div class="link-health-stat"><span class="link-health-value">${p.orphanCount}</span> orphans</div>
|
|
32
|
+
<div class="link-health-stat"><span class="link-health-value">${p.brokenCount}</span> broken</div>
|
|
33
|
+
<div class="link-health-stat"><span class="link-health-value">${p.oneWayCount}</span> one-way</div>
|
|
34
|
+
</div>
|
|
35
|
+
`;if(p.brokenTargets.length>0){i+='<h3 class="warnings-title">Broken targets</h3><ul class="warning-list">';for(const g of p.brokenTargets)i+=`<li><code>${D(g)}</code></li>`;i+="</ul>"}if(p.orphanSlugs.length>0){i+='<h3 class="warnings-title">Orphan pages</h3><ul class="warning-list">';for(const g of p.orphanSlugs)i+=`<li><code>${D(g)}</code></li>`;i+="</ul>"}s.innerHTML=i}function S(p){var i;if(c.innerHTML="",p.length===0){c.innerHTML='<li class="placeholder">All docs have frontmatter</li>';return}for(const g of p){const d=document.createElement("li");d.className="queue-item",d.innerHTML=`
|
|
36
|
+
<div class="queue-main">
|
|
37
|
+
<div class="queue-title">${D(g.relativePath)}</div>
|
|
38
|
+
<div class="meta">${D(g.suggestedType)} · slug: ${D(g.suggestedSlug)}</div>
|
|
39
|
+
</div>
|
|
40
|
+
<div class="queue-actions">
|
|
41
|
+
<button type="button" class="btn-primary btn-sm" data-action="prepare">Add frontmatter</button>
|
|
42
|
+
</div>
|
|
43
|
+
`,(i=d.querySelector('[data-action="prepare"]'))==null||i.addEventListener("click",()=>{Ge(g.relativePath,g.suggestedType).then(({result:h})=>{n.onNotify(`Prepared: ${h.slug}`),E()}).catch(h=>{n.onNotify(h instanceof Error?h.message:"Prepare failed",!0)})}),c.appendChild(d)}}function P(p){var i,g;if(a.innerHTML="",p.length===0){a.innerHTML='<li class="placeholder">No drafts in queue</li>';return}for(const d of p){const h=document.createElement("li");h.className="queue-item",h.innerHTML=`
|
|
44
|
+
<div class="queue-main">
|
|
45
|
+
<div class="queue-title">${D(d.title||d.slug)}</div>
|
|
46
|
+
<div class="meta">${D(d.slug)} · ${D(d.type)}</div>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="queue-actions">
|
|
49
|
+
<button type="button" class="btn-ghost btn-sm" data-action="edit">Edit</button>
|
|
50
|
+
<button type="button" class="btn-primary btn-sm" data-action="publish">Publish</button>
|
|
51
|
+
</div>
|
|
52
|
+
`,(i=h.querySelector('[data-action="edit"]'))==null||i.addEventListener("click",()=>{n.onOpenDraft(d)}),(g=h.querySelector('[data-action="publish"]'))==null||g.addEventListener("click",()=>{z(d.id).then(({result:r})=>{n.onPublished(r.path),E()}).catch(r=>{n.onNotify(r instanceof Error?r.message:"Publish failed",!0)})}),a.appendChild(h)}}async function E(){try{const[p,i,{drafts:g},{files:d}]=await Promise.all([Oe(),Be(),O(),Ke()]);o(p),v(i),S(d),P(g)}catch(p){t.innerHTML=`<p class="check-status check-fail">${D(p instanceof Error?p.message:"Failed to load")}</p>`}}return(T=e.querySelector("#dash-refresh"))==null||T.addEventListener("click",()=>{E()}),(w=e.querySelector("#dash-prepare-all"))==null||w.addEventListener("click",()=>{Fe().then(({result:p})=>{n.onNotify(`Prepared ${p.prepared.length} file(s)`),E()}).catch(p=>{n.onNotify(p instanceof Error?p.message:"Prepare all failed",!0)})}),(L=e.querySelector("#dash-sync-links"))==null||L.addEventListener("click",()=>{je().then(({result:p})=>{const i=p.files.filter(g=>g.changed).length;n.onNotify(`Synced links in ${i} file(s)`),E()}).catch(p=>{n.onNotify(p instanceof Error?p.message:"Sync links failed",!0)})}),($=e.querySelector("#dash-export"))==null||$.addEventListener("click",()=>{Ie().then(({path:p})=>{n.onNotify(`Exported ${p}`)}).catch(p=>{n.onNotify(p instanceof Error?p.message:"Export failed",!0)})}),E(),{refresh:E}}function D(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function ft(e){if(!e)return null;if(e.startsWith("?slug=")||e.startsWith("/?slug=")){const n=e.includes("?")?e.slice(e.indexOf("?")):e,t=new URLSearchParams(n).get("slug");return(t==null?void 0:t.trim())||null}try{const t=new URL(e,"http://local").searchParams.get("slug");return(t==null?void 0:t.trim())||null}catch{return null}}function V(e){var n,t;return((t=(n=e.split("#")[0])==null?void 0:n.split("?")[0])==null?void 0:t.trim())??""}function Le(e){const n=e.replace(/\\/g,"/").replace(/^\/+/,"");return n?n.toLowerCase().endsWith(".md")?n:`${n}.md`:""}function gt(e,n){const t=V(n);if(!t||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("mailto:")||t.startsWith("#"))return null;const s=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",c=t.replace(/\\/g,"/").split("/"),a=s?s.split("/"):[];for(const o of c)if(!(!o||o===".")){if(o===".."){if(a.length===0)return null;a.pop();continue}a.push(o)}return Le(a.join("/"))}function ht(e){let n=V(e).replace(/\\/g,"/");return!n||n.startsWith("http://")||n.startsWith("https://")||n.startsWith("mailto:")||n.startsWith("#")||(n.startsWith("/")&&(n=n.slice(1)),n.startsWith("docs/")&&(n=n.slice(5)),!n)?null:Le(n)}function mt(e,n){const t=n.get(e);if(t)return t;const s=e.toLowerCase();for(const[c,a]of n.entries())if(c.toLowerCase()===s)return a;return null}function vt(e,n,t){const s=ft(n);if(s){for(const a of t.values())if(a===s)return s;return null}const c=[gt(e,n),ht(n)].filter(a=>!!a);for(const a of c){const o=mt(a,t);if(o)return o}return null}const yt=[".png",".jpg",".jpeg",".gif",".webp",".svg"];function ge(e){const n=e.toLowerCase();return yt.some(t=>n.endsWith(t))}function bt(e,n){const t=V(n);if(!t||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("mailto:")||t.startsWith("#")||t.startsWith("data:"))return null;let s=t.replace(/\\/g,"/");if(s.startsWith("/")&&(s=s.slice(1)),s.startsWith("docs/")?s=s.slice(5):s="",s&&!s.split("/").includes("..")&&ge(s))return s;const c=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",a=t.replace(/\\/g,"/").split("/"),o=c?c.split("/"):[];for(const S of a)if(!(!S||S===".")){if(S===".."){if(o.length===0)return null;o.pop();continue}o.push(S)}const v=o.join("/");return v&&ge(v)?v:null}function St(e,n){const t=bt(e,n);return t?`/api/assets/${t.split("/").map(encodeURIComponent).join("/")}`:null}const wt="modulepreload",Et=function(e){return"/"+e},he={},$e=function(n,t,s){let c=Promise.resolve();if(t&&t.length>0){let o=function(P){return Promise.all(P.map(E=>Promise.resolve(E).then(T=>({status:"fulfilled",value:T}),T=>({status:"rejected",reason:T}))))};document.getElementsByTagName("link");const v=document.querySelector("meta[property=csp-nonce]"),S=(v==null?void 0:v.nonce)||(v==null?void 0:v.getAttribute("nonce"));c=o(t.map(P=>{if(P=Et(P),P in he)return;he[P]=!0;const E=P.endsWith(".css"),T=E?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${P}"]${T}`))return;const w=document.createElement("link");if(w.rel=E?"stylesheet":wt,E||(w.as="script"),w.crossOrigin="",w.href=P,S&&w.setAttribute("nonce",S),document.head.appendChild(w),E)return new Promise((L,$)=>{w.addEventListener("load",L),w.addEventListener("error",()=>$(new Error(`Unable to preload CSS for ${P}`)))})}))}function a(o){const v=new Event("vite:preloadError",{cancelable:!0});if(v.payload=o,window.dispatchEvent(v),!v.defaultPrevented)throw o}return c.then(o=>{for(const v of o||[])v.status==="rejected"&&a(v.reason);return n().catch(a)})};let me=null;async function Lt(e){const n=e.querySelectorAll("pre.mermaid");if(n.length===0)return;const t=document.documentElement.dataset.theme==="dark"?"dark":"default",s=await $e(()=>import("./mermaid.core-C2wn2wM5.js").then(c=>c.ba),__vite__mapDeps([0,1,2]));me!==t&&(s.default.initialize({startOnLoad:!1,theme:t,securityLevel:"loose"}),me=t);try{await s.default.run({nodes:[...n]})}catch{for(const c of n)if(!c.closest(".mermaid-error")){const a=c.parentElement;a==null||a.classList.add("mermaid-error")}}}const qe=/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g;function Pe(e,n){const t=e.trim(),s=((n==null?void 0:n.trim())||t).trim();return{display:t,slug:s}}function fn(e,n){const t=e.trim(),s=(n??t).trim();return s===t?`[[${t}]]`:`[[${t}|${s}]]`}function $t(e){const n=[];for(const t of e.matchAll(qe)){const{slug:s}=Pe(t[1]??"",t[2]);s&&n.push(s)}return n}let ve=!1,W=null;function _(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function qt(e){return e.replace(qe,(n,t,s)=>{const{display:c,slug:a}=Pe(t,s),o=encodeURIComponent(a);return`[${c}](#wikilink:${o})`})}function Pt(){ve||(Ee.use({gfm:!0,renderer:{code({text:e,lang:n}){return n==="mermaid"?`<div class="mermaid-wrapper"><pre class="mermaid">${_(e.trim())}</pre></div>
|
|
53
|
+
`:!1},list(e){if(!e.items.some(a=>a.task))return!1;const t=e.ordered?"ol":"ul",s=e.ordered&&e.start!==1&&e.start!=null?` start="${e.start}"`:"";let c="";for(const a of e.items)c+=this.listitem(a);return`<${t} class="contains-task-list"${s}>
|
|
54
|
+
${c}</${t}>
|
|
55
|
+
`},listitem(e){if(!e.task)return!1;const n=`<input type="checkbox" class="task-list-item-checkbox"${e.checked?" checked":""} disabled>`,t=this.parser.parse(e.tokens,!!e.loose).trim();return`<li class="task-list-item"><label class="task-list-item-label">${n}<span class="task-list-item-content">${t}</span></label></li>
|
|
56
|
+
`},image({href:e,text:n,title:t}){if(!e||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:"))return!1;if(W){const s=St(W.docRelativePath,e);if(s){const c=_(n||t||"");return`<img src="${_(s)}" alt="${c}" loading="lazy" class="markdown-image">`}}return!1},link({href:e,text:n}){if(e!=null&&e.startsWith("#wikilink:")){const t=decodeURIComponent(e.slice(10));return`<a href="#" class="wikilink" data-slug="${_(t)}">${n}</a>`}if(W&&e){const t=vt(W.docRelativePath,e,W.slugByRelative);if(t)return`<a href="#" class="wikilink" data-slug="${_(t)}">${n}</a>`}return e!=null&&e.startsWith("http://")||e!=null&&e.startsWith("https://")?`<a href="${_(e)}" target="_blank" rel="noopener noreferrer">${n}</a>`:e!=null&&e.startsWith("mailto:")||e!=null&&e.startsWith("#")?!1:e?`<a href="#" class="md-link-unresolved" title="Link not in docs index">${n}</a>`:!1}}}),ve=!0)}function Ct(e,n){Pt(),W=n??null;try{return Ee.parse(qt(e),{async:!1})}finally{W=null}}const X="slug",Ce="path",Tt="draft";function Y(){const e=new URLSearchParams(window.location.search).get(X);return e!=null&&e.trim()?e.trim():null}function kt(){const e=new URLSearchParams(window.location.search).get(Ce);return e!=null&&e.trim()?e.trim().replace(/\\/g,"/"):null}function Mt(){const e=new URLSearchParams(window.location.search).get(Tt);return e!=null&&e.trim()?e.trim():null}function At(){const e=new URL(window.location.href),n=e.pathname;if(n==="/"||n==="/index.html")return;const t=Y();e.pathname="/",history.replaceState(t?{slug:t}:{},"",e)}function Te(){const e=new URL(window.location.href);return e.pathname="/",e}function xt(e){const n=Te();return n.search="",n.searchParams.set(X,e),n.toString()}function Dt(e,n="push"){const t=Te();t.searchParams.delete(Ce),t.searchParams.set(X,e);const s={slug:e};n==="replace"?history.replaceState(s,"",t):history.pushState(s,"",t)}function Rt(e){const n=()=>{e(Y())};return window.addEventListener("popstate",n),()=>window.removeEventListener("popstate",n)}const ke="repomind-page-info-hidden";function k(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Q(){try{const e=localStorage.getItem(ke);return e===null?!0:e==="true"}catch{return!0}}function Me(e){try{localStorage.setItem(ke,e?"true":"false")}catch{}}function Ht(e){return e.map((n,t)=>{const s=t>0?'<span class="crumb-sep">›</span>':"";return n.current?`${s}<span class="crumb current">${k(n.label)}</span>`:n.crumbId?`${s}<button type="button" class="crumb" data-crumb="${k(n.crumbId)}">${k(n.label)}</button>`:`${s}<span class="crumb">${k(n.label)}</span>`}).join("")}function Ae(e,n){const t=n.focusMode??Q();e.className=n.rootClass??"workspace-main",e.innerHTML=`
|
|
57
|
+
<nav class="breadcrumb" aria-label="Breadcrumb">
|
|
58
|
+
${Ht(n.breadcrumbs)}
|
|
59
|
+
</nav>
|
|
60
|
+
<div class="page-layout${t?" page-layout--focus":""}">
|
|
61
|
+
<article class="page-content">
|
|
62
|
+
<header class="page-header">
|
|
63
|
+
<div class="page-title-slot">${n.titleHtml}</div>
|
|
64
|
+
<div class="workspace-actions">${n.actionsHtml}</div>
|
|
65
|
+
</header>
|
|
66
|
+
<div class="page-body-slot">${n.mainHtml}</div>
|
|
67
|
+
</article>
|
|
68
|
+
<aside class="page-info">${n.railHtml}</aside>
|
|
69
|
+
</div>
|
|
70
|
+
`;const s=e.querySelector(".page-layout");return{pageLayout:s,bodySlot:e.querySelector(".page-body-slot"),railSlot:e.querySelector(".page-info"),setFocusMode(c){s.classList.toggle("page-layout--focus",c),Me(c)}}}function xe(e,n,t){const s=e.querySelector("#toggle-focus"),c=e.querySelector(".page-layout");!s||!c||(c.classList.toggle("page-layout--focus",n),s.setAttribute("aria-pressed",String(n)),s.textContent=n?"Show info":"Hide info",s.addEventListener("click",()=>{const a=!c.classList.contains("page-layout--focus");c.classList.toggle("page-layout--focus",a),Me(a),s.setAttribute("aria-pressed",String(a)),s.textContent=a?"Show info":"Hide info"}))}function Nt(e,n){e.querySelectorAll(".breadcrumb [data-crumb]").forEach(t=>{t.addEventListener("click",()=>{const s=t.dataset.crumb;s&&n[s]&&n[s]()})})}function Wt(e,n){if(n==="json")try{const t=JSON.parse(e);return JSON.stringify(t,null,2)}catch{return e}return e}function Ut(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function _t(e,n){const t=Wt(e,n);return`<pre class="structured-preview ${n==="json"?"structured-preview--json":"structured-preview--yaml"}"><code>${Ut(t)}</code></pre>`}function Ft(e,n){typeof n.title=="string"?n.title:e.slug;const t=typeof n.status=="string"?n.status:"",s=typeof n.type=="string"?n.type:"",c=typeof n.domain=="string"?n.domain:"",a=Array.isArray(n.tags)?n.tags.filter(S=>typeof S=="string"):[],o=Array.isArray(n.related)?n.related.filter(S=>typeof S=="string"):[],v=e.contentKind??"markdown";return`
|
|
71
|
+
<h2 class="page-info-title">Page info</h2>
|
|
72
|
+
<dl class="info-list">
|
|
73
|
+
<dt>Status</dt><dd><span class="status-chip status-${k(t)}">${k(t)}</span></dd>
|
|
74
|
+
<dt>Type</dt><dd>${k(s)}</dd>
|
|
75
|
+
${c?`<dt>Domain</dt><dd>${k(c)}</dd>`:""}
|
|
76
|
+
<dt>Format</dt><dd>${k(v)}</dd>
|
|
77
|
+
${a.length>0?`<dt>Tags</dt><dd>${a.map(S=>`<span class="tag-chip">${k(S)}</span>`).join(" ")}</dd>`:""}
|
|
78
|
+
</dl>
|
|
79
|
+
${o.length>0?`<div class="info-block"><div class="info-block-label">Related</div>${o.map(S=>`<button type="button" class="related-chip" data-slug="${k(S)}">${k(S)}</button>`).join("")}</div>`:""}
|
|
80
|
+
<div class="info-tabs tabs">
|
|
81
|
+
<button class="tab active" data-tab="frontmatter">Frontmatter</button>
|
|
82
|
+
<button class="tab" data-tab="agent">Agent JSON</button>
|
|
83
|
+
</div>
|
|
84
|
+
<div id="tab-frontmatter" class="tab-panel active"></div>
|
|
85
|
+
<div id="tab-agent" class="tab-panel"></div>
|
|
86
|
+
<footer class="page-info-footer">
|
|
87
|
+
<code id="doc-path">${k(e.path??"")}</code>
|
|
88
|
+
</footer>
|
|
89
|
+
`}function H(e,n,t={}){var p,i,g;if(!n||!n.found){e.className="workspace-main",e.innerHTML=`
|
|
90
|
+
<div class="workspace-empty">
|
|
91
|
+
<h1>Knowledge</h1>
|
|
92
|
+
<p class="placeholder">Select a page from the tree or use the ⋯ menu to create one.</p>
|
|
93
|
+
</div>
|
|
94
|
+
`;return}const s=n.frontmatter??{},c=typeof s.title=="string"?s.title:n.slug??"",a=typeof s.type=="string"?s.type:"",o=J(a),v=Q(),S=n.contentKind??"markdown",P=S==="json"||S==="yaml",E=P?"":'<button type="button" id="edit-page" class="btn-primary">Edit</button>',T=Ae(e,{breadcrumbs:[{label:"Knowledge",crumbId:"root"},{label:o,crumbId:"catalog"},{label:c,current:!0}],titleHtml:`<h1 class="doc-title">${k(c)}</h1>`,actionsHtml:`
|
|
95
|
+
<button type="button" id="toggle-focus" class="btn-ghost" aria-pressed="${v}">
|
|
96
|
+
${v?"Show info":"Hide info"}
|
|
97
|
+
</button>
|
|
98
|
+
${E}
|
|
99
|
+
<button type="button" id="copy-link" class="btn-ghost">Copy link</button>
|
|
100
|
+
<button type="button" id="copy-path" class="btn-ghost">Copy path</button>
|
|
101
|
+
`,mainHtml:`
|
|
102
|
+
<div id="tab-preview" class="markdown-preview reader-preview"></div>
|
|
103
|
+
<section id="reader-backlinks" class="reader-backlinks hidden" aria-label="Backlinks"></section>
|
|
104
|
+
`,railHtml:Ft(n,s),focusMode:v});xe(e,v),Nt(e,{root:()=>{var d;return(d=t.onNavigateRoot)==null?void 0:d.call(t)},catalog:()=>{var d;return(d=t.onNavigateCatalog)==null?void 0:d.call(t)}});const w=T.bodySlot.querySelector("#tab-preview");if(P)w.innerHTML=_t(n.body??"",S);else{const d=t.docRelativePath&&t.slugByRelative?{docRelativePath:t.docRelativePath,slugByRelative:t.slugByRelative}:void 0;w.innerHTML=Ct(n.body??"",d),Lt(w),w.querySelectorAll("a.wikilink").forEach(h=>{h.addEventListener("click",r=>{r.preventDefault();const l=h.dataset.slug;l&&e.dispatchEvent(new CustomEvent("navigate-slug",{detail:{slug:l}}))})}),w.querySelectorAll("a.md-link-unresolved").forEach(h=>{h.addEventListener("click",r=>{r.preventDefault()})})}const L=T.railSlot.querySelector("#tab-frontmatter");L.innerHTML='<pre class="frontmatter-yaml"></pre>',L.querySelector("pre").textContent=JSON.stringify(s,null,2);const $=T.railSlot.querySelector("#tab-agent");$.innerHTML='<pre class="agent-json"></pre>',$.querySelector("pre").textContent=JSON.stringify(n.agentShape,null,2),e.querySelectorAll(".info-tabs .tab").forEach(d=>{d.addEventListener("click",()=>{var r;const h=d.dataset.tab;e.querySelectorAll(".info-tabs .tab").forEach(l=>l.classList.remove("active")),e.querySelectorAll(".page-info .tab-panel").forEach(l=>l.classList.remove("active")),d.classList.add("active"),(r=e.querySelector(`#tab-${h}`))==null||r.classList.add("active")})}),(p=e.querySelector("#copy-path"))==null||p.addEventListener("click",()=>{n.path&&navigator.clipboard.writeText(n.path)}),(i=e.querySelector("#copy-link"))==null||i.addEventListener("click",()=>{var d;n.slug&&(navigator.clipboard.writeText(xt(n.slug)),(d=t.onCopyLink)==null||d.call(t))}),(g=e.querySelector("#edit-page"))==null||g.addEventListener("click",()=>{n.slug&&t.onEdit&&t.onEdit(n.slug)}),T.railSlot.querySelectorAll(".related-chip").forEach(d=>{d.addEventListener("click",()=>{const h=d.dataset.slug;h&&e.dispatchEvent(new CustomEvent("navigate-slug",{detail:{slug:h}}))})}),n.slug&&!P&&ze(n.slug).then(({backlinks:d})=>{const h=T.bodySlot.querySelector("#reader-backlinks");!h||d.length===0||(h.classList.remove("hidden"),h.innerHTML=`
|
|
105
|
+
<h2 class="reader-backlinks-title">Backlinks</h2>
|
|
106
|
+
<div class="reader-backlinks-list">
|
|
107
|
+
${d.map(r=>`<button type="button" class="related-chip" data-slug="${k(r.slug)}">${k(r.title)} <span class="backlink-kind">${k(r.kind)}</span></button>`).join("")}
|
|
108
|
+
</div>
|
|
109
|
+
`,h.querySelectorAll(".related-chip").forEach(r=>{r.addEventListener("click",()=>{const l=r.dataset.slug;l&&e.dispatchEvent(new CustomEvent("navigate-slug",{detail:{slug:l}}))})}))}).catch(()=>{})}function jt(e){return $t(e)}function It(e,n){const t=n.find(a=>a.slug===e);if(t)return t.slug;const s=e.toLowerCase(),c=n.find(a=>a.title.toLowerCase()===s);return(c==null?void 0:c.slug)??null}function Ot(e,n,t){const s=new Set(n),c=[];for(const a of jt(e)){const o=It(a,t);!o||s.has(o)||c.includes(o)||c.push(o)}return c}function Bt(e,n,t){const s=e.toLowerCase();if(!s)return 1;const c=n.toLowerCase(),a=t.toLowerCase();return c.startsWith(s)||a.startsWith(s)?3:c.includes(s)||a.includes(s)?2:0}function Kt(e,n,t=12){return n.map(s=>({doc:s,score:Bt(e,s.slug,s.title)})).filter(s=>s.score>0).sort((s,c)=>c.score-s.score||s.doc.slug.localeCompare(c.doc.slug)).slice(0,t).map(s=>s.doc)}const Gt=["adr","feature-spec","glossary-term","open-question","agent-instruction","wiki-page"],zt=["draft","proposed","accepted","superseded"];function Jt(e){return`
|
|
110
|
+
<h2 class="page-info-title">Page properties</h2>
|
|
111
|
+
<div class="workspace-badges editor-badges">
|
|
112
|
+
<span class="badge badge-draft">draft</span>
|
|
113
|
+
${e.forkedFrom?`<span class="badge">fork: ${k(e.forkedFrom)}</span>`:""}
|
|
114
|
+
</div>
|
|
115
|
+
<div class="props-section">
|
|
116
|
+
<div class="props-label">Status</div>
|
|
117
|
+
<div class="props-chip-row">
|
|
118
|
+
<button type="button" id="ed-status-chip" class="status-chip props-chip-trigger" aria-haspopup="listbox"></button>
|
|
119
|
+
<div id="ed-status-menu" class="props-dropdown hidden" role="listbox"></div>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
<div class="props-section">
|
|
123
|
+
<div class="props-label">Type</div>
|
|
124
|
+
<div class="props-chip-row">
|
|
125
|
+
<button type="button" id="ed-type-chip" class="props-chip props-chip-trigger" aria-haspopup="listbox"></button>
|
|
126
|
+
<div id="ed-type-menu" class="props-dropdown hidden" role="listbox"></div>
|
|
127
|
+
</div>
|
|
128
|
+
<div class="props-hint" id="ed-catalog-hint"></div>
|
|
129
|
+
</div>
|
|
130
|
+
<div class="props-section">
|
|
131
|
+
<div class="props-label">Slug</div>
|
|
132
|
+
<input id="ed-slug" class="props-slug-input" spellcheck="false" />
|
|
133
|
+
</div>
|
|
134
|
+
<div class="props-section">
|
|
135
|
+
<div class="props-label">Tags</div>
|
|
136
|
+
<div id="ed-tags-chips" class="props-chip-list"></div>
|
|
137
|
+
<input id="ed-tags-input" class="props-add-input" placeholder="Add tag…" />
|
|
138
|
+
</div>
|
|
139
|
+
<div class="props-section">
|
|
140
|
+
<div class="props-label">Related</div>
|
|
141
|
+
<div id="ed-related-chips" class="props-chip-list"></div>
|
|
142
|
+
<input id="ed-related-input" class="props-add-input" placeholder="Add related slug…" autocomplete="off" />
|
|
143
|
+
<div id="ed-related-menu" class="props-dropdown hidden" role="listbox"></div>
|
|
144
|
+
</div>
|
|
145
|
+
`}function Vt(e,n,t,s){const c=e.querySelector("#ed-slug"),a=e.querySelector("#ed-status-chip"),o=e.querySelector("#ed-status-menu"),v=e.querySelector("#ed-type-chip"),S=e.querySelector("#ed-type-menu"),P=e.querySelector("#ed-catalog-hint"),E=e.querySelector("#ed-tags-chips"),T=e.querySelector("#ed-tags-input"),w=e.querySelector("#ed-related-chips"),L=e.querySelector("#ed-related-input"),$=e.querySelector("#ed-related-menu");let p=[...n.tags],i=[...n.related],g=n.status,d=n.type;c.value=n.slug,r(),l(),f(),y();function h(){s()}function r(){a.textContent=g,a.className=`status-chip props-chip-trigger status-${g}`,o.innerHTML=zt.map(m=>`<button type="button" class="props-dropdown-item" data-value="${m}" role="option">${m}</button>`).join("")}function l(){v.textContent=d,P.textContent=J(d),S.innerHTML=Gt.map(m=>`<button type="button" class="props-dropdown-item" data-value="${m}" role="option">${m}</button>`).join("")}function f(){E.innerHTML=p.map(m=>`<span class="tag-chip props-removable-chip">${k(m)}<button type="button" class="chip-remove" data-tag="${k(m)}" aria-label="Remove tag">×</button></span>`).join(""),E.querySelectorAll(".chip-remove").forEach(m=>{m.addEventListener("click",()=>{const C=m.dataset.tag;p=p.filter(M=>M!==C),f(),h()})})}function y(){w.innerHTML=i.map(m=>`<span class="related-chip props-removable-chip">${k(m)}<button type="button" class="chip-remove" data-slug="${k(m)}" aria-label="Remove related">×</button></span>`).join(""),w.querySelectorAll(".chip-remove").forEach(m=>{m.addEventListener("click",()=>{const C=m.dataset.slug;i=i.filter(M=>M!==C),y(),h()})})}function q(){o.classList.add("hidden"),S.classList.add("hidden"),$.classList.add("hidden")}a.addEventListener("click",()=>{o.classList.toggle("hidden")||(S.classList.add("hidden"),$.classList.add("hidden"))}),o.addEventListener("click",m=>{const C=m.target.closest("[data-value]");C&&(g=C.dataset.value??g,r(),o.classList.add("hidden"),h())}),v.addEventListener("click",()=>{S.classList.toggle("hidden")||(o.classList.add("hidden"),$.classList.add("hidden"))}),S.addEventListener("click",m=>{const C=m.target.closest("[data-value]");C&&(d=C.dataset.value??d,l(),S.classList.add("hidden"),h())}),c.addEventListener("input",h),T.addEventListener("keydown",m=>{if(m.key!=="Enter"&&m.key!==",")return;m.preventDefault();const C=T.value.trim().replace(/,$/,"");if(!C||p.includes(C)){T.value="";return}p.push(C),T.value="",f(),h()});function b(m){const C=Kt(m,t).filter(M=>!i.includes(M.slug));if(C.length===0){$.classList.add("hidden");return}$.innerHTML=C.map(M=>`<button type="button" class="props-dropdown-item" data-slug="${k(M.slug)}" role="option">
|
|
146
|
+
<span class="wikilink-option-slug">${k(M.slug)}</span>
|
|
147
|
+
<span class="wikilink-option-title">${k(M.title)}</span>
|
|
148
|
+
</button>`).join(""),$.classList.remove("hidden")}return L.addEventListener("input",()=>{b(L.value.trim())}),L.addEventListener("keydown",m=>{if(m.key==="Enter"){m.preventDefault();const C=L.value.trim();C&&!i.includes(C)&&(i.push(C),L.value="",y(),$.classList.add("hidden"),h())}}),$.addEventListener("mousedown",m=>{m.preventDefault();const C=m.target.closest("[data-slug]");if(!C)return;const M=C.dataset.slug??"";M&&!i.includes(M)&&(i.push(M),L.value="",y(),$.classList.add("hidden"),h())}),document.addEventListener("click",m=>{const C=m.target;!a.contains(C)&&!o.contains(C)&&!v.contains(C)&&!S.contains(C)&&!L.contains(C)&&!$.contains(C)&&q()}),{getState:()=>({slug:c.value.trim(),type:d,status:g,tags:[...p],related:[...i]}),setRelated(m){i=[...new Set(m)],y(),h()}}}let N=null,I=null;function Xt(e,n,t,s=[]){var Z,ee,te,ne,se,re,ie,ae,oe,le,de,ce;const c=s.map(u=>({slug:u.slug,title:u.title}));let a=null,o=n.body;const v=Q(),S=Ae(e,{rootClass:"workspace-main workspace-editor",breadcrumbs:[{label:"Knowledge"},{label:"Drafts"},{label:n.title||n.slug,current:!0}],titleHtml:'<input id="ed-title" class="title-input doc-title" type="text" placeholder="Document title" />',actionsHtml:`
|
|
149
|
+
<span id="ed-save-status" class="save-status" aria-live="polite"></span>
|
|
150
|
+
<button type="button" id="toggle-focus" class="btn-ghost" aria-pressed="${v}">
|
|
151
|
+
${v?"Show info":"Hide info"}
|
|
152
|
+
</button>
|
|
153
|
+
<div class="publish-split">
|
|
154
|
+
<button type="button" id="ed-publish" class="btn-primary publish-main">Publish</button>
|
|
155
|
+
<button type="button" id="ed-publish-menu-btn" class="btn-primary publish-menu-trigger" aria-haspopup="true" aria-expanded="false">▾</button>
|
|
156
|
+
<div id="ed-publish-menu" class="publish-menu hidden" role="menu">
|
|
157
|
+
<button type="button" id="ed-publish-review" role="menuitem">Review changes</button>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
<button type="button" id="ed-view-md" class="btn-ghost">View markdown</button>
|
|
161
|
+
<button type="button" id="ed-close" class="btn-ghost">Close</button>
|
|
162
|
+
<button type="button" id="ed-discard" class="btn-ghost">Discard draft</button>
|
|
163
|
+
`,mainHtml:'<div id="ed-visual-canvas"></div>',railHtml:Jt({forkedFrom:n.forked_from}),focusMode:v});xe(e,v);const P=e.querySelector("#ed-title"),E=e.querySelector("#ed-save-status"),T=S.bodySlot.querySelector("#ed-visual-canvas"),w=document.createElement("div");w.id="publish-modal",w.className="modal hidden",w.innerHTML=`
|
|
164
|
+
<div class="modal-card modal-card-wide">
|
|
165
|
+
<p>Publish to git as markdown?</p>
|
|
166
|
+
<code id="publish-target"></code>
|
|
167
|
+
<pre id="publish-diff" class="diff-preview"></pre>
|
|
168
|
+
<div id="publish-related" class="publish-related hidden">
|
|
169
|
+
<p id="publish-related-prompt"></p>
|
|
170
|
+
<ul id="publish-related-list" class="publish-related-list"></ul>
|
|
171
|
+
<div class="editor-actions">
|
|
172
|
+
<button type="button" id="publish-related-apply" class="btn-primary">Add to related</button>
|
|
173
|
+
<button type="button" id="publish-related-skip" class="btn-ghost">Skip</button>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
<div class="editor-actions">
|
|
177
|
+
<button type="button" id="publish-confirm" class="btn-primary">Confirm</button>
|
|
178
|
+
<button type="button" id="publish-cancel" class="btn-ghost">Cancel</button>
|
|
179
|
+
</div>
|
|
180
|
+
</div>
|
|
181
|
+
`,e.appendChild(w);const L=document.createElement("div");L.id="view-md-modal",L.className="modal hidden",L.innerHTML=`
|
|
182
|
+
<div class="modal-card modal-card-wide">
|
|
183
|
+
<h3 class="modal-title">Markdown source</h3>
|
|
184
|
+
<pre id="view-md-content" class="md-source"></pre>
|
|
185
|
+
<div class="editor-actions">
|
|
186
|
+
<button type="button" id="view-md-copy" class="btn-primary">Copy</button>
|
|
187
|
+
<button type="button" id="view-md-close" class="btn-ghost">Close</button>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
`,e.appendChild(L);const $=e.querySelector("#ed-publish-menu");P.value=n.title;const p=Vt(S.railSlot,{slug:n.slug,type:n.type,status:n.status,tags:n.tags,related:n.related},c,()=>l());$e(async()=>{const{mountVisualEditor:u}=await import("./visual-editor-D1uYYGOW.js");return{mountVisualEditor:u}},__vite__mapDeps([3,2,4,5])).then(({mountVisualEditor:u})=>{a=u(T,{initialMarkdown:n.body,docCandidates:c,onBodyChange:()=>l(),onError:t.onError})});let i=[];function g(){return(a==null?void 0:a.getMarkdownBody())??o}function d(){const u=p.getState();return{title:P.value,slug:u.slug,type:u.type,status:u.status,tags:u.tags,related:u.related,body:g()}}function h(u){E.textContent=u}async function r(){h("Saving…");const u=d();o=u.body,await Ve(n.id,u),h("Saved")}function l(){N&&clearTimeout(N),N=setTimeout(()=>{N=null,I=r().catch(u=>{h(""),t.onError(u instanceof Error?u.message:"Autosave failed")})},800)}async function f(){N&&(clearTimeout(N),N=null,I=r().catch(u=>{throw h(""),t.onError(u instanceof Error?u.message:"Autosave failed"),u})),I&&(await I,I=null)}P.addEventListener("input",()=>l()),P.addEventListener("change",()=>l());function y(){const u=e.querySelector("#publish-related"),A=e.querySelector("#publish-related-prompt"),U=e.querySelector("#publish-related-list"),R=p.getState();if(i=Ot(g(),R.related,c),i.length===0){u.classList.add("hidden");return}A.textContent=`Add ${i.length} body link(s) to related?`,U.innerHTML=i.map(K=>{var ue;const Ue=((ue=c.find(_e=>_e.slug===K))==null?void 0:ue.title)??K;return`<li><code>${k(K)}</code> — ${k(Ue)}</li>`}).join(""),u.classList.remove("hidden")}function q(){var A;if(i.length===0)return;const u=p.getState();p.setRelated([...new Set([...u.related,...i])]),i=[],(A=e.querySelector("#publish-related"))==null||A.classList.add("hidden")}(Z=e.querySelector("#publish-related-apply"))==null||Z.addEventListener("click",()=>{q()}),(ee=e.querySelector("#publish-related-skip"))==null||ee.addEventListener("click",()=>{var u;i=[],(u=e.querySelector("#publish-related"))==null||u.classList.add("hidden")});let b=null;function m(){w.classList.add("hidden"),b&&(document.removeEventListener("keydown",b),b=null)}function C(){w.classList.remove("hidden"),b||(b=u=>{u.key==="Escape"&&m()},document.addEventListener("keydown",b))}function M(){L.classList.add("hidden")}function He(){const u=L.querySelector("#view-md-content");u.textContent=g(),L.classList.remove("hidden")}async function Ne(){await f(),C(),y();const u=e.querySelector("#publish-target"),A=e.querySelector("#publish-diff"),U=p.getState();u.textContent=`docs/.../${U.slug}.md`,A.textContent="Loading diff…";try{const R=await Xe(n.id);R.targetPath&&(u.textContent=R.targetPath),A.textContent=R.diff}catch(R){A.textContent=R instanceof Error?R.message:"Diff unavailable"}}async function We(){const u=e.querySelector("#ed-publish");u.setAttribute("aria-busy","true"),u.disabled=!0;try{await f();const{result:A}=await z(n.id);t.onPublished(A.path)}finally{u.removeAttribute("aria-busy"),u.disabled=!1}}(te=e.querySelector("#ed-publish"))==null||te.addEventListener("click",()=>{We().catch(u=>{t.onError(u instanceof Error?u.message:"Publish failed")})}),(ne=e.querySelector("#ed-publish-review"))==null||ne.addEventListener("click",()=>{$.classList.add("hidden"),Ne().catch(u=>{t.onError(u instanceof Error?u.message:"Failed to prepare publish")})}),(se=e.querySelector("#ed-publish-menu-btn"))==null||se.addEventListener("click",()=>{var A;const u=$.classList.toggle("hidden");(A=e.querySelector("#ed-publish-menu-btn"))==null||A.setAttribute("aria-expanded",u?"false":"true")}),document.addEventListener("click",u=>{var U,R;const A=u.target;!$.contains(A)&&!((U=e.querySelector("#ed-publish-menu-btn"))!=null&&U.contains(A))&&($.classList.add("hidden"),(R=e.querySelector("#ed-publish-menu-btn"))==null||R.setAttribute("aria-expanded","false"))}),(re=e.querySelector("#ed-view-md"))==null||re.addEventListener("click",()=>{He()}),(ie=L.querySelector("#view-md-close"))==null||ie.addEventListener("click",()=>{M()}),L.addEventListener("click",u=>{u.target===L&&M()}),(ae=L.querySelector("#view-md-copy"))==null||ae.addEventListener("click",()=>{navigator.clipboard.writeText(g()).catch(u=>{t.onError(u instanceof Error?u.message:"Copy failed")})}),(oe=e.querySelector("#publish-cancel"))==null||oe.addEventListener("click",()=>{m()}),w.addEventListener("click",u=>{u.target===w&&m()}),(le=e.querySelector("#publish-confirm"))==null||le.addEventListener("click",()=>{(async()=>{await f();const{result:u}=await z(n.id);m(),t.onPublished(u.path)})().catch(u=>{t.onError(u instanceof Error?u.message:"Publish failed")})}),(de=e.querySelector("#ed-close"))==null||de.addEventListener("click",()=>{a==null||a.destroy(),t.onClosed()}),(ce=e.querySelector("#ed-discard"))==null||ce.addEventListener("click",()=>{confirm("Discard this draft?")&&(a==null||a.destroy(),Je(n.id).then(()=>t.onDeleted()).catch(u=>{t.onError(u instanceof Error?u.message:"Delete failed")}))})}function ye(e){const n=[];function t(s){s.indexPageSlug&&n.push(s.indexPageSlug);for(const c of s.children)c.kind==="page"?n.push(c.slug):t(c)}return t(e),n}function Yt(e){if(!(e instanceof HTMLElement))return!1;const n=e.tagName;return n==="INPUT"||n==="TEXTAREA"||n==="SELECT"?!0:e.isContentEditable}function Qt(e){const n=t=>{if(t.metaKey||t.ctrlKey||t.altKey)return;const s=Yt(t.target);if(t.key==="/"&&!s){t.preventDefault(),e.onFocusSearch();return}if(!s)switch(t.key){case"j":t.preventDefault(),e.onNext();break;case"k":t.preventDefault(),e.onPrev();break;case"e":e.onEdit();break}};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)}const De="repomind-tree-expanded";function Zt(){try{const e=localStorage.getItem(De);return e?new Set(JSON.parse(e)):new Set([""])}catch{return new Set([""])}}function G(e){localStorage.setItem(De,JSON.stringify([...e]))}function en(e){return e.emoji?e.emoji:"📁"}function tn(e,n){if(n==="json")return"{ }";if(n==="yaml")return"Y";const t=ut(e);return t.length===1?t:"📄"}function nn(){document.querySelectorAll(".tree-context-menu").forEach(e=>e.remove())}function Re(e){const n=[e.relativePath];for(const t of e.children??[])t.kind==="folder"&&n.push(...Re(t));return n}function be(){const e=window.prompt("Page name (without .md):");return e!=null&&e.trim()?e.trim():null}function Se(e,n,t,s){nt(e,n,void 0,t).then(({draft:c})=>{var a,o;(a=s.onTreeChanged)==null||a.call(s),(o=s.onSelectDraft)==null||o.call(s,c)}).catch(c=>{var a;(a=s.onError)==null||a.call(s,c instanceof Error?c.message:"Create page failed")})}function sn(e,n,t){var $,p,i,g,d,h;nn();const{kind:s,parentPath:c,folderPath:a,page:o,tree:v,templates:S}=n,P=s==="page"&&o?Re(v).filter(r=>{const l=o.relativePath.includes("/")?o.relativePath.slice(0,o.relativePath.lastIndexOf("/")):"";return r!==l}):[],E=document.createElement("div");E.className="tree-create-menu tree-context-menu",E.innerHTML=`
|
|
191
|
+
<div class="tree-menu-label">Create</div>
|
|
192
|
+
<button type="button" data-action="page">New page</button>
|
|
193
|
+
${S.map(r=>`<button type="button" data-action="template" data-template="${we(r.id)}">From template: ${F(r.label)}</button>`).join("")}
|
|
194
|
+
<button type="button" data-action="folder">New folder</button>
|
|
195
|
+
${s==="folder"&&a?'<button type="button" data-action="emoji">Set emoji</button>':""}
|
|
196
|
+
${s==="page"&&o?`
|
|
197
|
+
<div class="tree-menu-label">Page</div>
|
|
198
|
+
<button type="button" data-action="rename">Rename…</button>
|
|
199
|
+
${P.length>0?'<div class="tree-menu-label">Move to</div>':""}
|
|
200
|
+
${P.map(r=>`<button type="button" data-action="move" data-folder="${we(r)}">${F(r||"(root)")}</button>`).join("")}
|
|
201
|
+
<button type="button" data-action="delete-page" class="tree-menu-danger">Delete page</button>
|
|
202
|
+
`:""}
|
|
203
|
+
${s==="folder"&&a?'<button type="button" data-action="delete-folder" class="tree-menu-danger">Delete folder</button>':""}
|
|
204
|
+
`;const T=e.getBoundingClientRect();E.style.top=`${T.bottom+4}px`,E.style.left=`${Math.max(8,T.left-160)}px`,document.body.appendChild(E);const w=()=>E.remove(),L=r=>{E.contains(r.target)||(w(),document.removeEventListener("click",L))};setTimeout(()=>document.addEventListener("click",L),0),($=E.querySelector('[data-action="page"]'))==null||$.addEventListener("click",()=>{w();const r=be();r&&Se(c,r,void 0,t)}),E.querySelectorAll('[data-action="template"]').forEach(r=>{r.addEventListener("click",()=>{w();const l=be();l&&Se(c,l,r.dataset.template,t)})}),(p=E.querySelector('[data-action="folder"]'))==null||p.addEventListener("click",()=>{w();const r=window.prompt("Folder name:");r!=null&&r.trim()&&Qe(c,r.trim()).then(()=>{var l;return(l=t.onTreeChanged)==null?void 0:l.call(t)}).catch(l=>{var f;(f=t.onError)==null||f.call(t,l instanceof Error?l.message:"Create folder failed")})}),(i=E.querySelector('[data-action="emoji"]'))==null||i.addEventListener("click",()=>{w();const r=window.prompt("Emoji for this folder:");r!==null&&Ze(a,r).then(()=>{var l;return(l=t.onTreeChanged)==null?void 0:l.call(t)}).catch(l=>{var f;(f=t.onError)==null||f.call(t,l instanceof Error?l.message:"Set emoji failed")})}),(g=E.querySelector('[data-action="rename"]'))==null||g.addEventListener("click",()=>{var f;if(w(),!o)return;const r=((f=o.relativePath.split("/").pop())==null?void 0:f.replace(/\.md$/,""))??o.name,l=window.prompt("New page name (without .md):",r);!(l!=null&&l.trim())||l.trim()===r||et(o.relativePath,l.trim()).then(({result:y})=>{var q,b,m;(q=t.onTreeChanged)==null||q.call(t),y.cascadeUpdated.length>0?(b=t.onNotify)==null||b.call(t,`Renamed to ${y.slug}; updated links in ${y.cascadeUpdated.length} file(s).`):y.slugChanged&&y.inboundWarnings.length>0&&((m=t.onError)==null||m.call(t,`Renamed to ${y.slug}; ${y.inboundWarnings.length} page(s) may still reference the old slug.`)),t.onSelectSlug(y.slug)}).catch(y=>{var q;(q=t.onError)==null||q.call(t,y instanceof Error?y.message:"Rename failed")})}),E.querySelectorAll('[data-action="move"]').forEach(r=>{r.addEventListener("click",()=>{if(w(),!o)return;const l=r.dataset.folder??"";tt(o.relativePath,l).then(({result:f})=>{var y,q,b;(y=t.onTreeChanged)==null||y.call(t),f.cascadeUpdated.length>0?(q=t.onNotify)==null||q.call(t,`Moved to ${f.relativePath}; updated links in ${f.cascadeUpdated.length} file(s).`):f.slugChanged&&f.inboundWarnings.length>0&&((b=t.onError)==null||b.call(t,`Moved; slug is now ${f.slug}. ${f.inboundWarnings.length} page(s) still reference the old slug.`)),t.onSelectSlug(f.slug)}).catch(f=>{var y;(y=t.onError)==null||y.call(t,f instanceof Error?f.message:"Move failed")})})}),(d=E.querySelector('[data-action="delete-page"]'))==null||d.addEventListener("click",()=>{w(),o&&window.confirm(`Delete page "${o.title}"?`)&&pe(o.relativePath,"page").then(({result:r})=>{var l,f,y,q;(l=t.onFsDeleted)==null||l.call(t,[r.slug]),(f=t.onTreeChanged)==null||f.call(t),r.cascadeUpdated.length>0?(y=t.onNotify)==null||y.call(t,`Deleted ${r.slug}; cleaned links in ${r.cascadeUpdated.length} file(s).`):r.inboundWarnings.length>0&&((q=t.onError)==null||q.call(t,`${r.inboundWarnings.length} page(s) still reference deleted slug "${r.slug}".`))}).catch(r=>{var l;(l=t.onError)==null||l.call(t,r instanceof Error?r.message:"Delete failed")})}),(h=E.querySelector('[data-action="delete-folder"]'))==null||h.addEventListener("click",()=>{w(),a&&window.confirm(`Delete folder "${a}" and all pages inside?`)&&pe(a,"folder").then(({result:r})=>{var l,f,y,q;(l=t.onFsDeleted)==null||l.call(t,r.deletedSlugs),(f=t.onTreeChanged)==null||f.call(t),r.cascadeUpdated.length>0?(y=t.onNotify)==null||y.call(t,`Deleted folder; cleaned links in ${r.cascadeUpdated.length} file(s).`):r.inboundWarnings.length>0&&((q=t.onError)==null||q.call(t,`${r.inboundWarnings.length} page(s) still reference deleted page(s).`))}).catch(r=>{var l;(l=t.onError)==null||l.call(t,r instanceof Error?r.message:"Delete folder failed")})})}function rn(e,n,t,s){var p;e.innerHTML=`
|
|
205
|
+
<nav id="docs-tree" class="docs-tree" aria-label="Documentation tree"></nav>
|
|
206
|
+
<section class="catalog-section catalog-drafts">
|
|
207
|
+
<button type="button" class="catalog-header" data-catalog="__drafts__" aria-expanded="true">
|
|
208
|
+
<span class="catalog-chevron" aria-hidden="true">▾</span>
|
|
209
|
+
<span class="catalog-icon catalog-icon--draft" aria-hidden="true">✎</span>
|
|
210
|
+
<span class="catalog-label">Drafts</span>
|
|
211
|
+
<span class="catalog-count">${t.length}</span>
|
|
212
|
+
</button>
|
|
213
|
+
<ul id="draft-list" class="catalog-pages"></ul>
|
|
214
|
+
</section>
|
|
215
|
+
`;const c=e.querySelector("#docs-tree"),a=e.querySelector("#draft-list"),o=Zt();let v=null,S=null,P=null;async function E(i,g){var d;try{v||(v=(await Ye()).templates),sn(i,{...g,templates:v},s)}catch(h){(d=s.onError)==null||d.call(s,h instanceof Error?h.message:"Failed to open menu")}}function T(i,g){var r,l;const d=document.createElement("div");d.className="tree-row",d.style.paddingLeft=`${g*12+8}px`,i.slug===S&&d.classList.add("active"),d.innerHTML=`
|
|
216
|
+
<span class="tree-spacer" aria-hidden="true"></span>
|
|
217
|
+
<button type="button" class="tree-label">
|
|
218
|
+
<span class="tree-icon tree-icon--page">${tn(i.type,i.contentKind)}</span>
|
|
219
|
+
<span class="tree-title">${F(i.title)}</span>
|
|
220
|
+
</button>
|
|
221
|
+
<button type="button" class="tree-menu" title="Actions">⋯</button>
|
|
222
|
+
`;const h=i.relativePath.includes("/")?i.relativePath.slice(0,i.relativePath.lastIndexOf("/")):"";return(r=d.querySelector(".tree-menu"))==null||r.addEventListener("click",f=>{f.stopPropagation(),E(f.currentTarget,{kind:"page",parentPath:h,folderPath:h,page:i,tree:n})}),(l=d.querySelector(".tree-label"))==null||l.addEventListener("click",()=>{S=i.slug,P=null,L(),$(),s.onSelectSlug(i.slug)}),d}function w(i,g){var l,f,y;const d=document.createElement("div");d.className="tree-folder";const h=o.has(i.relativePath),r=document.createElement("div");if(r.className="tree-row",r.style.paddingLeft=`${g*12+8}px`,r.innerHTML=`
|
|
223
|
+
<button type="button" class="tree-toggle" aria-expanded="${h}">${h?"▾":"▸"}</button>
|
|
224
|
+
<button type="button" class="tree-label">
|
|
225
|
+
<span class="tree-icon tree-icon--folder">${en(i)}</span>
|
|
226
|
+
<span class="tree-title">${F(i.name)}</span>
|
|
227
|
+
</button>
|
|
228
|
+
<button type="button" class="tree-menu" title="Actions">⋯</button>
|
|
229
|
+
`,(l=r.querySelector(".tree-toggle"))==null||l.addEventListener("click",q=>{q.stopPropagation(),o.has(i.relativePath)?o.delete(i.relativePath):o.add(i.relativePath),G(o),L()}),(f=r.querySelector(".tree-label"))==null||f.addEventListener("click",()=>{if(i.indexPageSlug){S=i.indexPageSlug,P=null,L(),$(),s.onSelectSlug(i.indexPageSlug);return}o.has(i.relativePath)?o.delete(i.relativePath):o.add(i.relativePath),G(o),L()}),(y=r.querySelector(".tree-menu"))==null||y.addEventListener("click",q=>{q.stopPropagation(),E(q.currentTarget,{kind:"folder",parentPath:i.relativePath,folderPath:i.relativePath,tree:n})}),d.appendChild(r),h){const q=document.createElement("div");q.className="tree-children";for(const b of i.children??[])b.kind==="folder"?q.appendChild(w(b,g+1)):q.appendChild(T(b,g+1));d.appendChild(q)}return d}function L(){c.innerHTML="",c.appendChild(w(n,0))}function $(){if(a.innerHTML="",t.length===0){a.innerHTML='<li class="placeholder page-item">No drafts</li>';return}for(const i of t){const g=document.createElement("li");g.className="page-item",i.id===P&&g.classList.add("active"),g.innerHTML=`<span class="page-title">${F(i.title||i.slug)}</span><span class="status-chip status-draft">draft</span>`,g.addEventListener("click",()=>{var d;P=i.id,S=null,L(),$(),(d=s.onSelectDraft)==null||d.call(s,i)}),a.appendChild(g)}}L(),$(),(p=e.querySelector('[data-catalog="__drafts__"]'))==null||p.addEventListener("click",()=>{const i=e.querySelector("#draft-list"),g=e.querySelector('[data-catalog="__drafts__"]'),d=(i==null?void 0:i.classList.toggle("hidden"))===!1;g==null||g.setAttribute("aria-expanded",String(d));const h=g==null?void 0:g.querySelector(".catalog-chevron");h&&(h.textContent=d?"▾":"▸")}),e.setActiveSlug=i=>{S=i,P=null,o.add(""),G(o),L(),$()},e.setActiveDraft=i=>{P=i,S=null,L(),$()},e.refreshDrafts=i=>{t.length=0,t.push(...i),$();const g=e.querySelector(".catalog-drafts .catalog-count");g&&(g.textContent=String(t.length))},e.refreshTree=(i,g)=>{n.children=i.children??[],n.emoji=i.emoji,n.indexPageSlug=i.indexPageSlug,n.name=i.name,t.length=0,t.push(...g??[]),L(),$()}}function F(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function we(e){return F(e)}function an(e){const n=new EventSource("/api/events");return n.onmessage=()=>{e()},()=>{n.close()}}At();st();function on(e){return new Map(e.map(n=>[n.relativePath,n.slug]))}function ln(e,n){var t;return(t=e.find(s=>s.slug===n))==null?void 0:t.relativePath}function x(e,n=!1){const t=document.querySelector("#banner");t&&(t.textContent=e,t.classList.toggle("error",n),t.classList.remove("hidden"),setTimeout(()=>t.classList.add("hidden"),5e3))}async function dn(e){var t;const{drafts:n}=await O();return(t=e.refreshDrafts)==null||t.call(e,n),n}async function cn(){var h;rt(document.querySelector("#theme-toggle"));const e=document.querySelector("#sidebar"),n=document.querySelector("#workspace"),t=document.querySelector("#health-toggle"),s=document.querySelector("#stats"),c=document.querySelector("#global-search"),a=document.querySelector("#search-dropdown");let o=[],v=null,S=[],P="workspace",E=null,T=null;async function w(r){var y;const[{tree:l},{drafts:f}]=await Promise.all([fe(),O()]);return(y=r.refreshTree)==null||y.call(r,l,f),S=ye(l),l}function L(r){if(P=r,t.setAttribute("aria-pressed",String(r==="dashboard")),r==="dashboard"){E=pt(n,{onOpenDraft:f=>{L("workspace"),i(f)},onPublished:f=>{(async()=>(await w(e),await $(),x(`Published: ${f}`)))()},onNotify:(f,y)=>x(f,y)}).refresh;return}E=null,H(n,null)}t.addEventListener("click",()=>{L(P==="dashboard"?"workspace":"dashboard")}),Qt({onNext:()=>{if(P!=="workspace"||!v)return;const r=S.indexOf(v);r>=0&&r<S.length-1&&d(S[r+1])},onPrev:()=>{if(P!=="workspace"||!v)return;const r=S.indexOf(v);r>0&&d(S[r-1])},onFocusSearch:()=>{c.focus(),c.select()},onEdit:()=>{P==="workspace"&&v&&g(v)}});async function $(){const r=await ot(),f=await(await fetch("/api/stats")).json(),{drafts:y}=await O(),q=f.brokenRelatedCount>0?` · ${f.brokenRelatedCount} broken links`:"";s.textContent=`v${r.version} · ${r.docCount} pages · ${y.length} drafts${q}`}function p(r){if(r.length===0){a.innerHTML='<p class="search-empty">No matches</p>',a.classList.remove("hidden");return}const l=document.createElement("ul");l.className="search-results";for(const f of r){const y=o.find(b=>b.slug===f.slug),q=document.createElement("li");q.innerHTML=`
|
|
230
|
+
<div class="search-result-title">${f.title}</div>
|
|
231
|
+
<div class="search-result-meta">${J((y==null?void 0:y.type)??"")} · ${f.snippet}</div>
|
|
232
|
+
`,q.addEventListener("click",()=>{a.classList.add("hidden"),c.value="",d(f.slug)}),l.appendChild(q)}a.innerHTML="",a.appendChild(l),a.classList.remove("hidden")}c.addEventListener("input",()=>{const r=c.value.trim();if(T&&clearTimeout(T),!r){a.classList.add("hidden"),a.innerHTML="";return}T=setTimeout(()=>{it(r).then(({results:l})=>p(l)).catch(l=>x(l instanceof Error?l.message:"Search failed",!0))},300)}),document.addEventListener("click",r=>{!a.contains(r.target)&&r.target!==c&&a.classList.add("hidden")});function i(r){var l;L("workspace"),(l=e.setActiveDraft)==null||l.call(e,r.id),Xt(n,r,{onPublished:f=>{(async()=>(o=(await j()).docs,await w(e),await $(),E==null||E(),x(`Published: ${f}`),await d(r.slug)))()},onClosed:()=>{d(r.forked_from??r.slug).catch(()=>{H(n,null)})},onDeleted:()=>{(async()=>(await w(e),H(n,null)))()},onError:f=>x(f,!0)},o)}async function g(r){try{const{draft:l}=await lt(r);await dn(e),i(l)}catch(l){x(l instanceof Error?l.message:"Edit failed",!0)}}async function d(r,l={}){var q;const f=l.updateUrl??!0,y=l.urlMode??"push";P==="dashboard"&&L("workspace"),v=r,(q=e.setActiveSlug)==null||q.call(e,r);try{const b=await at(r),m=ln(o,r);H(n,b,{onEdit:C=>{g(C)},docRelativePath:m,slugByRelative:on(o),onCopyLink:()=>x("Link copied")}),f&&Dt(r,y)}catch(b){x(b instanceof Error?b.message:"Failed to load doc",!0)}}n.addEventListener("navigate-slug",(r=>{d(r.detail.slug)}));try{await $();const[r,{tree:l},{drafts:f}]=await Promise.all([j(),fe(),O()]);o=r.docs,S=ye(l),rn(e,l,f,{onSelectSlug:b=>{d(b)},onSelectDraft:b=>i(b),onTreeChanged:()=>{(async()=>(o=(await j()).docs,await w(e),await $()))()},onFsDeleted:b=>{(async()=>(o=(await j()).docs,v&&b.includes(v)&&(v=null,H(n,null)),await w(e),await $()))()},onError:b=>x(b,!0),onNotify:b=>x(b)}),an(()=>{(async()=>{try{o=(await j()).docs,await w(e),await $(),v&&!o.some(m=>m.slug===v)&&(v=null,H(n,null))}catch{}})()}),Rt(b=>{if(!b){v=null,H(n,null);return}o.some(m=>m.slug===b)&&d(b,{updateUrl:!1})}),H(n,null);const y=Y(),q=Mt();if(q){const b=f.find(m=>m.id===q);b?i(b):x(`Unknown draft: ${q}`,!0)}else if(y)o.some(b=>b.slug===y)?await d(y,{updateUrl:!1}):x(`Unknown page: ${y}`,!0);else{const b=kt(),m=b?(h=o.find(C=>C.relativePath===b))==null?void 0:h.slug:void 0;b&&m?await d(m,{updateUrl:!1}):b?x(`Unknown path: ${b}`,!0):l.indexPageSlug?await d(l.indexPageSlug,{urlMode:"replace"}):o.length>0&&o[0]&&await d(o[0].slug,{urlMode:"replace"})}}catch(r){x(r instanceof Error?r.message:"Failed to load workspace",!0)}}cn();export{$e as _,Kt as a,Lt as e,fn as f,Pe as p};
|