Files
zeekayandHanzo Dev 10c0782526 hanzo-app: give every example a product, a brand and a builder
`ex-admin`, `ex-kanban`, `ex-shop`. That is not a name, it is a filing
code, and it told every visitor that what they were looking at was a
sample of something rather than a thing. Nobody bookmarks Example #47.

So each one is now a product: a name, a mark, a hue that drives the kit's
--acc so the whole page inherits it, and a tagline in its own voice.
ex-kanban is Lanes — "a board with WIP limits that mean something, because
they stop you". The identity lives in ONE place (products.json) and the
shell is the only way a product is built, so an unbranded page cannot be
published.

AND A BUILDER. Ten named agents (agents.json), each with a discipline and
a body of work, each with a generated avatar. The byline reads "<Product>
— published by Hanzo AI, built by <Agent>, an AI agent working on <X>".
That is honest attribution, not decoration: the agent really did write the
app. They are described as what they are and never dressed as people — no
biography, no employer, no photograph, no testimonial. HIP-903. An agent
that genuinely built the thing needs none of that, and inventing it would
turn a true story into a false one.

LINEAGE IS RECORDED, NOT ASSERTED. Every product's project is created by
POST /v1/projects/fork from a gallery template, so projects.forked_from is
a fact the platform wrote at fork time. 74/74, across 28 parent templates.

AND FOR SIX OF THEM, THE BYTES ARE THE TEMPLATE'S. derive.py checks out
the parent, applies the agent's edit to its SOURCE, runs the template's
own build, and ships that. The diff is the point — proof the product is a
derivative and proof a template is agent-editable, in one artifact. It
also found what the pre-built demos were hiding: four templates did not
compile at all, and several 404'd on an /api/placeholder route that cannot
exist on a static host. Fixed upstream and in the edit respectively.

The other 68 carry a real fork edge but ship the kit build. Said plainly
in the README rather than papered over.

One slug now names the source file, the project and the host.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-28 09:36:36 -07:00

96 lines
5.7 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--hz {"title":"Stockroom","archetype":"inventory","creator":"apps","desc":"Inventory control: stock on hand across locations, reorder points, stock movements ledger and a receive/issue form backed by @hanzo/base.","nav":[["#/","Stock"],["#/moves","Movements"],["#/reorder","Reorder"]]} -->
<div class="row" style="margin-bottom:14px">
<h1 style="margin:0">Stockroom</h1><span class="tag" id="kpi"></span>
<span class="spacer"></span>
<button class="p" id="recv">Receive</button><button id="issue">Issue</button>
</div>
<div id="view"></div>
<p class="hz-note" style="margin-top:16px">SKUs, quantities and suppliers are synthetic demo data. Movements you post are appended locally and to @hanzo/base.</p>
<script>
const {h,fill,$,store,rng,range,pick,uid,fmt,grid,bars,donut,modal,toast,submit,route,spark} = hz;
const r = rng(9012);
const LOCS = ['SFO-1','ORD-2','AMS-1'];
const NAMES = ['Hex bolt M6','Hex bolt M8','Bearing 608ZZ','Belt 300mm','Stepper NEMA17','Driver A4988','PSU 24V 5A',
'Filament PLA 1kg','Filament PETG 1kg','Nozzle 0.4mm','Heat block','Thermistor 100k','Limit switch','Cable drag 10x20',
'Alu extrusion 2020','Coupler 5x8','Lead screw T8','Fan 40mm','Fan 60mm','Glass bed 235'];
const seed = NAMES.map((n,i)=>({
id: uid(), sku:'SR-'+String(1000+i*7), name:n,
loc: LOCS[i%3], qty: Math.round(r()*260), rop: 40+Math.round(r()*60),
cost: +(2+r()*48).toFixed(2), sup: pick(r,['Northwind','Cedarline','Ironleaf','Kestrel']),
hist: range(14,()=>Math.round(40+r()*220)),
}));
const db = store('stockroom', seed);
const moves = store('stockroom.moves', []);
const view = $('#view');
function kpi(){
const d = db.get();
$('#kpi').textContent = d.length+' SKUs · '+fmt.money(d.reduce((a,x)=>a+x.qty*x.cost,0))+' at cost · '
+ d.filter(x=>x.qty<x.rop).length+' below reorder';
}
function stock(){
fill(view, h('div.pane', grid([
{k:'sku',t:'SKU',w:'104px',cell:x=>h('span.mono.small',x.sku)},
{k:'name',t:'Item',cell:x=>h('div',h('div.b',x.name),h('div.small.muted',x.sup))},
{k:'loc',t:'Location',cell:x=>h('span.tag',x.loc)},
{k:'qty',t:'On hand',num:true,cell:x=>h('span.'+(x.qty<x.rop?'down b':'num'),fmt.n(x.qty))},
{k:'rop',t:'Reorder at',num:true},
{k:'cost',t:'Unit',num:true,cell:x=>fmt.money(x.cost)},
{k:'id',t:'14-day',w:'110px',cell:x=>spark(x.hist, x.qty<x.rop?'#f4685e':'#3ecf8e',100,22)},
], db.get(), {onRow:detail, placeholder:'Search SKU or item…'})));
}
function movesView(){
const m = moves.get();
fill(view, h('div.pane', h('header','Stock movement ledger'),
m.length ? h('div.scroll-x',h('table',
h('thead',h('tr',h('th','When'),h('th','SKU'),h('th','Type'),h('th','Qty'),h('th','Location'),h('th','Note'))),
h('tbody', m.map(x=>h('tr',h('td.small.muted',fmt.ago(x.at)),h('td.mono.small',x.sku),
h('td',h('span.tag '+(x.type==='receive'?'ok':'warn'),x.type)),
h('td.num',(x.type==='receive'?'+':'−')+x.qty),h('td',x.loc),h('td.small.muted',x.note||'—'))))))
: h('div.empty','No movements recorded yet — use Receive or Issue above.')));
}
function reorder(){
const low = db.get().filter(x=>x.qty<x.rop).sort((a,b)=>(a.qty/a.rop)-(b.qty/b.rop));
const byLoc = LOCS.map(l=>({k:l, v:db.get().filter(x=>x.loc===l).reduce((a,x)=>a+x.qty*x.cost,0)}));
fill(view, h('div.split.r',
h('div.pane',h('header','Below reorder point ('+low.length+')'),
low.length? h('table',h('thead',h('tr',h('th','Item'),h('th','On hand'),h('th','Reorder'),h('th','Suggested PO'))),
h('tbody',low.map(x=>h('tr',h('td',h('div.b',x.name),h('div.small.muted',x.sku)),
h('td.num.down',x.qty),h('td.num',x.rop),
h('td.num',fmt.n(Math.max(x.rop*2-x.qty,10))+' × '+fmt.money(x.cost))))))
: h('div.empty','Everything is above its reorder point.')),
h('div.pane',h('header','Inventory value by location'),h('div.body',donut(byLoc),
h('div',{style:{marginTop:'12px'}}, bars(byLoc.map(x=>({...x,f:fmt.money(x.v)}))))))));
}
function detail(x){
modal(x.name, h('div',
h('div.row',{style:{gap:'6px',marginBottom:'10px'}},h('span.tag.acc',x.sku),h('span.tag',x.loc),h('span.tag',x.sup)),
h('div.grid.k4',
h('div.stat',h('div.k','On hand'),h('div.v',fmt.n(x.qty))),
h('div.stat',h('div.k','Reorder at'),h('div.v',x.rop)),
h('div.stat',h('div.k','Unit cost'),h('div.v',fmt.money(x.cost))),
h('div.stat',h('div.k','Value'),h('div.v',fmt.money(x.qty*x.cost)))),
h('div',{style:{marginTop:'12px'}}, spark(x.hist,'#5b8cff',560,80))));
}
function mv(type){
const d = db.get();
const sel = h('select', d.map(x=>h('option',{value:x.id},x.sku+' — '+x.name)));
const q = h('input',{type:'number',value:10,min:1}); const n = h('input',{placeholder:'Reference / note'});
modal(type==='receive'?'Receive stock':'Issue stock', h('div',
h('div.field',h('label','Item'),sel), h('div.field',h('label','Quantity'),q),
h('div.field',h('label','Note'),n)),
async () => {
const item = d.find(x=>x.id===sel.value); const qty = Math.max(1,+q.value||0);
db.set(v=>v.map(x=>x.id===item.id?{...x,qty:Math.max(0,x.qty+(type==='receive'?qty:-qty)),hist:[...x.hist.slice(1),x.qty]}:x));
const rec = {at:Date.now(),sku:item.sku,type,qty,loc:item.loc,note:n.value.trim()};
moves.set(v=>[rec,...v]); kpi(); render();
try{ await submit('stockroom.move', rec); toast('Movement posted to @hanzo/base'); }catch(e){ toast('Movement recorded locally'); }
}, type==='receive'?'Receive':'Issue');
}
$('#recv').onclick = () => mv('receive'); $('#issue').onclick = () => mv('issue');
let render = stock;
route({'':()=>{render=stock;stock();},'moves':()=>{render=movesView;movesView();},
'reorder':()=>{render=reorder;reorder();},'*':()=>{render=stock;stock();}});
kpi();
</script>