userforge 0.1.1 → 0.2.0

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/dist/process.js CHANGED
@@ -1,7 +1,7 @@
1
- import{E as e,F as t,M as n,N as r,O as i,T as a,a as o,b as s,c,l,n as u,o as d,s as f,x as p,y as m}from"./map.js";import{STAGES as h,storyStage as g,workDone as _}from"./stage.js";import{n as v,r as y}from"./results.js";import{existsSync as b,mkdirSync as x,rmSync as S,writeFileSync as C}from"node:fs";import{dirname as w,join as T}from"node:path";function E(e){return e===``||e===`.`?[]:e.split(`.`).map(e=>/^(0|[1-9]\d*)$/.test(e)?Number(e):e)}function D(e){return e.join(`.`)}function O(e,t){let n=typeof t==`string`?E(t):t,r=e;for(let e of n){if(r==null)return;r=r[e]}return r}function k(e,t){return Array.isArray(e)?e.slice():e&&typeof e==`object`?{...e}:typeof t==`number`?[]:{}}function A(e,t,n){if(t.length===0)throw Error(`A patch needs a path below the root`);let r=k(e,t[0]),i=r;for(let e=0;e<t.length-1;e++){let n=t[e];i[n]=k(i[n],t[e+1]),i=i[n]}return n(i,t[t.length-1]),r}function j(e,t){let n=e[e.length-1];if(typeof n!=`number`)throw Error(`${t} needs a list item path ending in an index`);return{listKeys:e.slice(0,-1),index:n}}function M(e,t){let n=E(t.path);if(t.op===`set`){let r=O(e,n);return{root:A(e,n,(e,n)=>{t.value===void 0?Array.isArray(e)?e[n]=void 0:delete e[n]:e[n]=t.value}),applied:{...t,previous:r}}}let{listKeys:r,index:i}=j(n,t.op),a=O(e,r);if(a!==void 0&&!Array.isArray(a))throw Error(`${t.op} at "${t.path}": "${D(r)}" is not a list`);let o=a??[];if(t.op===`insert`){if(i<0||i>o.length)throw Error(`insert index ${i} is out of range`);let n=o.slice();return n.splice(i,0,t.value),{root:r.length?A(e,r,(e,t)=>e[t]=n):n,applied:{...t}}}if(i<0||i>=o.length)throw Error(`${t.op} index ${i} is out of range`);if(t.op===`remove`){let n=o.slice(),[a]=n.splice(i,1);return{root:r.length?A(e,r,(e,t)=>e[t]=n):n,applied:{...t,previous:a}}}if(t.op===`move`){let n=t.to;if(typeof n!=`number`||n<0||n>=o.length)throw Error(`move to ${n} is out of range`);let a=o.slice(),[s]=a.splice(i,1);return a.splice(n,0,s),{root:r.length?A(e,r,(e,t)=>e[t]=a):a,applied:{...t}}}throw Error(`Unknown patch op "${t.op}"`)}function N(e,t){let n=e,r=[];for(let e of t){let t=M(n,e);n=t.root,r.push(t.applied)}return{root:n,applied:r}}const P=/\bhttps?:\/\/[^\s<>()"']+|\bwww\.[^\s<>()"']+\.[a-z]{2,}[^\s<>()"']*/gi,F=/^([^\n(]{2,80}\(\s*https?:\/\/[^)\s]+\s*\)|\s*https?:\/\/\S+)\s*[-–—:|]/,I=/\[url=|<a\s+href|\b(backlinks?|guest posts?|seo (services|agency|experts?)|link building|rank(ing)? (higher|first) on google|first page of google|website traffic|increase (your )?traffic|casino|viagra|cialis|forex|crypto (signals|investment)|bitcoin investment|whatsapp me|telegram me)\b/i;function L(e){let t=String(e??``).trim();if(!t)return;let n=t.match(P)??[];if(n.length>=3||n.join(``).length>=t.length*.4)return`links`;if(F.test(t))return`advert`;if(I.test(t))return`phrases`}const R=e=>!e.facts?.person&&!!L(e.data.feedback?.text),z=e=>e.data.feedback?.status!==`done`&&!R(e),B=`c-site`,V=e=>(e.data.place?.blocks??[]).some(e=>e?.is===B);function H(e,t){for(let n=t,r=/* @__PURE__ */ new Set;n?.kind===`place`&&!r.has(n.key);r.add(n.key),n=e[n.data.place?.under??``])if(V(n))return n}const U=[`failing`,`unchecked`,`unplaced`,`bare`,`unsorted`,`undecided`];function W(e,t){let n=t=>Object.values(e).filter(e=>e.kind===t),r=e=>e.map(e=>e.key).sort((e,t)=>Number(e.slice(1))-Number(t.slice(1))),i=n(`story`),a=n(`place`),o=e=>e.data.story.checks??[];return{failing:r(i.filter(e=>o(e).some(n=>t[`${e.key}.${n.id}`]?.state===`fail`))),unchecked:r(i.filter(e=>!o(e).length)),unplaced:r(i.filter(t=>!(t.data.story.where??[]).some(t=>e[t]))),bare:r(a.filter(t=>!H(e,t)&&!a.some(e=>e.key!==t.key&&e.data.place.under===t.key)&&!t.data.place.shot&&!t.data.place.blocks?.length)),unsorted:r(n(`feedback`).filter(z)),undecided:r(n(`decision`).filter(e=>(e.data.decision.status??`proposed`)===`proposed`))}}function G(e=u,t=o){let n=()=>f(e,t).all,s=e=>n()[e]??Promise.reject(new p(`There is nothing with the id "${e}".`)),h=(r,o,s,c,u)=>{let{value:d,problems:f}=a(t,r,s,{all:n(),had:c,key:o,patch:u});if(f.length)throw new p(i(r,f));let h={key:o,kind:r,data:{[r]:d}},g=m(t,h);return x(w(T(e,g.path)),{recursive:!0}),C(T(e,g.path),g.text),l(e,t),h};return{kinds:Object.fromEntries(Object.entries(t).filter(([,e])=>e.file)),all:n,results:()=>c(e),stage:t=>g(t,c(e)),async make(e,r){let i=t[e];if(!i?.file)throw new p(`There is no kind "${e}" in this map.`);let a=i.one?`${i.letter}1`:v()&&await y(v(),e).catch(()=>void 0)||d(t,e,n());return h(e,a,r)},async put(e,t){let n=await s(e);return h(n.kind,e,t,n)},async change(e,t){let n=await s(e),r;try{r=N(n.data,t).root}catch(e){throw new p(`That change couldn’t be made: ${e.message}`)}return h(n.kind,e,r[n.kind]??{},n,t.at(-1))},async drop(i){let a=n(),o=await s(i);S(T(e,m(t,o).path));for(let{thing:n}of r(t,a,i))C(T(e,m(t,n).path),m(t,n).text);b(e)&&l(e,t)}}}const K=[`source`,`feedback`,`queue`],q=e=>({type:`string`,description:`The id of ${e}, such as S12.`}),J={failing:`Abilities with a check that fails`,unchecked:`Abilities with no checks`,unplaced:`Abilities with no place`,bare:`Places with no picture`,unsorted:`Notes to sort`,undecided:`Decisions still proposed`},Y=e=>Array.isArray(e)?e.map(Y):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).filter(([e])=>e!==`required`).map(([e,t])=>[e,Y(t)])):e;function X(e){let t=e.kinds,n=Object.keys(t).filter(e=>!K.includes(e)).map(e=>{let{$defs:n,...r}=Y(t[e].schema),{letter:i,one:a}=t[e],o={...r,properties:{key:{type:`string`,description:`The id of a ${e} there is, to write it again, such as ${i}3. Leave it out to make a new one.`},...r.properties}};return{name:`write_${e}`,description:`${r.description??``} ${a?`Writes the map's ${e}`:`Makes each ${e} given, or writes it again when it carries the key of one there is`}: the fields given replace what was there, and the rest stay.`.trim(),inputSchema:a?{type:`object`,properties:r.properties,$defs:n}:{type:`object`,properties:{items:{type:`array`,minItems:1,maxItems:20,items:o}},required:[`items`],$defs:n}}});return[{name:`overview`,description:`The map at a glance: why it is being built and for whom, how many abilities stand at each stage, its documents and decisions, the code work waiting, and what needs attention. Start here.`,inputSchema:{type:`object`,properties:{}}},{name:`list`,description:`Every thing of one kind, a line each, or those whose words hold what is searched for, or those tied to one persona, place or ability. Abilities can be narrowed to one stage.`,inputSchema:{type:`object`,properties:{kind:{type:`string`,enum:Object.keys(t)},search:{type:`string`,description:`Words the things listed hold, in any of their fields.`},persona:q(`a persona`),place:q(`a place`),story:q(`an ability`),stage:{type:`string`,enum:[...h]}},required:[`kind`]}},{name:`read`,description:`One thing in full, by its id: its fields as its file holds them, and for an ability its stage and each check’s result.`,inputSchema:{type:`object`,properties:{key:q(`the thing`)},required:[`key`]}},...n,{name:`change`,description:'Change lines of one thing without sending all of it. Each change names a path into its fields, with dots and list positions ("story.what", "story.checks.2.text"). `set` puts a value there, `insert` adds to a list at that position, `remove` takes out, `move` moves to `to`.',inputSchema:{type:`object`,properties:{key:q(`the thing to change`),changes:{type:`array`,minItems:1,items:{type:`object`,properties:{op:{type:`string`,enum:[`set`,`insert`,`remove`,`move`]},path:{type:`string`},value:{},to:{type:`string`}},required:[`op`,`path`]}}},required:[`key`,`changes`]}},{name:`remove`,description:`Remove one thing. It is taken out of whatever pointed at it.`,inputSchema:{type:`object`,properties:{key:q(`the thing to remove`)},required:[`key`]}},...e.queue?[{name:`queue`,description:`Put code work in the queue for the team’s coding agent, once the map’s part is done: what the code must do, the abilities it is for, and the checks that must pass on main for it to be done. Once for what was asked, last.`,inputSchema:(({by:e,...n})=>({type:`object`,properties:n,required:t.queue.schema.required??[]}))(t.queue.schema.properties??{})}]:[]]}function Z(e,n){let r=n.data[n.kind]??{},i={key:n.key,title:t(n),...r.status?{status:r.status}:{}};switch(n.kind){case`story`:return{...i,stage:e.stage(n),who:r.who??[],where:r.where??[],checks:(r.checks??[]).length};case`place`:return{...i,route:r.route,under:r.under};case`queue`:return{key:n.key,asked:r.asked,for:r.for??[],done:r.done??[],..._(r.done,e.results())?{finished:!0}:{}};default:return i}}async function Q(e,t,n={}){try{let r=await $(e,t,n??{});return{text:typeof r==`string`?r:JSON.stringify(r,null,2)}}catch(e){if(e instanceof p)return{text:e.message,failed:!0};throw e}}async function $(t,r,i){let a=t.all(),o=e=>Object.values(a).filter(t=>t.kind===e),c=e=>a[String(e??``)]??Promise.reject(new p(`There is no thing with the id "${e??``}".`)),l=(r,i)=>e(a,i?n(r,t.kinds[i].schema):r);if(r.startsWith(`write_`)){let e=r.slice(6);if(!t.kinds[e]||K.includes(e))throw new p(`There is no tool "${r}".`);let n=t.kinds[e].one?[{...i,key:o(e)[0]?.key}]:i.items;if(!Array.isArray(n)||!n.length)throw new p("Give `items`: a list of what to write.");let s=[];for(let{key:r,...i}of n){if(r&&a[r]?.kind!==e)throw new p(`There is no ${e} with the id "${r}". Leave the key out to make a new one.`);let{n,...o}=r?a[r].data[e]:{},c=r?await t.put(r,{...o,...l(i,e)}):await t.make(e,l(i,e));a[c.key]=c,s.push(Z(t,c))}return s}switch(r){case`overview`:{let e=a.B1?.data.brief,n=o(`story`),r=W(a,t.results()),i=o(`queue`),s=i.filter(e=>_(e.data.queue.done,t.results())).map(e=>e.key),c=i.filter(e=>!e.data.queue.done?.some(Boolean)).map(e=>e.key);return{why:e?{name:e.name,idea:e.idea}:`There is no brief yet.`,personas:o(`persona`).map(e=>Z(t,e)),abilities:Object.fromEntries(h.map(e=>[e,n.filter(n=>t.stage(n)===e).length])),places:o(`place`).length,documents:[`document`,`script`,`voice`,`look`].flatMap(o).map(e=>Z(t,e)),decisions:o(`decision`).map(e=>Z(t,e)),waiting:i.map(e=>Z(t,e)),needsAttention:[...U.filter(e=>r[e].length).map(e=>`${J[e]}: ${r[e].join(`, `)}`),...s.length?[`Code work whose checks all pass, to remove: ${s.join(`, `)}`]:[],...c.length?[`Code work that names no checks: ${c.join(`, `)}`]:[]]}}case`list`:{if(!t.kinds[i.kind])throw new p(`"${i.kind??``}" is not a kind. The kinds are ${Object.keys(t.kinds).join(`, `)}.`);let e=String(i.search??``).trim().toLowerCase(),n=(e,n,r)=>!r||Object.entries(t.kinds[e.kind].refs??{}).some(([t,i])=>[i].flat()[0]===n&&[e.data[e.kind][t]??[]].flat().includes(r));return o(i.kind).filter(n=>!e||s(t.kinds,n).toLowerCase().includes(e)).filter(e=>n(e,`persona`,i.persona)&&n(e,`place`,i.place)&&n(e,`story`,i.story)&&(!i.stage||e.kind!==`story`||t.stage(e)===i.stage)).sort((e,t)=>Number(e.key.slice(1))-Number(t.key.slice(1))).map(e=>Z(t,e))}case`read`:{let e=await c(i.key),n=t.results(),r=e=>`results:\n${e.map(e=>` ${e}: ${n[e]?.state??`not run`}`).join(`
2
- `)}\n`,a=e.kind===`queue`?(e.data.queue.done??[]).filter(Boolean):[],o=e.kind===`story`?`\nstage: ${t.stage(e)}\n${r((e.data.story.checks??[]).map(t=>`${e.key}.${t.id}`))}`:a.length?`\n${r(a)}`:e.kind===`queue`?`
1
+ import{B as e,D as t,H as n,M as r,P as i,S as a,c as o,d as s,j as c,l,n as u,s as d,u as f,x as p,z as m}from"./map.js";import{STAGES as h,storyStage as g,workDone as _}from"./stage.js";import{n as v,r as y}from"./results.js";import{existsSync as b,mkdirSync as x,rmSync as S,writeFileSync as C}from"node:fs";import{dirname as w,join as T}from"node:path";function E(e){return e===``||e===`.`?[]:e.split(`.`).map(e=>/^(0|[1-9]\d*)$/.test(e)?Number(e):e)}function D(e){return e.join(`.`)}function O(e,t){let n=typeof t==`string`?E(t):t,r=e;for(let e of n){if(r==null)return;r=r[e]}return r}function k(e,t){return Array.isArray(e)?e.slice():e&&typeof e==`object`?{...e}:typeof t==`number`?[]:{}}function A(e,t,n){if(t.length===0)throw Error(`A patch needs a path below the root`);let r=k(e,t[0]),i=r;for(let e=0;e<t.length-1;e++){let n=t[e];i[n]=k(i[n],t[e+1]),i=i[n]}return n(i,t[t.length-1]),r}function j(e,t){let n=e[e.length-1];if(typeof n!=`number`)throw Error(`${t} needs a list item path ending in an index`);return{listKeys:e.slice(0,-1),index:n}}function M(e,t){let n=E(t.path);if(t.op===`set`){let r=O(e,n);return{root:A(e,n,(e,n)=>{t.value===void 0?Array.isArray(e)?e[n]=void 0:delete e[n]:e[n]=t.value}),applied:{...t,previous:r}}}let{listKeys:r,index:i}=j(n,t.op),a=O(e,r);if(a!==void 0&&!Array.isArray(a))throw Error(`${t.op} at "${t.path}": "${D(r)}" is not a list`);let o=a??[];if(t.op===`insert`){if(i<0||i>o.length)throw Error(`insert index ${i} is out of range`);let n=o.slice();return n.splice(i,0,t.value),{root:r.length?A(e,r,(e,t)=>e[t]=n):n,applied:{...t}}}if(i<0||i>=o.length)throw Error(`${t.op} index ${i} is out of range`);if(t.op===`remove`){let n=o.slice(),[a]=n.splice(i,1);return{root:r.length?A(e,r,(e,t)=>e[t]=n):n,applied:{...t,previous:a}}}if(t.op===`move`){let n=t.to;if(typeof n!=`number`||n<0||n>=o.length)throw Error(`move to ${n} is out of range`);let a=o.slice(),[s]=a.splice(i,1);return a.splice(n,0,s),{root:r.length?A(e,r,(e,t)=>e[t]=a):a,applied:{...t}}}throw Error(`Unknown patch op "${t.op}"`)}function N(e,t){let n=e,r=[];for(let e of t){let t=M(n,e);n=t.root,r.push(t.applied)}return{root:n,applied:r}}const P=/\bhttps?:\/\/[^\s<>()"']+|\bwww\.[^\s<>()"']+\.[a-z]{2,}[^\s<>()"']*/gi,F=/^([^\n(]{2,80}\(\s*https?:\/\/[^)\s]+\s*\)|\s*https?:\/\/\S+)\s*[-–—:|]/,I=/\[url=|<a\s+href|\b(backlinks?|guest posts?|seo (services|agency|experts?)|link building|rank(ing)? (higher|first) on google|first page of google|website traffic|increase (your )?traffic|casino|viagra|cialis|forex|crypto (signals|investment)|bitcoin investment|whatsapp me|telegram me)\b/i;function L(e){let t=String(e??``).trim();if(!t)return;let n=t.match(P)??[];if(n.length>=3||n.join(``).length>=t.length*.4)return`links`;if(F.test(t))return`advert`;if(I.test(t))return`phrases`}const R=e=>!e.facts?.person&&!!L(e.data.feedback?.text),z=e=>e.data.feedback?.status!==`done`&&!R(e),B=`c-site`,V=e=>(e.data.place?.blocks??[]).some(e=>e?.is===B);function H(e,t){for(let n=t,r=/* @__PURE__ */ new Set;n?.kind===`place`&&!r.has(n.key);r.add(n.key),n=e[n.data.place?.under??``])if(V(n))return n}const U=[`failing`,`unchecked`,`unplaced`,`bare`,`unsorted`,`undecided`];function W(e,t){let n=t=>Object.values(e).filter(e=>e.kind===t),r=e=>e.map(e=>e.key).sort((e,t)=>Number(e.slice(1))-Number(t.slice(1))),i=n(`story`),a=n(`place`),o=e=>e.data.story.checks??[];return{failing:r(i.filter(e=>o(e).some(n=>t[`${e.key}.${n.id}`]?.state===`fail`))),unchecked:r(i.filter(e=>!o(e).length)),unplaced:r(i.filter(t=>!(t.data.story.where??[]).some(t=>e[t]))),bare:r(a.filter(t=>!H(e,t)&&!a.some(e=>e.key!==t.key&&e.data.place.under===t.key)&&!t.data.place.shot&&!t.data.place.blocks?.length)),unsorted:r(n(`feedback`).filter(z)),undecided:r(n(`decision`).filter(e=>(e.data.decision.status??`proposed`)===`proposed`))}}function G(n=u,r=d){let a=()=>l(n,r).all,m=e=>a()[e]??Promise.reject(new t(`There is nothing with the id "${e}".`)),h=(e,t,i)=>{let a=p(r,e,t);i[e.key]&&i[e.key]!==a.path&&S(T(n,i[e.key]),{force:!0}),x(w(T(n,a.path)),{recursive:!0}),C(T(n,a.path),a.text)},_=(e,a,o,u,d)=>{let{all:f,paths:p}=l(n,r),{value:m,problems:g}=c(r,e,o,{all:f,had:u,key:a,patch:d});if(g.length)throw new t(i(e,g));let _={key:a,kind:e,data:{[e]:m}};if(f[a]=_,h(_,f,p),e===`persona`)for(let e of Object.values(f))e.kind===`story`&&e.data.story.who?.includes(a)&&h(e,f,p);return s(n,r),_};return{kinds:Object.fromEntries(Object.entries(r).filter(([,e])=>e.file)),all:a,results:()=>f(n),stage:e=>g(e,f(n)),async make(e,n){let i=r[e];if(!i?.file)throw new t(`There is no kind "${e}" in this map.`);let s=i.one?`${i.letter}1`:v()&&await y(v(),e).catch(()=>void 0)||o(r,e,a());return _(e,s,n)},async put(e,t){let n=await m(e);return _(n.kind,e,t,n)},async change(e,n){let r=await m(e),i;try{i=N(r.data,n).root}catch(e){throw new t(`That change couldn’t be made: ${e.message}`)}return _(r.kind,e,i[r.kind]??{},r,n.at(-1))},async drop(t){let{all:i,paths:a}=l(n,r);i[t]||await m(t);let o=e(r,i,t);S(T(n,a[t])),delete i[t];for(let{thing:e}of o)i[e.key]=e;for(let{thing:e}of o)h(e,i,a);b(n)&&s(n,r)}}}const K=[`source`,`feedback`,`queue`],q=e=>({type:`string`,description:`The id of ${e}, such as S12.`}),J={failing:`Abilities with a check that fails`,unchecked:`Abilities with no checks`,unplaced:`Abilities with no place`,bare:`Places with no picture`,unsorted:`Notes to sort`,undecided:`Decisions still proposed`},Y=e=>Array.isArray(e)?e.map(Y):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).filter(([e])=>e!==`required`).map(([e,t])=>[e,Y(t)])):e;function X(e){let t=e.kinds,n=Object.keys(t).filter(e=>!K.includes(e)).map(e=>{let{$defs:n,...r}=Y(t[e].schema),{letter:i,one:a}=t[e],o={...r,properties:{key:{type:`string`,description:`The id of a ${e} there is, to write it again, such as ${i}3. Leave it out to make a new one.`},...r.properties}};return{name:`write_${e}`,description:`${r.description??``} ${a?`Writes the map's ${e}`:`Makes each ${e} given, or writes it again when it carries the key of one there is`}: the fields given replace what was there, and the rest stay.`.trim(),inputSchema:a?{type:`object`,properties:r.properties,$defs:n}:{type:`object`,properties:{items:{type:`array`,minItems:1,maxItems:20,items:o}},required:[`items`],$defs:n}}});return[{name:`overview`,description:`The map at a glance: why it is being built and for whom, how many abilities stand at each stage, its documents and decisions, the code work waiting, and what needs attention. Start here.`,inputSchema:{type:`object`,properties:{}}},{name:`list`,description:`Every thing of one kind, a line each, or those whose words hold what is searched for, or those tied to one persona, place or ability. Abilities can be narrowed to one stage.`,inputSchema:{type:`object`,properties:{kind:{type:`string`,enum:Object.keys(t)},search:{type:`string`,description:`Words the things listed hold, in any of their fields.`},persona:q(`a persona`),place:q(`a place`),story:q(`an ability`),stage:{type:`string`,enum:[...h]}},required:[`kind`]}},{name:`read`,description:`One thing in full, by its id: its fields as its file holds them, and for an ability its stage and each check’s result.`,inputSchema:{type:`object`,properties:{key:q(`the thing`)},required:[`key`]}},...n,{name:`change`,description:'Change lines of one thing without sending all of it. Each change names a path into its fields, with dots and list positions ("story.what", "story.checks.2.text"). `set` puts a value there, `insert` adds to a list at that position, `remove` takes out, `move` moves to `to`.',inputSchema:{type:`object`,properties:{key:q(`the thing to change`),changes:{type:`array`,minItems:1,items:{type:`object`,properties:{op:{type:`string`,enum:[`set`,`insert`,`remove`,`move`]},path:{type:`string`},value:{},to:{type:`string`}},required:[`op`,`path`]}}},required:[`key`,`changes`]}},{name:`remove`,description:`Remove one thing. It is taken out of whatever pointed at it.`,inputSchema:{type:`object`,properties:{key:q(`the thing to remove`)},required:[`key`]}},...e.queue?[{name:`queue`,description:`Put code work in the queue for the team’s coding agent, once the map’s part is done: what the code must do, the abilities it is for, and the checks that must pass on main for it to be done. Once for what was asked, last.`,inputSchema:(({by:e,...n})=>({type:`object`,properties:n,required:t.queue.schema.required??[]}))(t.queue.schema.properties??{})}]:[]]}function Z(e,t){let r=t.data[t.kind]??{},i={key:t.key,title:n(t),...r.status?{status:r.status}:{}};switch(t.kind){case`story`:return{...i,stage:e.stage(t),who:r.who??[],where:r.where??[],checks:(r.checks??[]).length};case`place`:return{...i,route:r.route,under:r.under};case`queue`:return{key:t.key,asked:r.asked,for:r.for??[],done:r.done??[],..._(r.done,e.results())?{finished:!0}:{}};default:return i}}async function Q(e,n,r={}){try{let t=await $(e,n,r??{});return{text:typeof t==`string`?t:JSON.stringify(t,null,2)}}catch(e){if(e instanceof t)return{text:e.message,failed:!0};throw e}}async function $(e,n,i){let o=e.all(),s=e=>Object.values(o).filter(t=>t.kind===e),c=e=>o[String(e??``)]??Promise.reject(new t(`There is no thing with the id "${e??``}".`)),l=(t,n)=>r(o,n?m(t,e.kinds[n].schema):t);if(n.startsWith(`write_`)){let r=n.slice(6);if(!e.kinds[r]||K.includes(r))throw new t(`There is no tool "${n}".`);let a=e.kinds[r].one?[{...i,key:s(r)[0]?.key}]:i.items;if(!Array.isArray(a)||!a.length)throw new t("Give `items`: a list of what to write.");let c=[];for(let{key:n,...i}of a){if(n&&o[n]?.kind!==r)throw new t(`There is no ${r} with the id "${n}". Leave the key out to make a new one.`);let{n:a,...s}=n?o[n].data[r]:{},u=n?await e.put(n,{...s,...l(i,r)}):await e.make(r,l(i,r));o[u.key]=u,c.push(Z(e,u))}return c}switch(n){case`overview`:{let t=o.B1?.data.brief,n=s(`story`),r=W(o,e.results()),i=s(`queue`),a=i.filter(t=>_(t.data.queue.done,e.results())).map(e=>e.key),c=i.filter(e=>!e.data.queue.done?.some(Boolean)).map(e=>e.key);return{why:t?{name:t.name,idea:t.idea}:`There is no brief yet.`,personas:s(`persona`).map(t=>Z(e,t)),abilities:Object.fromEntries(h.map(t=>[t,n.filter(n=>e.stage(n)===t).length])),places:s(`place`).length,documents:[`document`,`script`,`voice`,`look`].flatMap(s).map(t=>Z(e,t)),decisions:s(`decision`).map(t=>Z(e,t)),waiting:i.map(t=>Z(e,t)),needsAttention:[...U.filter(e=>r[e].length).map(e=>`${J[e]}: ${r[e].join(`, `)}`),...a.length?[`Code work whose checks all pass, to remove: ${a.join(`, `)}`]:[],...c.length?[`Code work that names no checks: ${c.join(`, `)}`]:[]]}}case`list`:{if(!e.kinds[i.kind])throw new t(`"${i.kind??``}" is not a kind. The kinds are ${Object.keys(e.kinds).join(`, `)}.`);let n=String(i.search??``).trim().toLowerCase(),r=(t,n,r)=>!r||Object.entries(e.kinds[t.kind].refs??{}).some(([e,i])=>[i].flat()[0]===n&&[t.data[t.kind][e]??[]].flat().includes(r));return s(i.kind).filter(t=>!n||a(e.kinds,t).toLowerCase().includes(n)).filter(t=>r(t,`persona`,i.persona)&&r(t,`place`,i.place)&&r(t,`story`,i.story)&&(!i.stage||t.kind!==`story`||e.stage(t)===i.stage)).sort((e,t)=>Number(e.key.slice(1))-Number(t.key.slice(1))).map(t=>Z(e,t))}case`read`:{let t=await c(i.key),n=e.results(),r=e=>`results:\n${e.map(e=>` ${e}: ${n[e]?.state??`not run`}`).join(`
2
+ `)}\n`,o=t.kind===`queue`?(t.data.queue.done??[]).filter(Boolean):[],s=t.kind===`story`?`\nstage: ${e.stage(t)}\n${r((t.data.story.checks??[]).map(e=>`${t.key}.${e.id}`))}`:o.length?`\n${r(o)}`:t.kind===`queue`?`
3
3
  It names no checks: write the checks that will say it is done on its abilities first.
4
- `:``;return`${e.key}, a ${e.kind}:\n\n${s(t.kinds,e)}${o}`}case`change`:{let e=await c(i.key);if(!Array.isArray(i.changes)||!i.changes.length)throw new p("Give `changes`: a list of `{ op, path, value }`.");return Z(t,await t.change(e.key,l(i.changes)))}case`remove`:{let e=await c(i.key);return await t.drop(e.key),`Removed ${e.key}.`}case`queue`:{if(!t.queue)break;let e=String(i.asked??``).trim();if(!e)throw new p("Give `asked`: what the code must do.");let n=(Array.isArray(i.done)?i.done:[]).map(String);for(let e of n)if(!a[e.split(`.`)[0]]?.data.story?.checks?.some(t=>t.id===e.split(`.`)[1]))throw new p(`done: "${e}" is no check here. Write the check on its ability first, then name it by its id, such as S12.2.`);return Z(t,await t.queue({asked:e,for:(Array.isArray(i.for)?i.for:[]).map(String),done:n}))}}throw new p(`There is no tool "${r}".`)}var ee=`The map is the product's: who it is for, what they need to do, where that happens, and why. Read it before you work on anything it describes, and change it only through these tools: each thing is written through its kind's sheet, and what doesn't fit is turned down with what would.
4
+ `:``;return`${t.key}, a ${t.kind}:\n\n${a(e.kinds,t)}${s}`}case`change`:{let n=await c(i.key);if(!Array.isArray(i.changes)||!i.changes.length)throw new t("Give `changes`: a list of `{ op, path, value }`.");return Z(e,await e.change(n.key,l(i.changes)))}case`remove`:{let t=await c(i.key);return await e.drop(t.key),`Removed ${t.key}.`}case`queue`:{if(!e.queue)break;let n=String(i.asked??``).trim();if(!n)throw new t("Give `asked`: what the code must do.");let r=(Array.isArray(i.done)?i.done:[]).map(String);for(let e of r)if(!o[e.split(`.`)[0]]?.data.story?.checks?.some(t=>t.id===e.split(`.`)[1]))throw new t(`done: "${e}" is no check here. Write the check on its ability first, then name it by its id, such as S12.2.`);return Z(e,await e.queue({asked:n,for:(Array.isArray(i.for)?i.for:[]).map(String),done:r}))}}throw new t(`There is no tool "${n}".`)}var ee=`The map is the product's: who it is for, what they need to do, where that happens, and why. Read it before you work on anything it describes, and change it only through these tools: each thing is written through its kind's sheet, and what doesn't fit is turned down with what would.
5
5
 
6
6
  What it holds, each thing by its id:
7
7
  - A persona (P1) is one kind of person the product is for, named by their role.
@@ -15,32 +15,4 @@ What it holds, each thing by its id:
15
15
  - Code work (Q4) waits for a coding agent: what was asked, for which abilities, and the checks that say it is done.
16
16
 
17
17
  How to use the tools: \`overview\` first, then \`list\` and \`read\`; read a thing before you change it. Make a thing, or write one again, with its \`write_\` tool: the fields you give replace those fields, and the rest stay. Change a line or two with \`change\`, and \`remove\` only what should go. Tie things together as you write them: an ability to its personas and places, a page to the personas it is written for and the abilities it serves.
18
- `,te=`# How work is done here
19
-
20
- This project is built from one map, kept in \`spec/\` beside the code, one file for each thing. Its tools come from \`npx userforge mcp\`, which \`.mcp.json\` names: connect them before you change the map.
21
-
22
- However the work reaches you, it goes the same way:
23
-
24
- 1. Pull main, then work on a branch of your own. \`npx userforge\` prints this, what is waiting and where the map stands.
25
- 2. To take something waiting, \`read\` it (Q4): what was asked, by whom, for which abilities, and the checks that say it is done. If it names none, write them on its abilities first. Code work whose checks all pass is done: \`remove\` it.
26
- 3. Read each ability before you build it: the ability, the places it names, and any decision that affects it.
27
- 4. Change the map only through its tools, on your branch, beside the code it describes: its files reach main with the code. Never write those files yourself. Change a check's words before you change what it describes, and give a new check its test.
28
- 5. Name each test after the check it proves, its id first: \`test('S12.2 shows who it is for', …)\`, or \`check('S12.2', …)\` from \`userforge/test\`. The reporter keeps every result in \`spec/results.json\`, the failing ones too: commit it with the code.
29
- 6. Never set an ability's stage to building or live: those come from its checks' results.
30
- 7. Build the least that makes a check pass, and delete what a change replaces, moot tests included. Never remove what a person wrote unless they ask.
31
- 8. Run \`npx userforge check\` before you commit, and leave nothing it names.
32
- 9. Open a pull request into main: what was asked, each ability it touched by its id, and each check's result. Taking something from the queue, name it (\`Q4\`) and \`remove\` it in the same pull request. Don't merge it yourself.
33
- 10. When what was asked is a question, answer it to whoever asked, in markdown that reads by itself. A question changes nothing.
34
-
35
- ## Mapping a codebase
36
-
37
- Asked to map this codebase (or to import it, bring it in, or set it up the Userforge way: all the same ask), map what is true today, on a branch, without stopping to ask, and open one pull request at the end. Direction that comes with the ask comes first: areas to focus on or leave out, who the product is for, names to use, how deep to go. Follow it, and say in the pull request how you did. Keep everything small and true: a thing earns its place by being something the team would point at, a check by being something two people would agree passes. Leave out what you would have to invent, and write again what the map already holds rather than writing it twice.
38
-
39
- 1. Survey: how the project is run and tested, where its routes or screens are, what kinds of user it knows (roles, permissions, plans), and what its README says it is for. A spec the project already keeps in another shape (stories with acceptance criteria, personas, wireframes, a README beside them) is the first source: bring each thing in it into the map as what it is, its acceptance criteria as checks, and say in the pull request which of its files the map now holds. Write the brief: a working name, the idea in a sentence, and who it is for. Divide the product into the areas a person would name, and map one area at a time.
40
- 2. Places: one for each screen a person can reach, with its route, the place it stands under, and a rough sketch of it as blocks with its real labels. Leave out routes no person sees.
41
- 3. Screenshots: if you can run the app and drive a browser (Playwright, Puppeteer, or a browser tool of your own), take one of each place: 1440 pixels wide, the whole page, PNG or JPEG under 6 MB, signed in as the persona who uses it where you can, showing made-up data and never a real customer's. Save each beside the map, as \`spec/where/shots/orders.png\`, and give its place \`shot: shots/orders.png\`. Where you can't run the app, leave them out and say why in the pull request.
42
- 4. Personas: one for each kind of person the code distinguishes, named by role, with only what the code and its docs support. Two or three is typical; never more than six. Give each a sentence of where they are when they use the product (\`shows\`), which a picture of them can be drawn from later.
43
- 5. Abilities: one for each thing a persona can do, said from their side ("I can cancel an order before it ships"), with who, where, two to four checks taken from what the code enforces and its tests assert, and in its notes what you inferred.
44
- 6. Tests: where a test already proves a check, put the check's id at the start of its name and change nothing else. With vitest, add the reporter (\`reporters: ['default', 'userforge/reporter']\`, or \`['userforge/reporter', { spec: '../spec' }]\` where the tests run from a folder below the map's); with another runner, write \`spec/results.json\` from its results, as \`{ "S12.2": { "state": "pass", "by": "tests/orders.test.ts", "at": 0 } }\`. Run them, so their results are kept.
45
- 7. What is still missing (\`npx userforge check\`): close what the code can close, and stop when what is left is what the code can't answer, or after three rounds. Then open the pull request: what you mapped, what you left out and why, and where you are unsure who something is for or why it exists.
46
- `;const ne=ee.trim(),re=te.trim();export{G as a,V as c,L as d,R as f,X as i,W as l,re as n,U as o,z as p,Q as r,B as s,ne as t,H as u};
18
+ `,te="# How work is done here\n\nThis project is built from one map, kept in `spec/` beside the code, one file for each thing. Its tools come from `npx userforge mcp`, which `.mcp.json` names: connect them before you change the map.\n\nHowever the work reaches you, it goes the same way:\n\n1. Pull main, then work on a branch of your own. `npx userforge` prints this, what is waiting and where the map stands.\n2. To take something waiting, `read` it (Q4): what was asked, by whom, for which abilities, and the checks that say it is done. If it names none, write them on its abilities first. Code work whose checks all pass is done: `remove` it.\n3. Read each ability before you build it: the ability, the places it names, and any decision that affects it.\n4. Change the map only through its tools, on your branch, beside the code it describes: its files reach main with the code. Never write those files yourself. Change a check's words before you change what it describes, and give a new check its test.\n5. Name each test after the check it proves, its id first: `test('S12.2 shows who it is for', …)`, or `check('S12.2', …)` from `userforge/test`. A check about data (a time, a price, a limit) may instead be proved by examples written under it on its ability (Given, When, Then), run by QuickPickle: each step is defined once, in `tests/steps.ts`. The reporter keeps every result in `spec/results.json`, the failing ones too: commit it with the code.\n6. Never set an ability's stage to building or live: those come from its checks' results.\n7. Build the least that makes a check pass, and delete what a change replaces, moot tests included. Never remove what a person wrote unless they ask.\n8. Run `npx userforge check` before you commit, and leave nothing it names.\n9. Open a pull request into main: what was asked, each ability it touched by its id, and each check's result. Taking something from the queue, name it (`Q4`) and `remove` it in the same pull request. Don't merge it yourself.\n10. When what was asked is a question, answer it to whoever asked, in markdown that reads by itself. A question changes nothing.\n\n## Mapping a codebase\n\nAsked to map this codebase (or to import it, bring it in, or set it up the Userforge way: all the same ask), map what is true today, on a branch, without stopping to ask, and open one pull request at the end. Direction that comes with the ask comes first: areas to focus on or leave out, who the product is for, names to use, how deep to go. Follow it, and say in the pull request how you did. Keep everything small and true: a thing earns its place by being something the team would point at, a check by being something two people would agree passes. Leave out what you would have to invent, and write again what the map already holds rather than writing it twice.\n\n1. Survey: how the project is run and tested, where its routes or screens are, what kinds of user it knows (roles, permissions, plans), and what its README says it is for. A spec the project already keeps in another shape (stories with acceptance criteria, Gherkin `.feature` files, personas, wireframes, a README beside them) is the first source: bring each thing in it into the map as what it is, its acceptance criteria as checks (in a `.feature` file, each `Then` line of an acceptance criteria scenario is one), and a scenario with real steps as an example of the check it shows; say in the pull request which of its files the map now holds. Write the brief: a working name, the idea in a sentence, and who it is for. Divide the product into the areas a person would name, and map one area at a time.\n2. Places: one for each screen a person can reach, with its route, the place it stands under, and a rough sketch of it as blocks with its real labels. Leave out routes no person sees.\n3. Screenshots: if you can run the app and drive a browser (Playwright, Puppeteer, or a browser tool of your own), take one of each place: 1440 pixels wide, the whole page, PNG or JPEG under 6 MB, signed in as the persona who uses it where you can, showing made-up data and never a real customer's. Save each beside the map, as `spec/where/shots/orders.png`, and give its place `shot: shots/orders.png`. Where you can't run the app, leave them out and say why in the pull request.\n4. Personas: one for each kind of person the code distinguishes, named by role, with only what the code and its docs support. Two or three is typical; never more than six. Give each a sentence of where they are when they use the product (`shows`), which a picture of them can be drawn from later.\n5. Abilities: one for each thing a persona can do, said from their side (\"I can cancel an order before it ships\"), with who, where, two to four checks taken from what the code enforces and its tests assert, and in its notes what you inferred.\n6. Tests: where a test already proves a check, put the check's id at the start of its name and change nothing else. With vitest, add the reporter (`reporters: ['default', 'userforge/reporter']`, or `['userforge/reporter', { spec: '../spec' }]` where the tests run from a folder below the map's); with another runner, write `spec/results.json` from its results, as `{ \"S12.2\": { \"state\": \"pass\", \"by\": \"tests/orders.test.ts\", \"at\": 0 } }`. Run them, so their results are kept.\n7. What is still missing (`npx userforge check`): close what the code can close, and stop when what is left is what the code can't answer, or after three rounds. Then open the pull request: what you mapped, what you left out and why, and where you are unsure who something is for or why it exists.\n";const ne=ee.trim(),re=te.trim();export{G as a,V as c,L as d,R as f,X as i,W as l,re as n,U as o,z as p,Q as r,B as s,ne as t,H as u};
@@ -1,7 +1,7 @@
1
1
  /**
2
- * A vitest reporter that keeps each check's result. A test named after a check ("S12.2 …") passes or fails that
3
- * check. The results are kept in `spec/results.json` (or the file it is given), committed with the code they are the
4
- * results of, and a check the map no longer has keeps none; and, when the run is given `USERFORGE_URL` and a
2
+ * A vitest reporter that keeps each check's result. A test named after a check ("S12.2 …"), or an example a Gherkin
3
+ * runner names with the check's tag ("… (@S12.2)"), passes or fails that check. The results are kept in
4
+ * `spec/results.json` (or the file it is given), committed with the code they are the results of, and a check the map no longer has keeps none; and, when the run is given `USERFORGE_URL` and a
5
5
  * workspace's `USERFORGE_KEY`, told to that workspace.
6
6
  *
7
7
  * reporters: ['default', 'userforge/reporter']
package/dist/reporter.js CHANGED
@@ -1 +1 @@
1
- import{n as e,p as t,s as n}from"./map.js";import{c as r,i,n as a,o,t as s}from"./results.js";var c=class{ran={};file;spec;heard=!1;constructor(t={}){this.spec=t.spec??e,this.file=t.file??`${this.spec}/results.json`}onTestCaseResult(e){this.heard=!0;let t=s.exec(e.name)?.[1],n=e.result().state;t&&(n===`passed`||n===`failed`)&&(this.ran=r(this.ran,t,n===`passed`,e.module.relativeModuleId))}async onTestRunEnd(){if(this.heard=!0,!Object.keys(this.ran).length)return;let e=Object.keys(t(Object.values(n(this.spec).all).filter(e=>e.kind===`story`)));i(this.file,this.ran,e.length?new Set(e):void 0);let r=a();r&&console.log(await o(r,this.ran).catch(e=>`Userforge was not told the results: ${e.message}`))}async onFinished(e=[]){if(this.heard)return;let t=(e,n)=>{let i=e.type===`test`?s.exec(e.name)?.[1]:void 0,a=e.result?.state;i&&(a===`pass`||a===`fail`)&&(this.ran=r(this.ran,i,a===`pass`,n));for(let r of e.tasks??[])t(r,n)};for(let n of e)t(n,n.name);await this.onTestRunEnd()}};export{c as default};
1
+ import{h as e,l as t,n}from"./map.js";import{c as r,i,n as a,o,t as s}from"./results.js";var c=class{ran={};file;spec;heard=!1;constructor(e={}){this.spec=e.spec??n,this.file=e.file??`${this.spec}/results.json`}onTestCaseResult(e){this.heard=!0;let t=s(e.name),n=e.result().state;t&&(n===`passed`||n===`failed`)&&(this.ran=r(this.ran,t,n===`passed`,e.module.relativeModuleId))}async onTestRunEnd(){if(this.heard=!0,!Object.keys(this.ran).length)return;let n=Object.keys(e(Object.values(t(this.spec).all).filter(e=>e.kind===`story`)));i(this.file,this.ran,n.length?new Set(n):void 0);let r=a();r&&console.log(await o(r,this.ran).catch(e=>`Userforge was not told the results: ${e.message}`))}async onFinished(e=[]){if(this.heard)return;let t=(e,n)=>{let i=e.type===`test`?s(e.name):void 0,a=e.result?.state;i&&(a===`pass`||a===`fail`)&&(this.ran=r(this.ran,i,a===`pass`,n));for(let r of e.tasks??[])t(r,n)};for(let n of e)t(n,n.name);await this.onTestRunEnd()}};export{c as default};
package/dist/results.d.ts CHANGED
@@ -4,8 +4,8 @@ export type Result = {
4
4
  at: number;
5
5
  };
6
6
  export type Results = Record<string, Result>;
7
- /** A check's id at the start of a test's name. */
8
- export declare const CHECK: RegExp;
7
+ /** The check a test proves, by its name. */
8
+ export declare const checkOf: (name: string) => string | undefined;
9
9
  /** One more test's result for a check: a check proved by several tests passes only when all of them do. */
10
10
  export declare const tally: (ran: Results, id: string, passed: boolean, by: string) => Results;
11
11
  /** Results laid over the ones a file already keeps, in the order of their checks: a run of some tests changes only the checks it ran. */
package/dist/results.js CHANGED
@@ -1,2 +1,2 @@
1
- import{existsSync as e,readFileSync as t,writeFileSync as n}from"node:fs";const r=/^(S\d+\.\d+) /,i=e=>e.slice(1).split(`.`).map(Number),a=(e,t,n,r)=>({...e,[t]:{state:n&&e[t]?.state!==`fail`?`pass`:`fail`,by:r,at:Date.now()}});function o(r,a,o){let s=e(r)?JSON.parse(t(r,`utf8`)):{},c=Object.fromEntries(Object.entries({...s,...a}).filter(([e])=>!o||o.has(e)||e in a).sort(([e],[t])=>i(e)[0]-i(t)[0]||i(e)[1]-i(t)[1]));return n(r,JSON.stringify(c,null,` `)+`
2
- `),c}const s=(e=process.env)=>e.USERFORGE_URL&&e.USERFORGE_KEY?{url:e.USERFORGE_URL.replace(/\/$/,``),key:e.USERFORGE_KEY}:void 0,c=async(e,t,n)=>{let r=await fetch(`${e.url}${t}`,{method:n?`POST`:`GET`,headers:{Authorization:`Bearer ${e.key}`,...n?{"Content-Type":`application/json`}:{}},body:n?JSON.stringify(n):void 0}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(i.message??`Userforge answered ${r.status}.`);return i},l=async(e,t)=>(await c(e,`/api/report`,{results:Object.entries(t).map(([e,{state:t,by:n}])=>({check:e,state:t,by:n}))})).message,u=async e=>(await c(e,`/api/spec`)).files,d=async(e,t,n)=>(await c(e,`/api/site?origin=${encodeURIComponent(t)}${n?`&website=${encodeURIComponent(n)}`:``}`)).files,f=async(e,t)=>(await c(e,`/api/ids`,{kind:t})).id;export{u as a,a as c,o as i,s as n,l as o,f as r,d as s,r as t};
1
+ import{existsSync as e,readFileSync as t,writeFileSync as n}from"node:fs";const r=/^(S\d+\.\d+) |@(S\d+\.\d+)(?![\w.])/,i=e=>{let t=r.exec(e);return t?t[1]??t[2]:void 0},a=e=>e.slice(1).split(`.`).map(Number),o=(e,t,n,r)=>({...e,[t]:{state:n&&e[t]?.state!==`fail`?`pass`:`fail`,by:r,at:Date.now()}});function s(r,i,o){let s=e(r)?JSON.parse(t(r,`utf8`)):{},c=Object.fromEntries(Object.entries({...s,...i}).filter(([e])=>!o||o.has(e)||e in i).sort(([e],[t])=>a(e)[0]-a(t)[0]||a(e)[1]-a(t)[1]));return n(r,JSON.stringify(c,null,` `)+`
2
+ `),c}const c=(e=process.env)=>e.USERFORGE_URL&&e.USERFORGE_KEY?{url:e.USERFORGE_URL.replace(/\/$/,``),key:e.USERFORGE_KEY}:void 0,l=async(e,t,n)=>{let r=await fetch(`${e.url}${t}`,{method:n?`POST`:`GET`,headers:{Authorization:`Bearer ${e.key}`,...n?{"Content-Type":`application/json`}:{}},body:n?JSON.stringify(n):void 0}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(i.message??`Userforge answered ${r.status}.`);return i},u=async(e,t)=>(await l(e,`/api/report`,{results:Object.entries(t).map(([e,{state:t,by:n}])=>({check:e,state:t,by:n}))})).message,d=async e=>(await l(e,`/api/spec`)).files,f=async(e,t,n)=>(await l(e,`/api/site?origin=${encodeURIComponent(t)}${n?`&website=${encodeURIComponent(n)}`:``}`)).files,p=async(e,t)=>(await l(e,`/api/ids`,{kind:t})).id;export{d as a,o as c,s as i,c as n,u as o,p as r,f as s,i as t};
package/dist/store.d.ts CHANGED
@@ -29,6 +29,8 @@ export interface Store {
29
29
  /**
30
30
  * A project's map, as its files keep it (`spec/`, or `USERFORGE_SPEC`). A new thing's id comes from the workspace
31
31
  * when there is a key to it (`USERFORGE_URL`, `USERFORGE_KEY`), so two branches never take the same one; otherwise it
32
- * is the next the files leave free. Every write leaves the front page written again.
32
+ * is the next the files leave free. A thing's file is named for what it is called, so a write that changes that moves
33
+ * it; a persona's role is said in the abilities for it, so those are written again with it. Every write leaves the
34
+ * front page written again.
33
35
  */
34
36
  export declare function filesStore(dir?: string, kinds?: Kinds): Store;
package/dist/test.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { type Checks } from './checks.ts';
2
+ /** The ability files holding examples, for a Gherkin runner to run (QuickPickle): `include: ['tests/**\/*.test.ts', ...exampled()]`. */
3
+ export { exampled } from './map.ts';
2
4
  export declare const checker: (checks: Checks) => (id: string, prove: () => unknown, timeout?: number) => void;
3
5
  /** A test that proves one check of the map in `spec/` (or `USERFORGE_SPEC`). */
4
6
  export declare const check: (id: string, prove: () => unknown, timeout?: number) => void;
package/dist/test.js CHANGED
@@ -1 +1 @@
1
- import{test as e}from"vitest";import{n as t,p as n,s as r}from"./map.js";const i=t=>(n,r,i)=>{if(!t[n])throw Error(`There is no check ${n}.`);e(`${n} ${t[n]}`,r,i)};let a;const o=(e,o,s)=>(a??=i(n(Object.values(r(t).all).filter(e=>e.kind===`story`))))(e,o,s);export{o as check,i as checker};
1
+ import{test as e}from"vitest";import{h as t,l as n,n as r,r as i}from"./map.js";const a=t=>(n,r,i)=>{if(!t[n])throw Error(`There is no check ${n}.`);e(`${n} ${t[n]}`,r,i)};let o;const s=(e,i,s)=>(o??=a(t(Object.values(n(r).all).filter(e=>e.kind===`story`))))(e,i,s);export{s as check,a as checker,i as exampled};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "userforge",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Build software the Userforge way: the map of who it is for, what they can do and where, kept beside the code.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -53,6 +53,8 @@
53
53
  }
54
54
  },
55
55
  "devDependencies": {
56
+ "@cucumber/gherkin": "^43.1.0",
57
+ "@cucumber/messages": "^35.0.0",
56
58
  "@types/node": "^24.0.0",
57
59
  "rolldown": "^1.0.0-rc.1",
58
60
  "typescript": "^6.0.3",