Add fx bootstrap.sh and copy-paste command on the live page
This commit is contained in:
+52
-1
@@ -20,6 +20,26 @@
|
||||
}
|
||||
h1{font-size:1.4rem; margin:0 0 .4rem; font-weight:600;}
|
||||
header p{color:var(--dim); margin:.2rem 0; font-size:.92rem;}
|
||||
.runbox{
|
||||
max-width:900px; margin:0 auto 1.5rem; padding:0 1.5rem;
|
||||
}
|
||||
.runbox-label{font-size:.78rem; text-transform:uppercase; letter-spacing:.06em; color:var(--dim); margin-bottom:.4rem;}
|
||||
.runbox-cmd{
|
||||
display:flex; align-items:stretch; gap:0; background:var(--panel);
|
||||
border:1px solid var(--accent); border-radius:8px; overflow:hidden;
|
||||
}
|
||||
.runbox-cmd code{
|
||||
flex:1; padding:.75rem .9rem; font-size:.82rem; overflow-x:auto;
|
||||
white-space:pre; color:var(--ok);
|
||||
}
|
||||
.runbox-cmd button{
|
||||
flex-shrink:0; background:var(--accent); border:0; color:#0b0d10;
|
||||
font:inherit; font-weight:600; font-size:.8rem; padding:0 1.1rem; cursor:pointer;
|
||||
}
|
||||
.runbox-cmd button:hover{opacity:.9;}
|
||||
.runbox-cmd button.copied{background:var(--ok);}
|
||||
.runbox-note{color:var(--dim); font-size:.8rem; margin-top:.5rem; line-height:1.5;}
|
||||
.runbox-note code{background:#171b22; padding:.05rem .3rem; border-radius:4px;}
|
||||
main{max-width:900px; margin:0 auto; padding:0 1.5rem 3rem; display:grid; gap:1.25rem; grid-template-columns:1fr; }
|
||||
@media (min-width:760px){ main{grid-template-columns: 1.3fr .9fr;} }
|
||||
.panel{
|
||||
@@ -70,9 +90,18 @@
|
||||
<header>
|
||||
<h1>🔁 Self-Healing Autopoietic Shell</h1>
|
||||
<p>A shell function that learns from its own failures — run a command, teach it a fix when it fails, and it never fails that way again.</p>
|
||||
<p class="dim">This is a live simulation of <code>f()</code> running entirely in your browser. Try a command below.</p>
|
||||
<p class="dim">The simulation below is a browser mockup, not a real shell — this page is static, so nothing here can actually execute anything. To run the real thing in your real shell:</p>
|
||||
</header>
|
||||
|
||||
<div class="runbox">
|
||||
<div class="runbox-label">run this in your terminal — no git clone needed</div>
|
||||
<div class="runbox-cmd">
|
||||
<code id="bootstrapCmd">eval "$(curl -fsSL https://huggingface.co/spaces/Daveswo/self-healing-autopoietic-shell/raw/main/contrib/fx/bootstrap.sh)"</code>
|
||||
<button id="copyBtn" type="button">copy</button>
|
||||
</div>
|
||||
<div class="runbox-note">fetches <code>f()</code>, <code>fx()</code>, and all default fix-sources into a temp dir and sources them into your <em>current</em> shell — add the same line to your rc file to keep it every session.</div>
|
||||
</div>
|
||||
|
||||
<main>
|
||||
<div class="panel">
|
||||
<h2>Simulated shell</h2>
|
||||
@@ -244,6 +273,28 @@
|
||||
print('// try: cat needs-fix.txt', 'dim');
|
||||
print('// it will fail once — teach it a fix like: echo hello > needs-fix.txt', 'dim');
|
||||
})();
|
||||
|
||||
(function(){
|
||||
const btn = document.getElementById('copyBtn');
|
||||
const codeEl = document.getElementById('bootstrapCmd');
|
||||
if(!btn || !codeEl) return;
|
||||
btn.addEventListener('click', async () => {
|
||||
try{
|
||||
await navigator.clipboard.writeText(codeEl.textContent);
|
||||
}catch(e){
|
||||
const range = document.createRange();
|
||||
range.selectNode(codeEl);
|
||||
window.getSelection().removeAllRanges();
|
||||
window.getSelection().addRange(range);
|
||||
document.execCommand('copy');
|
||||
window.getSelection().removeAllRanges();
|
||||
}
|
||||
const original = btn.textContent;
|
||||
btn.textContent = 'copied';
|
||||
btn.classList.add('copied');
|
||||
setTimeout(() => { btn.textContent = original; btn.classList.remove('copied'); }, 1500);
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user