userforge 0.1.1 → 0.3.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/README.md CHANGED
@@ -1,52 +1,20 @@
1
1
  # userforge
2
2
 
3
- The map's tools, command line, file format and test tools for a project built
4
- the Userforge way. The project keeps a map beside its code, in `spec/`: who it
5
- is for (personas), what each of them needs to be able to do (abilities, each
6
- with checks), and where that happens (places), one YAML file per thing,
7
- holding its data by key. Tests are named after the checks they prove, so the
8
- map always says what works.
3
+ The map of a product, kept beside its code in `spec/`: who it is for, what
4
+ they need to do, where, and why. One file per thing. This package is its
5
+ command line, its tools for coding agents, and its test helpers. No account,
6
+ and no network unless given a Userforge workspace.
9
7
 
10
- It needs nothing else: no account, and no network unless it is given a
11
- Userforge workspace.
12
-
13
- ## Install
8
+ ## Set up
14
9
 
15
10
  ```sh
16
11
  npm i -D userforge
17
12
  npx userforge init
18
13
  ```
19
14
 
20
- `init` creates `spec/` with a brief to start from, adds one line to
21
- `AGENTS.md`, points `CLAUDE.md` at it, and names the map's tools in
22
- `.mcp.json`. Nothing already there is written over. The line sends every
23
- coding agent here:
24
-
25
- > This project is built the Userforge way: run `npx userforge` and follow it.
26
-
27
- For a codebase that already exists, then ask your coding agent to **map this
28
- codebase**. It writes the brief, a place for each screen (with a screenshot,
29
- if it can run the app), personas, abilities with their checks, and names your
30
- tests after them, on a branch, and opens a pull request. Say "import" if you
31
- prefer, and add any direction: "Map this codebase, focusing on the admin side."
32
-
33
- ## The map's tools
34
-
35
- A coding agent reads and changes the map only through its tools, which
36
- `.mcp.json` names: `npx userforge mcp`, a Model Context Protocol server on
37
- stdin and stdout. Restart the agent after `init` so it picks them up.
38
-
39
- | | |
40
- |---|---|
41
- | `overview` | The brief, the personas, how many abilities stand at each stage, the places, the code work waiting, and what needs attention: abilities with a check that fails, no checks or no place, places with no picture, decisions still proposed, and code work whose checks all pass or that names none. |
42
- | `list`, `read` | Every thing of a kind, searched or tied to a persona, place or ability; one thing as its file holds it. |
43
- | `write_persona`, `write_story`, … | One for each kind, its input that kind's sheet. Makes a thing under the next id, or writes one again by its key. |
44
- | `change`, `remove` | A line or two changed by its path; a thing removed, and taken out of whatever pointed at it. |
45
-
46
- What a tool is given is fitted to its kind's sheet exactly as the Userforge
47
- app fits what a person writes there. What doesn't fit is turned down with what
48
- would, and nothing is written. Every write leaves `spec/README.md` written
49
- again.
15
+ `init` makes `spec/` with a brief and its front page, adds one line to `AGENTS.md`, points
16
+ `CLAUDE.md` at it, and names the map's tools in `.mcp.json`. Nothing already
17
+ there is written over. Then ask your coding agent to **map this codebase**.
50
18
 
51
19
  ## The map
52
20
 
@@ -54,48 +22,61 @@ again.
54
22
  |---|---|
55
23
  | `spec/why/` | The brief, documents, decisions, research and sources. |
56
24
  | `spec/who/` | Personas. |
57
- | `spec/what/` | Abilities, each with its checks (`S12.2` is check 2 of `S12`). |
58
- | `spec/where/` | Places: screens, and a website's pages. Screenshots beside them, in `spec/where/shots/`. |
59
- | `spec/queue/` | Code work waiting for a coding agent, one file each. |
25
+ | `spec/what/` | Abilities, in Gherkin. |
26
+ | `spec/where/` | Places, with their screenshots in `shots/`. |
27
+ | `spec/queue/` | Code work waiting for a coding agent. |
60
28
  | `spec/results.json` | The last result of every check. |
61
- | `spec/README.md` | The front page, written from the files. Never edited by hand. |
62
-
63
- A file is the thing's data by key, exactly as a workspace holds it:
64
-
65
- ```yaml
66
- stage: planned
67
- who: [P1]
68
- what: see tomorrow’s orders
69
- where: [W1]
70
- checks:
71
- - id: "1"
72
- text: The orders for tomorrow are listed.
29
+ | `spec/README.md` | Its front page: what each folder holds, and how to work here. Written for you. |
30
+
31
+ Each file is named by its id, then what it is called
32
+ (`who/P2-weekday-regular.yaml`), and found by its id. Everything points at
33
+ things by id. An ability reads as its user story:
34
+
35
+ ```gherkin
36
+ @S1 @planned @P2 @W1
37
+ Ability: reserve tomorrow’s sourdough with just my name and phone number
38
+ As a Weekday regular
39
+ When I’m on the sofa after dinner
40
+ So that my loaf is waiting at 8:15
41
+
42
+ @S1.3
43
+ Rule: After the 7:30pm cutoff, tomorrow’s orders are closed.
44
+
45
+ Example: a late order on a Tuesday
46
+ Given it is 7:45pm on Tuesday
47
+ When I open the order page
48
+ Then it says Wednesday’s orders are closed
73
49
  ```
74
50
 
75
- An ability's stage comes from its results. People say idea or planned; it is
76
- building while a check fails on main or a branch is at work on it, and live
77
- once every check passes on main.
51
+ Its tags are its id, stage, personas and places; the `As a …` line is written
52
+ from the personas. Each `Rule:` is a check, tagged with its id. Everything
53
+ else is YAML, by its data's own keys. An ability is building while a check
54
+ fails on main or a branch is at work on it, and live once every check passes
55
+ on main.
56
+
57
+ Change the map only through its tools (`npx userforge mcp`, which `.mcp.json`
58
+ names); they fit what they are given to each kind's sheet, as the app does.
78
59
 
79
60
  ## Commands
80
61
 
81
62
  | | |
82
63
  |---|---|
83
- | `npx userforge` | What the map holds, how work is done here, what is waiting in `spec/queue/`, and where the map stands. |
84
- | `npx userforge init` | Sets the project up, or gives one that has its map what it lacks. |
85
- | `npx userforge mcp` | The map's tools, over stdin and stdout. |
86
- | `npx userforge check` | Says what doesn't hold together: files that don't fit, pointers to nothing, pictures that aren't there, citations of what may not be cited, code work still waiting though its checks all pass, and checks of abilities being built that no test is named after (but those that waiting code work names). |
87
- | `npx userforge pull` | Writes a workspace's map into `spec/`. |
88
- | `npx userforge report [file]` | Tells a workspace the results in `spec/results.json`. |
89
- | `npx userforge site <address> [website]` | Writes a workspace's website into `site/`, for a host of your own. |
90
-
91
- `pull`, `report` and `site` need `USERFORGE_URL` and `USERFORGE_KEY`, your
92
- own key from Settings, Code. With them, the tools take each new thing's id
93
- from the workspace, so two branches never take the same one. `USERFORGE_SPEC` moves the
94
- map from `spec/`; `USERFORGE_TESTS` says where the tests are when they aren't
95
- in `tests/`, `test/` or `__tests__/`.
64
+ | `npx userforge` | How work is done here, what is waiting, and where the map stands. |
65
+ | `npx userforge init` | Sets the project up. |
66
+ | `npx userforge check` | What doesn't hold together. Run it before you commit. |
67
+ | `npx userforge pull` | A workspace's map, written into `spec/`. |
68
+ | `npx userforge report [file]` | `spec/results.json`, told to a workspace. |
69
+ | `npx userforge site <address> [website]` | A workspace's website, written into `site/`. |
70
+
71
+ `pull`, `report` and `site` need `USERFORGE_URL` and `USERFORGE_KEY` (Settings,
72
+ Code). With them, new ids come from the workspace, so two branches never take
73
+ the same one. `USERFORGE_SPEC` moves the map; `USERFORGE_TESTS` says where the
74
+ tests are.
96
75
 
97
76
  ## Tests
98
77
 
78
+ Name each test after the check it proves:
79
+
99
80
  ```ts
100
81
  import { check } from 'userforge/test';
101
82
 
@@ -104,38 +85,27 @@ check('S12.2', () => {
104
85
  });
105
86
  ```
106
87
 
107
- A test whose name starts with a check's id (`test('S12.2 …', …)`) proves it
108
- too. The vitest reporter keeps every result in `spec/results.json`; commit it
109
- with the code:
88
+ A check's examples run with [QuickPickle](https://github.com/dnotes/quickpickle),
89
+ each step defined once. The reporter keeps every result in
90
+ `spec/results.json`; commit it with the code.
110
91
 
111
92
  ```ts
112
93
  // vitest.config.ts
113
- export default { test: { reporters: ['default', 'userforge/reporter'] } };
94
+ import { quickpickle } from 'quickpickle';
95
+ import { exampled } from 'userforge/test';
96
+
97
+ export default {
98
+ plugins: [quickpickle()],
99
+ test: {
100
+ include: ['tests/**/*.test.ts', ...exampled()],
101
+ setupFiles: ['tests/steps.ts'],
102
+ reporters: ['default', 'userforge/reporter']
103
+ }
104
+ };
114
105
  ```
115
106
 
116
- ## What an agent is told
117
-
118
- [`map.md`](map.md) says what the map holds and how its tools are used;
119
- [`process.md`](process.md) says how work is done in a Userforge project,
120
- mapping an existing codebase included. `npx userforge` prints both, and the
121
- tools carry both as their instructions. Update this package to get newer ones.
122
-
123
- ## In code
124
-
125
- `import { … } from 'userforge'`: the tools (`tools`, `call`) over a map kept
126
- anywhere (`Store`; `filesStore` for `spec/`); fitting a thing to its kind's
127
- sheet (`fitThing`) and what on it needs someone (`needs`), also alone as
128
- `userforge/fit` for an app that has viewschema itself; the file format (`fromFile`, `toFile`, `yamlOf`,
129
- `overview`) and the kinds (`kinds`); a map read and checked (`readMap`,
130
- `faults`, `init`); checks and results (`checksIn`, `unproved`, `keep`,
131
- `resultsIn`); stages (`stageOf`, `storyStage`, also alone as
132
- `userforge/stage`); set-up (`setup`, `lineFor`); and what an agent is told
133
- (`MAP`, `PROCESS`).
134
-
135
107
  ## Working on this package
136
108
 
137
- `npm test` builds `dist/` and runs the tests, and runs before every
138
- `npm publish`. What is published is `dist/` alone, minified, with viewschema
139
- bundled into it; `dist/` is committed too, so the repository installs with no
140
- build step. `kinds.json` is written by the Userforge app (`npm run userforge:vendor`
141
- there) and never edited here.
109
+ `npm test` builds `dist/` and runs the tests. `dist/` is committed, so the
110
+ repository installs with no build step. `kinds.json` is written by the
111
+ Userforge app (`npm run userforge:vendor` there), never here.
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import{spawnSync as e}from"node:child_process";import{existsSync as t,mkdirSync as n,readFileSync as r,writeFileSync as i}from"node:fs";import{dirname as a,join as o,relative as s}from"node:path";import{c,i as l,m as u,n as d,p as f,r as p,s as m,t as h}from"./map.js";import{createInterface as g}from"node:readline";import{a as _,i as v,n as y,r as b,t as x}from"./process.js";import{storyStage as S,workDone as C}from"./stage.js";import{a as w,n as T,o as E,s as D}from"./results.js";var O=`0.1.1`;const k=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`];async function A(e,t){let{id:n,method:r,params:i={}}=t??{};if(n==null)return null;let a=e=>({jsonrpc:`2.0`,id:n,result:e});try{switch(r){case`initialize`:return a({protocolVersion:k.includes(i.protocolVersion)?i.protocolVersion:k[0],capabilities:{tools:{}},serverInfo:{name:`userforge`,version:O},instructions:`${x}\n\n${y}`});case`ping`:return a({});case`tools/list`:return a({tools:v(e)});case`tools/call`:{let{text:t,failed:n}=await b(e,String(i.name??``),i.arguments);return a({content:[{type:`text`,text:t}],...n?{isError:!0}:{}})}default:return{jsonrpc:`2.0`,id:n,error:{code:-32601,message:`Method not found: ${r}`}}}}catch(e){return{jsonrpc:`2.0`,id:n,error:{code:-32603,message:e.message}}}}function j(e=_()){return new Promise(t=>{let n=g({input:process.stdin}),r=Promise.resolve();n.on(`line`,t=>{if(!t.trim())return;let n;try{n=JSON.parse(t)}catch{process.stdout.write(`${JSON.stringify({jsonrpc:`2.0`,id:null,error:{code:-32700,message:`Parse error`}})}\n`);return}r=r.then(()=>A(e,n)).then(e=>e&&process.stdout.write(`${JSON.stringify(e)}\n`))}),n.on(`close`,()=>void r.then(()=>t(0)))})}function M(e=d){let t=c(e);return Object.values(m(e).all).filter(e=>e.kind===`queue`).sort((e,t)=>Number(e.key.slice(1))-Number(t.key.slice(1))).map(e=>{let n=(e.data.queue.done??[]).filter(Boolean);return{id:e.key,asked:String(e.data.queue.asked??``),abilities:e.data.queue.for??[],done:n,finished:C(n,t)}})}const N=process.env.USERFORGE_TESTS??u(),P=s(process.cwd(),d)||`spec`,F=e=>e.length&&console.log(e.join(`
3
- `)),I=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,L=e=>T()?void 0:(console.error(`usage: USERFORGE_URL=… USERFORGE_KEY=… userforge ${e}`),2);function R(){let{all:e}=m(),t=t=>Object.values(e).filter(e=>e.kind===t),n=t(`story`),r=c(),i=n.filter(e=>S(e,r)===`live`).length,a=p(d,N).length;return[`The map holds ${I(t(`persona`).length,`persona`)}, ${I(n.length,`ability`,`abilities`)} (${i} live) with ${I(Object.keys(f(n)).length,`check`)}, and ${I(t(`place`).length,`place`)};`,a?`${I(a,`thing doesn't`,`things don't`)} hold together: \`npx userforge check\` says which.`:`it holds together.`].join(` `)}const z=e=>[e.abilities.length&&`for ${e.abilities.join(`, `)}`,e.finished?`done: ${e.done.join(`, `)} pass, so remove it`:e.done.length?`done when ${e.done.join(`, `)} pass`:`no checks say when it is done: write them first`].filter(Boolean).join(`; `),B=["The site is changed in Userforge and taken again with this command, never edited here. `_redirects` lists old address, new address, 301.",`Cloudflare Pages: npx wrangler pages deploy site --project-name <name>, then add the domain under the project’s custom domains.`,`Firebase Hosting: point hosting.public at the folder in firebase.json, with "cleanUrls": true, run firebase deploy --only hosting, then add the domain under Hosting’s custom domains and the DNS records it shows.`,`Then open the address: the home page loads, a link to another page works, and the sign-up form answers.`],V={"":()=>{let e=M(d);return F([x,``,y,``,`## Waiting in ${P}/queue/`,``,...e.length?e.map(e=>`- ${e.id}: ${e.asked.split(`
4
- `)[0]}${z(e)?` (${z(e)})`:``}`):[`Nothing is waiting.`],``,t(d)?R():`There is no map in ${P}/ yet: \`npx userforge init\` sets one up.`]),0},init:()=>{let n=t(d),r=n&&t(o(d,`README.before.md`)),i=[...n?[]:[`${P}/`],...l()],a=!Object.values(m().all).some(e=>[`persona`,`story`,`place`].includes(e.kind)),s=e(`git`,[`check-ignore`,`-q`,o(d,`README.md`)]).status===0;return F([i.length?`Set up ${i.join(`, `)}.`:`It is set up already.`,...!r&&t(o(d,`README.before.md`))?[`The README.md that was in ${P}/ is kept as ${P}/${h}; the map's own front page is ${P}/README.md.`]:[],...s?[`git leaves ${P}/ out (.gitignore): take it out, or the map never reaches the repository, nor a workspace linked to it.`]:[],...a?[``,`Next, ask your coding agent: “Map this codebase.” Add any direction you like, such as “Map this codebase, focusing on the admin side.” It maps it on a branch and opens a pull request.`,"For a new project with no code yet, run `npx userforge` and follow it."]:[]]),0},mcp:()=>j(),check:()=>{let e=p(d,N);return F(e),+!!e.length},async pull(){let e=await w(T());for(let[t,r]of Object.entries(e))n(a(o(d,t)),{recursive:!0}),i(o(d,t),r);return console.log(`${Object.keys(e).length-1} things written to ${P}/.`),0},report:async([e=o(d,`results.json`)])=>(console.log(await E(T(),JSON.parse(r(e,`utf8`)))),0),async site([e,t]){if(!/^https?:\/\/[^/\s]+$/.test(e??``))return console.error(`usage: userforge site <address, such as https://www.example.com> [website id]`),2;let r=await D(T(),e,t);for(let[e,t]of Object.entries(r))n(a(o(`site`,e)),{recursive:!0}),i(o(`site`,e),t);return F([`${I(Object.keys(r).length,`file`)} written to site/.`,``,...B]),0}},[H=``,...U]=process.argv.slice(2),W=V[H];W?Promise.resolve().then(()=>[`pull`,`report`,`site`].includes(H)?L(H)??W(U):W(U)).then(e=>void(process.exitCode=e),e=>(console.error(e.message),process.exitCode=1)):(console.error(`usage: userforge [init | mcp | check | pull | report [results.json] | site <address> [website]]`),process.exitCode=2);export{};
2
+ import{spawnSync as e}from"node:child_process";import{existsSync as t,mkdirSync as n,readFileSync as r,rmSync as i,writeFileSync as a}from"node:fs";import{dirname as o,join as s,relative as c}from"node:path";import{a as l,c as u,h as d,i as f,l as p,m,n as h,o as g,q as _,t as v}from"./map.js";import{createInterface as y}from"node:readline";import{a as b,i as x,n as S,r as C,t as w}from"./process.js";import{storyStage as T,workDone as E}from"./stage.js";import{a as D,n as O,o as k,s as A}from"./results.js";var j=`0.3.0`;const M=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`];async function N(e,t){let{id:n,method:r,params:i={}}=t??{};if(n==null)return null;let a=e=>({jsonrpc:`2.0`,id:n,result:e});try{switch(r){case`initialize`:return a({protocolVersion:M.includes(i.protocolVersion)?i.protocolVersion:M[0],capabilities:{tools:{}},serverInfo:{name:`userforge`,version:j},instructions:`${w}\n\n${S}`});case`ping`:return a({});case`tools/list`:return a({tools:x(e)});case`tools/call`:{let{text:t,failed:n}=await C(e,String(i.name??``),i.arguments);return a({content:[{type:`text`,text:t}],...n?{isError:!0}:{}})}default:return{jsonrpc:`2.0`,id:n,error:{code:-32601,message:`Method not found: ${r}`}}}}catch(e){return{jsonrpc:`2.0`,id:n,error:{code:-32603,message:e.message}}}}function P(e=b()){return new Promise(t=>{let n=y({input:process.stdin}),r=Promise.resolve();n.on(`line`,t=>{if(!t.trim())return;let n;try{n=JSON.parse(t)}catch{process.stdout.write(`${JSON.stringify({jsonrpc:`2.0`,id:null,error:{code:-32700,message:`Parse error`}})}\n`);return}r=r.then(()=>N(e,n)).then(e=>e&&process.stdout.write(`${JSON.stringify(e)}\n`))}),n.on(`close`,()=>void r.then(()=>t(0)))})}function F(e=h){let t=p(e);return Object.values(u(e).all).filter(e=>e.kind===`queue`).sort((e,t)=>Number(e.key.slice(1))-Number(t.key.slice(1))).map(e=>{let n=(e.data.queue.done??[]).filter(Boolean);return{id:e.key,asked:String(e.data.queue.asked??``),abilities:e.data.queue.for??[],done:n,finished:E(n,t)}})}const I=process.env.USERFORGE_TESTS??d(),L=c(process.cwd(),h)||`spec`,R=e=>e.length&&console.log(e.join(`
3
+ `)),z=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,B=e=>O()?void 0:(console.error(`usage: USERFORGE_URL=… USERFORGE_KEY=… userforge ${e}`),2);function V(){let{all:e}=u(),t=t=>Object.values(e).filter(e=>e.kind===t),n=t(`story`),r=p(),i=n.filter(e=>T(e,r)===`live`).length,a=f(h,I).length;return[`The map holds ${z(t(`persona`).length,`persona`)}, ${z(n.length,`ability`,`abilities`)} (${i} live) with ${z(Object.keys(m(n)).length,`check`)}, and ${z(t(`place`).length,`place`)};`,a?`${z(a,`thing doesn't`,`things don't`)} hold together: \`npx userforge check\` says which.`:`it holds together.`].join(` `)}const H=e=>[e.abilities.length&&`for ${e.abilities.join(`, `)}`,e.finished?`done: ${e.done.join(`, `)} pass, so remove it`:e.done.length?`done when ${e.done.join(`, `)} pass`:`no checks say when it is done: write them first`].filter(Boolean).join(`; `),U=["The site is changed in Userforge and taken again with this command, never edited here. `_redirects` lists old address, new address, 301.",`Cloudflare Pages: npx wrangler pages deploy site --project-name <name>, then add the domain under the project’s custom domains.`,`Firebase Hosting: point hosting.public at the folder in firebase.json, with "cleanUrls": true, run firebase deploy --only hosting, then add the domain under Hosting’s custom domains and the DNS records it shows.`,`Then open the address: the home page loads, a link to another page works, and the sign-up form answers.`],W={"":()=>{let e=F(h);return R([w,``,S,``,`## Waiting in ${L}/queue/`,``,...e.length?e.map(e=>`- ${e.id}: ${e.asked.split(`
4
+ `)[0]}${H(e)?` (${H(e)})`:``}`):[`Nothing is waiting.`],``,t(h)?V():`There is no map in ${L}/ yet: \`npx userforge init\` sets one up.`]),0},init:()=>{let n=t(h),r=n&&t(s(h,`README.before.md`)),i=[...n?[]:[`${L}/`],...l()],a=!Object.values(u().all).some(e=>[`persona`,`story`,`place`].includes(e.kind)),o=e(`git`,[`check-ignore`,`-q`,s(h,`README.md`)]).status===0;return R([i.length?`Set up ${i.join(`, `)}.`:`It is set up already.`,...!r&&t(s(h,`README.before.md`))?[`The README.md that was in ${L}/ is kept as ${L}/${v}; the map's own front page is ${L}/README.md.`]:[],...o?[`git leaves ${L}/ out (.gitignore): take it out, or the map never reaches the repository, nor a workspace linked to it.`]:[],...a?[``,`Next, ask your coding agent: “Map this codebase.” Add any direction you like, such as “Map this codebase, focusing on the admin side.” It maps it on a branch and opens a pull request.`,"For a new project with no code yet, run `npx userforge` and follow it."]:[]]),0},mcp:()=>P(),check:()=>{let e=f(h,I);return R(e),+!!e.length},async pull(){let e=await D(O()),r=t(h)?u().paths:{};for(let t of Object.keys(e)){let e=r[_(g,t)?.key??``];e&&e!==t&&i(s(h,e),{force:!0})}for(let[t,r]of Object.entries(e))n(o(s(h,t)),{recursive:!0}),a(s(h,t),r);return console.log(`${z(Object.keys(e).filter(e=>e!==`README.md`).length,`thing`)} written to ${L}/.`),0},report:async([e=s(h,`results.json`)])=>(console.log(await k(O(),JSON.parse(r(e,`utf8`)))),0),async site([e,t]){if(!/^https?:\/\/[^/\s]+$/.test(e??``))return console.error(`usage: userforge site <address, such as https://www.example.com> [website id]`),2;let r=await A(O(),e,t);for(let[e,t]of Object.entries(r))n(o(s(`site`,e)),{recursive:!0}),a(s(`site`,e),t);return R([`${z(Object.keys(r).length,`file`)} written to site/.`,``,...U]),0}},[G=``,...K]=process.argv.slice(2),q=W[G];q?Promise.resolve().then(()=>[`pull`,`report`,`site`].includes(G)?B(G)??q(K):q(K)).then(e=>void(process.exitCode=e),e=>(console.error(e.message),process.exitCode=1)):(console.error(`usage: userforge [init | mcp | check | pull | report [results.json] | site <address> [website]]`),process.exitCode=2);export{};
package/dist/files.d.ts CHANGED
@@ -1,12 +1,19 @@
1
1
  import { type Kinds, type Thing } from './kinds.ts';
2
- import type { Results } from './results.ts';
3
2
  /** A thing's data as YAML, by its own keys, in one order: what its file holds, whether or not its kind is kept in files. */
4
3
  export declare function yamlOf(kinds: Kinds, thing: Thing): string;
5
- /** A thing as its file says it: its path, and its YAML. Nothing, for a kind kept in the workspace alone. */
6
- export declare function toFile(kinds: Kinds, thing: Thing): {
4
+ /**
5
+ * A thing as its file says it: its path, and what it holds. Nothing, for a kind kept in the workspace alone. Given
6
+ * everything there is (`all`), an ability says who it is for by their roles too, as it always should be written.
7
+ */
8
+ export declare function toFile(kinds: Kinds, thing: Thing, all?: Record<string, Thing>): {
7
9
  path: string;
8
10
  text: string;
9
11
  } | undefined;
12
+ /**
13
+ * Whether two texts of one file say the same thing, however each is spaced, ordered or commented: what each holds as
14
+ * written, before it is fitted. (A check written without its number, or a persona without its colour, says less.)
15
+ */
16
+ export declare function sameFile(kinds: Kinds, path: string, a: string, b: string): boolean;
10
17
  /**
11
18
  * A file read back into the thing it holds, fitted to its kind's sheet: what doesn't fit is said, by its path. Given
12
19
  * everything there is (`all`), what it points at and cites is checked too.
@@ -14,8 +21,12 @@ export declare function toFile(kinds: Kinds, thing: Thing): {
14
21
  export declare function fromFile(kinds: Kinds, path: string, text: string, all?: Record<string, Thing>): {
15
22
  thing: Thing;
16
23
  problems: string[];
24
+ said?: string;
17
25
  } | undefined;
18
- /** The line the map's front page opens with, which says it is written from the files beside it. */
19
- export declare const FRONT = "<!-- Written from the files beside it; what is changed here is written over. -->";
20
- /** The map's front page: the idea, the documents, who it is for and what each of them can do (at the stage its results say), and where. Written, never edited. */
21
- export declare function overview(kinds: Kinds, all: Record<string, Thing>, results?: Results): string;
26
+ /** The line the map's front page opens with, which says it is written for it. */
27
+ export declare const FRONT = "<!-- Written by userforge; what is changed here is written over. -->";
28
+ /**
29
+ * The map's front page, for whoever finds the folder: what the product is, what each folder holds, and how to work
30
+ * here. It changes only when the map does: a folder is first used, or the brief says something new. Written, never read.
31
+ */
32
+ export declare function overview(kinds: Kinds, all: Record<string, Thing>): string;
package/dist/fit.d.ts CHANGED
@@ -28,6 +28,12 @@ export declare function unnamed(kinds: Kinds, all: Record<string, Thing>, key: s
28
28
  thing: Thing;
29
29
  fields: string[];
30
30
  }[];
31
+ /**
32
+ * What is wrong with an example's steps, as a sentence: each line a step (Given, When, Then, And, But or *), a row of
33
+ * a table under one (`| … |`), a comment, or inside a doc string (between `"""` or ```` ``` ````). Nothing, when they
34
+ * can be run, or when there are none yet.
35
+ */
36
+ export declare function stepsFault(steps: unknown): string | undefined;
31
37
  type Defs = Record<string, JSONSchemaProperty>;
32
38
  /**
33
39
  * What a writer wrote, with its quotation marks and apostrophes set as type. Addresses are left as they came, and so
@@ -72,6 +78,6 @@ export declare function fitThing(kinds: Kinds, kind: string, given: Record<strin
72
78
  problems: string[];
73
79
  };
74
80
  export { citationsIn, citationsOf, cited, eachChanged, eachLine, heldTo, keysIn, keysOf, quoted, says, uncited, type Citation } from './cite.ts';
75
- export { called, EXT, kindOf, pathOf, thingAt, type Kind, type Kinds, type Schema, type Thing } from './kinds.ts';
81
+ export { called, EXTS, extOf, kindOf, pathOf, slugOf, thingAt, type Kind, type Kinds, type Schema, type Thing } from './kinds.ts';
76
82
  export { isSite, needs, NEEDS, siteOf, SITE_BLOCK, type Need } from './needs.ts';
77
83
  export { spamOf, spammy, waiting } from './notes.ts';
package/dist/fit.js CHANGED
@@ -1,2 +1,3 @@
1
- import{CITATION as e,extractSchema as t,fit as n,resolveSchema as r}from"viewschema";const i=/^[A-Z]\d+$/,a=()=>new RegExp(e.source,`g`),o=e=>[...new Set(e.split(/[,;]/).map(e=>e.trim()).filter(e=>i.test(e)))],s=(e,t)=>`[${e}](cite:${t.join(`,`)})`,c=e=>[...String(e??``).matchAll(a())].map(e=>({words:e[1],keys:o(e[2])}));function l(e,t,n=``){if(typeof e==`string`)t(n,e);else if(Array.isArray(e))e.forEach((e,r)=>l(e,t,n?`${n}.${r}`:String(r)));else if(e&&typeof e==`object`)for(let[r,i]of Object.entries(e))l(i,t,n?`${n}.${r}`:r)}function u(e,t,n=``){if(typeof e==`string`)return t(e,n);if(Array.isArray(e)){let r=e.map((e,r)=>u(e,t,n?`${n}.${r}`:String(r)));return r.some((t,n)=>t!==e[n])?r:e}if(e&&typeof e==`object`){let r=!1,i=Object.fromEntries(Object.entries(e).map(([e,i])=>{let a=u(i,t,n?`${n}.${e}`:e);return r||=a!==i,[e,a]}));return r?i:e}return e}function d(e){let t=[];return l(e,(e,n)=>n.includes(`](cite:`)&&t.push(...c(n).map(t=>({...t,path:e})))),t}const f=e=>[...new Set(d(e).flatMap(e=>e.keys))],p=e=>u(e,e=>e.includes(`](cite:`)?e.replace(a(),`$1`):e),m=e=>String(e??``).normalize(`NFKC`).toLowerCase().replace(/[‘’ʼ']/g,``).replace(/[^\p{L}\p{N}]+/gu,` `).trim();function h(e,t){let n=m(t);return n.split(` `).length>=4&&` ${m(e)} `.includes(` ${n} `)}const g=(e,t=``)=>/^\s*["“«„‘][^"”»“«„]*["”»“’][.,;:!?]?\s*$/.test(e)||/(^|\.)(quote|said)$/.test(t);function _(e,t){return u(e,(e,n)=>e.includes(`](cite:`)?e.replace(a(),(e,r,i)=>{let a=o(i).filter(e=>t(e)!==void 0&&(!g(r,n)||h(t(e),r)));return a.length?s(r,a):r}):e)}const v=`.yaml`,y=(e,t,n)=>{let r=e[t]?.file;return r&&`${r.dir}/${r.name??n}.yaml`};function b(e,t){let[n,r=``]=t.split(`/`).slice(-2);if(!r.endsWith(`.yaml`))return;let i=r.slice(0,-5);for(let[t,r]of Object.entries(e))if(r.file?.dir===n&&(r.file.name?r.file.name===i:RegExp(`^${r.letter}\\d+$`).test(i)))return{kind:t,key:r.file.name?`${r.letter}1`:i}}const x=(e,t)=>Object.keys(e).find(n=>RegExp(`^${e[n].letter}\\d+$`).test(t)),S=e=>{let t=e?.data[e.kind]??{};return String(t.role||t.name||t.title||t.what||t.question||t.summary||t.text||t.asked||e?.key||``).trim()},C=/\bhttps?:\/\/[^\s<>()"']+|\bwww\.[^\s<>()"']+\.[a-z]{2,}[^\s<>()"']*/gi,w=/^([^\n(]{2,80}\(\s*https?:\/\/[^)\s]+\s*\)|\s*https?:\/\/\S+)\s*[-–—:|]/,T=/\[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 E(e){let t=String(e??``).trim();if(!t)return;let n=t.match(C)??[];if(n.length>=3||n.join(``).length>=t.length*.4)return`links`;if(w.test(t))return`advert`;if(T.test(t))return`phrases`}const D=e=>!e.facts?.person&&!!E(e.data.feedback?.text),O=e=>e.data.feedback?.status!==`done`&&!D(e),k=`c-site`,A=e=>(e.data.place?.blocks??[]).some(e=>e?.is===k);function j(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(A(n))return n}const M=[`failing`,`unchecked`,`unplaced`,`bare`,`unsorted`,`undecided`];function N(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=>!j(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(O)),undecided:r(n(`decision`).filter(e=>(e.data.decision.status??`proposed`)===`proposed`))}}var P=class extends Error{};const F=(e,t)=>`This doesn’t fit the ${e} sheet:\n- ${t.join(`
2
- - `)}`,I=e=>e?.kind===`source`&&e.data.source.cite!==`no`,L=(e,t)=>_(t,t=>I(e[t])?String(e[t].data.source.text??``):void 0);function R(e,t){let n=e.data[e.kind]??{},r=n.blocks?.[Number(t)-1]??{};if(e.kind===`story`)return n.checks?.find(e=>e.id===t)?.text;if(e.kind===`research`)return n.findings?.[Number(t)-1]?.claim;if(e.kind===`place`)return Object.entries(r).find(([e,t])=>e!==`is`&&typeof t==`string`&&t)?.[1];if(e.kind===`document`||e.kind===`brief`)return r.label||r.left?.label}function z(e,t){let[,n,r]=/^([A-Z]\d+)(?:\.(\d+))?$/.exec(String(t??``).trim())??[],i=e[n??``];return!!i&&(!r||!!R(i,r))}const B=new Set(`section div header footer h2 h3 h4 p ul ol li dl dt dd blockquote figure figcaption table thead tbody tr th td span b strong i em small hr a img template`.split(` `)),V=/* @__PURE__ */ new Set([`img`,`hr`]),H=/^(href|src|alt|datetime|data-[a-z-]+|aria-[a-z-]+)$/,U=/^(class|alt|colspan|rowspan|data-vs-add-label|view-(text|markdown|each|if|object|title|prompt|optional|readonly|static|examples|default|declare|type|format|max-length|min-items|max-items|items))$/,W=e=>U.test(e)||H.test(/^view-(?:attr|optional|readonly|title|prompt):(.+)$/.exec(e)?.[1]??``),G=/<(\/?)([a-zA-Z][\w-]*)((?:\s+[^\s"'=<>/]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*)\s*(\/?)>/g;function K(e){let n=String(e??``).trim();if(!n)return`It has no template yet.`;if(n.length>12e3)return`It is longer than a block can be.`;if(/\{@|<!|<\?/.test(n))return`It holds something only this app writes: {@…}, a comment or a declaration.`;let r=[],i=0,a=0,o=0;if(n.replace(G,(e,t,n,s,c,l)=>{let u=n.toLowerCase();B.has(u)||r.push(`<${u}> can’t be used in a block.`);for(let[,e]of s.matchAll(/\s+([^\s"'=<>/]+)(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?/g))W(e.toLowerCase())||r.push(`The attribute “${e}” can’t be used in a block.`);return t?--i===0&&!o&&(o=l+e.length):(i===0&&a++,!V.has(u)&&!c&&i++),``}).includes(`<`)&&r.push(`It holds a tag that isn’t well formed.`),i!==0&&r.push(`A tag is opened and never closed, or closed and never opened.`),a===1&&n.startsWith(`<`)&&o===n.length||r.push(`It needs one element around everything in it.`),r.length)return r[0];try{t(n,{},{emptyStrings:!0})}catch(e){return e.message}}function q(e,t,n){let r=t[n]?.kind,i=[];for(let a of Object.values(t)){if(a.key===n)continue;let t=a.data[a.kind]??{},o=[];for(let[i,s]of Object.entries(e[a.kind]?.refs??{})){let e=t[i];if([s].flat()[0]!==r||(Array.isArray(e)?!e.includes(n):e!==n))continue;let{[i]:a,...c}=t;t=Array.isArray(e)?{...c,[i]:e.filter(e=>e!==n)}:c,o.push(i)}o.length&&i.push({thing:{...a,data:{[a.kind]:t}},fields:o})}return i}const J=(e,t,n=t?.$defs??{})=>{let i=t&&r(t,n,e);return typeof e==`string`?i?.contentMediaType||/^(https?:|\/|#)/.test(e)?e:e.replace(/(^|[\s([{—–-])"/g,`$1“`).replace(/"/g,`”`).replace(/(^|[\s([{—–-])'/g,`$1‘`).replace(/'/g,`’`):Array.isArray(e)?e.map(e=>J(e,i?.items,n)):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,J(t,i?.properties?.[e],n)])):e};function Y(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||!e||!t||Array.isArray(e)!==Array.isArray(t))return!1;let n=Object.keys(e).filter(t=>e[t]!==void 0),r=Object.keys(t).filter(e=>t[e]!==void 0);return n.length===r.length&&n.every(n=>Y(e[n],t[n]))}function X(e,t){if(e.kind===`place`)return Z(e.data,t);if(e.kind!==`story`)return e.data;let n=e.data.story,r=Math.max(Number(n.n)||0,...(n.checks??[]).map(e=>Number(e.id)||0)),i=(n.checks??[]).map(e=>e.id?e:{...e,id:String(++r)});return r===n.n&&i.every((e,t)=>e===n.checks[t])?e.data:{story:{...n,checks:i,n:r}}}function Z(e,t){let n=e.place?.blocks;if(!n?.some(e=>e?.is===`w-table`))return e;let r=t?.path.match(/^place\.blocks\.(\d+)\.columns\.(\d+)$/),i=n.map((e,n)=>{if(e?.is!==`w-table`)return e;let i=(e.columns??[]).length,a=(e.rows??[]).map(e=>{let a=[...e.cells??[]];if(r&&Number(r[1])===n){let e=Number(r[2]);t.op===`insert`?a.splice(e,0,``):t.op===`remove`?a.splice(e,1):t.op===`move`&&a.splice(t.to,0,...a.splice(e,1))}let o=[...a.slice(0,i),...Array(Math.max(0,i-a.length)).fill(``)];return Y(o,e.cells)?e:{...e,cells:o}});return a.every((t,n)=>t===e.rows[n])?e:{...e,rows:a}});return i.every((e,t)=>e===n[t])?e:{...e,place:{...e.place,blocks:i}}}function Q(e,t,n,{all:r={},had:i,key:a=i?.key,whole:o=!1}={}){let s=[],c=e[t];for(let[e,t]of Object.entries(c.refs??{})){let i=[t].flat()[0];for(let t of[n[e]??[]].flat())t&&r[t]?.kind!==i&&s.push(`${e}: there is no ${i} "${t}". Use \`list\` to see the ones there are.`)}let l=t=>o||!!e[x(e,t.split(`.`)[0])??``]?.file;for(let e of c.points??[])for(let t of[n[e]??[]].flat().filter(Boolean))!z(r,t)&&l(String(t))&&s.push(`${e}: "${t}" points at nothing here. A pointer is a thing’s id (P1, S12, W3, R2, F4), or one line of it: a check (S12.2), a finding (R2.1), a block of a place or a page of the website (W3.2).`);let u=new Set(f(i?.data[t]));for(let e of f(n).filter(e=>!u.has(e)))r[e]?.kind===`source`?I(r[e])||s.push(`cite:${e}: ${e} is the team’s own material, which informs what is written and is never cited.`):s.push(`cite:${e}: there is no source "${e}". A claim cites a source of the library by its key, in the words it rests on: [the words](cite:C1). Use \`list\` to see the sources there are.`);if(t===`place`&&n.under){let e=/* @__PURE__ */ new Set([a]);for(let t=n.under;t;t=r[t]?.data.place?.under)if(e.has(t)){s.push(`under: ${n.under} already stands under this place. A place can’t stand under itself, or under anything that stands under it.`);break}else e.add(t)}return s}function $(e,t,r,i={}){let a=e[t];if(!a)return{value:{},problems:[`there is no kind "${t}".`]};let o=a.schema.$defs??{},s=a.schema.properties??{},c=i.had?.data[t]??{},{order:l,n:u,...d}=r??{},f=Object.fromEntries(Object.keys(c).filter(e=>!(e in s)).map(e=>[e,c[e]]));for(let e of Object.keys(d))!(e in s)&&e in c&&delete d[e];let p=t===`story`&&Array.isArray(d.checks)?d.checks.map(e=>e&&typeof e==`object`?e.id:void 0):[];if(t===`story`&&Array.isArray(d.checks)&&(d.checks=d.checks.map(e=>typeof e==`string`?{text:e}:e&&typeof e==`object`?Object.fromEntries(Object.entries(e).filter(([e])=>e!==`id`)):e)),t===`persona`&&!d.color){let e=Object.values(i.all??{}).filter(e=>e.kind===`persona`&&e.key!==i.key).map(e=>e.data.persona?.color),t=s.color?.enum??[];d.color=c.color??t.find(t=>!e.includes(t))??t[e.length%t.length]}let m={};for(let[e,t]of Object.entries(s))t?.items?.oneOf&&Array.isArray(d[e])&&(m[e]=d[e].map((e,t)=>[t,e]).filter(([,e])=>typeof e?.is==`string`&&!(e.is in o)),m[e].length&&(d[e]=d[e].filter(t=>!m[e].some(([,e])=>e===t))));let{value:h,problems:g}=n(a.schema,d);for(let[e,t]of Object.entries(m))for(let[n,r]of t)h[e].splice(n,0,r);if(t===`block`&&K(h.html)&&g.push(`html: ${K(h.html)}`),i.all&&g.push(...Q(e,t,h,i)),t===`story`){let e=c.checks??[],t=/* @__PURE__ */ new Set,n=e=>/^\d+$/.test(String(e??``))&&!t.has(String(e))?(t.add(String(e)),String(e)):void 0,r=p.map(n),i=!p.some(e=>e!==void 0);h.checks=(h.checks??[]).map((t,a)=>({...t,id:r[a]??n(e.find(e=>e.text===t.text)?.id)??(i&&e[a]&&!h.checks.some(t=>t.text===e[a].text)?n(e[a].id):void 0)}))}return Object.assign(h,f,typeof l==`number`?{order:l}:{}),{value:X({kind:t,data:{[t]:h}},i.patch)[t],problems:g}}export{v as EXT,P as Misfit,M as NEEDS,k as SITE_BLOCK,Y as alike,S as called,I as citable,d as citationsIn,c as citationsOf,s as cited,u as eachChanged,l as eachLine,K as faultIn,$ as fitThing,L as held,_ as heldTo,A as isSite,f as keysIn,o as keysOf,x as kindOf,R as lineAt,F as misfitOf,N as needs,y as pathOf,z as pointed,g as quoted,Q as references,h as says,j as siteOf,E as spamOf,D as spammy,b as thingAt,X as tidy,J as typeset,p as uncited,q as unnamed,O as waiting};
1
+ import{CITATION as e,extractSchema as t,fit as n,resolveSchema as r}from"viewschema";const i=/^[A-Z]\d+$/,a=()=>new RegExp(e.source,`g`),o=e=>[...new Set(e.split(/[,;]/).map(e=>e.trim()).filter(e=>i.test(e)))],s=(e,t)=>`[${e}](cite:${t.join(`,`)})`,c=e=>[...String(e??``).matchAll(a())].map(e=>({words:e[1],keys:o(e[2])}));function l(e,t,n=``){if(typeof e==`string`)t(n,e);else if(Array.isArray(e))e.forEach((e,r)=>l(e,t,n?`${n}.${r}`:String(r)));else if(e&&typeof e==`object`)for(let[r,i]of Object.entries(e))l(i,t,n?`${n}.${r}`:r)}function u(e,t,n=``){if(typeof e==`string`)return t(e,n);if(Array.isArray(e)){let r=e.map((e,r)=>u(e,t,n?`${n}.${r}`:String(r)));return r.some((t,n)=>t!==e[n])?r:e}if(e&&typeof e==`object`){let r=!1,i=Object.fromEntries(Object.entries(e).map(([e,i])=>{let a=u(i,t,n?`${n}.${e}`:e);return r||=a!==i,[e,a]}));return r?i:e}return e}function d(e){let t=[];return l(e,(e,n)=>n.includes(`](cite:`)&&t.push(...c(n).map(t=>({...t,path:e})))),t}const f=e=>[...new Set(d(e).flatMap(e=>e.keys))],p=e=>u(e,e=>e.includes(`](cite:`)?e.replace(a(),`$1`):e),m=e=>String(e??``).normalize(`NFKC`).toLowerCase().replace(/[‘’ʼ']/g,``).replace(/[^\p{L}\p{N}]+/gu,` `).trim();function h(e,t){let n=m(t);return n.split(` `).length>=4&&` ${m(e)} `.includes(` ${n} `)}const g=(e,t=``)=>/^\s*["“«„‘][^"”»“«„]*["”»“’][.,;:!?]?\s*$/.test(e)||/(^|\.)(quote|said)$/.test(t);function _(e,t){return u(e,(e,n)=>e.includes(`](cite:`)?e.replace(a(),(e,r,i)=>{let a=o(i).filter(e=>t(e)!==void 0&&(!g(r,n)||h(t(e),r)));return a.length?s(r,a):r}):e)}const v=e=>e?.file?.format===`gherkin`?`.feature`:`.yaml`,y=[`.yaml`,`.feature`];function b(e){let t=e.normalize(`NFKD`).replace(/[\u0300-\u036f]/g,``).toLowerCase().replace(/['’‘`]/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``);if(t.length<=48)return t;let n=t.slice(0,49);return(n.includes(`-`)?n.slice(0,n.lastIndexOf(`-`)):n.slice(0,48)).replace(/-$/,``)}const x=(e,t)=>{let n=e[t.kind],r=n?.file;if(!r)return;if(r.name)return`${r.dir}/${r.name}${v(n)}`;let i=t.data?b(w(t)):``;return`${r.dir}/${t.key}${i&&i!==t.key.toLowerCase()?`-${i}`:``}${v(n)}`};function S(e,t){let[n,r=``]=t.split(`/`).slice(-2);for(let[t,i]of Object.entries(e)){let e=v(i);if(i.file?.dir!==n||!r.endsWith(e))continue;let a=r.slice(0,-e.length);if(i.file.name?i.file.name===a:RegExp(`^${i.letter}\\d+(?:-.*)?$`).test(a))return{kind:t,key:i.file.name?`${i.letter}1`:a.split(`-`)[0]}}}const C=(e,t)=>Object.keys(e).find(n=>RegExp(`^${e[n].letter}\\d+$`).test(t)),w=e=>{let t=e?.data[e.kind]??{};return String(t.role||t.name||t.title||t.what||t.question||t.summary||t.text||t.asked||e?.key||``).trim()},T=/\bhttps?:\/\/[^\s<>()"']+|\bwww\.[^\s<>()"']+\.[a-z]{2,}[^\s<>()"']*/gi,E=/^([^\n(]{2,80}\(\s*https?:\/\/[^)\s]+\s*\)|\s*https?:\/\/\S+)\s*[-–—:|]/,D=/\[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 O(e){let t=String(e??``).trim();if(!t)return;let n=t.match(T)??[];if(n.length>=3||n.join(``).length>=t.length*.4)return`links`;if(E.test(t))return`advert`;if(D.test(t))return`phrases`}const k=e=>!e.facts?.person&&!!O(e.data.feedback?.text),A=e=>e.data.feedback?.status!==`done`&&!k(e),j=`c-site`,M=e=>(e.data.place?.blocks??[]).some(e=>e?.is===j);function N(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(M(n))return n}const P=[`failing`,`unchecked`,`unplaced`,`bare`,`unsorted`,`undecided`];function F(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=>!N(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(A)),undecided:r(n(`decision`).filter(e=>(e.data.decision.status??`proposed`)===`proposed`))}}var I=class extends Error{};const ee=(e,t)=>`This doesn’t fit the ${e} sheet:\n- ${t.join(`
2
+ - `)}`,L=e=>e?.kind===`source`&&e.data.source.cite!==`no`,R=(e,t)=>_(t,t=>L(e[t])?String(e[t].data.source.text??``):void 0);function z(e,t){let n=e.data[e.kind]??{},r=n.blocks?.[Number(t)-1]??{};if(e.kind===`story`)return n.checks?.find(e=>e.id===t)?.text;if(e.kind===`research`)return n.findings?.[Number(t)-1]?.claim;if(e.kind===`place`)return Object.entries(r).find(([e,t])=>e!==`is`&&typeof t==`string`&&t)?.[1];if(e.kind===`document`||e.kind===`brief`)return r.label||r.left?.label}function B(e,t){let[,n,r]=/^([A-Z]\d+)(?:\.(\d+))?$/.exec(String(t??``).trim())??[],i=e[n??``];return!!i&&(!r||!!z(i,r))}const V=new Set(`section div header footer h2 h3 h4 p ul ol li dl dt dd blockquote figure figcaption table thead tbody tr th td span b strong i em small hr a img template`.split(` `)),H=/* @__PURE__ */ new Set([`img`,`hr`]),U=/^(href|src|alt|datetime|data-[a-z-]+|aria-[a-z-]+)$/,W=/^(class|alt|colspan|rowspan|data-vs-add-label|view-(text|markdown|each|if|object|title|prompt|optional|readonly|static|examples|default|declare|type|format|max-length|min-items|max-items|items))$/,G=e=>W.test(e)||U.test(/^view-(?:attr|optional|readonly|title|prompt):(.+)$/.exec(e)?.[1]??``),K=/<(\/?)([a-zA-Z][\w-]*)((?:\s+[^\s"'=<>/]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*)\s*(\/?)>/g;function q(e){let n=String(e??``).trim();if(!n)return`It has no template yet.`;if(n.length>12e3)return`It is longer than a block can be.`;if(/\{@|<!|<\?/.test(n))return`It holds something only this app writes: {@…}, a comment or a declaration.`;let r=[],i=0,a=0,o=0;if(n.replace(K,(e,t,n,s,c,l)=>{let u=n.toLowerCase();V.has(u)||r.push(`<${u}> can’t be used in a block.`);for(let[,e]of s.matchAll(/\s+([^\s"'=<>/]+)(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?/g))G(e.toLowerCase())||r.push(`The attribute “${e}” can’t be used in a block.`);return t?--i===0&&!o&&(o=l+e.length):(i===0&&a++,!H.has(u)&&!c&&i++),``}).includes(`<`)&&r.push(`It holds a tag that isn’t well formed.`),i!==0&&r.push(`A tag is opened and never closed, or closed and never opened.`),a===1&&n.startsWith(`<`)&&o===n.length||r.push(`It needs one element around everything in it.`),r.length)return r[0];try{t(n,{},{emptyStrings:!0})}catch(e){return e.message}}function J(e,t,n){let r=t[n]?.kind,i=[];for(let a of Object.values(t)){if(a.key===n)continue;let t=a.data[a.kind]??{},o=[];for(let[i,s]of Object.entries(e[a.kind]?.refs??{})){let e=t[i];if([s].flat()[0]!==r||(Array.isArray(e)?!e.includes(n):e!==n))continue;let{[i]:a,...c}=t;t=Array.isArray(e)?{...c,[i]:e.filter(e=>e!==n)}:c,o.push(i)}o.length&&i.push({thing:{...a,data:{[a.kind]:t}},fields:o})}return i}function Y(e){let t=String(e??``).split(`
3
+ `),n,r=!1;for(let[e,i]of t.entries()){let t=i.trim();if(n)t.startsWith(n)&&(n=void 0);else if(!(!t||t.startsWith(`#`)||t.startsWith(`|`))){if(t.startsWith(`"""`)||t.startsWith("```"))n=t.slice(0,3);else if(/^(Given|When|Then|And|But) \S/.test(t)||/^\* \S/.test(t))r=!0;else return`line ${e+1} isn’t a step: start it with Given, When, Then, And or But.`}}if(n)return`a doc string is opened and never closed.`;if(!r&&String(e??``).trim())return`it has no steps: Given what is so, When something happens, Then what is true.`}const X=(e,t,n=t?.$defs??{})=>{let i=t&&r(t,n,e);return typeof e==`string`?i?.contentMediaType||/^(https?:|\/|#)/.test(e)?e:e.replace(/(^|[\s([{—–-])"/g,`$1“`).replace(/"/g,`”`).replace(/(^|[\s([{—–-])'/g,`$1‘`).replace(/'/g,`’`):Array.isArray(e)?e.map(e=>X(e,i?.items,n)):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,X(t,i?.properties?.[e],n)])):e};function Z(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||!e||!t||Array.isArray(e)!==Array.isArray(t))return!1;let n=Object.keys(e).filter(t=>e[t]!==void 0),r=Object.keys(t).filter(e=>t[e]!==void 0);return n.length===r.length&&n.every(n=>Z(e[n],t[n]))}function Q(e,t){if(e.kind===`place`)return te(e.data,t);if(e.kind!==`story`)return e.data;let n=e.data.story,r=Math.max(Number(n.n)||0,...(n.checks??[]).map(e=>Number(e.id)||0)),i=(n.checks??[]).map(e=>e.id?e:{...e,id:String(++r)});return r===n.n&&i.every((e,t)=>e===n.checks[t])?e.data:{story:{...n,checks:i,n:r}}}function te(e,t){let n=e.place?.blocks;if(!n?.some(e=>e?.is===`w-table`))return e;let r=t?.path.match(/^place\.blocks\.(\d+)\.columns\.(\d+)$/),i=n.map((e,n)=>{if(e?.is!==`w-table`)return e;let i=(e.columns??[]).length,a=(e.rows??[]).map(e=>{let a=[...e.cells??[]];if(r&&Number(r[1])===n){let e=Number(r[2]);t.op===`insert`?a.splice(e,0,``):t.op===`remove`?a.splice(e,1):t.op===`move`&&a.splice(t.to,0,...a.splice(e,1))}let o=[...a.slice(0,i),...Array(Math.max(0,i-a.length)).fill(``)];return Z(o,e.cells)?e:{...e,cells:o}});return a.every((t,n)=>t===e.rows[n])?e:{...e,rows:a}});return i.every((e,t)=>e===n[t])?e:{...e,place:{...e.place,blocks:i}}}function $(e,t,n,{all:r={},had:i,key:a=i?.key,whole:o=!1}={}){let s=[],c=e[t];for(let[e,t]of Object.entries(c.refs??{})){let i=[t].flat()[0];for(let t of[n[e]??[]].flat())t&&r[t]?.kind!==i&&s.push(`${e}: there is no ${i} "${t}". Use \`list\` to see the ones there are.`)}let l=t=>o||!!e[C(e,t.split(`.`)[0])??``]?.file;for(let e of c.points??[])for(let t of[n[e]??[]].flat().filter(Boolean))!B(r,t)&&l(String(t))&&s.push(`${e}: "${t}" points at nothing here. A pointer is a thing’s id (P1, S12, W3, R2, F4), or one line of it: a check (S12.2), a finding (R2.1), a block of a place or a page of the website (W3.2).`);let u=new Set(f(i?.data[t]));for(let e of f(n).filter(e=>!u.has(e)))r[e]?.kind===`source`?L(r[e])||s.push(`cite:${e}: ${e} is the team’s own material, which informs what is written and is never cited.`):s.push(`cite:${e}: there is no source "${e}". A claim cites a source of the library by its key, in the words it rests on: [the words](cite:C1). Use \`list\` to see the sources there are.`);if(t===`place`&&n.under){let e=/* @__PURE__ */ new Set([a]);for(let t=n.under;t;t=r[t]?.data.place?.under)if(e.has(t)){s.push(`under: ${n.under} already stands under this place. A place can’t stand under itself, or under anything that stands under it.`);break}else e.add(t)}return s}function ne(e,t,r,i={}){let a=e[t];if(!a)return{value:{},problems:[`there is no kind "${t}".`]};let o=a.schema.$defs??{},s=a.schema.properties??{},c=i.had?.data[t]??{},{order:l,n:u,...d}=r??{},f=Object.fromEntries(Object.keys(c).filter(e=>!(e in s)).map(e=>[e,c[e]]));for(let e of Object.keys(d))!(e in s)&&e in c&&delete d[e];let p=t===`story`&&Array.isArray(d.checks)?d.checks.map(e=>e&&typeof e==`object`?e.id:void 0):[];if(t===`story`&&Array.isArray(d.checks)&&(d.checks=d.checks.map(e=>typeof e==`string`?{text:e}:e&&typeof e==`object`?Object.fromEntries(Object.entries(e).filter(([e])=>e!==`id`)):e)),t===`persona`&&!d.color){let e=Object.values(i.all??{}).filter(e=>e.kind===`persona`&&e.key!==i.key).map(e=>e.data.persona?.color),t=s.color?.enum??[];d.color=c.color??t.find(t=>!e.includes(t))??t[e.length%t.length]}let m={};for(let[e,t]of Object.entries(s))t?.items?.oneOf&&Array.isArray(d[e])&&(m[e]=d[e].map((e,t)=>[t,e]).filter(([,e])=>typeof e?.is==`string`&&!(e.is in o)),m[e].length&&(d[e]=d[e].filter(t=>!m[e].some(([,e])=>e===t))));let{value:h,problems:g}=n(a.schema,d);for(let[e,t]of Object.entries(m))for(let[n,r]of t)h[e].splice(n,0,r);if(t===`block`&&q(h.html)&&g.push(`html: ${q(h.html)}`),t===`story`&&(h.checks??[]).forEach((e,t)=>(e.examples??[]).forEach((e,n)=>{let r=Y(e.steps);r&&g.push(`checks.${t}.examples.${n}.steps: ${r}`)})),i.all&&g.push(...$(e,t,h,i)),t===`story`){let e=c.checks??[],t=/* @__PURE__ */ new Set,n=e=>/^\d+$/.test(String(e??``))&&!t.has(String(e))?(t.add(String(e)),String(e)):void 0,r=p.map(n),i=!p.some(e=>e!==void 0);h.checks=(h.checks??[]).map((t,a)=>({...t,id:r[a]??n(e.find(e=>e.text===t.text)?.id)??(i&&e[a]&&!h.checks.some(t=>t.text===e[a].text)?n(e[a].id):void 0)}))}return Object.assign(h,f,typeof l==`number`?{order:l}:{}),{value:Q({kind:t,data:{[t]:h}},i.patch)[t],problems:g}}export{y as EXTS,I as Misfit,P as NEEDS,j as SITE_BLOCK,Z as alike,w as called,L as citable,d as citationsIn,c as citationsOf,s as cited,u as eachChanged,l as eachLine,v as extOf,q as faultIn,ne as fitThing,R as held,_ as heldTo,M as isSite,f as keysIn,o as keysOf,C as kindOf,z as lineAt,ee as misfitOf,F as needs,x as pathOf,B as pointed,g as quoted,$ as references,h as says,N as siteOf,b as slugOf,O as spamOf,k as spammy,Y as stepsFault,S as thingAt,Q as tidy,X as typeset,p as uncited,J as unnamed,A as waiting};
@@ -0,0 +1,18 @@
1
+ import type { Kinds, Thing } from './kinds.ts';
2
+ /** "a" or "an", as the first word of a role is said: an Owner, a User, an hour, an SEO lead. */
3
+ export declare function articleOf(role: string): 'a' | 'an';
4
+ /** The line an ability's file says who it is for in, from its personas' roles: "As a Solo Founder or a Product Lead". Nothing, when a role isn't known. */
5
+ export declare function asLine(roles: (string | undefined)[]): string | undefined;
6
+ /** The roles of an ability's personas, from everything there is. */
7
+ export declare const rolesOf: (story: Record<string, any>, all: Record<string, Thing>) => any;
8
+ /** An ability as its Gherkin file says it, in one order. Given everything there is, it says who it is for by their roles too. */
9
+ export declare function featureOf(kinds: Kinds, thing: Thing, all?: Record<string, Thing>): string;
10
+ /**
11
+ * An ability's file read back into its data by key, with what in it the map doesn't keep said (fitting it to the
12
+ * sheet is the caller's). `key` is the id its file's name gives it. `said` is the `As a …` line as the file has it.
13
+ */
14
+ export declare function fromFeature(kinds: Kinds, key: string, text: string): {
15
+ read: Record<string, any>;
16
+ problems: string[];
17
+ said?: string;
18
+ };
package/dist/index.d.ts CHANGED
@@ -5,12 +5,13 @@
5
5
  * command line `npx userforge`.
6
6
  */
7
7
  export * from './fit.ts';
8
- export { fromFile, overview, toFile, yamlOf } from './files.ts';
9
- export { faults, init, kinds, nextId, readMap, resultsIn, SPEC, written } from './map.ts';
8
+ export { fromFile, overview, sameFile, toFile, yamlOf } from './files.ts';
9
+ export { articleOf, asLine, featureOf, fromFeature } from './gherkin.ts';
10
+ export { exampled, faults, init, kinds, nextId, readMap, resultsIn, SPEC, written } from './map.ts';
10
11
  export { filesStore, type Store } from './store.ts';
11
12
  export { call, tools, type Tool } from './tools.ts';
12
13
  export { MAP, PROCESS } from './process.ts';
13
14
  export { STAGES, stageOf, storyStage, type Stage } from './stage.ts';
14
15
  export { checksIn, testsAt, testsIn, unproved, type Checks } from './checks.ts';
15
- export { CHECK, door, keep, report, tally, type Door, type Result, type Results } from './results.ts';
16
+ export { checkOf, door, keep, report, tally, type Door, type Result, type Results } from './results.ts';
16
17
  export { lineFor, setup, SETUP_FILES } from './setup.ts';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{A as e,B as t,C as n,D as r,E as i,F as a,G as o,H as s,I as c,J as l,K as u,L as d,M as f,N as p,O as m,P as h,R as g,S as _,T as v,U as y,V as b,W as x,Y as S,_ as C,a as w,b as T,c as E,d as D,f as O,g as k,h as A,i as j,j as M,k as N,l as P,m as F,n as I,o as L,p as R,q as z,r as B,s as V,u as H,v as U,w as W,x as G,y as K,z as q}from"./map.js";import{a as J,c as Y,d as X,f as Z,i as Q,l as $,n as ee,o as te,p as ne,r as re,s as ie,t as ae,u as oe}from"./process.js";import{STAGES as se,stageOf as ce,storyStage as le}from"./stage.js";import{c as ue,i as de,n as fe,o as pe,t as me}from"./results.js";export{me as CHECK,h as EXT,ae as MAP,G as Misfit,te as NEEDS,ee as PROCESS,H as SETUP_FILES,ie as SITE_BLOCK,I as SPEC,se as STAGES,_ as alike,re as call,a as called,R as checksIn,n as citable,q as citationsIn,t as citationsOf,b as cited,fe as door,s as eachChanged,y as eachLine,W as faultIn,B as faults,J as filesStore,v as fitThing,C as fromFile,i as held,x as heldTo,j as init,Y as isSite,de as keep,o as keysIn,u as keysOf,c as kindOf,w as kinds,r as lineAt,D as lineFor,m as misfitOf,$ as needs,L as nextId,U as overview,d as pathOf,N as pointed,z as quoted,V as readMap,e as references,pe as report,E as resultsIn,l as says,O as setup,oe as siteOf,X as spamOf,Z as spammy,ce as stageOf,le as storyStage,ue as tally,F as testsAt,A as testsIn,g as thingAt,M as tidy,K as toFile,Q as tools,f as typeset,S as uncited,p as unnamed,k as unproved,ne as waiting,P as written,T as yamlOf};
1
+ import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as y,T as b,U as x,V as S,W as C,X as w,Y as T,Z as E,_ as D,a as O,b as k,c as A,d as j,et as M,f as N,g as P,h as F,i as I,it as L,j as R,k as z,l as B,m as V,n as H,nt as U,o as W,p as G,q as K,r as q,rt as J,s as Y,tt as X,u as Z,v as Q,w as $,x as ee,y as te,z as ne}from"./map.js";import{a as re,c as ie,d as ae,f as oe,i as se,l as ce,n as le,o as ue,p as de,r as fe,s as pe,t as me,u as he}from"./process.js";import{STAGES as ge,stageOf as _e,storyStage as ve}from"./stage.js";import{c as ye,i as be,n as xe,o as Se,t as Ce}from"./results.js";export{S as EXTS,me as MAP,i as Misfit,ue as NEEDS,le as PROCESS,j as SETUP_FILES,pe as SITE_BLOCK,H as SPEC,ge as STAGES,h as alike,r as articleOf,$ as asLine,fe as call,c as called,Ce as checkOf,V as checksIn,z as citable,u as citationsIn,T as citationsOf,w as cited,xe as door,E as eachChanged,_ as eachLine,q as exampled,x as extOf,t as faultIn,I as faults,b as featureOf,re as filesStore,R as fitThing,a as fromFeature,Q as fromFile,p as held,e as heldTo,O as init,ie as isSite,be as keep,M as keysIn,X as keysOf,C as kindOf,W as kinds,m as lineAt,N as lineFor,g as misfitOf,ce as needs,Y as nextId,te as overview,s as pathOf,o as pointed,U as quoted,A as readMap,l as references,Se as report,B as resultsIn,k as sameFile,J as says,G as setup,he as siteOf,d as slugOf,ae as spamOf,oe as spammy,_e as stageOf,f as stepsFault,ve as storyStage,ye as tally,F as testsAt,P as testsIn,K as thingAt,v as tidy,ee as toFile,se as tools,ne as typeset,L as uncited,n as unnamed,D as unproved,de as waiting,Z as written,y as yamlOf};
package/dist/kinds.d.ts CHANGED
@@ -16,11 +16,15 @@ export interface Kind {
16
16
  letter: string;
17
17
  /** A map holds exactly one. */
18
18
  one?: boolean;
19
- /** Where its file is kept, and which fields it opens with; a kind kept in the workspace alone has none. */
19
+ /**
20
+ * Where its file is kept, and which fields it opens with; a kind kept in the workspace alone has none. A file is in
21
+ * YAML unless it says Gherkin (an ability, which then reads as its user story).
22
+ */
20
23
  file?: {
21
24
  dir: string;
22
25
  name?: string;
23
26
  lines?: string[];
27
+ format?: 'yaml' | 'gherkin';
24
28
  };
25
29
  /** The fields that hold the ids of other things, by the kind they hold (in a list when they hold several). */
26
30
  refs?: Record<string, string | string[]>;
@@ -34,11 +38,27 @@ export interface Thing {
34
38
  kind: string;
35
39
  data: Record<string, any>;
36
40
  }
37
- /** A map file's own ending. */
38
- export declare const EXT = ".yaml";
39
- /** Where a thing's file stands, under the map's folder; nothing for a kind kept in the workspace alone. */
40
- export declare const pathOf: (kinds: Kinds, kind: string, key: string) => string | undefined;
41
- /** The thing a file holds, from where it stands. */
41
+ /** A kind's file's own ending: `.feature` for one kept in Gherkin, `.yaml` for the rest. */
42
+ export declare const extOf: (kind: Kind | undefined) => ".yaml" | ".feature";
43
+ /** Every ending a map's file can have. */
44
+ export declare const EXTS: string[];
45
+ /**
46
+ * A name made for people from what a thing is called: lower case, accents and apostrophes dropped, anything else
47
+ * between words one hyphen, cut at a word to at most 48 characters ("reserve-tomorrows-sourdough").
48
+ */
49
+ export declare function slugOf(words: string): string;
50
+ /**
51
+ * Where a thing's file stands, under the map's folder: its id, then what it is called, for people
52
+ * (`what/S1-reserve-tomorrows-sourdough.feature`), or the fixed name of a kind the map holds one of
53
+ * (`why/brief.yaml`). Nothing, for a kind kept in the workspace alone. The name is only ever written from the
54
+ * thing: a file is found by the id it starts with.
55
+ */
56
+ export declare const pathOf: (kinds: Kinds, thing: {
57
+ kind: string;
58
+ key: string;
59
+ data?: Record<string, any>;
60
+ }) => string | undefined;
61
+ /** The thing a file holds, from where it stands: by the id its name starts with, whatever follows it, or by a kind's fixed name. */
42
62
  export declare function thingAt(kinds: Kinds, path: string): {
43
63
  kind: string;
44
64
  key: string;
package/dist/map.d.ts CHANGED
@@ -4,15 +4,23 @@ import type { Results } from './results.ts';
4
4
  export declare const kinds: Kinds;
5
5
  /** Where the map is kept: `spec/`, unless `USERFORGE_SPEC` says otherwise. */
6
6
  export declare const SPEC: string;
7
- /** Every file of a map, read: what it holds, and what in it doesn't fit its sheet. */
7
+ /**
8
+ * Every file of a map, read: what it holds, by its id; where each is kept (`paths`, from the map's folder); what in it
9
+ * doesn't fit its sheet; and, for an ability, its `As a …` line as its file says it (`said`). A file is found by the
10
+ * id its name starts with, whatever follows: two files with one id are a problem, and the first is taken.
11
+ */
8
12
  export declare function readMap(dir?: string, k?: Kinds): {
9
13
  all: Record<string, Thing>;
10
14
  problems: string[];
15
+ paths: Record<string, string>;
16
+ said: Record<string, string>;
11
17
  };
12
18
  /** The results of the map's checks, as the test reporter keeps them beside it (`results.json`). */
13
19
  export declare const resultsIn: (dir?: string) => Results;
14
- /** The map's front page, written again from its files. */
15
- /** The map's front page, written from the files beside it. One the project wrote itself before the map was there is kept beside it, as README.before.md, never written over. */
20
+ /**
21
+ * The map's front page, written again from its files. One the project wrote itself in that folder before the map was
22
+ * there is kept beside it, as README.before.md, never written over.
23
+ */
16
24
  export declare const written: (dir?: string, k?: Kinds) => void;
17
25
  /** Where a README.md the project wrote in the map's folder before the map was is kept. */
18
26
  export declare const BEFORE = "README.before.md";
@@ -26,7 +34,14 @@ export declare const nextId: (k: Kinds, kind: string, all: Record<string, Thing>
26
34
  */
27
35
  export declare function faults(dir?: string, tests?: string): string[];
28
36
  /**
29
- * A project set up: its map's folders, a brief to begin from, the front page, the line in AGENTS.md, CLAUDE.md pointing
37
+ * A project set up: its map's folders, a brief to begin from, its front page, the line in AGENTS.md, CLAUDE.md pointing
30
38
  * at it, and `.mcp.json` giving every coding agent that reads it the map's tools. Nothing already there is written over.
31
39
  */
32
40
  export declare function init(root?: string, dir?: string): string[];
41
+ /**
42
+ * The ability files of a map that hold an example, by their path from where the tests run: what a Gherkin runner
43
+ * (QuickPickle) is given to run, so that it opens none that has nothing to run.
44
+ *
45
+ * include: ['tests/**\/*.test.ts', ...exampled()]
46
+ */
47
+ export declare function exampled(dir?: string, from?: string): string[];