archscribe 0.2.1 → 0.2.2-rc.1
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 +1 -8
- package/dist/cli/archscribe.js +29 -74
- package/dist/cli/archscribe.js.map +1 -1
- package/dist/cli/doctor.js +1 -0
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/login.js +5 -2
- package/dist/cli/login.js.map +1 -1
- package/dist/cli/rag.d.ts +4 -1
- package/dist/cli/rag.js +29 -7
- package/dist/cli/rag.js.map +1 -1
- package/dist/cli/run.js +7 -1
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/shell.d.ts +1 -1
- package/dist/cli/shell.js +29 -3
- package/dist/cli/shell.js.map +1 -1
- package/dist/core/docx-package.d.ts +9 -0
- package/dist/core/docx-package.js +99 -0
- package/dist/core/docx-package.js.map +1 -0
- package/dist/core/docx-styles.d.ts +12 -11
- package/dist/core/docx-styles.js +12 -11
- package/dist/core/docx-styles.js.map +1 -1
- package/dist/core/docx-update.d.ts +6 -0
- package/dist/core/docx-update.js +437 -0
- package/dist/core/docx-update.js.map +1 -0
- package/dist/core/docx.d.ts +8 -2
- package/dist/core/docx.js +263 -74
- package/dist/core/docx.js.map +1 -1
- package/dist/core/flow.js +8 -2
- package/dist/core/flow.js.map +1 -1
- package/dist/core/iuh-logo.d.ts +1 -0
- package/dist/core/iuh-logo.js +3 -0
- package/dist/core/iuh-logo.js.map +1 -0
- package/dist/core/manifest.js +1 -1
- package/dist/core/manifest.js.map +1 -1
- package/dist/core/markdown.js +24 -11
- package/dist/core/markdown.js.map +1 -1
- package/dist/core/parser.js +3 -0
- package/dist/core/parser.js.map +1 -1
- package/dist/core/project-config.d.ts +4 -0
- package/dist/core/project-config.js +39 -0
- package/dist/core/project-config.js.map +1 -1
- package/dist/diagrams/layout/radial.js +69 -0
- package/dist/diagrams/layout/radial.js.map +1 -1
- package/dist/evaluation/dashboard-review.js +66 -0
- package/dist/evaluation/dashboard-review.js.map +1 -1
- package/dist/knowledge/embedding.d.ts +11 -0
- package/dist/knowledge/embedding.js +31 -0
- package/dist/knowledge/embedding.js.map +1 -0
- package/dist/knowledge/hub-grouping.d.ts +3 -3
- package/dist/knowledge/hub-grouping.js +52 -54
- package/dist/knowledge/hub-grouping.js.map +1 -1
- package/dist/knowledge/qdrant-client.d.ts +20 -0
- package/dist/knowledge/qdrant-client.js +95 -0
- package/dist/knowledge/qdrant-client.js.map +1 -0
- package/dist/knowledge/rag-augment.d.ts +1 -1
- package/dist/knowledge/rag-augment.js +7 -6
- package/dist/knowledge/rag-augment.js.map +1 -1
- package/dist/knowledge/retriever.d.ts +2 -6
- package/dist/knowledge/retriever.js +14 -27
- package/dist/knowledge/retriever.js.map +1 -1
- package/dist/knowledge/seed-data-extended.d.ts +7 -0
- package/dist/knowledge/seed-data-extended.js +183 -0
- package/dist/knowledge/seed-data-extended.js.map +1 -0
- package/dist/knowledge/seed-data-extra.d.ts +6 -0
- package/dist/knowledge/seed-data-extra.js +178 -0
- package/dist/knowledge/seed-data-extra.js.map +1 -0
- package/dist/knowledge/seed-data.d.ts +3 -0
- package/dist/knowledge/seed-data.js +333 -0
- package/dist/knowledge/seed-data.js.map +1 -0
- package/dist/knowledge/seed.d.ts +22 -0
- package/dist/knowledge/seed.js +44 -0
- package/dist/knowledge/seed.js.map +1 -0
- package/dist/knowledge/types.d.ts +1 -4
- package/dist/license/banner.d.ts +3 -1
- package/dist/license/banner.js +6 -2
- package/dist/license/banner.js.map +1 -1
- package/dist/license/client.d.ts +7 -3
- package/dist/license/client.js +15 -2
- package/dist/license/client.js.map +1 -1
- package/dist/license/gate.d.ts +3 -1
- package/dist/license/gate.js +1 -1
- package/dist/license/gate.js.map +1 -1
- package/dist/parser.jar +0 -0
- package/dist/server.js +10 -28
- package/dist/server.js.map +1 -1
- package/dist/theory/fill.d.ts +3 -1
- package/dist/theory/fill.js +28 -47
- package/dist/theory/fill.js.map +1 -1
- package/dist/theory/references.d.ts +32 -5
- package/dist/theory/references.js +126 -2
- package/dist/theory/references.js.map +1 -1
- package/dist/theory/scaffold.js +7 -6
- package/dist/theory/scaffold.js.map +1 -1
- package/dist/tools/analyze_project.js +3 -0
- package/dist/tools/analyze_project.js.map +1 -1
- package/dist/tools/environment.js +1 -0
- package/dist/tools/environment.js.map +1 -1
- package/dist/tools/generate_report.d.ts +5 -5
- package/dist/tools/generate_report.js +83 -232
- package/dist/tools/generate_report.js.map +1 -1
- package/dist/tools/learn_usecase.d.ts +6 -2
- package/dist/tools/learn_usecase.js +34 -50
- package/dist/tools/learn_usecase.js.map +1 -1
- package/dist/tools/scaffold.js +24 -23
- package/dist/tools/scaffold.js.map +1 -1
- package/dist/types/license.d.ts +3 -1
- package/dist/types/report.d.ts +3 -3
- package/dist/types/theory.d.ts +4 -1
- package/dist/types/uc-grouping.d.ts +8 -0
- package/dist/utils/approval.d.ts +32 -4
- package/dist/utils/approval.js +160 -9
- package/dist/utils/approval.js.map +1 -1
- package/dist/utils/dashboard-launcher.js +1 -0
- package/dist/utils/dashboard-launcher.js.map +1 -1
- package/dist/utils/keep-regions.d.ts +44 -0
- package/dist/utils/keep-regions.js +153 -0
- package/dist/utils/keep-regions.js.map +1 -0
- package/package.json +11 -16
- package/LICENSE +0 -33
- package/dashboard-server/client-dist/assets/index-CswIFyKN.js +0 -9
- package/dashboard-server/client-dist/assets/index-DWB_-3yk.css +0 -1
- package/dashboard-server/client-dist/brand/favicon.png +0 -0
- package/dashboard-server/client-dist/brand/logo-full.png +0 -0
- package/dashboard-server/client-dist/icons.svg +0 -24
- package/dashboard-server/client-dist/index.html +0 -14
- package/dashboard-server/dist/core-bridge.js +0 -19
- package/dashboard-server/dist/files-route.js +0 -28
- package/dashboard-server/dist/index.js +0 -294
- package/dashboard-server/dist/license-routes.js +0 -39
- package/dashboard-server/dist/review-route.js +0 -150
- package/dashboard-server/dist/run-route.js +0 -74
- package/dashboard-server/dist/security.js +0 -115
- package/dist/core/review-ledger.d.ts +0 -36
- package/dist/core/review-ledger.js +0 -104
- package/dist/core/review-ledger.js.map +0 -1
- package/dist/core/review-rerun.d.ts +0 -16
- package/dist/core/review-rerun.js +0 -31
- package/dist/core/review-rerun.js.map +0 -1
- package/dist/knowledge/local-kb.d.ts +0 -4
- package/dist/knowledge/local-kb.js +0 -82
- package/dist/knowledge/local-kb.js.map +0 -1
- package/dist/knowledge/rag-client.d.ts +0 -11
- package/dist/knowledge/rag-client.js +0 -60
- package/dist/knowledge/rag-client.js.map +0 -1
- package/dist/knowledge/rules.d.ts +0 -2
- package/dist/knowledge/rules.js +0 -10
- package/dist/knowledge/rules.js.map +0 -1
- package/dist/tools/review-tasks.d.ts +0 -28
- package/dist/tools/review-tasks.js +0 -168
- package/dist/tools/review-tasks.js.map +0 -1
- package/dist/utils/mcp-launch.d.ts +0 -24
- package/dist/utils/mcp-launch.js +0 -37
- package/dist/utils/mcp-launch.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@import "https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap";:root{--bg:#fafaf9;--panel:#fff;--panel2:#f1f1ee;--panel3:#e6e6e2;--ink:#0b0b0b;--dim:#4a4a47;--faint:#8c8c88;--rule:#0b0b0b;--hair:#dededa;--track:#ededea;--accent:#d6351f;--accent-soft:#d6351f1a;--pass:#1e7a4c;--pass-soft:#1e7a4c1a;--revise:#b5680b;--revise-soft:#b5680b1a;--skip:#6b6b68;--skip-soft:#6b6b681a;--onAccent:#fff;--onInk:#fafaf9;--sidebar-w:236px;--mono:"JetBrains Mono", monospace;--sans:"Archivo", system-ui, sans-serif}*,:before,:after{box-sizing:border-box;margin:0;padding:0}html,body,#root{height:100%}body{font-family:var(--sans);color:var(--ink);background:var(--bg);-webkit-font-smoothing:antialiased;font-size:13.5px;line-height:1.5}.shell{background:var(--bg);min-height:100vh;color:var(--ink);display:flex}.sidebar{width:var(--sidebar-w);flex:0 0 var(--sidebar-w);background:var(--panel);border-right:1px solid var(--rule);z-index:100;flex-direction:column;height:100vh;display:flex;position:sticky;top:0}.main{flex:1;min-width:0;min-height:100vh}.logo{border-bottom:1px solid var(--rule);align-items:center;gap:10px;padding:16px 16px 14px;display:flex}.logo-img{flex-shrink:0;width:auto;height:28px;display:block}.logo-ver{font-family:var(--mono);color:var(--faint);border:1px solid var(--hair);margin-left:auto;padding:2px 4px;font-size:9.5px}.sidebar-section-label{font-family:var(--mono);letter-spacing:.14em;color:var(--faint);margin-bottom:7px;font-size:9.5px}.sidebar-proj-section{border-bottom:1px solid var(--hair);padding:14px 16px}.project-select-btn{text-align:left;background:var(--panel2);border:1px solid var(--rule);cursor:pointer;width:100%;font-family:var(--mono);color:var(--ink);align-items:center;gap:8px;padding:9px 10px;font-size:12.5px;font-weight:500;display:flex;position:relative}.project-select-btn:hover{background:var(--panel3)}.project-select-btn .ps-arrow{color:var(--faint);margin-left:auto;font-size:10px}.project-dropdown{background:var(--panel);border:1px solid var(--rule);z-index:200;border-top:none;max-height:200px;position:absolute;top:100%;left:-1px;right:-1px;overflow-y:auto}.project-dropdown-item{cursor:pointer;font-family:var(--mono);color:var(--ink);border-bottom:1px solid var(--hair);padding:9px 10px;font-size:12px}.project-dropdown-item:hover{background:var(--panel2)}.project-dropdown-item.active{background:var(--panel2);font-weight:700}.sidebar-nav-section{flex:1;padding:12px 16px 0}.nav-item{color:var(--dim);cursor:pointer;-webkit-user-select:none;user-select:none;border-left:2px solid #0000;align-items:center;gap:10px;margin-bottom:2px;padding:9px 10px;font-size:13.5px;display:flex}.nav-item:hover{color:var(--ink);background:var(--panel2)}.nav-item.active{color:var(--ink);border-left-color:var(--accent);background:var(--accent-soft);font-weight:600}.nav-num{font-family:var(--mono);color:var(--faint);min-width:16px;font-size:10px}.nav-item.active .nav-num{color:var(--accent)}.sidebar-footer{border-top:1px solid var(--hair);color:var(--faint);margin-top:auto;padding:14px 16px;font-size:12px}.sidebar-footer .proj{color:var(--ink);margin-bottom:2px;font-size:13px;font-weight:600}.hamburger{z-index:200;background:var(--ink);color:var(--onInk);cursor:pointer;border:none;justify-content:center;align-items:center;width:40px;height:40px;font-size:20px;display:none;position:fixed;top:14px;left:14px}.screen-header{border-bottom:1px solid var(--rule);background:var(--panel);align-items:center;gap:18px;padding:15px 28px;display:flex}.screen-label{font-family:var(--mono);letter-spacing:.16em;color:var(--faint);flex-shrink:0;font-size:9.5px}.screen-title{letter-spacing:-.35px;text-transform:uppercase;margin:0;font-size:19px;font-weight:700}.screen-actions{gap:8px;margin-left:auto;display:flex}.mono{font-family:var(--mono)}.sub{color:var(--dim);margin-bottom:20px;font-size:13px}.btn{background:var(--panel);color:var(--ink);border:1px solid var(--rule);text-transform:uppercase;letter-spacing:.05em;cursor:pointer;font-size:12.5px;font-weight:600;font-family:var(--sans);padding:9px 15px}.btn:hover{background:var(--panel2)}.btn-primary{background:var(--accent);border-color:var(--accent);color:var(--onAccent);font-weight:700}.btn-primary:hover{background:var(--ink);border-color:var(--ink);color:var(--onInk)}.btn-ink{background:var(--ink);border-color:var(--ink);color:var(--onInk);font-weight:700}.btn-ink:hover{background:var(--accent);border-color:var(--accent);color:var(--onAccent)}.section-row{border-bottom:1px solid var(--rule);background:var(--panel);display:grid}.section-cell{padding:20px 24px 24px}.section-cell+.section-cell{border-left:1px solid var(--rule)}.section-heading{text-transform:uppercase;letter-spacing:.08em;align-items:baseline;gap:10px;margin-bottom:14px;font-size:12px;font-weight:700;display:flex}.section-heading .sh-meta{font-family:var(--mono);color:var(--faint);font-size:10px;font-weight:400}.section-heading .sh-score{font-family:var(--mono);color:var(--revise);font-size:10px;font-weight:400}.kpi-grid{border-bottom:1px solid var(--rule);background:var(--panel);grid-template-columns:repeat(4,1fr);display:grid}.kpi-cell{border-right:1px solid var(--hair);padding:16px 20px 18px}.kpi-cell:last-child{border-right:none}.kpi-label{font-family:var(--mono);letter-spacing:.14em;color:var(--faint);align-items:center;gap:6px;margin-bottom:8px;font-size:9.5px;display:flex}.kpi-dot{flex-shrink:0;width:5px;height:5px}.kpi-value{font-family:var(--mono);letter-spacing:-1.5px;margin-bottom:10px;font-size:34px;font-weight:700;line-height:1}.kpi-unit{color:var(--faint);font-size:15px;font-weight:400}.kpi-bar{background:var(--track);height:8px}.kpi-bar-fill{height:100%}.acc-row{border-top:1px solid var(--hair);grid-template-columns:20px 1fr 190px 58px;align-items:center;gap:12px;padding:12px 0;display:grid}.acc-n{font-family:var(--mono);color:var(--faint);font-size:10px}.acc-label{font-size:13.5px;font-weight:500}.acc-bars{flex-direction:column;gap:3px;display:flex}.acc-bar-row{align-items:center;gap:6px;display:flex}.acc-bar-key{font-family:var(--mono);color:var(--faint);width:14px;font-size:9px}.acc-bar-track{background:var(--track);flex:1;height:5px;display:block}.acc-bar-fill{height:100%;display:block}.acc-f1{text-align:right;font-family:var(--mono);font-size:14px;font-weight:700}.comp-row{border-top:1px solid var(--hair);grid-template-columns:14px 1fr auto;align-items:center;gap:10px;padding:9px 0;display:grid}.comp-dot{flex-shrink:0;width:9px;height:9px}.comp-label{font-size:13px}.comp-val{font-family:var(--mono);font-size:12px;font-weight:500}.timing-row{grid-template-columns:22px 140px 1fr 48px;align-items:center;gap:12px;padding:8px 0;display:grid}.timing-n{font-family:var(--mono);color:var(--faint);font-size:10px}.timing-label{font-size:13px}.timing-bar{background:var(--track);height:18px}.timing-bar-fill{background:var(--ink);height:100%}.timing-val{text-align:right;font-family:var(--mono);font-size:11.5px}.rv-wrap{height:calc(100vh - 52px);min-height:400px;display:flex}.rv-list{background:var(--panel);border-right:1px solid var(--rule);flex-direction:column;flex:none;width:300px;display:flex;overflow:hidden}.rv-filters{border-bottom:1px solid var(--hair);flex-direction:column;gap:6px;padding:10px;display:flex}.rv-filters input,.rv-filters select{border:1px solid var(--rule);width:100%;font-size:12.5px;font-family:var(--sans);background:var(--panel);color:var(--ink);padding:6px 8px}.rv-items{flex:1;overflow-y:auto}.rv-item{text-align:left;width:100%;color:var(--ink);border:0;border-bottom:1px solid var(--hair);cursor:pointer;background:0 0;align-items:center;gap:8px;padding:10px 12px;display:flex}.rv-item:hover{background:var(--panel2)}.rv-item.sel{background:var(--accent-soft)}.rv-item .ttl{text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:12.5px;font-weight:600;overflow:hidden}.rv-item .sub2{color:var(--dim);font-size:11px}.rv-detail{background:var(--bg);flex:1;padding:20px 24px;overflow-y:auto}.rv-detail textarea{border:1px solid var(--rule);resize:vertical;width:100%;min-height:60px;font-size:12.5px;font-family:var(--sans);background:var(--panel);color:var(--ink);padding:8px}.rv-spec{white-space:pre-wrap;overflow-wrap:anywhere;background:var(--panel);border:1px solid var(--rule);max-height:320px;padding:12px;font-size:12px;line-height:1.6;overflow-y:auto}.stbtn{border:1px solid var(--rule);background:var(--panel);cursor:pointer;font-size:12px;font-family:var(--sans);text-transform:uppercase;letter-spacing:.04em;margin-right:6px;padding:5px 12px;font-weight:600}.stbtn:hover{background:var(--panel2)}.stbtn.pass{background:var(--pass);border-color:var(--pass);color:#fff}.stbtn.fix{background:var(--revise);border-color:var(--revise);color:#fff}.stbtn.skip{background:var(--skip);border-color:var(--skip);color:#fff}.pill{font-size:11.5px;font-weight:600;font-family:var(--mono);padding:2px 8px;display:inline-block}.pill-ok{background:var(--pass-soft);color:var(--pass)}.pill-warn{background:var(--revise-soft);color:var(--revise)}.pill-bad{background:var(--accent-soft);color:var(--accent)}.dot{border:1.5px solid var(--faint);flex-shrink:0;width:8px;height:8px;margin-right:8px;display:inline-block}.dot.on{background:var(--pass);border-color:var(--pass)}.toast{background:var(--accent);color:var(--onAccent);z-index:999;padding:10px 18px;font-size:13px;position:fixed;top:16px;right:16px;box-shadow:0 4px 16px #0000002e}.loading{color:var(--dim);text-align:center;padding:40px 0}.error-banner{background:var(--accent-soft);border:1px solid var(--accent);color:var(--accent);margin-bottom:20px;padding:14px 18px}.auth-banner{background:var(--panel);border:1px solid var(--rule);border-left:4px solid var(--accent);max-width:560px;margin:48px auto;padding:24px 28px}.auth-banner h2{margin-bottom:10px;font-size:16px}.auth-banner p{color:var(--dim);font-size:13px;line-height:1.6}.auth-banner code{font-family:var(--mono);background:var(--panel2);border:1px solid var(--hair);padding:1px 5px;font-size:12px}.auth-banner pre{font-family:var(--mono);background:var(--panel2);border:1px solid var(--hair);-webkit-user-select:all;user-select:all;margin-top:14px;padding:10px 12px;font-size:12.5px}.stale-banner{background:var(--revise-soft);border:1px solid var(--revise);color:var(--ink);justify-content:space-between;align-items:center;gap:16px;margin-bottom:20px;padding:12px 18px;display:flex}.stale-banner strong{color:var(--revise)}.stale-banner .stale-error{color:var(--accent);margin-top:6px}.empty-state{text-align:center;color:var(--dim);padding:60px 0}.empty-state strong{color:var(--ink)}.grid{gap:0;display:grid}.grid-4{grid-template-columns:repeat(4,1fr)}.grid-2{grid-template-columns:1fr 1fr}table{border-collapse:collapse;width:100%;font-size:13px}th,td{text-align:left;border-bottom:1px solid var(--hair);padding:8px 10px}th{color:var(--dim);font-size:12px;font-weight:600;font-family:var(--mono);letter-spacing:.06em}.table-wrap{overflow-x:auto}.card{background:var(--panel);border:1px solid var(--rule);margin-bottom:0;padding:20px 24px}.card+.card{border-top:none}h1,h2,h3{font-family:var(--sans)}h1{font-size:19px;font-weight:700}h2{margin-bottom:12px;font-size:14px;font-weight:700}h3{margin:16px 0 6px;font-size:13px;font-weight:700}.bar-track{background:var(--track);width:100%;height:7px;overflow:hidden}.bar-fill{height:7px}@media (width<=900px){.kpi-grid,.grid-4{grid-template-columns:repeat(2,1fr)}.grid-2{grid-template-columns:1fr}}@media (width<=768px){:root{--sidebar-w:0px}.sidebar{width:236px;height:100vh;position:fixed;transform:translate(-236px)}.sidebar.open{transform:translate(0);box-shadow:4px 0 32px #0000004d}.main{padding-top:52px}.hamburger{display:flex}.rv-wrap{flex-direction:column;height:auto}.rv-list{border-right:none;border-bottom:1px solid var(--rule);width:100%;max-height:280px}.screen-header{padding:10px 16px}.kpi-grid{grid-template-columns:1fr 1fr}.section-row{grid-template-columns:1fr!important}.section-cell+.section-cell{border-left:none;border-top:1px solid var(--rule)}.acc-row{grid-template-columns:20px 1fr 100px 50px;gap:8px}.timing-row{grid-template-columns:22px 100px 1fr 48px;gap:8px}}@media (width<=375px){.kpi-grid{grid-template-columns:1fr}.acc-row{grid-template-columns:1fr 80px}.acc-row .acc-n{display:none}}.license-banner{border:1px solid var(--rule);justify-content:space-between;align-items:center;gap:12px;margin-bottom:20px;padding:12px 18px;font-size:13px;display:flex}.license-banner.pill-ok{background:var(--pass-soft);border-color:var(--pass);color:var(--pass)}.license-banner.pill-warn{background:var(--revise-soft);border-color:var(--revise);color:var(--revise)}.license-banner .btn{flex-shrink:0}.run-input-row{gap:10px;margin-bottom:24px;display:flex}.run-path-input{border:1px solid var(--rule);font-size:13px;font-family:var(--mono);background:var(--panel);color:var(--ink);flex:1;padding:10px 12px}.run-path-input:disabled{opacity:.6}.run-steps{background:var(--panel);border:1px solid var(--rule);flex-wrap:wrap;gap:24px;margin-bottom:20px;padding:14px 18px;display:flex}.run-step{align-items:center;gap:8px;font-size:13px;display:flex}.run-step-label{font-weight:600}.run-step-detail{color:var(--dim);font-family:var(--mono);font-size:12px}.run-step-spinner{color:var(--accent);font-size:12px}.run-result{margin-top:4px}.component-group{border-top:1px solid var(--hair);padding:10px 0}.component-group:first-child{border-top:none}.component-group-label{margin-bottom:4px;font-size:13px;font-weight:600}.component-group-names{color:var(--dim);font-size:12.5px;line-height:1.5}.modal-backdrop{z-index:1000;background:#0006;justify-content:center;align-items:center;display:flex;position:fixed;inset:0}.modal{background:var(--panel);border:1px solid var(--rule);width:min(420px,90vw);padding:24px 28px;box-shadow:0 8px 32px #00000040}.modal h2{margin-bottom:6px}.modal .run-path-input{width:100%;margin-top:12px}.modal-message{margin-top:12px;padding:10px 12px;font-size:12.5px}.modal-actions{justify-content:flex-end;gap:8px;margin-top:18px;display:flex}@media (width<=600px){.run-input-row{flex-direction:column}.run-steps{gap:14px}}
|
|
Binary file
|
|
Binary file
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<symbol id="bluesky-icon" viewBox="0 0 16 17">
|
|
3
|
-
<g clip-path="url(#bluesky-clip)"><path fill="#08060d" d="M7.75 7.735c-.693-1.348-2.58-3.86-4.334-5.097-1.68-1.187-2.32-.981-2.74-.79C.188 2.065.1 2.812.1 3.251s.241 3.602.398 4.13c.52 1.744 2.367 2.333 4.07 2.145-2.495.37-4.71 1.278-1.805 4.512 3.196 3.309 4.38-.71 4.987-2.746.608 2.036 1.307 5.91 4.93 2.746 2.72-2.746.747-4.143-1.747-4.512 1.702.189 3.55-.4 4.07-2.145.156-.528.397-3.691.397-4.13s-.088-1.186-.575-1.406c-.42-.19-1.06-.395-2.741.79-1.755 1.24-3.64 3.752-4.334 5.099"/></g>
|
|
4
|
-
<defs><clipPath id="bluesky-clip"><path fill="#fff" d="M.1.85h15.3v15.3H.1z"/></clipPath></defs>
|
|
5
|
-
</symbol>
|
|
6
|
-
<symbol id="discord-icon" viewBox="0 0 20 19">
|
|
7
|
-
<path fill="#08060d" d="M16.224 3.768a14.5 14.5 0 0 0-3.67-1.153c-.158.286-.343.67-.47.976a13.5 13.5 0 0 0-4.067 0c-.128-.306-.317-.69-.476-.976A14.4 14.4 0 0 0 3.868 3.77C1.546 7.28.916 10.703 1.231 14.077a14.7 14.7 0 0 0 4.5 2.306q.545-.748.965-1.587a9.5 9.5 0 0 1-1.518-.74q.191-.14.372-.293c2.927 1.369 6.107 1.369 8.999 0q.183.152.372.294-.723.437-1.52.74.418.838.963 1.588a14.6 14.6 0 0 0 4.504-2.308c.37-3.911-.63-7.302-2.644-10.309m-9.13 8.234c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.894 0 1.614.82 1.599 1.82.001 1-.705 1.82-1.6 1.82m5.91 0c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.893 0 1.614.82 1.599 1.82 0 1-.706 1.82-1.6 1.82"/>
|
|
8
|
-
</symbol>
|
|
9
|
-
<symbol id="documentation-icon" viewBox="0 0 21 20">
|
|
10
|
-
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="m15.5 13.333 1.533 1.322c.645.555.967.833.967 1.178s-.322.623-.967 1.179L15.5 18.333m-3.333-5-1.534 1.322c-.644.555-.966.833-.966 1.178s.322.623.966 1.179l1.534 1.321"/>
|
|
11
|
-
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M17.167 10.836v-4.32c0-1.41 0-2.117-.224-2.68-.359-.906-1.118-1.621-2.08-1.96-.599-.21-1.349-.21-2.848-.21-2.623 0-3.935 0-4.983.369-1.684.591-3.013 1.842-3.641 3.428C3 6.449 3 7.684 3 10.154v2.122c0 2.558 0 3.838.706 4.726q.306.383.713.671c.76.536 1.79.64 3.581.66"/>
|
|
12
|
-
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M3 10a2.78 2.78 0 0 1 2.778-2.778c.555 0 1.209.097 1.748-.047.48-.129.854-.503.982-.982.145-.54.048-1.194.048-1.749a2.78 2.78 0 0 1 2.777-2.777"/>
|
|
13
|
-
</symbol>
|
|
14
|
-
<symbol id="github-icon" viewBox="0 0 19 19">
|
|
15
|
-
<path fill="#08060d" fill-rule="evenodd" d="M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844" clip-rule="evenodd"/>
|
|
16
|
-
</symbol>
|
|
17
|
-
<symbol id="social-icon" viewBox="0 0 20 20">
|
|
18
|
-
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M12.5 6.667a4.167 4.167 0 1 0-8.334 0 4.167 4.167 0 0 0 8.334 0"/>
|
|
19
|
-
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M2.5 16.667a5.833 5.833 0 0 1 8.75-5.053m3.837.474.513 1.035c.07.144.257.282.414.309l.93.155c.596.1.736.536.307.965l-.723.73a.64.64 0 0 0-.152.531l.207.903c.164.715-.213.991-.84.618l-.872-.52a.63.63 0 0 0-.577 0l-.872.52c-.624.373-1.003.094-.84-.618l.207-.903a.64.64 0 0 0-.152-.532l-.723-.729c-.426-.43-.289-.864.306-.964l.93-.156a.64.64 0 0 0 .412-.31l.513-1.034c.28-.562.735-.562 1.012 0"/>
|
|
20
|
-
</symbol>
|
|
21
|
-
<symbol id="x-icon" viewBox="0 0 19 19">
|
|
22
|
-
<path fill="#08060d" fill-rule="evenodd" d="M1.893 1.98c.052.072 1.245 1.769 2.653 3.77l2.892 4.114c.183.261.333.48.333.486s-.068.089-.152.183l-.522.593-.765.867-3.597 4.087c-.375.426-.734.834-.798.905a1 1 0 0 0-.118.148c0 .01.236.017.664.017h.663l.729-.83c.4-.457.796-.906.879-.999a692 692 0 0 0 1.794-2.038c.034-.037.301-.34.594-.675l.551-.624.345-.392a7 7 0 0 1 .34-.374c.006 0 .93 1.306 2.052 2.903l2.084 2.965.045.063h2.275c1.87 0 2.273-.003 2.266-.021-.008-.02-1.098-1.572-3.894-5.547-2.013-2.862-2.28-3.246-2.273-3.266.008-.019.282-.332 2.085-2.38l2-2.274 1.567-1.782c.022-.028-.016-.03-.65-.03h-.674l-.3.342a871 871 0 0 1-1.782 2.025c-.067.075-.405.458-.75.852a100 100 0 0 1-.803.91c-.148.172-.299.344-.99 1.127-.304.343-.32.358-.345.327-.015-.019-.904-1.282-1.976-2.808L6.365 1.85H1.8zm1.782.91 8.078 11.294c.772 1.08 1.413 1.973 1.425 1.984.016.017.241.02 1.05.017l1.03-.004-2.694-3.766L7.796 5.75 5.722 2.852l-1.039-.004-1.039-.004z" clip-rule="evenodd"/>
|
|
23
|
-
</symbol>
|
|
24
|
-
</svg>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/png" href="/brand/favicon.png" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>archscribe dashboard</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-CswIFyKN.js"></script>
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/assets/index-DWB_-3yk.css">
|
|
10
|
-
</head>
|
|
11
|
-
<body>
|
|
12
|
-
<div id="root"></div>
|
|
13
|
-
</body>
|
|
14
|
-
</html>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Every archscribe-core function the dashboard needs, re-exported from one
|
|
3
|
-
* place. The dashboard calls these DIRECTLY — never spawns `archscribe`
|
|
4
|
-
* and parses its terminal output — so this file is the one spot that knows
|
|
5
|
-
* the relative path from dashboard-server/dist back to the root dist/
|
|
6
|
-
* (requires `npm run build:ts` in the repo root before building this
|
|
7
|
-
* package; see dashboard-server/README or build-test.yml for the order).
|
|
8
|
-
*/
|
|
9
|
-
export { scanRepo, extractClasses, extractDependencies } from "../../dist/tools/scan_repo.js";
|
|
10
|
-
export { generateReport } from "../../dist/tools/generate_report.js";
|
|
11
|
-
export { loadLicense } from "../../dist/license/verify.js";
|
|
12
|
-
export { performLogin } from "../../dist/license/login-flow.js";
|
|
13
|
-
export { formatLicenseStatusLine } from "../../dist/license/status-line.js";
|
|
14
|
-
export { formatReportResultLine } from "../../dist/core/run-result.js";
|
|
15
|
-
export { renderComponentGroups } from "../../dist/core/component-groups.js";
|
|
16
|
-
export { buildRunSummary } from "../../dist/core/run-summary.js";
|
|
17
|
-
export { getPackageVersion } from "../../dist/utils/version.js";
|
|
18
|
-
export { readConfig, resolveOutputDir } from "../../dist/core/project-config.js";
|
|
19
|
-
export { checkFreshness } from "../../dist/core/freshness.js";
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GET /api/files — serves one output file by path, scoped to a run's own
|
|
3
|
-
* output directory. `path` is normally one of the absolute paths the SAME
|
|
4
|
-
* run already returned (e.g. RunSummary.report.docx_path) — the client
|
|
5
|
-
* echoes it back, the server re-validates it stays inside `dir` before
|
|
6
|
-
* ever reading it. Never serves a file that doesn't exist: a missing
|
|
7
|
-
* report.docx (Free tier skipped it) is a 404, not a fabricated "ready".
|
|
8
|
-
*/
|
|
9
|
-
import fs from "node:fs";
|
|
10
|
-
import { resolveWithinDir } from "./security.js";
|
|
11
|
-
export function handleFileDownload(req, res) {
|
|
12
|
-
const dir = req.query["dir"];
|
|
13
|
-
const filePath = req.query["path"];
|
|
14
|
-
if (typeof dir !== "string" || typeof filePath !== "string" || !dir || !filePath) {
|
|
15
|
-
res.status(400).json({ error: "dir and path query params are required" });
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const resolved = resolveWithinDir(dir, filePath);
|
|
19
|
-
if (!resolved) {
|
|
20
|
-
res.status(403).json({ error: "path escapes the given output directory" });
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
if (!fs.existsSync(resolved) || !fs.statSync(resolved).isFile()) {
|
|
24
|
-
res.status(404).json({ error: "file not found" });
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
res.download(resolved);
|
|
28
|
-
}
|
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
// Suppress the spurious Node.js 22+ localStorage warning emitted by the docx
|
|
2
|
-
// library (loaded transitively via core-bridge.js -> generateReport). Same
|
|
3
|
-
// suppression as archscribe.ts/server.ts in the root package — docx touches
|
|
4
|
-
// window.localStorage at module load; this process never passes
|
|
5
|
-
// --localstorage-file either.
|
|
6
|
-
{
|
|
7
|
-
const _origEmit = process.emit.bind(process);
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
-
process.emit = function (name, ...args) {
|
|
10
|
-
if (name === "warning") {
|
|
11
|
-
const w = args[0];
|
|
12
|
-
if (w && String(w.message).includes("localstorage-file"))
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
-
return _origEmit(name, ...args);
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
import express from "express";
|
|
20
|
-
import fs from "node:fs";
|
|
21
|
-
import os from "node:os";
|
|
22
|
-
import path from "node:path";
|
|
23
|
-
import { fileURLToPath } from "node:url";
|
|
24
|
-
import { hostGuard, authGuard, generateToken, persistToken, readPersistedToken } from "./security.js";
|
|
25
|
-
import { handleRunRequest } from "./run-route.js";
|
|
26
|
-
import { handleLicenseStatus, handleLogin } from "./license-routes.js";
|
|
27
|
-
import { handleFileDownload } from "./files-route.js";
|
|
28
|
-
import { getReview, putReview } from "./review-route.js";
|
|
29
|
-
import { getPackageVersion, checkFreshness } from "./core-bridge.js";
|
|
30
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
31
|
-
const PORT = parseInt(process.env.DASHBOARD_PORT ?? "4173", 10);
|
|
32
|
-
// DASHBOARD_PROJECTS_FILE: tests point this at a temp file, never the
|
|
33
|
-
// developer's real projects.local.json.
|
|
34
|
-
const PROJECTS_FILE = process.env.DASHBOARD_PROJECTS_FILE
|
|
35
|
-
? path.resolve(process.env.DASHBOARD_PROJECTS_FILE)
|
|
36
|
-
: path.resolve(__dirname, "../../projects.local.json");
|
|
37
|
-
const STATE_FILE = path.join(os.homedir(), ".archscribe", "state.json");
|
|
38
|
-
// Serve React build when available (built via `npm run build` in client/)
|
|
39
|
-
const CLIENT_DIST = path.resolve(__dirname, "../client-dist");
|
|
40
|
-
// A pre-chosen token (DASHBOARD_TOKEN env var) wins when present so the process
|
|
41
|
-
// that spawned this server can pin one without reading the token file back.
|
|
42
|
-
// Otherwise reuse the token a previous run persisted: minting a fresh one on
|
|
43
|
-
// every start turned every /api/* call in an already-open dashboard tab into a
|
|
44
|
-
// 401 (the tab still had the old token in sessionStorage and no way to get the
|
|
45
|
-
// new one). Only when there is no usable persisted token do we generate one.
|
|
46
|
-
// Either way it's persisted to TOKEN_FILE so any other local process can
|
|
47
|
-
// discover whichever token THIS running server actually checks.
|
|
48
|
-
const TOKEN = process.env.DASHBOARD_TOKEN && process.env.DASHBOARD_TOKEN.length >= 32
|
|
49
|
-
? process.env.DASHBOARD_TOKEN
|
|
50
|
-
: readPersistedToken() ?? generateToken();
|
|
51
|
-
persistToken(TOKEN);
|
|
52
|
-
const app = express();
|
|
53
|
-
app.use(express.json({ limit: "10mb" }));
|
|
54
|
-
// Serve React SPA static assets if built
|
|
55
|
-
if (fs.existsSync(CLIENT_DIST)) {
|
|
56
|
-
app.use(express.static(CLIENT_DIST));
|
|
57
|
-
}
|
|
58
|
-
const sseClients = [];
|
|
59
|
-
let sseClientId = 0;
|
|
60
|
-
function broadcast(event, data) {
|
|
61
|
-
const payload = `event: ${event}\ndata: ${JSON.stringify(data)}\n\n`;
|
|
62
|
-
for (const client of sseClients) {
|
|
63
|
-
client.res.write(payload);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
// ── Helpers ──────────────────────────────────────────────────────────────────
|
|
67
|
-
/** Recent projects the CLI recorded in ~/.archscribe/state.json (an npm install has no projects.local.json). */
|
|
68
|
-
function readRecentProjects() {
|
|
69
|
-
try {
|
|
70
|
-
const state = JSON.parse(fs.readFileSync(STATE_FILE, "utf-8"));
|
|
71
|
-
const out = {};
|
|
72
|
-
for (const r of state.recent ?? []) {
|
|
73
|
-
if (typeof r?.path !== "string")
|
|
74
|
-
continue;
|
|
75
|
-
const base = path.basename(r.path);
|
|
76
|
-
let name = base;
|
|
77
|
-
for (let i = 2; out[name]; i++)
|
|
78
|
-
name = `${base}-${i}`;
|
|
79
|
-
out[name] = r.path;
|
|
80
|
-
}
|
|
81
|
-
return out;
|
|
82
|
-
}
|
|
83
|
-
catch {
|
|
84
|
-
return {};
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
function readProjects() {
|
|
88
|
-
if (!fs.existsSync(PROJECTS_FILE))
|
|
89
|
-
return process.env.DASHBOARD_PROJECTS_FILE ? {} : readRecentProjects();
|
|
90
|
-
try {
|
|
91
|
-
return JSON.parse(fs.readFileSync(PROJECTS_FILE, "utf-8"));
|
|
92
|
-
}
|
|
93
|
-
catch {
|
|
94
|
-
return {};
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
function reportPath(projectPath) {
|
|
98
|
-
return path.join(projectPath, "archscribe-output", "evaluation-report.json");
|
|
99
|
-
}
|
|
100
|
-
function diagramDir(projectPath) {
|
|
101
|
-
return path.join(projectPath, "archscribe-output", "diagrams");
|
|
102
|
-
}
|
|
103
|
-
// ── Public routes (no auth — must reveal nothing sensitive) ────────────────
|
|
104
|
-
/** Health check — used by launcher to detect if server is already running. */
|
|
105
|
-
app.get("/health", (_req, res) => {
|
|
106
|
-
res.json({ status: "ok", port: PORT });
|
|
107
|
-
});
|
|
108
|
-
// ── Everything under /api/* requires same-host + the startup token ─────────
|
|
109
|
-
app.use("/api", hostGuard, authGuard(() => TOKEN));
|
|
110
|
-
app.get("/api/version", (_req, res) => {
|
|
111
|
-
res.json({ version: getPackageVersion() });
|
|
112
|
-
});
|
|
113
|
-
app.get("/api/license/status", (_req, res) => {
|
|
114
|
-
handleLicenseStatus(_req, res).catch((e) => res.status(500).json({ error: String(e) }));
|
|
115
|
-
});
|
|
116
|
-
app.post("/api/login", (req, res) => {
|
|
117
|
-
handleLogin(req, res).catch((e) => res.status(500).json({ error: String(e) }));
|
|
118
|
-
});
|
|
119
|
-
app.post("/api/run", (req, res) => {
|
|
120
|
-
handleRunRequest(req, res, broadcast).catch((e) => res.status(500).json({ error: String(e) }));
|
|
121
|
-
});
|
|
122
|
-
app.get("/api/files", handleFileDownload);
|
|
123
|
-
/** List all configured projects with metadata. */
|
|
124
|
-
app.get("/api/projects", (_req, res) => {
|
|
125
|
-
const projects = readProjects();
|
|
126
|
-
const list = Object.entries(projects).map(([name, projectPath]) => {
|
|
127
|
-
const rp = reportPath(projectPath);
|
|
128
|
-
let lastRun = null;
|
|
129
|
-
let hasReport = false;
|
|
130
|
-
if (fs.existsSync(rp)) {
|
|
131
|
-
hasReport = true;
|
|
132
|
-
try {
|
|
133
|
-
const stat = fs.statSync(rp);
|
|
134
|
-
lastRun = stat.mtime.toISOString();
|
|
135
|
-
}
|
|
136
|
-
catch {
|
|
137
|
-
// ignore
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return { name, path: projectPath, hasReport, lastRun };
|
|
141
|
-
});
|
|
142
|
-
res.json(list);
|
|
143
|
-
});
|
|
144
|
-
/** Read a project's evaluation-report.json live (no caching). */
|
|
145
|
-
app.get("/api/projects/:name/report", (req, res) => {
|
|
146
|
-
const projects = readProjects();
|
|
147
|
-
const projectPath = projects[req.params.name];
|
|
148
|
-
if (!projectPath) {
|
|
149
|
-
res.status(404).json({ error: "Project not found" });
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
const rp = reportPath(projectPath);
|
|
153
|
-
if (!fs.existsSync(rp)) {
|
|
154
|
-
res.status(404).json({ error: "No report yet — run archscribe first" });
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
try {
|
|
158
|
-
const data = JSON.parse(fs.readFileSync(rp, "utf-8"));
|
|
159
|
-
res.json(data);
|
|
160
|
-
}
|
|
161
|
-
catch {
|
|
162
|
-
res.status(500).json({ error: "Failed to parse report" });
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
app.get('/api/projects/:name/review', (req, res) => getReview(req, res, readProjects()));
|
|
166
|
-
app.put('/api/projects/:name/review/:sourceKey', (req, res) => {
|
|
167
|
-
putReview(req, res, readProjects());
|
|
168
|
-
if (res.statusCode === 200)
|
|
169
|
-
broadcast('review-updated', { project: req.params.name });
|
|
170
|
-
});
|
|
171
|
-
/** List .drawio files in a project's archscribe-output dir. */
|
|
172
|
-
app.get("/api/projects/:name/diagrams", (req, res) => {
|
|
173
|
-
const projects = readProjects();
|
|
174
|
-
const projectPath = projects[req.params.name];
|
|
175
|
-
if (!projectPath) {
|
|
176
|
-
res.status(404).json({ error: "Project not found" });
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
const dir = diagramDir(projectPath);
|
|
180
|
-
if (!fs.existsSync(dir)) {
|
|
181
|
-
res.json([]);
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
const files = fs.readdirSync(dir)
|
|
185
|
-
.filter((f) => f.endsWith(".drawio"))
|
|
186
|
-
.map((f) => ({ name: f, path: path.join(dir, f) }));
|
|
187
|
-
res.json(files);
|
|
188
|
-
});
|
|
189
|
-
/**
|
|
190
|
-
* Receive new report data from the archscribe pipeline (via dashboard-launcher).
|
|
191
|
-
* Saves to disk and notifies SSE clients.
|
|
192
|
-
*/
|
|
193
|
-
app.post("/api/projects/:name/report", (req, res) => {
|
|
194
|
-
const projects = readProjects();
|
|
195
|
-
const projectPath = projects[req.params.name];
|
|
196
|
-
if (!projectPath) {
|
|
197
|
-
res.status(404).json({ error: "Project not found" });
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
const rp = reportPath(projectPath);
|
|
201
|
-
try {
|
|
202
|
-
// Persist the incoming report (pipeline already wrote it; this is a
|
|
203
|
-
// push notification so the React client can update without polling)
|
|
204
|
-
const data = req.body;
|
|
205
|
-
fs.mkdirSync(path.dirname(rp), { recursive: true });
|
|
206
|
-
fs.writeFileSync(rp, JSON.stringify(data, null, 2), "utf-8");
|
|
207
|
-
broadcast("report-updated", { project: req.params.name });
|
|
208
|
-
res.json({ ok: true });
|
|
209
|
-
}
|
|
210
|
-
catch (e) {
|
|
211
|
-
res.status(500).json({ error: String(e) });
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
/** SSE endpoint — clients subscribe to live report updates. EventSource can't set headers, so the client passes the token via ?token= (see authGuard). */
|
|
215
|
-
app.get("/api/events", (req, res) => {
|
|
216
|
-
res.setHeader("Content-Type", "text/event-stream");
|
|
217
|
-
res.setHeader("Cache-Control", "no-cache");
|
|
218
|
-
res.setHeader("Connection", "keep-alive");
|
|
219
|
-
res.flushHeaders();
|
|
220
|
-
const id = ++sseClientId;
|
|
221
|
-
sseClients.push({ res, id });
|
|
222
|
-
// Heartbeat every 25s to keep connection alive through proxies
|
|
223
|
-
const heartbeat = setInterval(() => {
|
|
224
|
-
res.write(": heartbeat\n\n");
|
|
225
|
-
}, 25_000);
|
|
226
|
-
req.on("close", () => {
|
|
227
|
-
clearInterval(heartbeat);
|
|
228
|
-
const idx = sseClients.findIndex((c) => c.id === id);
|
|
229
|
-
if (idx >= 0)
|
|
230
|
-
sseClients.splice(idx, 1);
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
/** B3 — are the generated docs stale? Compares the sources with archscribe-output/manifest.json. */
|
|
234
|
-
app.get("/api/projects/:name/freshness", (req, res) => {
|
|
235
|
-
const projectPath = readProjects()[req.params.name];
|
|
236
|
-
if (!projectPath) {
|
|
237
|
-
res.status(404).json({ error: "Project not found" });
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
res.json(checkFreshness(projectPath, path.join(projectPath, "archscribe-output")));
|
|
241
|
-
});
|
|
242
|
-
/** Read run history for a project from runs/<slug>/run-meta.json files. */
|
|
243
|
-
app.get("/api/projects/:name/runs", (req, res) => {
|
|
244
|
-
const projects = readProjects();
|
|
245
|
-
const projectPath = projects[req.params.name];
|
|
246
|
-
if (!projectPath) {
|
|
247
|
-
res.status(404).json({ error: "Project not found" });
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
const runsDir = path.join(projectPath, "archscribe-output", "runs");
|
|
251
|
-
if (!fs.existsSync(runsDir)) {
|
|
252
|
-
res.json([]);
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
try {
|
|
256
|
-
const entries = fs.readdirSync(runsDir, { withFileTypes: true })
|
|
257
|
-
.filter((e) => e.isDirectory()).map((e) => e.name).sort().reverse();
|
|
258
|
-
const runs = entries.flatMap((dir) => {
|
|
259
|
-
try {
|
|
260
|
-
return [JSON.parse(fs.readFileSync(path.join(runsDir, dir, "run-meta.json"), "utf8"))];
|
|
261
|
-
}
|
|
262
|
-
catch {
|
|
263
|
-
return [];
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
res.json(runs);
|
|
267
|
-
}
|
|
268
|
-
catch {
|
|
269
|
-
res.json([]);
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
// A request under /api/* that doesn't match any route above is a client
|
|
273
|
-
// bug (wrong endpoint), not a page navigation — it must 404 as JSON, not
|
|
274
|
-
// fall through to the SPA catch-all below. Without this, a mistyped API
|
|
275
|
-
// call gets back index.html's HTML with a 200, which surfaces client-side
|
|
276
|
-
// as "Unexpected token '<'" from JSON.parse() — a confusing failure mode
|
|
277
|
-
// for what's actually a 404. Registered AFTER every real /api/* route
|
|
278
|
-
// above (Express matches routes in registration order) and BEFORE the
|
|
279
|
-
// catch-all below, so it only catches what nothing else did.
|
|
280
|
-
app.use("/api", (_req, res) => {
|
|
281
|
-
res.status(404).json({ error: "Not found" });
|
|
282
|
-
});
|
|
283
|
-
// SPA fallback — serve index.html for any unmatched route (React Router)
|
|
284
|
-
if (fs.existsSync(CLIENT_DIST)) {
|
|
285
|
-
app.get("*", (_req, res) => {
|
|
286
|
-
res.sendFile(path.join(CLIENT_DIST, "index.html"));
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
// Bind 127.0.0.1 ONLY — this server runs real core functions (scanRepo,
|
|
290
|
-
// generateReport, activateOnline) with filesystem and license-server access;
|
|
291
|
-
// it must never be reachable from the local network, only this machine.
|
|
292
|
-
app.listen(PORT, "127.0.0.1", () => {
|
|
293
|
-
console.log(`archscribe dashboard running on http://localhost:${PORT}/?token=${TOKEN}`);
|
|
294
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { loadLicense, performLogin, formatLicenseStatusLine } from "./core-bridge.js";
|
|
2
|
-
export async function handleLicenseStatus(_req, res) {
|
|
3
|
-
const check = await loadLicense([]);
|
|
4
|
-
res.json({ ...check, line: formatLicenseStatusLine(check) });
|
|
5
|
-
}
|
|
6
|
-
export async function handleLogin(req, res) {
|
|
7
|
-
const body = req.body;
|
|
8
|
-
const licenseKey = body.licenseKey;
|
|
9
|
-
if (!licenseKey || typeof licenseKey !== "string" || !licenseKey.trim()) {
|
|
10
|
-
res.status(400).json({ error: "licenseKey is required" });
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const outcome = await performLogin(licenseKey);
|
|
14
|
-
if (outcome.kind === "ok") {
|
|
15
|
-
const { session } = outcome;
|
|
16
|
-
res.json({
|
|
17
|
-
kind: "ok",
|
|
18
|
-
tier: session.tier,
|
|
19
|
-
licensee: session.licensee,
|
|
20
|
-
expiresAt: session.expiresAt,
|
|
21
|
-
line: formatLicenseStatusLine({ tier: session.tier, code: session.tier === "pro" ? "pro" : "free_plan", licensee: session.licensee, expiresAt: session.expiresAt, reason: "login" }),
|
|
22
|
-
});
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (outcome.kind === "already_logged_in") {
|
|
26
|
-
// D1: the dashboard never silently replaces another key — use the CLI.
|
|
27
|
-
res.status(409).json({
|
|
28
|
-
kind: "already_logged_in",
|
|
29
|
-
message: `This machine already uses another license (key ending ${outcome.currentKeyHint}). Run \`archscribe logout\` or \`archscribe login --switch\` in a terminal.`,
|
|
30
|
-
});
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (outcome.kind === "denied") {
|
|
34
|
-
res.status(401).json({ kind: "denied", code: outcome.code, message: outcome.message });
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
res.status(503).json({ kind: "unavailable", message: outcome.message });
|
|
38
|
-
// Never echo `licenseKey` back in any branch above.
|
|
39
|
-
}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { createHash } from 'node:crypto';
|
|
4
|
-
import { sourceKey } from '../../dist/core/review-rerun.js';
|
|
5
|
-
import { loadReviewLedger, approveReview, saveReviewLedger } from '../../dist/core/review-ledger.js';
|
|
6
|
-
import { extractUseCaseSection } from '../../dist/utils/approval.js';
|
|
7
|
-
import { sha256File } from '../../dist/core/manifest.js';
|
|
8
|
-
import { currentReviewBaseFingerprint } from '../../dist/tools/review-tasks.js';
|
|
9
|
-
const output = (project) => path.join(project, 'archscribe-output');
|
|
10
|
-
const version = (project) => {
|
|
11
|
-
const file = path.join(project, '.archscribe', 'review.json');
|
|
12
|
-
return createHash('sha256').update(fs.existsSync(file) ? fs.readFileSync(file) : Buffer.from('')).digest('hex');
|
|
13
|
-
};
|
|
14
|
-
function current(project) {
|
|
15
|
-
const report = JSON.parse(fs.readFileSync(path.join(output(project), 'evaluation-report.json'), 'utf8'));
|
|
16
|
-
if (!Array.isArray(report.usecases))
|
|
17
|
-
throw new Error('Invalid evaluation use cases');
|
|
18
|
-
const flows = report.usecases.map((flow) => ({ ...flow, key: sourceKey(flow) }));
|
|
19
|
-
if (new Set(flows.map((flow) => flow.key)).size !== flows.length)
|
|
20
|
-
throw new Error('Ambiguous use case source');
|
|
21
|
-
return flows;
|
|
22
|
-
}
|
|
23
|
-
function reviewedFlows(project, ledger) {
|
|
24
|
-
const markdown = fs.readFileSync(path.join(output(project), 'report.md'), 'utf8');
|
|
25
|
-
return current(project).map((flow) => ({ ...flow,
|
|
26
|
-
spec: extractUseCaseSection(markdown, flow.id) ?? '',
|
|
27
|
-
draft: ledger.entries[flow.key]?.status === 'draft' ? Object.fromEntries(Object.entries(ledger.entries[flow.key].draft ?? {}).map(([kind, relative]) => [kind, fs.readFileSync(reviewArtifact(project, relative), 'utf8')])) : undefined,
|
|
28
|
-
sourceState: sourceState(project, flow, ledger.entries[flow.key]),
|
|
29
|
-
}));
|
|
30
|
-
}
|
|
31
|
-
function reviewArtifact(project, relative) {
|
|
32
|
-
const base = path.resolve(project, '.archscribe', 'review');
|
|
33
|
-
const file = path.resolve(project, '.archscribe', relative);
|
|
34
|
-
if (!file.startsWith(base + path.sep))
|
|
35
|
-
throw new Error('Invalid review artifact path');
|
|
36
|
-
return file;
|
|
37
|
-
}
|
|
38
|
-
function sourceState(project, flow, entry) {
|
|
39
|
-
const file = flow.sourceTrace?.[0]?.split(' -> ')[0];
|
|
40
|
-
if (!file)
|
|
41
|
-
return 'missing';
|
|
42
|
-
const manifest = JSON.parse(fs.readFileSync(path.join(output(project), 'manifest.json'), 'utf8'));
|
|
43
|
-
const root = path.resolve(project, manifest.sourceRoot);
|
|
44
|
-
const source = path.resolve(root, file);
|
|
45
|
-
if (!source.startsWith(root + path.sep) || !fs.existsSync(source))
|
|
46
|
-
return 'missing';
|
|
47
|
-
const previous = entry?.sourceFingerprint ?? manifest.files?.[path.posix.join(manifest.sourceRoot.replace(/\\/g, '/'), file.replace(/\\/g, '/'))];
|
|
48
|
-
return previous && previous !== sha256File(source) ? 'changed' : 'current';
|
|
49
|
-
}
|
|
50
|
-
export function getReview(req, res, projects) {
|
|
51
|
-
const project = projects[req.params.name];
|
|
52
|
-
if (!project || !fs.existsSync(path.join(output(project), 'evaluation-report.json'))) {
|
|
53
|
-
res.status(404).json({ error: 'Project report not found' });
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
try {
|
|
57
|
-
const ledger = loadReviewLedger(project);
|
|
58
|
-
res.json({ version: version(project), entries: ledger.entries, usecases: reviewedFlows(project, ledger) });
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
res.status(500).json({ error: String(error) });
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
export function putReview(req, res, projects) {
|
|
65
|
-
const project = projects[req.params.name];
|
|
66
|
-
if (!project || !fs.existsSync(path.join(output(project), 'evaluation-report.json'))) {
|
|
67
|
-
res.status(404).json({ error: 'Project report not found' });
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
try {
|
|
71
|
-
const flow = current(project).find((item) => item.key === req.params.sourceKey);
|
|
72
|
-
if (!flow) {
|
|
73
|
-
res.status(404).json({ error: 'Use case not in current report' });
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const { version: expected, status, note } = req.body ?? {};
|
|
77
|
-
if (typeof expected !== 'string' || !['approved', 'needs-fix', 'pending'].includes(status) ||
|
|
78
|
-
(note !== undefined && (typeof note !== 'string' || note.length > 10000))) {
|
|
79
|
-
res.status(400).json({ error: 'Invalid review update' });
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
const ledger = loadReviewLedger(project);
|
|
83
|
-
if (expected !== version(project)) {
|
|
84
|
-
res.status(409).json({ error: 'Review changed; reload before saving' });
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
let entry;
|
|
88
|
-
if (status === 'approved') {
|
|
89
|
-
const previous = ledger.entries[flow.key];
|
|
90
|
-
if (previous?.status === 'draft' && !previous.draft?.spec)
|
|
91
|
-
throw new Error('Incomplete review draft');
|
|
92
|
-
if (previous?.status === 'draft' && previous.baseFingerprint !== currentReviewBaseFingerprint(project, flow.key, previous.note)) {
|
|
93
|
-
res.status(409).json({ error: 'Review draft is based on an older report or source; rerun the agent review before approving' });
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
const specText = extractUseCaseSection(fs.readFileSync(path.join(output(project), 'report.md'), 'utf8'), flow.id);
|
|
97
|
-
if (!specText)
|
|
98
|
-
throw new Error('Use case spec not found in report');
|
|
99
|
-
const temp = path.join(project, '.archscribe', `review-spec-${process.pid}-${Date.now()}.md`);
|
|
100
|
-
fs.mkdirSync(path.dirname(temp), { recursive: true });
|
|
101
|
-
try {
|
|
102
|
-
fs.writeFileSync(temp, specText, { flag: 'wx' });
|
|
103
|
-
const artifacts = { spec: temp };
|
|
104
|
-
for (const kind of ['activity', 'sequence']) {
|
|
105
|
-
const relative = kind === 'activity' ? flow.activityDiagramPath : flow.sequenceDiagramPath;
|
|
106
|
-
if (!relative)
|
|
107
|
-
continue;
|
|
108
|
-
const base = path.resolve(output(project));
|
|
109
|
-
const file = path.resolve(base, relative);
|
|
110
|
-
if (!file.startsWith(base + path.sep) || path.extname(file) !== '.drawio')
|
|
111
|
-
throw new Error('Invalid diagram path');
|
|
112
|
-
artifacts[kind] = file;
|
|
113
|
-
}
|
|
114
|
-
if (previous?.status === 'draft')
|
|
115
|
-
for (const kind of ['spec', 'activity', 'sequence']) {
|
|
116
|
-
if (previous.draft?.[kind])
|
|
117
|
-
artifacts[kind] = reviewArtifact(project, previous.draft[kind]);
|
|
118
|
-
}
|
|
119
|
-
const relative = flow.sourceTrace?.[0]?.split(' -> ')[0];
|
|
120
|
-
const manifest = JSON.parse(fs.readFileSync(path.join(output(project), 'manifest.json'), 'utf8'));
|
|
121
|
-
const source = relative && path.resolve(project, manifest.sourceRoot, relative);
|
|
122
|
-
const base = path.resolve(project, manifest.sourceRoot);
|
|
123
|
-
if (!source || !source.startsWith(base + path.sep) || !fs.existsSync(source)) {
|
|
124
|
-
res.status(409).json({ error: 'Source missing; reconcile before approving' });
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
const sourceFingerprint = sha256File(source);
|
|
128
|
-
const manifestKey = relative && path.posix.join(manifest.sourceRoot.replace(/\\/g, '/'), relative.replace(/\\/g, '/'));
|
|
129
|
-
if (manifestKey && manifest.files?.[manifestKey] && sourceFingerprint !== manifest.files[manifestKey]) {
|
|
130
|
-
res.status(409).json({ error: 'Source changed since report generation; rerun before approving' });
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
entry = approveReview(project, flow.key, artifacts, { title: flow.title, endpoint: flow.endpoint, sourceFingerprint });
|
|
134
|
-
}
|
|
135
|
-
finally {
|
|
136
|
-
fs.rmSync(temp, { force: true });
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
entry = { ...ledger.entries[flow.key], key: flow.key, title: flow.title, endpoint: flow.endpoint,
|
|
141
|
-
status, note: note ?? ledger.entries[flow.key]?.note ?? '' };
|
|
142
|
-
ledger.entries[flow.key] = entry;
|
|
143
|
-
saveReviewLedger(project, ledger);
|
|
144
|
-
}
|
|
145
|
-
res.json({ version: version(project), entry });
|
|
146
|
-
}
|
|
147
|
-
catch (error) {
|
|
148
|
-
res.status(500).json({ error: String(error) });
|
|
149
|
-
}
|
|
150
|
-
}
|