feat(web): add shell-first runbook UI and mock demo (#2)
Add notebook parameters, literal highlighted scripts, copy helpers, streamed runs, host-key confirmation, artifacts, conditional notes, login and optimistic Markdown editing. Keep the temporary core renderer isolated to mock mode. Use React and Vite for the UI, react-markdown for safe Markdown rendering, highlight.js for shell syntax, and CodeMirror 6 for Markdown editing. Add Testing Library, jsdom and Vitest for component and event-state coverage. Validate pnpm install, root typecheck and test (29 web tests, 1 server test), plus normal and mock web builds. Core contracts remain unchanged; real backend execution awaits the parallel core/server implementations.
This commit is contained in:
@@ -0,0 +1,441 @@
|
||||
@import "highlight.js/styles/github-dark.css";
|
||||
:root {
|
||||
font-family: Inter, ui-sans-serif, system-ui, sans-serif;
|
||||
color: #dce3ec;
|
||||
background: #11151b;
|
||||
color-scheme: dark;
|
||||
--panel: #191f28;
|
||||
--line: #303a49;
|
||||
--muted: #9ba9bb;
|
||||
--accent: #86dab9;
|
||||
--code: #10151c;
|
||||
}
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
button,
|
||||
input,
|
||||
select {
|
||||
font: inherit;
|
||||
}
|
||||
button {
|
||||
cursor: pointer;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 5px;
|
||||
background: var(--panel);
|
||||
color: inherit;
|
||||
padding: 7px 11px;
|
||||
}
|
||||
button:hover {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
button:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
button.primary {
|
||||
background: var(--accent);
|
||||
color: #12261f;
|
||||
font-weight: 650;
|
||||
}
|
||||
input,
|
||||
select {
|
||||
width: 100%;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 4px;
|
||||
background: var(--code);
|
||||
color: inherit;
|
||||
padding: 8px;
|
||||
}
|
||||
input:focus,
|
||||
select:focus,
|
||||
button:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.app {
|
||||
display: grid;
|
||||
grid-template-columns: 230px minmax(0, 1fr);
|
||||
min-height: 100vh;
|
||||
}
|
||||
.with-terminal {
|
||||
grid-template-columns: 230px minmax(0, 1fr) 300px;
|
||||
}
|
||||
.sidebar {
|
||||
background: var(--panel);
|
||||
border-right: 1px solid var(--line);
|
||||
padding: 24px 14px;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.sidebar h1 {
|
||||
font-size: 23px;
|
||||
margin: 0 10px 32px;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
.sidebar h1 span {
|
||||
display: block;
|
||||
font-size: 10px;
|
||||
letter-spacing: 3px;
|
||||
color: var(--muted);
|
||||
margin-top: 8px;
|
||||
}
|
||||
.sidebar nav button {
|
||||
display: block;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
margin-bottom: 6px;
|
||||
padding: 12px;
|
||||
border-color: transparent;
|
||||
}
|
||||
.sidebar nav button.selected {
|
||||
background: var(--code);
|
||||
border-color: var(--line);
|
||||
border-left: 3px solid var(--accent);
|
||||
}
|
||||
small {
|
||||
font-size: 12px;
|
||||
}
|
||||
.sidebar small {
|
||||
display: block;
|
||||
color: var(--muted);
|
||||
margin-top: 5px;
|
||||
}
|
||||
.connection {
|
||||
margin-top: auto !important;
|
||||
padding: 10px;
|
||||
}
|
||||
main {
|
||||
min-width: 0;
|
||||
}
|
||||
.toolbar {
|
||||
min-height: 60px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 10px 24px;
|
||||
}
|
||||
.toolbar > span {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.params {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
background: var(--panel);
|
||||
border-bottom: 1px solid var(--line);
|
||||
padding: 14px 24px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
}
|
||||
.params label {
|
||||
flex: 1;
|
||||
min-width: 145px;
|
||||
max-width: 280px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.params label > span {
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.params b {
|
||||
color: var(--accent);
|
||||
}
|
||||
.notebook {
|
||||
max-width: 1100px;
|
||||
margin: auto;
|
||||
padding: 22px 28px 80px;
|
||||
}
|
||||
.prose {
|
||||
line-height: 1.7;
|
||||
}
|
||||
.prose h1 {
|
||||
font-size: 30px;
|
||||
letter-spacing: -0.7px;
|
||||
}
|
||||
.prose code {
|
||||
background: var(--panel);
|
||||
padding: 2px 5px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.prose pre {
|
||||
overflow: auto;
|
||||
}
|
||||
.step {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 7px;
|
||||
background: var(--panel);
|
||||
margin: 20px 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.step header {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
padding: 13px 16px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.step h3 {
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
}
|
||||
.badge {
|
||||
font:
|
||||
11px ui-monospace,
|
||||
monospace;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 4px;
|
||||
padding: 3px 6px;
|
||||
color: var(--accent);
|
||||
}
|
||||
.target {
|
||||
margin-left: auto;
|
||||
font:
|
||||
12px ui-monospace,
|
||||
monospace;
|
||||
color: var(--muted);
|
||||
}
|
||||
pre.script {
|
||||
background: var(--code);
|
||||
margin: 0;
|
||||
padding: 22px 18px;
|
||||
overflow: auto;
|
||||
font:
|
||||
14px/1.8 "Cascadia Code",
|
||||
Consolas,
|
||||
monospace;
|
||||
tab-size: 2;
|
||||
user-select: text;
|
||||
}
|
||||
.script mark {
|
||||
background: #714c22;
|
||||
color: #ffe3a7;
|
||||
border-bottom: 2px solid #ffc568;
|
||||
}
|
||||
.actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
margin: 12px 0;
|
||||
}
|
||||
.step > .actions {
|
||||
padding: 0 14px;
|
||||
}
|
||||
.spacer {
|
||||
flex: 1;
|
||||
}
|
||||
.step > small {
|
||||
display: block;
|
||||
padding: 0 14px 12px;
|
||||
}
|
||||
.error {
|
||||
color: #ff9d9d;
|
||||
}
|
||||
.step > .error {
|
||||
padding: 0 14px;
|
||||
}
|
||||
.result {
|
||||
border-top: 1px solid var(--line);
|
||||
padding: 14px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.result pre {
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
max-height: 330px;
|
||||
overflow: auto;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.stderr {
|
||||
color: #ff9d9d;
|
||||
}
|
||||
.success {
|
||||
border-color: #38765f;
|
||||
}
|
||||
.failure {
|
||||
border-color: #914e56;
|
||||
}
|
||||
a {
|
||||
color: var(--accent);
|
||||
}
|
||||
.artifact {
|
||||
display: inline-block;
|
||||
margin: 6px 15px 0 0;
|
||||
}
|
||||
.after {
|
||||
border-left: 3px solid var(--accent);
|
||||
padding-left: 18px;
|
||||
}
|
||||
.banner {
|
||||
padding: 14px 24px;
|
||||
background: var(--panel);
|
||||
}
|
||||
.banner button {
|
||||
margin-left: 12px;
|
||||
}
|
||||
.terminal {
|
||||
border-left: 1px solid var(--line);
|
||||
padding: 20px;
|
||||
background: var(--code);
|
||||
}
|
||||
.terminal h2 {
|
||||
font-size: 15px;
|
||||
}
|
||||
.terminal p,
|
||||
.muted {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
.editor {
|
||||
border: 1px solid var(--line);
|
||||
font-size: 13px;
|
||||
background: var(--code);
|
||||
}
|
||||
.cm-editor {
|
||||
min-height: 280px;
|
||||
}
|
||||
.cm-scroller {
|
||||
max-height: 480px;
|
||||
}
|
||||
.cm-gutters {
|
||||
background: var(--panel) !important;
|
||||
color: var(--muted) !important;
|
||||
border-color: var(--line) !important;
|
||||
}
|
||||
.cm-activeLine {
|
||||
background: #8881 !important;
|
||||
}
|
||||
.cm-cursor {
|
||||
border-left-color: var(--accent) !important;
|
||||
}
|
||||
.modal-backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: #000a;
|
||||
z-index: 10;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
padding: 20px;
|
||||
}
|
||||
.modal-backdrop section {
|
||||
background: var(--panel);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
padding: 24px;
|
||||
max-width: 600px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.modal-backdrop h2 {
|
||||
font-size: 20px;
|
||||
}
|
||||
.modal-backdrop button {
|
||||
margin: 12px 8px 0 0;
|
||||
}
|
||||
.login {
|
||||
max-width: 360px;
|
||||
margin: 15vh auto;
|
||||
padding: 20px;
|
||||
}
|
||||
.login input {
|
||||
margin: 10px 0 16px;
|
||||
}
|
||||
.login button {
|
||||
width: 100%;
|
||||
}
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root {
|
||||
color-scheme: light;
|
||||
color: #233244;
|
||||
background: #fafbfc;
|
||||
--panel: #f0f3f6;
|
||||
--line: #cbd4df;
|
||||
--muted: #57687d;
|
||||
--accent: #197b59;
|
||||
--code: #fff;
|
||||
}
|
||||
.error,
|
||||
.stderr {
|
||||
color: #b42738;
|
||||
}
|
||||
.hljs-built_in,
|
||||
.hljs-string,
|
||||
.hljs-attr {
|
||||
color: #13654a;
|
||||
}
|
||||
.hljs-keyword,
|
||||
.hljs-variable {
|
||||
color: #8f3d8b;
|
||||
}
|
||||
button.primary {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
@media (max-width: 900px) {
|
||||
.app,
|
||||
.with-terminal {
|
||||
grid-template-columns: 170px minmax(0, 1fr);
|
||||
}
|
||||
.terminal {
|
||||
grid-column: 2;
|
||||
}
|
||||
.notebook {
|
||||
padding: 16px;
|
||||
}
|
||||
.params {
|
||||
padding: 12px;
|
||||
}
|
||||
.toolbar {
|
||||
padding: 10px;
|
||||
}
|
||||
.target {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
@media (max-width: 580px) {
|
||||
.app,
|
||||
.with-terminal {
|
||||
display: block;
|
||||
}
|
||||
.sidebar {
|
||||
height: auto;
|
||||
position: static;
|
||||
padding: 12px;
|
||||
}
|
||||
.sidebar h1 {
|
||||
margin: 0 0 12px;
|
||||
}
|
||||
.sidebar nav button {
|
||||
padding: 8px;
|
||||
}
|
||||
.connection {
|
||||
display: none !important;
|
||||
}
|
||||
.params {
|
||||
position: static;
|
||||
}
|
||||
.toolbar {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.toolbar > span {
|
||||
flex-basis: 100%;
|
||||
}
|
||||
.step .actions button {
|
||||
font-size: 12px;
|
||||
}
|
||||
.terminal {
|
||||
min-height: 200px;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user