archbyte 0.2.6 → 0.2.8
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
CHANGED
|
@@ -14,7 +14,7 @@ archbyte login
|
|
|
14
14
|
# Configure your AI provider (BYOK)
|
|
15
15
|
archbyte init
|
|
16
16
|
|
|
17
|
-
#
|
|
17
|
+
# Using Claude Code / Codex? Install the MCP server too:
|
|
18
18
|
archbyte mcp install
|
|
19
19
|
```
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ Your API keys stay on your machine. ArchByte never stores or transmits your prov
|
|
|
22
22
|
|
|
23
23
|
### Setup with Claude Code
|
|
24
24
|
|
|
25
|
-
**Option A: MCP
|
|
25
|
+
**Option A: MCP** — use ArchByte tools directly in Claude Code. You still need to sign in and configure a provider first:
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
28
|
archbyte mcp install
|
package/bin/archbyte.js
CHANGED
package/dist/cli/setup.js
CHANGED
|
@@ -132,26 +132,7 @@ export async function handleSetup() {
|
|
|
132
132
|
if (hasClaude || hasCodex) {
|
|
133
133
|
const tools = [hasClaude && "Claude Code", hasCodex && "Codex CLI"].filter(Boolean).join(" and ");
|
|
134
134
|
console.log(chalk.cyan(` Detected ${tools} on this machine.`));
|
|
135
|
-
console.log(chalk.white(`
|
|
136
|
-
console.log(chalk.white(` Your AI tool already provides the model, so you skip the BYOK step.`));
|
|
137
|
-
console.log();
|
|
138
|
-
console.log(chalk.white(` Run: `) + chalk.bold.cyan(`archbyte mcp install`));
|
|
139
|
-
console.log();
|
|
140
|
-
const continueIdx = await select("Continue with BYOK setup anyway?", [
|
|
141
|
-
`Skip ${chalk.gray("(use MCP instead, recommended)")}`,
|
|
142
|
-
`Continue ${chalk.gray("(set up your own API key)")}`,
|
|
143
|
-
]);
|
|
144
|
-
if (continueIdx === 0) {
|
|
145
|
-
console.log();
|
|
146
|
-
console.log(chalk.gray(" Run `archbyte mcp install` to configure MCP for your AI tool."));
|
|
147
|
-
console.log();
|
|
148
|
-
console.log(chalk.gray(" Then open your AI tool and try:"));
|
|
149
|
-
console.log(chalk.cyan(' "Analyze the architecture of this project"'));
|
|
150
|
-
console.log(chalk.cyan(' "Export the architecture as a Mermaid diagram"'));
|
|
151
|
-
console.log(chalk.cyan(' "Show me the architecture stats"'));
|
|
152
|
-
console.log();
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
135
|
+
console.log(chalk.white(` After setup, run `) + chalk.bold.cyan(`archbyte mcp install`) + chalk.white(` to use ArchByte from your AI tool.`));
|
|
155
136
|
console.log();
|
|
156
137
|
}
|
|
157
138
|
const config = loadConfig();
|
|
@@ -319,6 +300,10 @@ export async function handleSetup() {
|
|
|
319
300
|
console.log();
|
|
320
301
|
console.log(chalk.bold(" Next: ") + chalk.cyan("archbyte run") + chalk.bold(" to analyze your codebase."));
|
|
321
302
|
console.log(chalk.gray(" Run from your project root, or use ") + chalk.cyan("archbyte run -d /path/to/project"));
|
|
303
|
+
if (hasClaude || hasCodex) {
|
|
304
|
+
console.log();
|
|
305
|
+
console.log(chalk.bold(" MCP: ") + chalk.cyan("archbyte mcp install") + chalk.bold(" to use ArchByte from your AI tool."));
|
|
306
|
+
}
|
|
322
307
|
console.log();
|
|
323
308
|
}
|
|
324
309
|
function writeArchbyteReadme(archbyteDir) {
|
package/package.json
CHANGED
|
@@ -67,4 +67,4 @@ Error generating stack: `+p.message+`
|
|
|
67
67
|
(API)`,layer:"application",x:150,y:370,width:200,height:100,color:"#ffe8cc"},{id:"database",type:"database",label:"Database",layer:"data",x:150,y:570,width:200,height:80,color:"#b2f2bb"}],edges:[{id:"e1",source:"frontend",target:"backend",color:"#1971c2"},{id:"e2",source:"backend",target:"database",color:"#2f9e44"}],flows:[],lastUpdated:new Date().toISOString(),version:1};Zr($)},Zr=$=>{h($),g($.lastUpdated),$.gitInfo&&Jt($.gitInfo),$.environments&&Ln($.environments)};b.useEffect(()=>{if(!c)return;const $=c.nodes.filter(se=>ti(se.environments,vt)&&!oe.has(se.id)&&!he.has(se.layer)),W=new Set($.map(se=>se.id)),te=c.edges.filter(se=>ti(se.environments,vt)&&W.has(se.source)&&W.has(se.target));r(GN($,te,c.layoutSaved)),a(Np(te,qn))},[c,vt,oe,he,qn]),b.useEffect(()=>{xn()},[xn]),b.useEffect(()=>{if(!R||!P)return;const $=setInterval(()=>{G(W=>{const te=W+1;if(te>=P.steps.length)return M(new Set([P.steps[0].edge])),0;const se=new Set;for(let ae=0;ae<=te;ae++)se.add(P.steps[ae].edge);return M(se),te})},YN);return()=>clearInterval($)},[R,P]),b.useEffect(()=>{if(!c)return;const $=c.nodes.filter(ge=>ti(ge.environments,vt)),W=new Set($.map(ge=>ge.id)),te=c.edges.filter(ge=>ti(ge.environments,vt)&&W.has(ge.source)&&W.has(ge.target)),se=new Map;P&&P.steps.forEach((ge,je)=>{se.has(ge.edge)||se.set(ge.edge,je+1)});const ae=te.map(ge=>{const je=B.has(ge.id),Se=P==null?void 0:P.steps.some(Be=>Be.edge===ge.id),Pe=se.get(ge.id);return{id:ge.id,source:ge.source,target:ge.target,label:je&&Pe?`${Pe}`:void 0,labelStyle:je&&Pe?{fill:Co,fontWeight:700,fontSize:12,fontFamily:"'JetBrains Mono', monospace",transform:"translateY(-22px)"}:void 0,labelBgStyle:je&&Pe?{fill:(P==null?void 0:P.color)||"#3b82f6",fillOpacity:.95,rx:10,ry:10,transform:"translateY(-22px)"}:void 0,labelBgPadding:[6,4],style:{stroke:je?(P==null?void 0:P.color)||ge.color:ge.color||qn,strokeWidth:je?6:3,opacity:P?Se?1:.15:1,filter:je?"brightness(0.85) saturate(1.4)":void 0},animated:je,type:"smoothstep"}});a(ae)},[B,P,c,vt,qn,Co]);const gr=$=>{K($),G(0),M(new Set([$.steps[0].edge])),z(!0),ie(!0)},$n=()=>{if(z(!1),K(null),G(-1),M(new Set),ie(!1),c){const $=c.nodes.filter(se=>ti(se.environments,vt)),W=new Set($.map(se=>se.id)),te=c.edges.filter(se=>ti(se.environments,vt)&&W.has(se.source)&&W.has(se.target));a(Np(te,qn))}},yr=()=>{z(!1)},gi=()=>{P&&z(!0)},Zn=b.useRef(oe);b.useEffect(()=>{Zn.current=oe},[oe]);const We=b.useCallback(()=>{nn($=>{const W={nodes:[...tn.current],edges:[...s],hiddenNodeIds:new Set(Zn.current)},te=[...$,W];return te.length>Xr&&te.shift(),te}),rn([])},[s]),Rt=b.useCallback($=>{en($),setTimeout(()=>en(null),3e3)},[]),yi=b.useCallback($=>{We(),de(W=>new Set([...W,$])),pe(null)},[We]),bt=b.useCallback($=>{de(W=>{const te=new Set(W);return te.delete($),te})},[]),vi=b.useCallback(()=>{de(new Set)},[]);b.useCallback($=>{me(W=>{const te=new Set(W);return te.has($)?te.delete($):te.add($),te})},[]);const xi=b.useCallback(($,W)=>{pe(W.id)},[]),wi=b.useCallback(()=>{pe(null)},[]);b.useEffect(()=>{tn.current=t},[t]);const vr=b.useCallback($=>{o($);const W=$.some(se=>se.type==="position"&&se.dragging===!1&&se.position),te=$.some(se=>se.type==="dimensions"&&se.dimensions&&se.resizing===!1);(W||te)&&We(),$.forEach(se=>{if(se.type==="position"&&se.dragging===!1&&se.position){const ae=tn.current.find(ge=>ge.id===se.id);ae&&Vt(ge=>{var Pe,Be,Ye,ot;const je=new Map(ge),Se=je.get(se.id);return je.set(se.id,{id:se.id,x:se.position.x,y:se.position.y,width:(Se==null?void 0:Se.width)??((Pe=ae.style)==null?void 0:Pe.width)??((Be=ae.data)==null?void 0:Be.width)??100,height:(Se==null?void 0:Se.height)??((Ye=ae.style)==null?void 0:Ye.height)??((ot=ae.data)==null?void 0:ot.height)??60}),je})}if(se.type==="dimensions"&&se.dimensions&&se.resizing===!1){const ae=tn.current.find(ge=>ge.id===se.id);ae&&Vt(ge=>{const je=new Map(ge),Se=je.get(se.id);return je.set(se.id,{id:se.id,x:(Se==null?void 0:Se.x)??ae.position.x,y:(Se==null?void 0:Se.y)??ae.position.y,width:se.dimensions.width,height:se.dimensions.height}),je})}})},[o,We]),On=b.useCallback(async()=>{if(mn.size!==0){pr(!0);try{const $=Array.from(mn.values()),W=await fetch("/api/update-positions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:$})});if(W.ok)Vt(new Map),console.log("Changes saved successfully");else{const te=await W.json();console.error("Failed to save changes:",te)}}catch($){console.error("Error saving changes:",$)}finally{pr(!1)}}},[mn]),sn=b.useCallback(()=>{Vt(new Map),xn()},[xn]),Jn=b.useCallback(()=>{nn($=>{if($.length===0)return $;const W=[...$],te=W.pop();if(rn(se=>[...se,{nodes:[...tn.current],edges:[...s],hiddenNodeIds:new Set(Zn.current)}]),r(te.nodes),a(te.edges),de(te.hiddenNodeIds),c){const se=new Map;te.nodes.forEach(ae=>{var je,Se,Pe,Be;const ge=c.nodes.find(Ye=>Ye.id===ae.id);if(ge){const Ye=ae.position.x,ot=ae.position.y,Le=((je=ae.style)==null?void 0:je.width)??((Se=ae.data)==null?void 0:Se.width)??100,Ke=((Pe=ae.style)==null?void 0:Pe.height)??((Be=ae.data)==null?void 0:Be.height)??60;(Ye!==ge.x||ot!==ge.y||Le!==ge.width||Ke!==ge.height)&&se.set(ae.id,{id:ae.id,x:Ye,y:ot,width:Le,height:Ke})}}),Vt(se)}return W})},[s,r,a,c]),Jr=b.useCallback(()=>{rn($=>{if($.length===0)return $;const W=[...$],te=W.pop();if(nn(se=>[...se,{nodes:[...tn.current],edges:[...s],hiddenNodeIds:new Set(Zn.current)}]),r(te.nodes),a(te.edges),de(te.hiddenNodeIds),c){const se=new Map;te.nodes.forEach(ae=>{var je,Se,Pe,Be;const ge=c.nodes.find(Ye=>Ye.id===ae.id);if(ge){const Ye=ae.position.x,ot=ae.position.y,Le=((je=ae.style)==null?void 0:je.width)??((Se=ae.data)==null?void 0:Se.width)??100,Ke=((Pe=ae.style)==null?void 0:Pe.height)??((Be=ae.data)==null?void 0:Be.height)??60;(Ye!==ge.x||ot!==ge.y||Le!==ge.width||Ke!==ge.height)&&se.set(ae.id,{id:ae.id,x:Ye,y:ot,width:Le,height:Ke})}}),Vt(se)}return W})},[s,r,a,c]),Si=b.useCallback(({nodes:$})=>{Gr(new Set($.map(W=>W.id))),$.length===1?pe($[0].id):$.length===0&&pe(null)},[]),xr=b.useCallback(()=>{if(jt.size===0&&!ne)return;We();const $=jt.size>0?jt:new Set([ne]);de(W=>new Set([...W,...$])),Gr(new Set),pe(null)},[jt,ne,We]),er=b.useCallback(()=>{const $=jt.size>0?jt:ne?new Set([ne]):new Set;if($.size===0)return;const W=t.filter(te=>$.has(te.id));Yr(W)},[t,jt,ne]),wr=b.useCallback(()=>{if(Kn.length===0)return;We();const $=50,W=Kn.map((te,se)=>{var ae;return{...te,id:`${te.id}-copy-${Date.now()}-${se}`,position:{x:te.position.x+$,y:te.position.y+$},selected:!0,data:{...te.data,label:`${((ae=te.data)==null?void 0:ae.label)||te.id} (copy)`}}});r(te=>[...te.map(se=>({...se,selected:!1})),...W]),W.forEach(te=>{Vt(se=>{var ge,je,Se,Pe;const ae=new Map(se);return ae.set(te.id,{id:te.id,x:te.position.x,y:te.position.y,width:((ge=te.style)==null?void 0:ge.width)||((je=te.data)==null?void 0:je.width)||100,height:((Se=te.style)==null?void 0:Se.height)||((Pe=te.data)==null?void 0:Pe.height)||60}),ae})})},[Kn,r,We]),Wt=b.useCallback(($,W)=>{const te=jt.size>0?jt:ne?new Set([ne]):new Set;te.size!==0&&(We(),r(se=>se.map(ae=>{if(te.has(ae.id)&&!on.has(ae.id)){const ge={x:ae.position.x+$,y:ae.position.y+W};return Vt(je=>{var Pe,Be,Ye,ot;const Se=new Map(je);return Se.set(ae.id,{id:ae.id,x:ge.x,y:ge.y,width:((Pe=ae.style)==null?void 0:Pe.width)||((Be=ae.data)==null?void 0:Be.width)||100,height:((Ye=ae.style)==null?void 0:Ye.height)||((ot=ae.data)==null?void 0:ot.height)||60}),Se}),{...ae,position:ge}}return ae})))},[jt,ne,on,r,We]),Sr=b.useCallback($=>{No(W=>{const te=new Set(W);return te.has($)?te.delete($):te.add($),te})},[]),ki=b.useCallback($=>{const W={id:`edge-${$.source}-${$.target}-${Date.now()}`,source:$.source,target:$.target,type:"smoothstep",animated:!0,style:{stroke:ut==="dark"?"#868e96":"#6b7280",strokeWidth:2}};a(te=>Sm(W,te))},[a,ut]),Ve=b.useCallback(($,W)=>{We(),a(te=>s1($,W,te))},[a,We]),Ss=b.useCallback(async()=>{const $=document.querySelector(".react-flow");if($){It(!0);try{const W=await lN($,{backgroundColor:ut==="dark"?"hsl(222, 47%, 5%)":"hsl(220, 20%, 97%)",quality:1,pixelRatio:2}),te=document.createElement("a");te.download=`architecture-diagram-${new Date().toISOString().split("T")[0]}.png`,te.href=W,te.click()}catch(W){console.error("Failed to export PNG:",W)}finally{It(!1)}}},[ut]),ks=b.useCallback(async()=>{const $=document.querySelector(".react-flow");if($){It(!0);try{const W=await bg($,{backgroundColor:ut==="dark"?"hsl(222, 47%, 5%)":"hsl(220, 20%, 97%)"}),te=document.createElement("a");te.download=`architecture-diagram-${new Date().toISOString().split("T")[0]}.svg`,te.href=W,te.click()}catch(W){console.error("Failed to export SVG:",W)}finally{It(!1)}}},[ut]),tr=b.useCallback(async $=>{It(!0);try{const W=await fetch(`/api/export?format=${$}`);if(!W.ok)throw new Error("Export failed");const te=await W.blob(),se=$==="mermaid"?"mmd":$==="plantuml"?"puml":$==="markdown"?"md":$,ae=document.createElement("a");ae.download=`architecture.${se}`,ae.href=URL.createObjectURL(te),ae.click(),URL.revokeObjectURL(ae.href)}catch(W){console.error(`Failed to export ${$}:`,W)}finally{It(!1)}},[]);b.useCallback(()=>{if(!c)return;We();const $=250,W=100,te=100,se=t.map((ae,ge)=>({...ae,position:{x:W+ge*$,y:te}}));r(se),_e("horizontal")},[c,t,r,We]),b.useCallback(()=>{if(!c)return;We();const $=150,W=100,te=100,se=t.map((ae,ge)=>({...ae,position:{x:W,y:te+ge*$}}));r(se),_e("vertical")},[c,t,r,We]),b.useCallback(()=>{if(!c)return;We();const $=280,W=180,te=100,se=100,ae=Math.ceil(Math.sqrt(t.length)),ge=t.map((je,Se)=>({...je,position:{x:te+Se%ae*$,y:se+Math.floor(Se/ae)*W}}));r(ge),_e("grid")},[c,t,r,We]),b.useCallback(()=>{if(!c)return;We();const $=320,W=160,te=100,se=100,ae=new Set(t.map(Le=>Le.id)),ge=new Map,je=new Map;ae.forEach(Le=>{ge.set(Le,0),je.set(Le,[])}),s.forEach(Le=>{ae.has(Le.source)&&ae.has(Le.target)&&(je.get(Le.source).push(Le.target),ge.set(Le.target,(ge.get(Le.target)||0)+1))});const Se=new Map,Pe=[];for(ge.forEach((Le,Ke)=>{Le===0&&(Pe.push(Ke),Se.set(Ke,0))});Pe.length>0;){const Le=Pe.shift(),Ke=Se.get(Le);for(const Ut of je.get(Le)||[]){const Mo=Ke+1;(!Se.has(Ut)||Se.get(Ut)<Mo)&&Se.set(Ut,Mo),ge.set(Ut,ge.get(Ut)-1),ge.get(Ut)===0&&Pe.push(Ut)}}t.forEach(Le=>{Se.has(Le.id)||Se.set(Le.id,0)});const Be=new Map;t.forEach(Le=>{const Ke=Se.get(Le.id);Be.has(Ke)||Be.set(Ke,[]),Be.get(Ke).push(Le)});const Ye=[];[...Be.keys()].sort((Le,Ke)=>Le-Ke).forEach((Le,Ke)=>{Be.get(Le).forEach((Mo,aa)=>{Ye.push({...Mo,position:{x:te+Ke*$,y:se+aa*W}})})}),r(Ye),_e("flow")},[c,t,s,r,We]),b.useCallback(()=>{if(!c)return;We();const $=250,W=180,te=100,se=100,ae={};t.forEach(Pe=>{var Ye;const Be=((Ye=Pe.data)==null?void 0:Ye.layer)||"application";ae[Be]||(ae[Be]=[]),ae[Be].push(Pe)});const ge=["presentation","application","data","external","deployment"];let je=se;const Se=[];ge.forEach(Pe=>{const Be=ae[Pe]||[];Be.forEach((Ye,ot)=>{Se.push({...Ye,position:{x:te+ot*$,y:je}})}),Be.length>0&&(je+=W)}),Object.entries(ae).forEach(([Pe,Be])=>{ge.includes(Pe)||(Be.forEach((Ye,ot)=>{Se.push({...Ye,position:{x:te+ot*$,y:je}})}),je+=W)}),r(Se),_e("layer")},[c,t,r,We]);const eo=b.useCallback($=>{if(!$||!c){yn(new Set);return}const W=new Set;W.add($),c.edges.forEach(te=>{te.source===$&&(W.add(te.target),W.add(te.id)),te.target===$&&(W.add(te.source),W.add(te.id))}),yn(W)},[c]),Es=b.useMemo(()=>{if(!gn.trim())return new Set;const $=gn.toLowerCase(),W=new Set;return t.forEach(te=>{var ae;(((ae=te.data)==null?void 0:ae.label)||"").toLowerCase().includes($)&&W.add(te.id)}),W},[gn,t]),Ns=b.useCallback(async $=>{try{await fetch("/api/open-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:$})})}catch(W){console.error("Failed to open file:",W)}},[]),Ei=b.useCallback(($,W)=>{if(!c)return;const te=c.nodes.find(se=>se.id===W.id);te&&(hi(te),vn(!0))},[c]);b.useEffect(()=>{const $=W=>{if(W.target instanceof HTMLInputElement||W.target instanceof HTMLTextAreaElement)return;const se=navigator.platform.toUpperCase().indexOf("MAC")>=0?W.metaKey:W.ctrlKey;if(W.key==="Backspace"||W.key==="Delete"){W.preventDefault(),xr();return}if(se&&W.key==="c"){W.preventDefault(),er();return}if(se&&W.key==="v"){W.preventDefault(),wr();return}if(se&&W.shiftKey&&W.key==="z"){W.preventDefault(),Jr();return}if(se&&W.key==="z"){W.preventDefault(),Jn();return}if(se&&W.key==="s"){W.preventDefault(),On();return}if(W.key==="Escape"){Dn(""),yn(new Set),vn(!1);return}if(W.key==="ArrowUp"){W.preventDefault(),Wt(0,W.shiftKey?-Tt*5:-Tt);return}if(W.key==="ArrowDown"){W.preventDefault(),Wt(0,W.shiftKey?Tt*5:Tt);return}if(W.key==="ArrowLeft"){W.preventDefault(),Wt(W.shiftKey?-Tt*5:-Tt,0);return}if(W.key==="ArrowRight"){W.preventDefault(),Wt(W.shiftKey?Tt*5:Tt,0);return}if(se&&W.key==="l"&&ne){W.preventDefault(),Sr(ne);return}};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[xr,er,wr,On,Wt,Sr,ne,Jn,Jr]);const kr=b.useMemo(()=>c?c.nodes.filter($=>oe.has($.id)):[],[c,oe]);return b.useEffect(()=>{c&&r($=>$.map(W=>({...W,data:{...W.data,highlighted:W.id===Wr}})))},[Wr,c]),C?f.jsx("div",{className:"app",children:f.jsxs("div",{className:"loading",children:[f.jsx("div",{className:"loading-spinner"}),"Loading architecture..."]})}):f.jsxs("div",{className:"app",children:[f.jsxs("div",{className:"branding-header",children:[f.jsxs("div",{className:"archbyte-brand",children:[f.jsx("span",{className:"archbyte-name",children:"ArchByte"}),X?f.jsx(NN,{projectInfo:X}):f.jsx("span",{className:"archbyte-tagline",children:"See what agents build. As they build it."})]}),S.loggedIn&&f.jsx("div",{className:"branding-account",children:S.email&&f.jsxs("span",{className:"account-email",children:[S.email,S.tier==="premium"&&f.jsx("span",{className:"account-pro-tag",children:"PRO"})]})})]}),f.jsxs("div",{className:"toolbar",children:[f.jsxs("div",{className:"toolbar-left",children:[f.jsxs("div",{className:"toolbar-section",children:[f.jsx("span",{className:"toolbar-section-label",children:"View"}),f.jsx("div",{className:"toolbar-section-items",children:f.jsx("input",{type:"text",placeholder:"Filter nodes...",value:gn,onChange:$=>Dn($.target.value),className:"toolbar-search"})})]}),f.jsxs("div",{className:"toolbar-section",children:[f.jsx("span",{className:"toolbar-section-label",children:"Analyze"}),f.jsxs("div",{className:"toolbar-section-items",children:[f.jsxs(kp,{trigger:P?f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"flow-dot-inline",style:{background:P.color}}),P.name]}):"▶ Flows ▾",triggerClassName:`toolbar-btn ${P?"has-active-flow":""}`,children:[P&&f.jsxs(f.Fragment,{children:[f.jsx("button",{className:"dropdown-item flow-clear",onClick:$n,children:"⏹ Clear active flow"}),f.jsx("div",{className:"dropdown-separator"})]}),c!=null&&c.flows&&c.flows.length>0?(()=>{const $=["user-journey","data-pipeline","system","deployment","error-recovery"],W={"user-journey":"User Journey","data-pipeline":"Data Pipeline",system:"System",deployment:"Deployment","error-recovery":"Error / Recovery"},te={"user-journey":"#3b82f6","data-pipeline":"#22c55e",system:"#f59e0b",deployment:"#a855f7","error-recovery":"#ef4444"},se={};for(const je of c.flows){const Se=je.category||"system";se[Se]||(se[Se]=[]),se[Se].push(je)}const ae=[];for(const je of $){const Se=se[je];if(Se!=null&&Se.length){ae.push(f.jsxs("div",{className:"flow-category-header",children:[f.jsx("span",{className:"flow-dot-inline",style:{background:te[je]}}),W[je]||je]},`cat-${je}`));for(const Pe of Se)ae.push(f.jsxs("button",{className:`dropdown-item flow-dropdown-item ${(P==null?void 0:P.id)===Pe.id?"active":""}`,onClick:()=>{(P==null?void 0:P.id)===Pe.id?$n():gr(Pe)},children:[f.jsx("span",{className:"flow-dot-inline",style:{background:Pe.color}}),f.jsx("span",{className:"flow-dropdown-name",children:Pe.name}),(P==null?void 0:P.id)===Pe.id&&f.jsx("span",{className:"active-badge",children:"ACTIVE"})]},Pe.id))}}const ge=new Set($);for(const[je,Se]of Object.entries(se))if(!ge.has(je)&&Se!=null&&Se.length){ae.push(f.jsxs("div",{className:"flow-category-header",children:[f.jsx("span",{className:"flow-dot-inline",style:{background:"#6b7280"}}),je]},`cat-${je}`));for(const Pe of Se)ae.push(f.jsxs("button",{className:`dropdown-item flow-dropdown-item ${(P==null?void 0:P.id)===Pe.id?"active":""}`,onClick:()=>{(P==null?void 0:P.id)===Pe.id?$n():gr(Pe)},children:[f.jsx("span",{className:"flow-dot-inline",style:{background:Pe.color}}),f.jsx("span",{className:"flow-dropdown-name",children:Pe.name}),(P==null?void 0:P.id)===Pe.id&&f.jsx("span",{className:"active-badge",children:"ACTIVE"})]},Pe.id))}return ae})():f.jsx("span",{className:"dropdown-item disabled",children:"No flows defined"})]}),f.jsx("button",{className:`toolbar-btn premium-btn ${S.features.validate?"":"premium-locked"} ${ze?"active":""}`,onClick:()=>{if(!S.features.validate){A("Validate");return}He(!ze)},children:"Validate"})]})]}),f.jsxs("div",{className:"toolbar-section",children:[f.jsx("span",{className:"toolbar-section-label",children:"Ops"}),f.jsxs("div",{className:"toolbar-section-items",children:[f.jsx("button",{className:`toolbar-btn premium-btn ${S.features.patrol?"":"premium-locked"} ${Ae?"active":""}`,title:S.features.patrol?"":"Available in Pro",onClick:()=>{if(!S.features.patrol){A("Patrol");return}Ge(!Ae),ft(!1),ht(!1)},children:"Patrol"}),f.jsx("button",{className:`toolbar-btn premium-btn ${S.features.patrol?"":"premium-locked"} ${Ct?"active":""}`,title:S.features.patrol?"":"Available in Pro",onClick:()=>{if(!S.features.patrol){A("Workflows");return}ft(!Ct),Ge(!1),ht(!1)},children:"Workflows"}),f.jsx("button",{className:`toolbar-btn premium-btn ${S.features.premiumAgents?"":"premium-locked"} ${yt?"active":""}`,title:S.features.premiumAgents?"":"Available in Pro",onClick:()=>{if(!S.features.premiumAgents){A("Pro Agents");return}yt?ht(!1):(ht(!0),Ge(!1),ft(!1))},children:"Agents"})]})]})]}),f.jsxs("div",{className:"toolbar-right",children:[J&&f.jsx("button",{className:"toolbar-btn toolbar-error-btn",onClick:()=>ee(null),title:J,children:"Analysis failed"}),f.jsx("button",{className:`toolbar-btn ${Ce?"active":""}`,onClick:()=>Ee(!Ce),children:"Stats"}),f.jsxs(kp,{trigger:Qr?"Exporting...":"↓ Export ▾",triggerClassName:"toolbar-btn",disabled:Qr,children:[f.jsx("div",{className:"dropdown-label",children:"Image"}),f.jsx("button",{className:"dropdown-item",onClick:Ss,children:"PNG — Raster image"}),f.jsx("button",{className:"dropdown-item",onClick:ks,children:"SVG — Vector image"}),f.jsx("div",{className:"dropdown-separator"}),f.jsx("div",{className:"dropdown-label",children:"Diagram"}),f.jsx("button",{className:"dropdown-item",onClick:()=>tr("mermaid"),children:"Mermaid — .mmd"}),f.jsx("button",{className:"dropdown-item",onClick:()=>tr("plantuml"),children:"PlantUML — .puml"}),f.jsx("button",{className:"dropdown-item",onClick:()=>tr("dot"),children:"Graphviz DOT — .dot"}),f.jsx("div",{className:"dropdown-separator"}),f.jsx("div",{className:"dropdown-label",children:"Document"}),f.jsx("button",{className:"dropdown-item",onClick:()=>tr("markdown"),children:"Markdown — .md"}),f.jsx("button",{className:"dropdown-item",onClick:()=>tr("json"),children:"JSON — .json"})]}),f.jsx("button",{className:"toolbar-btn-icon",onClick:()=>Kr(ut==="dark"?"light":"dark"),title:`Switch to ${ut==="dark"?"light":"dark"} mode`,children:ut==="dark"?"☀":"☽"})]})]}),f.jsx(hN,{selectedEnvironment:vt,environments:pn,onSelectEnvironment:An}),f.jsxs("div",{className:"canvas-container",children:[f.jsx("div",{className:"watermark",children:"archbyte"}),f.jsxs(hg,{nodes:t.map($=>({...$,draggable:!on.has($.id),data:{...$.data,locked:on.has($.id),isConnected:Qn.size>0?Qn.has($.id):null,isSearchMatch:gn?Es.has($.id):null}})),edges:s.map($=>{var W;return{...$,style:{...$.style,opacity:Qn.size>0?Qn.has($.id)?1:.15:1,strokeWidth:Qn.has($.id)?3:((W=$.style)==null?void 0:W.strokeWidth)||2}}}),onNodesChange:vr,onEdgesChange:u,onNodeClick:($,W)=>{xi($,W),eo(W.id)},onNodeDoubleClick:Ei,onPaneClick:()=>{wi(),eo(null),document.dispatchEvent(new Event("dropdown:closeall"))},onConnect:ki,onReconnect:Ve,edgesReconnectable:!0,onSelectionChange:Si,nodeTypes:XN,connectionMode:wo.Loose,snapToGrid:!0,snapGrid:[Bt,Bt],selectionOnDrag:!0,selectNodesOnDrag:!1,fitView:!0,fitViewOptions:{padding:.2},minZoom:.1,maxZoom:2,attributionPosition:"bottom-left",deleteKeyCode:null,children:[f.jsx(mg,{color:ut==="dark"?"hsl(220 25% 15%)":"hsl(220 15% 82%)",gap:20,variant:Yn.Dots}),f.jsx(yg,{})]}),ne&&f.jsxs("div",{className:"node-actions-panel",children:[f.jsxs("div",{className:"node-actions-title",children:[on.has(ne)&&f.jsx("span",{className:"lock-icon",children:"🔒"}),((Sn=(wn=t.find($=>$.id===ne))==null?void 0:wn.data)==null?void 0:Sn.label)||ne]}),f.jsxs("div",{className:"node-actions-buttons",children:[f.jsx("button",{className:`panel-btn ${on.has(ne)?"amber":"cyan"}`,onClick:()=>Sr(ne),title:"Lock/Unlock (Cmd+L)",children:on.has(ne)?"🔓 Unlock":"🔒 Lock"}),f.jsx("button",{className:"panel-btn red",onClick:()=>yi(ne),title:"Hide (Delete key)",children:"Hide"})]}),f.jsx("div",{className:"node-actions-hint",children:"Arrow keys to move • Shift for faster"})]}),mr&&tt&&f.jsxs("div",{className:"node-details-panel",children:[f.jsxs("div",{className:"node-details-header",children:[f.jsxs("div",{children:[f.jsx("div",{className:"node-details-title",children:tt.label.split(`
|
|
68
68
|
`)[0]}),f.jsxs("div",{className:"node-details-type",children:[tt.layer," • ",tt.type]})]}),f.jsx("button",{className:"panel-close-btn",onClick:()=>vn(!1),children:"×"})]}),tt.path&&f.jsxs("div",{className:"node-details-section",children:[f.jsx("div",{className:"node-details-section-title",children:"Path"}),f.jsx("div",{className:"node-details-path",children:tt.path})]}),tt.techStack&&tt.techStack.length>0&&f.jsxs("div",{className:"node-details-section",children:[f.jsx("div",{className:"node-details-section-title",children:"Tech Stack"}),f.jsx("div",{className:"node-details-tech-stack",children:tt.techStack.map(($,W)=>f.jsx("span",{className:"tech-badge",children:$},W))})]}),f.jsxs("div",{className:"node-details-section",children:[f.jsx("div",{className:"node-details-section-title",children:"Connections"}),f.jsxs("div",{className:"node-details-connections",children:[c==null?void 0:c.edges.filter($=>$.source===tt.id||$.target===tt.id).map($=>{const W=$.source===tt.id,te=W?$.target:$.source,se=c==null?void 0:c.nodes.find(ae=>ae.id===te);return f.jsxs("div",{className:"connection-item-detailed",children:[f.jsxs("div",{className:"connection-header",children:[f.jsx("span",{className:"connection-arrow",children:W?"→":"←"}),f.jsx("span",{className:"connection-target",children:(se==null?void 0:se.label.split(`
|
|
69
69
|
`)[0])||te})]}),$.label&&f.jsx("div",{className:"connection-label",children:$.label})]},$.id)}),(c==null?void 0:c.edges.filter($=>$.source===tt.id||$.target===tt.id).length)===0&&f.jsx("span",{style:{color:"var(--text-muted)"},children:"No connections"})]})]}),f.jsxs("div",{className:"node-details-actions",children:[tt.path&&f.jsx("button",{className:"panel-btn cyan",onClick:()=>Ns(tt.path),children:"Open in VS Code"}),f.jsx("button",{className:"panel-btn",onClick:()=>{eo(tt.id),vn(!1)},children:"Highlight Deps"})]})]}),mn.size>0&&f.jsxs("div",{className:"save-panel",children:[f.jsxs("span",{className:"save-panel-text",children:[mn.size," unsaved change",mn.size!==1?"s":""]}),f.jsx("button",{className:"save-btn",onClick:On,disabled:Ur,children:Ur?"Saving...":"Save Changes"}),f.jsx("button",{className:"discard-btn",onClick:sn,disabled:Ur,children:"Discard"})]}),kr.length>0&&f.jsxs("div",{className:"hidden-nodes-panel",children:[f.jsxs("div",{className:"hidden-nodes-title",children:["Hidden (",kr.length,")",f.jsx("button",{className:"panel-btn cyan small",onClick:vi,children:"Show All"})]}),f.jsx("div",{className:"hidden-nodes-list",style:{maxHeight:220,overflowY:"auto"},children:kr.map($=>f.jsxs("div",{className:"hidden-node-item",children:[f.jsx("span",{className:"hidden-node-name",children:$.label.split(`
|
|
70
|
-
`)[0]}),f.jsx("button",{className:"panel-btn green small",onClick:()=>bt($.id),children:"Show"})]},$.id))})]}),P&&f.jsxs("div",{className:"flow-progress-bar",children:[f.jsx("span",{className:"flow-progress-dot",style:{background:P.color}}),f.jsx("span",{className:"flow-progress-name",children:P.name}),f.jsx("div",{className:"flow-progress-steps",children:P.steps.map(($,W)=>f.jsx("div",{className:`flow-progress-step ${W<=V?"active":""} ${W===V?"current":""}`,style:{borderColor:W<=V?P.color:void 0},title:$.label,children:$.label},W))}),f.jsxs("div",{className:"flow-progress-controls",children:[R?f.jsx("button",{className:"flow-progress-btn",onClick:yr,title:"Pause",children:"⏸"}):f.jsx("button",{className:"flow-progress-btn",onClick:gi,title:"Resume",children:"▶"}),f.jsx("button",{className:"flow-progress-btn stop",onClick:$n,title:"Stop",children:"⏹"})]})]}),D&&P&&c&&f.jsx(PN,{flow:P,architecture:c,onClose:$n}),f.jsx(yN,{visible:Ce,onClose:()=>Ee(!1)}),f.jsx(xN,{visible:ze,onClose:()=>He(!1),onHighlightNode:$=>{Rt($),eo($)}}),Ae&&f.jsxs(di,{className:"ops-panel",children:[f.jsxs("div",{className:"ops-header","data-drag-handle":!0,children:[f.jsx("span",{className:"ops-panel-title",children:"Patrol"}),f.jsx("button",{className:"panel-close-btn",onClick:()=>Ge(!1),children:"x"})]}),f.jsx(SN,{visible:!0})]}),Ct&&f.jsxs(di,{className:"ops-panel",children:[f.jsxs("div",{className:"ops-header","data-drag-handle":!0,children:[f.jsx("span",{className:"ops-panel-title",children:"Workflows"}),f.jsx("button",{className:"panel-close-btn",onClick:()=>ft(!1),children:"x"})]}),f.jsx(EN,{visible:!0})]}),f.jsx(UN,{visible:yt,onClose:()=>ht(!1),results:hn}),v.length>0&&f.jsxs("div",{className:"agent-panel",children:[f.jsx("div",{className:"agent-panel-title",children:"Agent Activity"}),v.map(($,W)=>f.jsxs("div",{className:"agent-item",children:[f.jsx("div",{className:`agent-dot ${W===0?"active":""}`}),f.jsx("span",{className:"agent-name",children:$.agentName}),f.jsx("span",{className:"agent-target",children:$.targetComponent||$.action})]},W))]})]}),f.jsxs("div",{className:"status-bar",children:[f.jsxs("div",{className:"status-left",children:[f.jsxs("div",{className:"status-indicator",children:[f.jsx("div",{className:`status-dot ${m?"":"disconnected"}`}),f.jsx("span",{children:m?"Live":"Offline"})]}),N&&f.jsx("span",{style:{color:"var(--accent-red)"},children:N})]}),f.jsx("div",{className:"status-center"}),f.jsxs("div",{className:"status-right",children:[f.jsx("span",{children:x?`Updated ${new Date(x).toLocaleTimeString()}`:"Waiting..."}),_t?f.jsxs("span",{className:"git-status",children:[_t.repo&&f.jsx("a",{href:((kn=_t.remoteUrl)==null?void 0:kn.replace(/^git@([^:]+):/,"https://$1/").replace(/\.git$/,""))||"#",target:"_blank",rel:"noopener noreferrer",className:"git-repo-badge",title:_t.remoteUrl||"",children:_t.repo}),f.jsx("span",{className:"git-branch",children:_t.branch}),f.jsx("span",{className:"git-hash",children:_t.commit})]}):f.jsxs("span",{children:["v",(c==null?void 0:c.version)||1]})]})]}),H&&f.jsx(IN,{onComplete:()=>{q(!1),xn()}}),O&&f.jsx(aN,{feature:O,onClose:()=>A(null)})]})}d0.createRoot(document.getElementById("root")).render(f.jsx(Cp.StrictMode,{children:f.jsx(KN,{})}));
|
|
70
|
+
`)[0]}),f.jsx("button",{className:"panel-btn green small",onClick:()=>bt($.id),children:"Show"})]},$.id))})]}),P&&f.jsxs("div",{className:"flow-progress-bar",children:[f.jsx("span",{className:"flow-progress-dot",style:{background:P.color}}),f.jsx("span",{className:"flow-progress-name",children:P.name}),f.jsx("div",{className:"flow-progress-steps",children:P.steps.map(($,W)=>f.jsx("div",{className:`flow-progress-step ${W<=V?"active":""} ${W===V?"current":""}`,style:{borderColor:W<=V?P.color:void 0},title:$.label,children:$.label},W))}),f.jsxs("div",{className:"flow-progress-controls",children:[R?f.jsx("button",{className:"flow-progress-btn",onClick:yr,title:"Pause",children:"⏸"}):f.jsx("button",{className:"flow-progress-btn",onClick:gi,title:"Resume",children:"▶"}),f.jsx("button",{className:"flow-progress-btn stop",onClick:$n,title:"Stop",children:"⏹"})]})]}),D&&P&&c&&f.jsx(PN,{flow:P,architecture:c,onClose:$n}),f.jsx(yN,{visible:Ce,onClose:()=>Ee(!1)}),f.jsx(xN,{visible:ze,onClose:()=>He(!1),onHighlightNode:$=>{Rt($),eo($)}}),Ae&&f.jsxs(di,{className:"ops-panel",children:[f.jsxs("div",{className:"ops-header","data-drag-handle":!0,children:[f.jsx("span",{className:"ops-panel-title",children:"Patrol"}),f.jsx("button",{className:"panel-close-btn",onClick:()=>Ge(!1),children:"x"})]}),f.jsx(SN,{visible:!0})]}),Ct&&f.jsxs(di,{className:"ops-panel",children:[f.jsxs("div",{className:"ops-header","data-drag-handle":!0,children:[f.jsx("span",{className:"ops-panel-title",children:"Workflows"}),f.jsx("button",{className:"panel-close-btn",onClick:()=>ft(!1),children:"x"})]}),f.jsx(EN,{visible:!0})]}),f.jsx(UN,{visible:yt,onClose:()=>ht(!1),results:hn}),v.length>0&&f.jsxs("div",{className:"agent-panel",children:[f.jsx("div",{className:"agent-panel-title",children:"Agent Activity"}),v.map(($,W)=>f.jsxs("div",{className:"agent-item",children:[f.jsx("div",{className:`agent-dot ${W===0?"active":""}`}),f.jsx("span",{className:"agent-name",children:$.agentName}),f.jsx("span",{className:"agent-target",children:$.targetComponent||$.action})]},W))]})]}),f.jsxs("div",{className:"status-bar",children:[f.jsxs("div",{className:"status-left",children:[f.jsxs("div",{className:"status-indicator",children:[f.jsx("div",{className:`status-dot ${m?"":"disconnected"}`}),f.jsx("span",{children:m?"Live":"Offline"})]}),N&&f.jsx("span",{style:{color:"var(--accent-red)"},children:N})]}),f.jsx("div",{className:"status-center",children:f.jsx("a",{href:"mailto:archbyte@heartbyte.io",style:{color:"var(--text-dim)",fontSize:11,textDecoration:"none"},children:"archbyte@heartbyte.io"})}),f.jsxs("div",{className:"status-right",children:[f.jsx("span",{children:x?`Updated ${new Date(x).toLocaleTimeString()}`:"Waiting..."}),_t?f.jsxs("span",{className:"git-status",children:[_t.repo&&f.jsx("a",{href:((kn=_t.remoteUrl)==null?void 0:kn.replace(/^git@([^:]+):/,"https://$1/").replace(/\.git$/,""))||"#",target:"_blank",rel:"noopener noreferrer",className:"git-repo-badge",title:_t.remoteUrl||"",children:_t.repo}),f.jsx("span",{className:"git-branch",children:_t.branch}),f.jsx("span",{className:"git-hash",children:_t.commit})]}):f.jsxs("span",{children:["v",(c==null?void 0:c.version)||1]})]})]}),H&&f.jsx(IN,{onComplete:()=>{q(!1),xn()}}),O&&f.jsx(aN,{feature:O,onClose:()=>A(null)})]})}d0.createRoot(document.getElementById("root")).render(f.jsx(Cp.StrictMode,{children:f.jsx(KN,{})}));
|
package/ui/dist/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>ArchByte</title>
|
|
7
7
|
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32.png">
|
|
8
8
|
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16.png">
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-pYTLuCyK.js"></script>
|
|
10
10
|
<link rel="stylesheet" crossorigin href="/assets/index-0_XpUUZQ.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|