Skip to content

Make an artifact

An artifact is something made for the site’s owner rather than for its visitors: a chart of the orders by month, a table of this week’s enquiries, a document, slides, a picture, a template that draws a blog post’s sharing picture, or a small program. The owner asks for one in the desktop app, opens it there, changes it by asking again, and decides who else sees it. Artifacts come with the plans that include them; on any other site the artifact commands say so and change nothing. Topic artifacts lists the kinds, how rows are read, who may share and how many a site keeps.

The artifact commands run inside bash, like every other site command: list_artifacts, get_artifact, create_artifact, update_artifact, restore_artifact_version, duplicate_artifact, embed_artifact, share_artifact and delete_artifact.

  • Two files of the site’s tree: artifacts/<slug>.vzk, what is drawn, and artifacts/<slug>.json, its title, its kind and the tables it reads. A picture is its settings alone, naming a file of the Disk by its key.
  • A page drawn on its own. It wears no layout and draws no component, so everything it shows is in its one file, styled with the site’s own Tailwind classes, with a controller script of its own where it needs one. The language card’s artifacts section has every rule of the two files, and vzk check judges them with the rest of the site.
  • A template is drawn as a browser draws it. A page’s sharing picture is the template’s page at 1200 by 630 pixels, in the site’s stylesheet and the fonts it loads. Lay it out in HTML and the site’s classes or as one <svg>, whichever suits it. Its scripts don’t run there, a picture it places from an address (a file of the Disk among them) isn’t drawn, and a template over about 1.5 MB with the site’s stylesheet has no picture.
  • Each change is a version. A change of its text or of what it reads is a new version the owner can go back to; a change of its title, its mode or its pin is not. Every write takes a note: the owner’s request in their words, which the version list shows.
  • Private until the owner shares it. Nobody but the site’s members sees an artifact until it is shared or put on a page that is live.

An artifact reads site, today(), now(), query (what its address asks for after ?) and the tables its reads names, as tables.<handle>. reads names exactly what it reads: a table it reads and does not name is refused where it is read. The handles a site’s artifact may name are sources in list_artifacts: the site’s own tables, but one with rules of its own, and the platform’s sources: files, the site’s Disk, and the site’s Meta Ads and Google Analytics numbers over the last 90 days (ads_daily, ads_campaigns, analytics_daily, analytics_pages, analytics_sources). One that says connected: false reads as no rows until the owner connects it. Only an artifact reads these: a page of the site never does.

It reads every row of them with the owner’s eyes, a private table’s too, which is why an artifact that reads a table not every visitor reads is never public and never put on a page. Words a visitor wrote, such as an enquiry’s message, are shown as words and nothing else.

mode is live, which reads the rows each time it is opened, or frozen, which keeps them as they were when it was frozen until the owner refreshes it. A chart of last month’s numbers is frozen; a list of today’s enquiries is live.

There is no chart library. A chart is markup, the site’s Tailwind classes and inline values: bars are elements whose style width is a number, a line or a pie is an <svg> whose coordinates are values. Read the rows in the server script, shape them there, and draw.

The owner asks: “show my sales by month as bars”, and the site has a sales table with a month and a total.

create_artifact --slug sales-by-month --title "Sales by month" \
--kind chart --reads sales --mode live \
--note "show my sales by month as bars" --text '<script server>
const months = tables.sales.sortBy(s => s.id)
const highest = months.map(s => s.total).toSorted().toReversed()[0] ?? 1
</script>
<section class="p-6 space-y-2">
<h1 class="text-lg font-semibold">Sales by month</h1>
<div :for={s in months} class="flex items-center gap-3">
<span class="w-20 text-sm">{s.month}</span>
<div class="h-4 rounded bg-accent" style="width: {s.total * 100 / highest}%"></div>
<span class="text-sm">{formatNumber(s.total)}</span>
</div>
</section>'

The answer is the artifact with preview_url, where it is drawn: open it and look before saying it is done. A text the compiler refuses is answered with its findings and nothing is made. The language card says what a table read may ask, and vzk/tables how one is read.

It is made on your own draft (get_site’s draft, drafts/<your account's id>), as one commit there (branch names another branch, and inside bash it is your checkout’s), and it goes live with that draft, as a page does: the owner sees it in Artifacts, marked as on the draft, and runs it there. Until then it reads its rows as they are, so make one frozen once it is live, and it is shared, copied or restored only then. No other artifact is made under its name meanwhile. A clone of the draft outside bash is behind by that commit, so pull before you push. An invoice template is the exception: it is the Payments screen’s and never on a page, so it is made on main at once and invoices can name it straight away.

Change it with update_artifact --slug sales-by-month --text '…' --note '…', always the whole file, built on what get_artifact gives. One on a branch changes there; where two branches made one by the same name, say which with --branch.

4. A change of one visitors see waits for the owner

Section titled “4. A change of one visitors see waits for the owner”

An artifact that is public, or on a page that is live, is what visitors see. Your change of its text, settings or what it reads, and its delete, do not reach them at once: the answer says so with pending, and the owner approves or discards it in the desktop app. A pin goes straight through while nothing waits. A restore waits on every artifact, seen or not. While a change waits, your next one joins it: get_artifact gives its text as pending.text, which is what to build on.

share_artifact makes a public link of the newest version, a frozen copy, and --public=false takes it down, which waits for the owner as any change of a public artifact does. It is the owner’s to do, with Share in the desktop app, unless the owner lets agents share: list_artifacts says which as sharing (owner or agents). When agents may and you share one, the site’s members are told. Never share one the owner did not ask you to share.

embed_artifact --slug sales-by-month --page pages/index.vzk puts its frame at the end of the page on your checkout’s branch, as one commit, which goes live when the branch is merged. A picture goes on a page as an image instead, and an artifact that reads private data goes on none.

The two files are files of the tree like any other: cat artifacts/<slug>.vzk reads one, and on your own branch you may change an artifact’s files and git commit, which the compiler judges as it judges the commands’ writes and a merge puts live. The same rules hold on that road: a commit that makes one public is refused unless agents may share, and a merge that changes one visitors see is refused, so change those with the commands, where the change waits for the owner.

You may also write a new artifact as its two files on a branch, which is what create_artifact does for you: it goes live with the branch, and the owner sees it in Artifacts, marked with its branch. A template made on the branch a page is on is the page’s to name at once. One made elsewhere is the page’s to name once its branch holds it: after it is live, git rebase main takes it in, and a branch with no commit yet takes nothing that way, so start it again from main with git switch -c <branch> main.