kq portal:build
kq portal:build turns the model and its pages into a static site, and reports every problem with them as it goes. This page says how to run it, where the site goes and what each problem it reports means.
Building the site
kq portal:build models/my-model --out site
kq portal:build needs the Portal package; without it, it says so, builds nothing and exits 3. It builds the model from model/ as kq build does, but writes nothing into your repository. It reads every page file under portal/, prints every problem with the model and the pages, and writes the site into --out.
- Any error stops it, exit 1, and nothing is written. A warning does not stop it.
- Your policy findings are printed too, after the model's, and none of them stops it, whatever its severity.
--outis emptied first, so the site is exactly this build. To keep you from losing files,kq portal:buildonly empties a directory it wrote itself (it leaves_kanoniq/kanoniq-portal.txtto recognize it); it refuses, with exit 2, a directory holding anything else, and a directory that is the repository or holds it. It also refuses a model with nokanoniq.repository.jsonat or above it: runkq initfirst.
The site is plain files with relative links. Serve it over HTTP from any static web server or hosting: a page links to another by its folder, which a browser opens as that folder's index.html only when a server answers, so opened straight from disk its links break. It fetches nothing from the internet, fonts and icons included. It carries the editor and your whole model, so anyone who can open the site can read the whole model, whatever the pages show.
In VS Code, Build Kanoniq Portal on the portal/ folder builds the site into portal-dist/ and serves it on your machine at the port in portal-dist/.kanoniq-server.json, 47620 unless you change it. See Building the portal.
kq portal:build comes from the package @extenza-works/kanoniq-export-portal, installed beside kq; see Installing.
What kq portal:build reports
Each problem is one line, file:line:column severity code message, like kq validate's. Each code links to its page, with what it means and how to fix it.
| Code | Rule | Severity | Checks |
|---|---|---|---|
| KQP001 | well-formed YAML | Error | A page file, a Markdown page's or a decision record's frontmatter, and a view block are well-formed YAML: one document, no key repeated. |
| KQP002 | page shape | Error | A page file, a Markdown page's or a decision record's frontmatter, and a view block have every field they need and only those they take, each with a value it can take. |
| KQP003 | page name | Error | A page file's name is the canonical encoding of the page's name. |
| KQP004 | one file per page | Error | A page has one file: no two sibling files for names that differ only in case or composition, or for one name under two extensions. |
| KQP005 | one home page | Error | portal/ holds exactly one page file directly: the home page. |
| KQP006 | every page is reachable | Error | Every page file and decision record sits in a directory that mirrors a page. |
| KQP007 | a tile names a child | Error | A page tile names a child page or decision record in the page's mirror directory. |
| KQP008 | a child is listed once | Error | A page's tiles list each child once. |
| KQP009 | a known icon | Error | An icon is named as Lucide names one of its icons. |
| KQP010 | a known plateau | Error | A view tile's or view block's at and to name plateaus of the model, its to later than its at. |
| KQP011 | a known element | Error | A decision record's element Id names an element of the model. |
| KQP012 | a known successor | Error | A superseded decision record's superseded-by names another decision record's file, by its path from portal/. |
| KQP013 | a chain of successors that ends | Error | Following superseded-by from record to record never comes back to a record already passed. |
| KQP014 | an image path | Error | An image in a page's text is named by a relative path to a file inside portal/. |
| KQP015 | an image that exists | Error | An image in a page's text names a file that exists. |
| KQP016 | an image type | Error | An image in a page's text is a PNG, JPEG, GIF, WebP or SVG file, as its extension says and its first bytes agree. |
| KQP017 | an image's size | Error | An image in a page's text is at most 5 MiB. |
| KQP018 | a link's target | Error | A link in a page's text names a page file or decision record by a relative path, or is a fragment or an http, https or mailto address. |
| KQP019 | a known view path | Error | A path that decides which view opens, a view's domain, focus or anchor, names an element of the model of a type the parameter takes. |
| KQP101 | published under unpublished | Lint | A published page sits under a published parent, since it is not rendered otherwise. |
| KQP102 | an unlisted child | Lint | A page's tiles list every child page, so their order is chosen rather than by name. |
| KQP103 | the element's path | Lint | A decision record's element path is the path its element Id is at in the model. |
| KQP104 | a successor in force | Lint | A superseded decision record's successor is not proposed or rejected, since then nothing has replaced the decision yet. |
| KQP105 | a link to an unrendered page | Lint | A rendered page links only to rendered pages, since a link to any other is written as its text. |
| KQP106 | a view's selected and collapsed paths | Lint | A view's selected path and collapsed entries name elements of the model. |
© 2026 Extenza Works. All rights reserved.