KScript docs
EN

A to Z

Everything built into KScript in one list: statements and their options, commands, methods, variables, types, error types, kscript.json settings and command line commands. Use your browser's find, or the search box, to look one up.

A B C D E F G H I J K L M N O P Q R S T U V W Y Z

A

@abortcommand in KScript.HttpStops the request with an error status, such as @abort(404) or @abort(403, 'Admins only').
@abscommand in KScript.MathThe number without its sign.
->absmethod of numberWithout its sign.
Abstractstatement in KScript.DocumentThe summary under the title. A blank line starts a new paragraph.
Accesserror typeThe operating system refused access to a file.
@acoscommand in KScript.MathThe angle in radians whose cosine is the number.
@acting_ascommand in KScript.AuthIn a test, sets who @can, @authorize and @user() ask about until the test ends, in the test and in routes it…
@acting_as_guestcommand in KScript.AuthIn a test, acts as a guest until the test ends, in the test and in routes it calls with @api(/...) or…
->addmethod of dateThe date this many years, months, weeks and days later: ->add(months: 1, days: 2). Months and years keep the…
->addmethod of durationThe two lengths added: 1h30m->add(45m) is 2h15m.
->addmethod of moneyAdds another amount in this amount's currency. For a foreign amount, rate gives units of the receiving…
->addmethod of setA new set with the items added. An item the set has already is left where it is.
add:handler shorthandAdds a value to a list field: add: $draft, to: $tags.
AddFieldstatement in KScript.DataAdds a column to a table. A required column needs a default when the table has rows.
AddIndexstatement in KScript.DataAdds an index to a table.
@adjust_lightnesscommand in KScript.StyleAdds a signed amount to HSL lightness and returns CSS colour text. Use 0.1 to add ten percentage points or…
->advancemethod of progress_barMoves the bar on by a number of steps (1 by default) and returns it. Reaching the total finishes the bar.
->aftermethod of durationThe time this long after a date, or after now.
->aftermethod of stringThe text after the first time text occurs (or the last time, with last), or the whole text when it doesn't…
after_eachstatement in KScript.TestRuns after every test in its file or <describe>, even when the test fails. Use it to tidy up files a test…
kscript agentscommand lineWrite AGENTS.md and .kscript/agents from project code, packages and Markdown listed in agents.merge.
agentskscript.json settingSettings for generated AGENTS.md.
agents.mergekscript.json settingProject-relative Markdown files to include in AGENTS.md, in the listed order.
AIerror typeA call to a language model that failed.
alertstatement in KScript.TerminalPrints the text after a label: type is info (the default), success, warn or error. Errors go to stderr.
->allmethod of configEvery setting, as a map.
->allmethod of listTrue when fn is true for every item.
->allmethod of mapTrue when fn(value, key) is true for every entry.
->allmethod of modelEvery record (leaving out soft-deleted ones).
->allmethod of sessionEvery value in the session, as a map.
->allmethod of setTrue when fn is true for every item: ->all(fn(name) => $name->count() > 2). An empty set gives true.
->allmethod of usersEvery user, oldest first.
->allocatemethod of moneyThe amount shared by these ratios, in parts that add up to it exactly: GBP 10.00 by [1, 1, 2] is GBP 2.50, GBP…
@alphacommand in KScript.StyleThe colour see-through: opacity from 0 to 1 (or '50%').
ANTHROPIC_API_KEYenvironment variableThe API key KScript.AI sends to Claude. Scripts never hold the key themselves.
ANTHROPIC_AUTH_TOKENenvironment variableAn OAuth token KScript.AI sends instead of an API key, when ANTHROPIC_API_KEY isn't set. Without either, it…
ANTHROPIC_BASE_URLenvironment variableSends KScript.AI's requests to another host, such as a proxy or a stand-in server for tests.
->anymethod of listTrue when fn is true for any item (or, without fn, if the list isn't empty).
->anymethod of mapTrue when fn(value, key) is true for any entry.
->anymethod of setTrue when fn is true for any item, or without fn, when the set isn't empty.
Anystatement in KScript.HttpA route for any method requests to a path. It is answered by a controller (to), a view, a redirect, or the…
anytypeAny value. The type a field or parameter has when none is given.
@apicommand in KScript.NetMakes an HTTP request and returns the response. Give an absolute HTTP(S) URL or a path such as '/api/notes' to…
@api_tokencommand in KScript.AuthMakes an API token for a user and returns it. Show it once: only its hash is kept. Requests that send it as…
@api_tokenscommand in KScript.AuthA user's API tokens, without the tokens themselves: [{ id, name, created_at, last_used_at, expires_at }].
appkscript.json settingUsed by kscript compile, which builds a script, desktop app or site into a program for macOS, Windows and…
app.iconkscript.json settingAn icon file relative to kscript.json: .icns for macOS, .ico for Windows, .png for Linux.
app.idkscript.json settingA reverse-DNS id such as com.example.lifelab (the macOS bundle id).
app.mainkscript.json settingThe script the app runs, relative to kscript.json. Usually one that imports KScript.UI and holds a Window { }…
app.namekscript.json settingThe app's name in the Dock, Start menu or launcher. Defaults to the project's name.
app.user_configkscript.json settingtrue lays the person's own settings over $config: config.json in the app's config folder, such as…
app.versionkscript.json settingThe app's version, such as 1.0.0.
@app_folderscommand in KScript.StorageEvery folder of the app, by kind: { config: ..., data: ..., cache: ..., state: ..., logs: ... }.
@app_namecommand in KScript.StorageThe name the app's folders are named after: app.name in kscript.json, else name, else the script's name.
->appendmethod of storageAdds text to the end of a file.
@append_textcommand in KScript.IOAdds text to the end of a file.
$argsvariableThe command line arguments after the script path.
Argumenterror typeA call with the wrong arguments.
as:option of @bindReads the value as this type before it reaches the field, and refuses one that isn't: as: int.
->asciimethod of domainThe form DNS uses, with international labels as xn--: xn--bcher-kva.example for bücher.example.
@asincommand in KScript.MathThe angle in radians whose sine is the number.
->askmethod of chatSends a message and returns the answer, keeping the history. With a schema the answer is a map.
@assertcommand in KScript.TestFails the test unless the condition is true. A failed comparison shows the value of each side. message is what…
@assert_responsecommand in KScript.TestChecks an HTTP response's status, headers, redirect or JSON. An optional type validates the body.
Assertionerror typeA failed check in a test.
@asset_urlcommand in KScript.HttpBuilds a public asset URL using assets.base and the optional assets.manifest map in project configuration.
->atmethod of listThe item at an index; negative counts from the end.
@atancommand in KScript.MathThe angle in radians whose tangent is the number.
@atan2command in KScript.MathThe angle in radians of the point (x, y).
->attachmethod of queryLinks records through a many to many relation's pivot table: $post->tags()->attach([$a, $b]) or keys…
@attemptcommand in KScript.AuthSigns someone in with an email and password: returns the user, or null when they don't match. session: false…
->attemptmethod of rate_limitCounts an attempt and runs work, returning what it returns. When the limit is used up, work doesn't run: it is…
Authorstatement in KScript.DocumentAn author, with an affiliation and email. Its text is the name.
@authorizecommand in KScript.AuthStops unless the model's policy lets the user use the ability: a Forbidden error (403 in a route), or…
auto_createoption of modelCreates this model's table and indexes on first use if the table is missing.
@autogrowpage directiveMakes a <textarea> grow taller as its text grows.
->available_inmethod of rate_limitHow long until attempts are allowed again, as a duration: 0s when some are left.
@averagecommand in KScript.MathThe mean of the numbers (or of one list).
->averagemethod of grouped_queryThe average of a column in each group.
->averagemethod of listThe mean of the items (or of fn for each item), or null when empty.
->averagemethod of modelThe average of a column, or null when no rows match.
->averagemethod of queryThe average of a column, or null when no rows match.
->averagemethod of setThe mean of the items (or of fn for each item), or null when the set is empty.

B

backoffoption of jobHow long to wait before each retry: one time (30s), a list ([10s, 1m, 5m], the last one repeats), or…
BadRequesterror typeA request that can't be handled as sent. Answers 400.
base64typeBase64 text (standard or URL-safe). ->decode() gives the text it holds.
@batchcommand in KScript.QueueJobs dispatched together, whose progress the queue keeps: @batch($rows->map(fn(r) => ImportRow(id…
->batchmethod of queueA batch dispatched on this connection, as the queue has it now, or null: @queue()->batch($id).progress .
->beforemethod of durationThe time this long before a date, or before now.
->beforemethod of stringThe text before the first time text occurs (or the last time, with last), or the whole text when it doesn't…
before_eachstatement in KScript.TestRuns before every test in its file or <describe>, in the test's own scope. Use it to reset shared variables…
@betweencommand in KScript.StyleA media query for screens from one width up to (not including) another.
Bibliographystatement in KScript.DocumentThe list of works cited with [@key]: from a BibTeX file, Source elements inside it, or both. Without one, the…
@bindpage directiveKeeps a control and a field in step: @bind($title) . Options such as on: blur and trim go after the field.
->bitsmethod of numberWorks on the number's bits, as a whole number: and: keeps the bits both have (12->bits(and: 10) is 8), or: the…
->blocksmethod of stringThe parts of the text between blank lines, each trimmed of the line breaks around it: 'a\nb\n\nc'->blocks() is…
@boldcommand in KScript.TerminalBold text.
booltypetrue or false .
Boxstatement in KScript.UIA rectangle: a coloured cell, a card or a panel. It can hold other items, and on_click (or a shorthand such as…
breakstatementLeaves the innermost loop.
bulletsstatement in KScript.TerminalPrints each item of a list on its own line, after a ⇂.
->bumpmethod of semverThe next version: bump('major'), bump('minor') or bump('patch'). The prerelease is dropped.
Buttonstatement in KScript.UIA button. Its text is the label; on_click runs when it is pressed, or name the action straight on it…
->bytesmethod of documentThe document rendered as pdf, docx or html, as a base64 value, ready for @response($doc->bytes(as: pdf), type…

C

@cachecommand in KScript.CacheA cache store: memory (the default, like $cache), file, which keeps values in files in the app's cache folder…
$cachevariableThe app's cache in memory: $cache->remember('repos', fn() => @get_json($url), ttl: 10m). It lasts while…
->callmethod of fnCalls the function with these arguments.
callstatementCalls a function for its effect, optionally keeping the result.
call:handler shorthandCalls a function or one of the component's methods: call: $save, with: [$note.id].
@cancommand in KScript.AuthTrue when the model's policy lets the user use the ability on a record: @can(update, $post). For an ability…
Cancellederror typeThe script was stopped.
@cannotcommand in KScript.AuthThe opposite of @can: true when the policy doesn't let the user use the ability.
->capitalizemethod of stringThe text with its first letter upper-cased.
capturestatement in KScript.TestRuns its body and keeps what it prints in a variable instead of showing it. input gives it lines to read.
cardtypeA payment card number, checked with the Luhn digit. It prints masked apart from the last four digits.
->casemethod of stringThe text as an identifier in one style: 'User ID'->case(snake) is user_id, kebab gives user-id, camel userId…
casestatement, written value => …A branch of <match>: runs when the value equals one of is , or when when is true (with both, the value must…
->catchmethod of batchThe job to dispatch when the first job of the batch fails. Returns the batch, to chain.
catchstatement, written catch errHandles matching errors in a try block, a function call, or calls to methods of a type or model. The nearest…
@cbrtcommand in KScript.MathThe cube root.
@ceilcommand in KScript.MathRounded up.
->ceilmethod of numberRounded up.
->cellsmethod of csvIts cells. On its own, or with rows , every row; with columns , every column. row: picks one row, counted from…
->cellsmethod of listThe cells of a list of lists, such as a ->grid(). On its own, or with rows , every row; with columns , every…
@chaincommand in KScript.QueueJobs that run one after another: each starts when the one before it succeeds, and a failure stops the rest…
->chainmethod of errorThe error's type and the types it extends, nearest first: ['NotFound', 'Validation', 'Error'].
->changemethod of page_visitRuns the on-change handler of the input with this label (the text of the <label> around it), such as a…
ChangeFieldstatement in KScript.DataChanges a column to the one described: its type, whether it may be null, its default or what it references…
@char_ofcommand in KScript.CoreThe character with this character code: @char_of(65) is A.
->charsmethod of stringThe characters, as a list.
@chatcommand in KScript.AIA conversation with a language model that keeps its history: $chat->ask(text). tools, model and max_tokens are…
kscript checkcommand lineCheck scripts and pages without running them (no path: the current project).
->checkmethod of responseThrows a Network error unless the status is 2xx; otherwise returns the response.
->checkmethod of typeThe problems that stop the data fitting this type, as { path, field, message } maps. Empty when it fits.
@check_scriptcommand in KScript.TestChecks another script as kscript check does, without running it, and returns its problems: a list of { line…
CheckBoxstatement in KScript.UIA tick box tied to a true/false variable. Its text is the label.
->chunkmethod of listThe items in lists of size.
->chunkmethod of modelReads the rows a batch at a time and calls work with each batch (and its number from 0): for going through…
->chunkmethod of queryReads the rows a batch at a time and calls work with each batch (and its number from 0): for going through…
CIenvironment variableSet by CI services such as GitHub Actions. When it is set (and not false or 0 ), kscript test runs every test…
cidrtypeA block of IP addresses: an address, / and a prefix length, such as 10.0.0.0/8.
@clampcommand in KScript.MathThe number kept between min and max.
->clampmethod of numberThe number limited to min..max.
@classpage directiveSwitch classes on by conditions: @class(done: $todo.done) or @class({ $todo.done: ['done', 'struck'] }).
->classesmethod of page_visitThe classes of the first element whose own text is this: classes('Buy milk').
->clearmethod of cacheRemoves every key. Returns how many there were.
->clearmethod of fake_mailForgets the mail sent so far, and returns how many there were.
->clearmethod of fake_queueForgets the dispatched jobs.
->clearmethod of queueRemoves every waiting job and returns how many there were. With failed, deletes every failed job of this queue…
->clearmethod of rate_limitForgets the attempts, such as after a successful sign-in.
->clearmethod of sessionRemoves every value, keeping the session (and who is signed in). Returns how many there were.
->clearmethod of storageDeletes everything in the folder. Returns how many files were deleted.
clearstatement in KScript.TerminalClears the terminal.
->clear_groupmethod of cacheClears this named cache group and returns how many entries were removed.
->clickmethod of page_visitRuns the live on-click handler of the element with this text (or aria-label or title) and redraws its block…
@close_windowcommand in KScript.UICloses the window, so the script carries on after </KScript.Window>.
Codestatement in KScript.DocumentA block of source code in a monospaced font, used as written.
collectionstatementBuilds a list or map from nested <item> elements, for data that reads better as markup than as a literal.
@colorcommand in KScript.TerminalText in a colour: red, green, yellow, blue, magenta, cyan, white, gray (or a bright_ one). Plain text when the…
colortypeA colour: #rgb, #rrggbb, #rrggbbaa, rgb(...) or a CSS name. Kept as lowercase #rrggbb (#rrggbbaa with alpha).
Columnstatement in KScript.UIStacks its items top to bottom.
COLUMNSenvironment variableHow wide kscript's tables, lines of dots and wrapped text are, instead of the terminal's own width.
->combinationsmethod of listEvery way to pick size items, order not mattering, in list order: [1, 2, 3]->combinations(2) is [[1, 2], [1…
->commonmethod of listThe items that occur most often, most first, each once and as they are (numbers stay numbers): [3, 7, 7, 9, 9…
->comparemethod of semver-1, 0 or 1 as this version comes before, with or after the other (build metadata is ignored).
kscript compilecommand lineBuild programs that run without kscript.
Configerror typeA missing or invalid setting.
configkscript.json settingThe app's own settings, read as $config: "config": { "app": { "name": "Shop" } } gives $config.app.name…
configstatementReads the script's settings with other options: an environment, other files, a prefix for environment…
$configvariableThe project's settings: the "config" section of kscript.json, with kscript.<env>.json and config.kscript laid…
config.appkscript.json settingSettings about the app, such as its name: $config.app.name.
config.cachekscript.json settingKScript.Cache settings, such as "store": "memory" and "ttl": "5m".
config.databasekscript.json settingKScript.Data's database connections.
config.database.connectionskscript.json settingConnections by name, such as "main": { "url": "sqlite:data/app.sqlite" }.
config.database.defaultkscript.json settingThe connection used when none is named (default: main).
config.i18nkscript.json settingTranslations: folder, default and locale, such as "default": "en-GB".
config.loggingkscript.json settingLog level and providers, such as "level": "info".
config.mailkscript.json settingKScript.Mail: how @send_mail sends (see docs/mail.md).
config.mail.driverkscript.json settingsmtp sends through a mail server, log writes each message to the log, and fake keeps them in memory.
config.mail.encryptionkscript.json settingtls upgrades the connection with STARTTLS; none sends in the clear, for a local test server.
config.mail.fromkscript.json settingThe address mail comes from unless @send_mail names one: "hello@example.com", or { "address"…
config.mail.hostkscript.json settingThe SMTP server.
config.mail.passwordkscript.json settingThe SMTP password. Leave it out to read the MAIL_PASSWORD environment variable.
config.mail.portkscript.json settingThe SMTP port: 587 for STARTTLS, 25 or a test server's port otherwise.
config.mail.queuekscript.json settingThe queue mail sent with queue goes on.
config.mail.usernamekscript.json settingThe SMTP user. Defaults to the MAIL_USERNAME environment variable.
config.moneykscript.json settingMoney settings, such as exchange_rates: { "EUR": { "GBP": 0.85 } }.
confirmstatement in KScript.TerminalAsks a yes/no question and stores true or false.
confirm:handler modifierAsks first, and runs only if the person says yes: confirm: 'Delete this note?'.
Conflicterror typeA change that clashes with the current state. Answers 409.
Connectionerror typeA database that can't be reached or opened. Answers 503.
connectionoption of jobThe connection in kscript.json's queue.connections it goes to, unless the dispatch names one. Defaults to…
connectionoption of modelThe database connection, from database.connections in your config. Default: the default connection (main).
Consterror typeChanging a const.
conststatement, written const $name = valueDeclares a value that can't change: the same as <let const="true">. Top-level consts are exported to scripts…
constructstatementA type's constructor. Its fields are what a caller may pass, as Point(x: 1) or as a component's attributes…
->containsmethod of cidrTrue when the address is in the block.
->containsmethod of listTrue when the list contains the item.
->containsmethod of setTrue when the item is in the set, matched with ===. It stays quick however big the set gets, and so does item…
->containsmethod of stringTrue when the text contains this text. With ignore_case: true, upper and lower case match.
Contentsstatement in KScript.DocumentThe table of contents, with page numbers in PDFs.
Contexterror typeSomething used where it doesn't work.
continuestatementSkips to the next turn of the innermost loop.
@contrast_colorcommand in KScript.StyleThe text colour that reads best on a background: dark (default #000000) on light colours, light (default…
->contrast_ratiomethod of colorThe WCAG contrast ratio with the other colour, from 1 to 21. Text needs 4.5 or more.
kscript convertcommand lineWrite the .kscript version of an XML script, or the reverse.
->convertmethod of anyChanges the value's format. from: reads text written in a format (json, yaml, csv, markdown or latex), and to…
->convertmethod of timezoneThe same moment as the local time in this zone.
@convert_lengthcommand in KScript.MathA length in other units: @convert_length(12, in, cm) is 30.48. Units: mm, cm, m, km, in, ft, yd, mi, pt and px…
@copycommand in KScript.IOCopies a file or folder, and returns the copy as a file value. to is a full path, or an existing folder to…
->copymethod of storageCopies a file or folder inside the folder. overwrite replaces what is at to.
->copy_tomethod of fileCopies the file or folder and returns the copy. to is a full path, or an existing folder to copy it into.
@coscommand in KScript.MathThe cosine of an angle in radians.
->countmethod of chainHow many jobs are in the chain.
->countmethod of fake_llmHow many times the script asked the model.
->countmethod of fake_mailHow many messages were sent.
->countmethod of fake_queueHow many jobs were dispatched.
->countmethod of grouped_queryHow many rows each group has: Order->group_by(status)->count() gives { open: 3, paid: 5 }.
->countmethod of listThe number of items.
->countmethod of mapThe number of keys.
->countmethod of modelHow many rows match.
->countmethod of queryHow many rows match.
->countmethod of setHow many items the set has.
->countmethod of stringThe number of characters.
->countmethod of usersHow many users there are.
->count_bymethod of listA map from fn's result to how many items gave it: ['a', 'bb', 'cc']->count_by(->count()) is { 1: 1, 2: 2 }.
->count_bymethod of setA map from fn's result to how many items gave it.
->count_ofmethod of fake_mailHow many messages went to one address (or user).
->count_ofmethod of fake_queueHow many jobs of one job type were dispatched: count_of(SendWelcome).
->count_ofmethod of listCounts items for which a function is true, or items equal to a value using ==.
->count_ofmethod of stringHow many times a piece of text occurs.
countrytypeAn ISO 3166 country code. Two-letter, three-letter and English names are read; it is kept as two capitals…
->createmethod of modelChecks the values against the model, saves a new record and returns it: User->create({ name: 'Joan', email…
->createmethod of queryAdds a record to the relation: $user->posts()->create(title: 'Hi') sets the post's author to the user. For a…
@create_foldercommand in KScript.IOCreates a folder (and any folders above it), and returns it as a file value. Does nothing if it is already…
->create_tablemethod of databaseMakes a model's table and indexes, if the database doesn't have them yet, and the pivot tables of its many to…
CreateTablestatement in KScript.DataMakes a table, with a Field for each column, its Index lines and a Key of two columns if it has one.
crontypeA cron schedule of five fields (minute hour day month weekday), or @daily, @hourly and the like.
@csrf_fieldcommand in KScript.AuthA hidden form field holding the CSRF token: write {! @csrf_field() } inside each <form method="post">.
@csrf_tokencommand in KScript.AuthThe session's CSRF token. Forms send it back as _token, and scripts as an X-CSRF-Token header.
kscript csscommand lineCompile .ks.css, .ks.scss and .ks.sass stylesheets.
->cssmethod of colorIts CSS form: #rrggbb, or rgb(r g b / a) with transparency.
css_textstatement in KScript.StyleCSS text in a stylesheet, with {$name} and { @fn() } filled in. kscript writes these for you around the…
@css_varcommand in KScript.Stylevar(--name), with a fallback when given.
@css_varscommand in KScript.StyleCustom properties from a map, one per line: { primary: '#36f', space: { sm: '4px' } } with prefix 'theme'…
csvtypeText that holds valid CSV, such as a ```csv block. ->cells() reads its rows, columns and cells.
currencytypeAn ISO 4217 currency code, kept in capitals: GBP, USD, EUR.
->cursor_paginatemethod of modelReads one page using a unique, non-null key (the model key by default). Returns { items, has_more, next }…
->cursor_paginatemethod of queryReads one page using a unique, non-null key (the model key by default). Returns { items, has_more, next }…
@cwdcommand in KScript.IOThe folder kscript was run from.
cycle:handler shorthandMoves a field to the next value of its enum, or of a list given with through:, wrapping round: cycle: $view…

D

@darkencommand in KScript.StyleSubtracts from HSL lightness. For example, @darken('red', '10%') gives the same CSS as…
->darkenmethod of colorMixed with black: amount 0.2 (the default) is a fifth of the way.
DATABASE_URLenvironment variableThe database to use when kscript.json and the config files don't set one, such as…
->datemethod of dateThe date at midnight.
datetypeA date and time: @now() , @today() , '2026-11-19'->to_date() .
date_formattypeHow a date is written, such as dd-MM-yyyy or d MMMM yyyy, HH:mm: dd is the day, MM the month, yyyy the year…
@dbcommand in KScript.DataA query on a table with no model ( @db('users')->where(active: 1)->get() gives maps), or with no table the…
kscript dbcommand lineMigrations and seeders: write a migration from the models, run it on the database, undo it, and fill the…
$dbvariableThe default database connection: $db->table('users'), $db->tables(), $db->create_table(User). With no config…
debounce:handler modifierWaits until the events stop for this long, then runs once: debounce: 300ms.
debounce:option of @bindSends the value once typing has stopped for this long: debounce: 300ms.
kscript debugcommand lineStart the step debugger (Debug Adapter Protocol over stdio).
->debugmethod of loggerLogs a message at debug level, with an optional map of fields.
->decodemethod of base64The text it holds (read as UTF-8).
->decrementmethod of modelTakes away from a number column on every row that matches (1 by default). Returns how many rows changed.
->decrementmethod of numberThe number minus 1.
->decrementmethod of queryTakes away from a number column on every row that matches (1 by default). Returns how many rows changed.
->decrementmethod of recordTakes away from a number field in the database in one statement and sets the record's field to the new value…
decrement:handler shorthandTakes 1 (or by:) from a number field, never going below its min: (stock: int(min: 0)): decrement: $stock.
@decryptcommand in KScript.CoreThe value @encrypt() was given. Text that was changed, or encrypted with another KSCRIPT_SECRET, is a Format…
->deep_mergemethod of mapRecursively merges maps. The right value replaces lists, nulls, and other leaves.
defaultstatement, written _ => …The branch of <match> that runs when no case matched. In a .kscript file it is the arm _ => ... .
@degreescommand in KScript.MathRadians to degrees.
@deletecommand in KScript.IODeletes a file, or a folder and everything in it. Does nothing if it isn't there.
->deletemethod of fileDeletes the file, or the folder and everything in it. True if something was deleted.
->deletemethod of modelDeletes every row that matches: models that extend SoftDeletes only mark them deleted. Returns how many.
->deletemethod of queryDeletes every row that matches: models that extend SoftDeletes only mark them deleted. Returns how many.
->deletemethod of recordDeletes the record. For a model that extends SoftDeletes it is only marked deleted (->restore() brings it…
->deletemethod of storageDeletes a file, or a folder and everything in it. True if something was deleted.
->deletemethod of usersDeletes a user, with their sessions and tokens. True if there was one.
Deletestatement in KScript.HttpA route for DELETE requests to a path. It is answered by a controller (to), a view, a redirect, or the…
delete:handler shorthandDeletes a KScript.Data record: delete: $note is $note->delete().
describestatement in KScript.TestA group of tests. Its name goes in front of each test's name, and its <before_each> and <after_each> apply to…
->describe_tablemethod of databaseReturns columns, indexes, and keys for the named table or model.
->detachmethod of queryUnlinks records from a many to many relation, or every record when none are given. Returns how many links were…
detailstatement in KScript.TerminalPrints a name, a line of dots and a value: " Version ........ 1.2". The text is the value.
->differencemethod of listThe items that aren't in other, each once and in order. Items match with ==, or by what by: gives for each.
->differencemethod of setThe items that aren't in other, as $set - $other gives. With symmetric, the items in exactly one of the two…
@dimcommand in KScript.TerminalDimmed text.
->dirtymethod of recordThe names of the fields with changes that aren't saved.
disablehandler modifierDisables the element while its action runs: disable.
->dispatchmethod of batchQueues the batch's jobs and returns the batch, with its id. Inside a transaction it waits for the commit, as a…
->dispatchmethod of chainQueues the first job of the chain; each of the others is queued when the one before it succeeds. Inside a…
->dispatchmethod of jobQueues the job and returns what was queued: { id, job, queue, connection, available_at }. delay (10m) or at (a…
@dispatch_eventcommand in KScript.QueueTells every listener of an event: runs each listener for function with it, in order, then queues each job that…
->dispatchesmethod of fake_queueWhat each dispatch asked for: job, queue, connection, delay, available_at.
->distinctmethod of modelLeaves out rows that repeat an earlier one, in the columns selected.
->distinctmethod of queryLeaves out rows that repeat an earlier one, in the columns selected.
dostatement, written $name = value; …Runs assignment statements and calls, separated by ; . A call that names a statement, such as locale(set…
kscript docscommand lineOpen these docs: a local website with every package, element, command and method, and examples you can run.
@documentcommand in KScript.DocumentMakes a document from Markdown or LaTeX source. A fenced value supplies the format. A plain string defaults to…
Documentstatement in KScript.DocumentA document. Its content (Section, Paragraph, List, Table, Figure, Math...) is laid out by the template and…
documenttypeA document built with KScript.Document, ready to save as PDF, Word, HTML or Markdown.
@document_templatescommand in KScript.DocumentThe built-in document templates and what each is for: { paper: '...', report: '...' }.
domaintypeA domain name such as example.com or api.example.co.uk, lowercased, without a trailing dot.
@downcommand in KScript.StyleA media query for screens narrower than this: @down('md') is (max-width: 767.98px).
Downstatement in KScript.DataThe steps that undo the migration, run by kscript db rollback in place of undoing each step.
@downloadcommand in KScript.NetDownloads a URL to a file and returns the file's full path. Folders are created as needed, and a relative path…
@dragpage directiveMove this element with the pointer, and run its on-dragend handler where it lands: @drag(front). With copy…
@drop-classpage directiveAdd classes while something this element accepts is dragged over it: @drop-class('file-over').
@drop-filespage directiveSend files dropped on this element through the named live-upload input inside it: @drop-files('upload').
->drop_tablemethod of databaseDeletes a table and everything in it, if it is there: a name, or a model's table. True when there was one.
DropFieldstatement in KScript.DataDrops a column, with its indexes. Rollback adds it back, empty.
DropIndexstatement in KScript.DataDrops the index on these columns.
DropTablestatement in KScript.DataDrops a table and its rows. Rollback makes it again, empty.
durationtypeA length of time: 1h30m, 90s, 2d, 5y10mo or ISO 8601 such as PT1H30M. Kept in its short form.

E

$evariablee, about 2.71828.
->eachmethod of listCalls fn for each item and returns the list.
->eachmethod of setCalls fn for each item, in the order they were added, and gives back the set.
@eachpage directiveDraws the tag once for each item: @each($tasks, as: task, at: i). Same as <for each="task" in="$tasks"> around…
echostatementPrints its text. { expr } inserts a value; $name and $name->method() work directly.
elifstatementRuns when the earlier <if>/<elif> tests were false and this test is true.
elsestatementRuns when the earlier <if>/<elif> tests were all false, or after a <for> that had nothing to loop over.
emailtypeAn email address such as joan@example.com. Spaces are trimmed and the domain is lowercased.
emit:handler shorthandSends an event to the page's live blocks: emit: 'notes-changed' is @emit_event('notes-changed').
@emit_eventcommand in KScript.WebSends an event from a live action to the page's live blocks. A target limits it to one block ID.
@encryptcommand in KScript.CoreEncrypts a value (text, a number, a map or a list) with the app's secret, KSCRIPT_SECRET, so only the app can…
->end_ofmethod of dateThe last moment of the day, week, month, quarter or year the date is in: ->end_of(month) is 23:59:59 on its…
->ends_withmethod of stringTrue when the text ends with this text. With ignore_case: true, upper and lower case match.
->entriesmethod of loggerWhat memory providers kept: a list of { time, level, category, message, fields, script, line }.
->entriesmethod of mapThe entries, as a list of { key, value } maps.
enumstatementDeclares a set of named values. Size.small is 'small', and a parameter typed with it ( params="size: Size" )…
@envcommand in KScript.CoreAn environment variable, or default when it isn't set.
$envvariableEnvironment variables: $env.HOME, $env['PATH'].
->environmentmethod of configThe environment the settings are for (staging, production), or null.
Errorerror typeAny error. Every error type extends Error.
->errormethod of loggerLogs a message at error level, with an optional map of fields.
errorstatementDeclares an error type. throw NotFound(id: 42) raises one, catch NotFound as e catches it and the error types…
->escapemethod of stringThe text HTML-escaped.
@escape_regexcommand in KScript.CoreText with every character that means something in a regular expression escaped, so it matches only itself…
@etagcommand in KScript.HttpTags the answer with an ETag made from a value (such as a record's version or updated time). When the…
eventstatement in KScript.QueueDeclares an event: something that happened in the app, with the fields its listeners need, typed like a…
$eventvariableThe event a handler runs for, in on-* attributes and <on> blocks: $event.value , $event.key , $event.data …
$eventvariable in page handlersThe browser event a handler runs for, with its fields.
@event-namepage directiveRuns @on-event only for events with this name: event-name="notes-changed" .
@everypage directiveHow often @on-tick runs: every="1s" .
@existscommand in KScript.IOTrue if a file or folder is at the path.
->existsmethod of modelTrue when any row matches.
->existsmethod of queryTrue when any row matches.
->existsmethod of storageTrue if the file (or, without a name, the folder) is there.
exitstatementEnds the script, with an exit code for the shell (0 means success).
@expcommand in KScript.Mathe to the power of the number.
expectstatement in KScript.TestChecks a value and fails the test if the check doesn't hold. Give the value and one check, such as equals="5".
expect_errorstatement in KScript.TestFails the test unless its body stops with an error. type and contains check which error; as keeps it for more…
extendstatementAdds methods to a type: a built-in one such as date, string or list, a package's (file, response), or a…
extendsoption of errorThe error type it is a kind of, such as Validation or another <error>. catch of that type catches this one…
extendsoption of typeA type whose required method signatures this type implements.
extensionskscript.json settingWhere the project's extension files are: folders (everything inside, subfolders too) or globs, relative to…
extraoption of modelKeys ->create() is given that the model doesn't have: drop them (the default), keep them, or make them an…
extraoption of typeKeys in the data that the type doesn't list: drop them (the default), keep them, or make them an error…

F

@factorialcommand in KScript.Mathn! for a whole number from 0 to 5000, exact.
@failcommand in KScript.TestFails the test now.
@fail_jobcommand in KScript.QueueIn a job's handle: fails the job now, without more tries. Give an error ( @fail_job(Validation('Bad data')) )…
fail_onoption of jobErrors of these types fail the job at once, without more tries: [Validation, NotFound].
->failedmethod of queueThe jobs of this queue that failed: id, job, fields, attempts, failed_at and error.
->fakemethod of modelSaves a record with made-up values for the fields that need one, and these values: User->fake(role: 'admin') …
@fake_llmcommand in KScript.AIFor tests: from now on in this run, @llm, llm and $chat->ask() answer from replies instead of asking Claude: a…
@fake_mailcommand in KScript.MailFor tests: from now on in this run, mail is kept instead of sent, queued or not…
->fake_manymethod of modelSaves count fake records, each with these values, and returns them: Post->fake_many(3, author: $joan) .
@fake_queuecommand in KScript.QueueFor tests: from now on in this run, dispatched jobs are kept instead of queued or run. $q->pushed(SendWelcome)…
->fatalmethod of loggerLogs a message at fatal level, with an optional map of fields.
Fieldstatement in KScript.DataA column of the table CreateTable makes.
fieldstatement, written name: typeOne field of a <type>, <error>, <model> or <job>: in a .kscript file, one line of the block, stars: int from…
fieldsoption of errorThe fields on one line, like fn params: id: int, kind: string = 'item' .
fieldsoption of eventThe fields on one line, like fn params: order_id: int, total: number . Bigger events list them one per line.
fieldsoption of jobThe fields on one line, like fn params: user_id: int, email: email . Bigger jobs list them one per line.
fieldsoption of modelA short model's fields on one line: name: string, email: email . Bigger models list one <field> per line.
fieldsoption of typeA short type's fields on one line, like fn params: login: string, id: int, avatar_url?: string . Bigger types…
Figurestatement in KScript.DocumentAn image (PNG or JPEG) with a caption. Figures with a caption are numbered.
@filecommand in KScript.IOA file value for a path, with fields like .name, .extension and .size, and methods like ->read_text().
->filemethod of storageA file in the folder as a file value, with .size, .modified, .mime and the file methods.
file_pathtypeWhere a file or folder is: ./data/input.txt from the script's folder, ../shared/rates.json from the folder…
@file_userscommand in KScript.AuthThe users kept as files in the app's data folder, as before http.auth.users kept them in a model: each with…
FileNotFounderror typeA file or folder that doesn't exist.
@filescommand in KScript.IOThe files in a folder, as file values. pattern is a wildcard like '*.txt'.
->fillmethod of page_visitTypes a value into the input bound to this field (bind="$draft"), sent with the next click or submit.
->filtermethod of listThe items for which fn(item, index) is true.
->filtermethod of mapThe entries for which fn(value, key) is true.
->filtermethod of setThe items for which fn(item) is true, as a set.
->finallymethod of batchThe job to dispatch once every job of the batch has run, whether or not they succeeded. Returns the batch, to…
finallystatementRuns after the <try> body and any <catch>, whether or not there was an error.
->findmethod of documentThe zero-based match offset in the document's source, or -1.
->findmethod of formatted_fileThe zero-based source offset of the first literal match, or -1.
->findmethod of latexThe zero-based source offset of the first literal match, or -1.
->findmethod of listThe first item for which fn(item, index) is true, or with last, the last one; null when none is.
->findmethod of mapThe first entry for which fn(value, key) is true, as { key, value }, or null.
->findmethod of markdownThe zero-based source offset of the first literal match, or -1.
->findmethod of modelThe record with this key, or null.
->findmethod of queryThe record with this key, or null.
->findmethod of setThe first item (in the order they were added) for which fn(item) is true, or null.
->findmethod of usersThe user with this id, or null.
->find_allmethod of stringEvery match of a regular expression, as a list.
->find_emailmethod of usersThe user with this email (case doesn't matter), or null.
->find_or_failmethod of modelThe record with this key, or a ModelNotFound error (a 404 in a route).
->find_or_failmethod of queryThe record with this key, or a ModelNotFound error (a 404 in a route).
->firstmethod of listThe first item, or null.
->firstmethod of modelThe first row, or null when none match.
->firstmethod of queryThe first row, or null when none match.
->firstmethod of stringThe first character.
->first_or_createmethod of modelThe first record that matches, or a new one made from both maps.
->first_or_failmethod of modelThe first row, or a ModelNotFound error (a 404 in a route) when none match.
->first_or_failmethod of queryThe first row, or a ModelNotFound error (a 404 in a route) when none match.
->first_or_newmethod of modelThe first record that matches, or a new one made from both maps that isn't saved yet: call ->save() to keep…
->flashmethod of sessionKeeps a value for this request and the next one only: a message to show after a redirect, or the form's input…
->flat_mapmethod of listMaps each item, then spreads each result list by one level.
->flattenmethod of listLists inside the list are spread into it.
floattypeA number that may have a fraction: 0.5 , 3.14 .
@floorcommand in KScript.MathRounded down.
->floormethod of numberRounded down.
@fluidcommand in KScript.StyleA size that grows with the screen: min (px) on screens up to from (default 640px), max on screens from to…
->flushmethod of loggerWrites out entries that providers hold back (they are also written when the script ends).
kscript fmtcommand lineTidy scripts and pages.
fnstatementDeclares a function, called like a command: @name(args) , or piped: $x | > @name() . Functions can be called…
fntypeA function: a lambda fn(x) => $x * 2 , or a declared function passed as @name .
@focuspage directiveGive this element focus when it appears, or when its condition turns true: @focus() or @focus($editing).
->foldermethod of storageA folder inside this one, with the same methods.
@folderscommand in KScript.IOThe folders in a folder, as file values.
foroption of listenerThe event it listens for.
foroption of policyThe model, or type, the policy is for.
forstatement, written for item in listLoops over a list, a map or a range such as 0..10 (end exclusive) or 0..100 step 5. $loop holds index, first…
Forbiddenerror typeA request the signed-in user isn't allowed to make. Answers 403.
FORCE_COLORenvironment variableSet to 1 to keep colours when the output isn't a terminal, such as in CI logs. 0 and false turn them off.
->force_deletemethod of modelDeletes every row that matches, even for models that extend SoftDeletes. Returns how many.
->force_deletemethod of queryDeletes every row that matches, even for models that extend SoftDeletes. Returns how many.
->force_deletemethod of recordDeletes the record from the table, even for a model that extends SoftDeletes.
ForeignKeyViolationerror typeA save or delete that would leave a record pointing at one that isn't there. Answers 409.
Formaterror typeText that isn't in the expected format, such as a date.
formatkscript.json settingUsed by kscript fmt and the editor's Format Document. Values set here win over the editor's tab settings.
->formatmethod of currencyAn amount written in this currency: £1,234.50.
->formatmethod of dateWrites the date the way a date_format says: ->format(dd-MM-yyyy), ->format('d MMMM yyyy') or…
->formatmethod of date_formatThe date written this way: 07-03-2026.
->formatmethod of localeA number or date written the way this locale writes it: 1.234,5 in de-DE.
->formatmethod of moneyThe amount written for a locale, or the current one: £10.00 in en, 10,00 £ in fr.
->formatmethod of numberFormats the number (.NET format, N0 by default: 1,234).
format.enabledkscript.json settingfalse turns formatting off for the project: kscript fmt skips its files and Format Document makes no changes.
format.end_of_linekscript.json settingLine endings to write. auto keeps the ones each file already uses.
format.excludekscript.json settingFiles and folders kscript fmt leaves alone.
format.includekscript.json settingFiles kscript fmt formats in a project folder, as globs relative to kscript.json. .xml files that start with…
format.indentkscript.json settingSpaces per indent level, or "tab" to indent with tabs.
format.max_blank_lineskscript.json settingBlank lines kept in a row; extra ones are removed.
format.preservekscript.json settingElements whose content is kept exactly as written, on top of <pre>, <textarea>, <script>, <style> and CDATA…
format.print_widthkscript.json settingThe longest a line should be (80 by default). Longer lines are wrapped: a start tag gets one attribute per…
format.ruleskscript.json settingTurn individual formatting rules off, e.g. { "statement_per_line": false }. Every rule is on unless listed. To…
format.rules.brace_stylekscript.json setting.kscript files: put else, elif, catch and finally on the line of the closing '}'. Off: they stay where they…
format.rules.collapse_blank_lineskscript.json settingShrink runs of blank lines to max_blank_lines.
format.rules.final_newlinekscript.json settingEnd the file with exactly one newline. Off: the file ends as it did.
format.rules.indentkscript.json settingRe-indent elements by how deeply they are nested. Off: lines keep their indentation.
format.rules.spacingkscript.json setting.kscript files: one space after commas and colons, around assignments and =>, and before a block's '{'. Off…
format.rules.statement_per_linekscript.json settingPut each statement and block-level element on its own line. Off: line breaks only change where there was…
format.rules.tidy_tagskscript.json settingOne space between attributes, and <x /> for self-closing tags. Off: start tags are kept exactly as written.
format.rules.trim_trailing_whitespacekscript.json settingRemove spaces at the ends of lines of text.
format.rules.wrap_attributeskscript.json settingOne attribute per line for long start tags and tags already written that way. Off: tags are never wrapped or…
format.rules.wrap_bodieskscript.json setting.kscript files: a one-line function (fn name() => body) that runs past print_width moves its body to the next…
format.rules.wrap_chainskscript.json setting.kscript files: a -> chain or |> pipe that runs past print_width puts each call on its own line, indented…
format.rules.wrap_commentskscript.json setting.kscript files: a // or /// comment line that runs past print_width is broken between words onto a new comment…
format.rules.wrap_stringskscript.json setting.kscript files: break a string that runs past print_width at a space, with a \ at the end of the line (the…
format.tab_widthkscript.json settingWith "indent": "tab", how many columns a tab counts as when lining up existing text.
@format_bytescommand in KScript.CoreA number of bytes for people: 1.4 MB, in powers of 1000. With binary: true, powers of 1024 (1.3 MiB).
@format_currencycommand in KScript.CoreAn amount of money for the locale: @format_currency(9.5, 'EUR') is €9.50 in en and 9,50 € in fr.
@format_datecommand in KScript.CoreA date for the locale. style: short, medium (the default), long, full, time, datetime, or a pattern such as 'd…
@format_durationcommand in KScript.CoreA length of time in words for the locale: 1h30m is 1 hour 30 minutes, 1 heure 30 minutes in fr.
@format_listcommand in KScript.CoreItems joined for the locale: a, b and c (or a, b or c with style: or).
@format_numbercommand in KScript.CoreA number written for the locale: 1,234.5 in en, 1 234,5 in fr.
@format_ordinalcommand in KScript.CoreA whole number as an ordinal for the locale: 1st, 2nd, 23rd in en, 1er and 2e in fr.
@format_percentcommand in KScript.CoreA fraction as a percentage for the locale: 0.25 is 25%.
@format_relativecommand in KScript.CoreHow long ago or ahead a date is, in words for the locale: 3 hours ago, in 2 days, il y a 3 jours. Measured…
->formattedmethod of ibanThe IBAN in groups of four, the way it is printed: GB82 WEST 1234 5698 7654 32.
formatted_filetypeSource code from a text block tagged with a file type such as ps1 , with .extension and .text .
->freshmethod of recordThe record as the database has it now (a new record), or null if it was deleted.
->frommethod of anyReads text written in a format: a shortcut for ->convert(from: type). ->from(type: csv, not header) reads csv…
->from_base64method of stringBase64 text decoded.
@full_pathcommand in KScript.IOThe absolute path.

G

@gcdcommand in KScript.MathThe greatest common divisor of two whole numbers, exact at any size.
->getmethod of cacheThe value kept under a key, or default (null) when it isn't there or has run out.
->getmethod of configA setting by path (database.port, servers.0.name), or default when it isn't set.
->getmethod of mapThe value for a key, or the default.
->getmethod of modelRuns the query: a list of records (maps, for a table with no model).
->getmethod of queryRuns the query: a list of records (maps, for a table with no model).
->getmethod of sessionThe value kept under a key, or default (null).
Getstatement in KScript.HttpA route for GET requests to a path. It is answered by a controller (to), a view, a redirect, or the statements…
GITHUB_TOKENenvironment variableA GitHub token kscript update and kscript ide install send with their requests, so they aren't limited the way…
go:handler shorthandSends the browser to a path on this site: go: '/notes' is @live_redirect('/notes').
->gridmethod of stringThe text as rows of characters, one list per line, for maps and mazes: '#.\n.#'->grid() is [['#', '.'], ['.'…
Gridstatement in KScript.UILays its items out in equal columns, filling each row in turn: a board, a keypad, a gallery.
->groupmethod of cacheA separate cache namespace inside this store.
Groupstatement in KScript.HttpRoutes that share a path prefix, middleware or a name prefix.
->group_bymethod of listA map from fn's result to the items that gave it.
->group_bymethod of modelSplits the rows into groups with the same values in these columns, for totals per group…
->group_bymethod of querySplits the rows into groups with the same values in these columns, for totals per group…
->group_bymethod of setA map from fn's result to a list of the items that gave it.
guardstatementChecks a precondition. When the test is false, its body must leave the current flow.
guardedoption of modelFields ->create($form) and ->update($form) don't set, so a form can't change them: [role] . Set them on the…
@guestcommand in KScript.AuthThe browser's guest id: the key of its Guest (a uuid, unless your copy of Guest says otherwise), kept in a…
Guestmodel in KScript.AuthSomeone using the app without an account. Each browser gets one, kept in a long-lived cookie, and it is stored…

H

handletype@ followed by letters, digits, _, . or -: a username such as @joan. Lowercased.
->hasmethod of cacheTrue when a value is kept under the key and hasn't run out.
->hasmethod of configTrue when the setting is set.
->hasmethod of mapTrue when the key exists.
->hasmethod of sessionTrue when a value is kept under the key.
@has_passkeyscommand in KScript.AuthTrue when this site has a configured passkey origin.
->has_sentmethod of fake_mailTrue when mail went to the address (or user), as to, cc or bcc.
@has_tcommand in KScript.CoreTrue when a key has a translation in the current locale (or its fallbacks).
->has_tablemethod of databaseTrue when the database has a model's table or a table with the given name: $db->has_table(User) or…
->hashmethod of passwordA hash to store instead of the password: argon2id (the default) or bcrypt, with a new random salt each time.
->headermethod of http_responseOne header (or null). For Set-Cookie set more than once, the first; .headers has them all.
->headermethod of responseOne response header (or null). For a header sent more than once, such as Set-Cookie, the first; .headers has…
headingstatement in KScript.TerminalPrints a heading in bold yellow, like the sections of kscript --help.
->hexmethod of colorIts #rrggbb form, without the alpha.
hextypeHexadecimal digits, such as a hash: a3f9c0. Lowercased; 0x is dropped.
hiddenoption of modelFields left out of JSON (and so out of route responses): [password] .
->highlightmethod of stringThe code as highlighted HTML for a <pre>, coloured with the grammars the VS Code extension uses: each token in…
->hitmethod of rate_limitCounts an attempt without running anything, such as a failed sign-in, and returns how many are left.
->hmacmethod of stringThe HMAC of the text with a secret key, in hex (SHA-256 by default), as webhook signatures are made. Compare…
@homecommand in KScript.IOThe user's home folder.
Httperror typeA mistake in a KScript.Http app, or a request that failed.
httpkscript.json settingKScript.Http: route files, middleware and their settings for kscript serve.
http.api_prefixkscript.json settingThe prefix of api.* route files.
http.authkscript.json settingSign-in with KScript.Auth, and the auth middleware. Times are seconds, or text such as "15m", "2h" or "30d".
http.auth.adopt_guestkscript.json settingMoves a guest's rows of Ownable models to their account when they sign in.
http.auth.attemptskscript.json settingFailed sign-ins allowed per email and address before @attempt() makes them wait.
http.auth.auto_createkscript.json settingWith sessions: database, false leaves making the kscript_sessions table to the project's migrations (kscript…
http.auth.confirm_withinkscript.json settingHow long after a sign-in or a passkey check someone may add or remove a passkey, such as "5m". Unset allows it…
http.auth.cookiekscript.json settingThe session cookie's name.
http.auth.csrfkscript.json settingFalse turns off the CSRF check that web routes get when their file imports KScript.Auth.
http.auth.folderkscript.json settingA folder, relative to the site, for users, sessions and tokens. By default they go in the app's data and state…
http.auth.guest_cookiekscript.json settingThe guest id cookie's name.
http.auth.guest_lifetimekscript.json settingHow long a browser keeps its @guest() id.
http.auth.homekscript.json settingWhere the guest middleware sends people who are signed in, and @intended()'s default.
http.auth.lifetimekscript.json settingHow long a session lasts after the last request.
http.auth.lockoutkscript.json settingHow long failed sign-ins are counted over, and how long @attempt() then waits.
http.auth.loginkscript.json settingWhere the auth middleware sends people who aren't signed in.
http.auth.passkey_originkscript.json settingThe public HTTPS origin for passkeys, or http://localhost with an optional development port. Setting this…
http.auth.passkey_rememberkscript.json settingKeeps a passkey sign-in for the remember time, not only the browser session.
http.auth.passkey_rp_idkscript.json settingAn optional relying party domain, such as example.com. Defaults to the passkey origin's hostname.
http.auth.passkey_signupkscript.json settingAllows new accounts to sign up with a passkey. Requires passkey_origin.
http.auth.passkeyskscript.json settingWhere passkeys are kept: file (a SQLite file in the app's data folder) or database (the kscript_passkeys…
http.auth.providerkscript.json settingSigns people in to other apps (OpenID Connect, the code flow with PKCE). true uses the defaults.
http.auth.rememberkscript.json settingHow long a "remember me" sign-in lasts.
http.auth.reset_lifetimekscript.json settingHow long a password reset token works.
http.auth.same_sitekscript.json settingThe cookie's SameSite.
http.auth.securekscript.json settingForces the cookie's Secure flag on or off. By default it is set for https requests.
http.auth.sessionskscript.json settingWhere sessions, API tokens, reset tokens and passkey challenges are kept: file (the app's state folder, so…
http.auth.token_envkscript.json settingThe environment variable holding the shared bearer token the auth middleware also accepts.
http.auth.userskscript.json settingA KScript.Data model in the models folder, such as "User", that holds the users. By default they are JSON…
http.corskscript.json settingSettings for the cors middleware.
http.cors.credentialskscript.json settingtrue allows cookies and Authorization from other origins.
http.cors.headerskscript.json settingRequest headers allowed in preflight requests.
http.cors.methodskscript.json settingMethods allowed in preflight requests.
http.cors.originskscript.json settingOrigins allowed to call the API, or ["*"] (the default) for any.
http.groupskscript.json settingNames for lists of middleware, used like a middleware name: { "admin": ["auth", "log"] }.
http.headerskscript.json settingResponse headers sent with everything the server answers (pages, files, routes and sign-in) unless a response…
http.middlewarekscript.json settingMiddleware run for every route, such as ["log"]. Built-ins: log, cors, auth, guest, csrf, throttle, etag…
http.openapikscript.json settingThe OpenAPI 3.1 document made from the routes. kscript serve answers /_openapi.json, /_openapi.yaml and the…
http.proxykscript.json settingBelieve a reverse proxy's X-Forwarded-For when the request carries its secret, so rate limits and sign-in…
http.proxy.headerkscript.json settingThe request header the proxy sends its secret in.
http.proxy.secret_envkscript.json settingThe environment variable holding the secret the proxy sends.
http.routeskscript.json settingThe route files, relative to the site folder. Without this, kscript serve loads routes.kscript and api.kscript…
http.throttlekscript.json settingSettings for the throttle middleware.
http.throttle.limitkscript.json settingRequests allowed per window, per address and route.
http.throttle.secondskscript.json settingThe length of the window.
http.throttle.storekscript.json settingWhere requests are counted: memory (this process), file (the app's cache folder) or database (shared by every…
http.upload_limitkscript.json settingThe most bytes of files one request may upload ($request.files and live uploads): a number of bytes, or text…
http.viewskscript.json settingThe folder @view() looks in first. It is never served as pages.
http.write_fileskscript.json settingfalse makes controllers read-only, like pages. Writes never leave the site folder.
@http_clientcommand in KScript.NetReturns a callable HTTP client. Call it with a relative path and optional request options.
@hypotcommand in KScript.MathThe length of the hypotenuse: sqrt(x² + y²).

I

ibantypeAn international bank account number, checked with its mod-97 digits. Kept in capitals without spaces.
kscript idecommand lineSet up VS Code, Cursor, VSCodium or another editor.
@ifpage directiveDraws the tag only while the condition is true: @if($note). Same as <if $note> around it.
ifstatementRuns its body when the test is true. Follow it with <elif> and <else> for other cases.
Importerror typeAn import that can't be found or a package that isn't imported.
importstatementImports a package ( package="KScript.Terminal" ), or the top-level <fn> functions and <let const> values of…
->inmethod of ipTrue when the address is in the block, such as '10.0.0.0/8'.
->in_random_ordermethod of modelReads the rows in a random order, a new one each time: Quote->in_random_order()->first() .
->in_random_ordermethod of queryReads the rows in a random order, a new one each time: Quote->in_random_order()->first() .
includestatement in KScript.WebRenders another page file here. Other attributes become its variables.
->incrementmethod of cacheAdds to the number under a key (1 by default; 0 when it isn't there) and returns the new number.
->incrementmethod of modelAdds to a number column on every row that matches (1 by default). Returns how many rows changed.
->incrementmethod of numberThe number plus 1.
->incrementmethod of queryAdds to a number column on every row that matches (1 by default). Returns how many rows changed.
->incrementmethod of recordAdds to a number field in the database in one statement, so two requests at once both count, and sets the…
increment:handler shorthandAdds 1 (or by:) to a number field: increment: $count, by: 5.
Indexerror typeA position outside a list.
indexoption of modelFields to index, so queries on them are fast: [team_id, [team_id, created_at]] .
Indexstatement in KScript.DataAn index of the table CreateTable makes.
->index_ofmethod of listThe index of an item (compared with ==), or of the first item for which a fn(item, index) is true; with last…
->index_ofmethod of stringWhere text first occurs, or with last, where it last occurs; -1 when it doesn't. With ignore_case, upper and…
->infomethod of loggerLogs a message at info level, with an optional map of fields.
infostatement in KScript.TerminalPrints the text after a blue INFO label, as kscript's own commands do. [Bracketed] parts are shown bold.
@injectcommand in KScript.CoreThe record of a model that the route being answered holds. As the default of an input, post: Post = @inject()…
Inputerror typeInput that couldn't be read.
inputstatement in KScript.TerminalAsks for a line of input and stores it. The element text is the prompt. With type , the answer is converted…
->insertmethod of documentReturns a document with same-format source or plain text added at the given offset.
->insertmethod of formatted_fileReturns a copy with text or source of the same format inserted at a zero-based offset. With no offset…
->insertmethod of latexReturns a copy with text or source of the same format inserted at a zero-based offset. With no offset…
->insertmethod of listA new list with item inserted at index.
->insertmethod of markdownReturns a copy with text or source of the same format inserted at a zero-based offset. With no offset…
->insertmethod of modelAdds rows: a map, or a list of maps. On a model each one is checked like ->create(). Returns how many were…
->insertmethod of queryAdds rows: a map, or a list of maps. On a model each one is checked like ->create(). Returns how many were…
inttypeA whole number: 42 , -7 . A number with a fraction isn't an int.
@intendedcommand in KScript.AuthWhere to go after signing in: the page the auth middleware sent someone away from, else default…
Internalerror typeA fault in KScript itself, not in the script.
->intersectmethod of listThe items that are in other too, each once and in order. Items match with ==, or by what by: gives for each.
->intersectmethod of setThe items that are in other too, in this set's order.
Invoicestatement in KScript.DocumentAn invoice: from and to addresses, the invoice number and dates, a table of items with subtotal, tax and…
IOerror typeReading or writing a file failed.
iptypeAn IPv4 or IPv6 address, written the standard way: 192.168.0.1 or 2001:db8::1.
->ismethod of errorTrue when the error is this type or one that extends it: $err->is(NotFound), $err->is(IO).
->ismethod of mimeTrue when it matches text/html, text/* or / .
->ismethod of recordTrue when the other record is the same row: a record of the same model with the same key, or that key itself…
->ismethod of typeTrue when the value is a record of this type, or of a type built on it with with [...]. Given a type, true…
->is_amethod of anyTrue when the value has this type, or when text passes validation for a native type such as uuid.
->is_blankmethod of stringTrue when the text is empty or contains only whitespace.
@is_confirmedcommand in KScript.AuthTrue when the signed-in user signed in or checked their passkey within this long (http.auth.confirm_within, or…
->is_dirtymethod of recordTrue when the record has changes that aren't saved: any field, or the one named.
->is_dstmethod of timezoneTrue when summer time is in effect, now or at a date.
->is_emptymethod of listTrue when the list has no items.
->is_emptymethod of mapTrue when the map has no keys.
->is_emptymethod of setTrue when the set has no items.
->is_emptymethod of stringTrue when the text has zero characters.
->is_enabledmethod of loggerTrue when entries at this level would be written, so costly messages can be skipped.
->is_evenmethod of numberTrue when the number is even.
@is_filecommand in KScript.IOTrue if a file is at the path.
@is_foldercommand in KScript.IOTrue if a folder is at the path.
->is_limitedmethod of rate_limitTrue when the attempts are used up for now.
->is_nullmethod of anyTrue when the value is null.
->is_numericmethod of stringTrue when the whole text is a number, such as '42', '-3.5' or '1e3'. Spaces around it are allowed.
->is_oddmethod of numberTrue when the number is odd.
->is_samemethod of dateTrue when both dates are in the same day (the default), week, month, quarter or year.
->is_savedmethod of recordTrue when the record is in the database: it was read from it or has been saved.
@is_signed_incommand in KScript.AuthTrue when someone is signed in (by the session or an API token).
->is_strongmethod of passwordTrue when the password passes ->strength() with these rules.
->is_subdomain_ofmethod of domainTrue when it is the other domain or under it: api.example.com is under example.com.
->is_subsetmethod of setTrue when every item is also in of. With strict, of must have at least one item more. Turn it round for a…
@is_terminalcommand in KScript.TerminalTrue when a person is at a terminal, false when input or output is redirected (a pipe, a file, a test). Use it…
->is_withinmethod of slash_pathTrue when it is the other path or under it: /docs/guides/start is within /docs. Names are compared exactly…
->isomethod of dateThe date in ISO 8601 format.
->isomethod of durationThe length in ISO 8601: PT1H30M.
@italiccommand in KScript.TerminalItalic text.
itemstatementAn entry of <collection>. With key it is a map entry, without it a list item. Its text is the value (numbers…
Itemstatement in KScript.DocumentAn item of a list. Its text works like a Paragraph's.

J

jobstatement in KScript.QueueDeclares a job: work to do later, on a queue, by kscript worker . Its fields are the data it needs, typed like…
JobFailederror typeA queued job that used up its tries. $err.cause is the last error.
JobTimeouterror typeA queued job that ran longer than its timeout.
->joinmethod of fileA file value for the joined path. Parts can be separate arguments or a list, as in $dir->join(['a', 'b.txt']).
->joinmethod of listThe items joined into text (', ' by default).
->joinmethod of setThe items joined into text (', ' by default), in the order they were added.
->joinmethod of slash_pathThe path with more names added on the end and tidied: /docs joined with 'guides/../start' is /docs/start. A /…
->joinmethod of urlThe url a link to path leads to from here: ../img/a.png or /about.
@join_pathcommand in KScript.IOJoins a folder and the parts below it with the right separator. Parts may be a list: @join_path(base: $folder…
Jsonerror typeText that isn't valid JSON.
jsontypeText that holds valid JSON. ->convert(from: json) gives the value.
jwttypeA JSON Web Token: three base64url parts. Its claims can be read; its signature isn't checked.

K

keyoption of modelThe field that is the key. Default: id, an int the database numbers, added when the model doesn't declare it.
Keystatement in KScript.DataA key of two or more columns, for the table CreateTable makes: a pivot table's.
key:handler modifierRuns only for this key, with any modifier keys: key: enter, key: [ctrl, s].
->keysmethod of cacheThe keys that are kept and haven't run out.
->keysmethod of mapThe keys, as a list.
@known_foldercommand in KScript.IOA standard folder: home, desktop, documents, downloads, music, pictures, videos, appdata or temp.
kscriptkscript.json settingThe KScript release the project is written for: 0.51.0, or 0.51 for the newest 0.51.x. Every kscript command…
kscriptstatement, written a .kscript fileThe root of a script. Everything the script does goes inside.
KScript.AIpackageLanguage models (Claude): @llm, @chat and <llm>.
KScript.AuthpackageSign-in for kscript serve apps: users, sessions, the auth and guest middleware, CSRF, password resets and API…
kscript.autoCloseTagsVS Code settingAdd the end tag when you finish typing a start tag in a .ks.xml script: <echo> becomes <echo></echo> .
kscript.blocks.dividersVS Code settingDraw a thin line between the top-level blocks of a script (functions, loops and comment-headed sections), like…
KScript.CachepackageA cache of values by key, with time limits: in memory, or in files in the app's cache folder.
kscript.codeLens.enabledVS Code settingShow Run above a script, Run test above each test and how many times each function is used.
KScript.CorepackageThe language itself: variables, branches, loops, functions, errors, imports and echo. Always imported.
KScript.DatapackageDatabases: models, a query builder, transactions and raw SQL, on SQLite, Postgres, MySQL and MariaDB.
KScript.DocumentpackagePapers, reports, letters and invoices with LaTeX maths, saved as PDF, LaTeX, Word, Markdown or HTML without a…
KScript.HttppackageRoutes, controllers and middleware: <KScript.Routes> files served by kscript serve.
KScript.IOpackageFiles and folders: read, write, list, move, copy and delete.
KScript.MailpackageEmail: @send_mail over SMTP, to the log or to a fake, now or on a queue, with HTML, text or a view, and…
KScript.MarkdownpackageMarkdown to HTML, with front matter.
KScript.MathpackageRoots, powers, trigonometry, logarithms, random numbers and statistics.
KScript.NetpackageHTTP requests (@api) and downloads.
kscript.pages.enabledVS Code settingCheck KScript in .html and .md pages (sites run with kscript serve ).
kscript.problems.workspaceVS Code settingList problems for every KScript file in the project, as kscript check reports them, not only for open files.
KScript.QueuepackageQueued jobs: job declarations, dispatch, retries with backoff, failed jobs, the worker that runs them, and the…
kscript.server.argsVS Code settingArguments that start the language server.
kscript.server.pathVS Code settingThe kscript executable that runs the language server. Leave empty to use the installed KScript (…
KScript.StoragepackageApp folders for config, data, cache, state and logs, in the right place on each platform.
KScript.StylepackageStylesheets written in KScript (.ks.css, .ks.scss, .ks.sass), with colour, size and responsive helpers.
KScript.TerminalpackagePrompts, menus, colours, Markdown, and artisan-style labels, tasks and tables for terminal scripts.
KScript.TestpackageTests run by kscript test: <test>, <describe>, <expect>, <expect_error>, <capture> and @assert().
kscript.trace.serverVS Code settingLog the messages between VS Code and the language server.
KScript.UIpackageDesktop windows with buttons, text, inputs and timers, on macOS, Windows and Linux.
KScript.WebpackageWeb pages run by kscript serve: layouts, components and live blocks.
KSCRIPT_AI_MODELenvironment variableThe model llm and @llm() use when a script doesn't name one with model: .
KSCRIPT_ENVenvironment variableThe environment a script or server runs in, such as staging or production . Its settings files (…
KSCRIPT_ERROR_PATHSenvironment variableSet to full and the error a script stops with names its file by its whole path, so an editor that runs scripts…
KSCRIPT_INSTALLenvironment variableThe folder the install script puts kscript in. The binary goes in its bin folder.
KSCRIPT_LIVE_RELOADenvironment variableSet to 0 to turn off live reload in kscript serve , as --no-reload does, so open pages aren't refreshed when a…
KSCRIPT_LOCALEenvironment variableThe locale for translations when the script doesn't choose one with locale(set: ...) and $config.i18n.locale…
KSCRIPT_NO_MODIFY_PATHenvironment variableSet to 1 and the install script doesn't add kscript to your shell profile or your Windows PATH.
KSCRIPT_PROJECT_DATA_ROOTenvironment variableThe folder relative auth and SQLite paths in kscript.json are under, instead of the project folder, such as…
KSCRIPT_REPOenvironment variableThe GitHub repository the install scripts, kscript update , kscript version , kscript compile and kscript ide…
KSCRIPT_SECRETenvironment variableThe app's secret: kscript serve signs live pages and components with it, and @signed_url() , @encrypt() and…
KSCRIPT_SERVE_IN_DOCKERenvironment variableTells kscript serve it is already inside a container, so it starts the web server instead of handing over to…
KSCRIPT_SERVE_MIGRATEenvironment variableSet to 1 and kscript serve applies pending migrations before it serves, and stops if one fails. kscript serve…
KSCRIPT_SOURCEenvironment variableThe KScript checkout the Docker files kscript make docker writes build from, for an unpublished or modified…
KSCRIPT_STACK_TRACEenvironment variableSet to 1 to show the .NET exception and stack trace under an error, as kscript --stack-trace does. 0 and false…
KSCRIPT_STORAGE_ROOTenvironment variableMoves every app's folders to <root>/<app>/<kind> , such as <root>/notes/data : KScript.Auth's users and…
KSCRIPT_SWITCHEDenvironment variableSet by kscript for the version of KScript it runs for you (see KSCRIPT_USE ), so that version runs the command…
KSCRIPT_TEMPLATESenvironment variableThe folder of your own kscript make project templates. kscript make templates project copies the built-in ones…
KSCRIPT_USEenvironment variableThe version of KScript to run, for every command in this terminal or just one: an exact release such as 0.50.0…
KSCRIPT_VERSIONenvironment variableThe release the install script installs, such as v0.34.0 . The Dockerfiles kscript make project writes take it…

L

->lastmethod of listThe last item, or null.
->lastmethod of stringThe last character.
->latestmethod of modelSorts newest first by the supplied column. Defaults to created_at, or the primary key for a model that doesn't…
->latestmethod of querySorts newest first by the supplied column. Defaults to created_at, or the primary key for a model that doesn't…
->latestmethod of semver[]The highest release, leaving out prereleases (null when there is none). ->max() includes prereleases.
Latexstatement in KScript.DocumentLaTeX, from its text, a latex value or a .tex file, read as a document part reads it: sections, paragraphs…
latextypeA LaTeX document, from a text block tagged latex . See Documents .
@latex_escapecommand in KScript.DocumentText made safe to put in a LaTeX file: \ { } $ & % # _ ~ ^ escaped.
layoutstatement in KScript.WebWraps the page in a layout file. Extra attributes become variables in the layout ( $title ).
@lcmcommand in KScript.MathThe least common multiple of two whole numbers, exact at any size: @lcm(4, 6) is 12.
letstatement, written $name = valueDeclares a variable in the current scope. The value goes in value , or in the element text for longer values…
Letterstatement in KScript.DocumentA letter: the sender's address and date on the right, the recipient, a subject line, a greeting, the body…
kscript libcommand lineInstall a KScript source library or restore the project's pinned libraries.
librarieskscript.json settingInstalled source libraries by folder name. kscript lib add records the exact revision; kscript lib restore…
librarykscript.json settingDeclares an installable library or points to its folder.
@lightencommand in KScript.StyleAdds to HSL lightness, as @adjust_lightness(color, amount) does. The amount can be a fraction (0.1) or a…
->lightenmethod of colorMixed with white: amount 0.2 (the default) is a fifth of the way.
Limiterror typeA limit was reached, such as too much recursion.
->limitmethod of modelReads at most this many rows.
->limitmethod of queryReads at most this many rows.
->linesmethod of stringThe lines of the text, as a list.
lintkscript.json settingUsed by kscript check and by the editor (language server).
lint.excludekscript.json settingFiles and folders that are never checked, by kscript check or the editor. A name without / (such as…
lint.includekscript.json settingFiles kscript check looks at, as globs relative to kscript.json. .xml files that start with <kscript> are…
lint.ruleskscript.json settingSeverity per diagnostic code (KS3003) or code prefix (KS3*). The longest match wins.
lint.warnings_as_errorskscript.json settingMake kscript check fail on warnings too (same as --warnings-as-errors).
->listmethod of storageThe names of the files in the folder, such as ['notes/a.txt', 'settings.json']. pattern is a wildcard like '…
Liststatement in KScript.DocumentA bulleted or numbered list of Item elements. A List right after an Item is nested in it.
listtypeA list of values: [1, 2, 3] . T[] is a list of T, such as string[] .
listenerstatement in KScript.QueueListens for an event. Each <fn> inside takes the event and runs, in order, when @dispatch_event() dispatches…
listens_tooption of jobAn event the job listens to: each @dispatch_event() of it queues the job, with its fields filled from the…
livestatement in KScript.WebA reactive block: its on-* handlers run on the server and only this block is redrawn. No page JavaScript…
@live-actionpage directiveNames the @on-action handler, so client code can call it with KScriptLive.call() .
@live-clientpage directiveRuns a client action registered with KScriptLive when the element is clicked, without a trip to the server.
@live-cloakpage directiveHides the element until the page's live code has started, so nothing half-drawn shows.
@live-dirtypage directiveShows the element while a binding has edits not yet sent. Name a field to watch only that one…
@live-disablepage directiveDisable this control while an action is pending, or while a condition holds: @live-disable(while: $saving).
@live-errorpage directiveShows the element only after an action fails.
@live-idpage directiveGives this component a name that stays the same between updates, so two of the same component keep their own…
@live-ignorepage directiveLeaves everything inside the element alone during updates, for a widget the browser or a script manages.
@live-keypage directiveGives each repeated element a key that stays the same between updates, so a moved row keeps its focus and…
@live-loadingpage directiveShows the element only while an action is running, such as a spinner.
@live-navigatepage directiveFollows the link without a full page load, swapping in the new page.
@live-navigate-oncepage directiveRuns this <script> only once, even when in-page navigation comes back to the page.
@live-offlinepage directiveShows the element only while the browser is offline.
@live-portalpage directiveDraws this <template> 's content somewhere else in the page, at the CSS selector given: live-portal="#modals"…
@live-replacepage directiveReplaces the element whole on each update instead of patching it.
@live-streampage directiveReceives what an action streams to this name, as it arrives.
@live-uploadpage directiveSends the files picked in this file input with the next action. They are in $event.files .
@live-use-namepage directiveAttaches a client directive registered with KScriptLive , by its name: @live-use-autosize() .
@live_downloadcommand in KScript.WebDownloads bytes from a live action as a file. Use a filename without directory separators.
@live_redirectcommand in KScript.WebSends the browser to a path on this site after a live action.
@llmcommand in KScript.AIAsks a language model (Claude) and returns its answer. The options are the llm statement's, given by name…
llmstatement in KScript.AISends its text as a prompt to a language model (Claude) and stores the answer. @llm(prompt, ...) takes the…
->loadmethod of recordLoads relations onto the record now (again, if they were loaded): $post->load(author, tags) . Returns the…
@localecommand in KScript.CoreThe current locale, such as fr or en-GB.
localestatementChanges the current locale, which @t() and the @format_ commands use. Without set , picks the best available…
localetypeA language tag (BCP 47) such as en, en-GB or pt-BR, in its usual case.
@locale_pathcommand in KScript.CoreA site path for a locale, for language links: @locale_path('/about', 'fr') is /fr/about. The default locale…
@localescommand in KScript.CoreThe locales there are translation files for.
->lockmethod of cacheRuns work while holding a lock that no other request or worker using this store can hold, and returns what…
->lock_for_updatemethod of modelLocks the rows read until the transaction ends, so nobody else changes them first. Use it inside a…
->lock_for_updatemethod of queryLocks the rows read until the transaction ends, so nobody else changes them first. Use it inside a…
->logmethod of loggerLogs a message at a level given by name.
logstatementLogs its text through $log's providers, at a level. Fields add values such as { user: $id }.
$logvariableThe script's logger: $log->info('Saved', { id: $id }), $log->named('db')->debug(...). Providers and levels…
@log10command in KScript.MathThe base 10 logarithm.
@log2command in KScript.MathThe base 2 logarithm.
log_providerstatementAdds somewhere for log entries to go: the console, a file, memory (for tests), a function, or a type a package…
@logarithmcommand in KScript.MathThe logarithm: natural (base e) unless a base is given.
@logincommand in KScript.AuthSigns a user in: the session gets a new id and the user. remember keeps them signed in for http.auth.remember…
@logoutcommand in KScript.AuthSigns out: the session ends and its cookie is removed. everywhere ends the user's sessions on every device.
->lowermethod of stringThe text in lower case.
kscript lspcommand lineStart the language server (LSP over stdio).

M

mactypeA network card's MAC address, written as six lowercase pairs: 00:1a:2b:3c:4d:5e.
kscript makecommand lineStart a new project, or generate a file: a route (added to the routes file), controller, request, middleware…
makekscript.json settingSettings for kscript make.
make.syntaxkscript.json settingThe syntax kscript make writes scripts, tests, routes and desktop apps in: kscript (.kscript files) or xml…
->mapmethod of listA new list with fn(item, index) applied to each item.
->mapmethod of mapA new map with fn(value, key) applied to each value.
->mapmethod of setA set of fn(item) for each item. Items that map to the same value become one.
maptypeNames and values: { name: 'Joan', age: 82 } .
->map_keysmethod of mapA new map with each key replaced by fn(key, value). A later entry wins when two get the same key.
@markdowncommand in KScript.MarkdownRenders Markdown: $doc.html, $doc.title, $doc.meta (front matter) and $doc.text.
Markdownstatement in KScript.DocumentMarkdown, from its text or a file: # headings become sections, with paragraphs, lists, tables, code, quotes…
markdownstatement in KScript.WebRenders its Markdown text (with { } values, escaped) to HTML.
markdowntypeA Markdown document, from a text block tagged markdown . See Documents .
->markdown_escapemethod of stringThe text escaped so Markdown shows it as written.
->maskmethod of stringThe text with each character replaced by char (* by default), apart from the last keep_end characters…
->matchmethod of regexThe first match: { text, index, groups, captures }, where groups holds named groups (?<name>...) and captures…
matchstatementCompares one value against several cases. Inside, $it is the value.
->match_allmethod of regexEvery match, as { text, index, groups, captures } maps.
->matchesmethod of stringTrue when the text matches a regular expression: ->matches(/^[a-z]+$/i).
Matherror typeA calculation with no answer, such as dividing by zero, or maths in a document that can't be read.
Mathstatement in KScript.DocumentA displayed equation in LaTeX, numbered unless numbered: false. Its text is used as written, so braces are…
@maxcommand in KScript.CoreThe largest of the arguments (or of one list).
->maxmethod of grouped_queryThe largest value of a column in each group.
->maxmethod of listThe largest item, or the item with the largest by: fn(item): ->max(by: .score).
->maxmethod of modelThe largest value of a column, or null when no rows match.
->maxmethod of numberThe larger of the two.
->maxmethod of queryThe largest value of a column, or null when no rows match.
->maxmethod of setThe largest item, or the item with the largest by: fn(item).
maxoption of typeThe largest value allowed, read by the base type: a number for int and float, a date for date, a length for…
kscript mcpcommand lineServe these docs to AI coding assistants (Claude Code, Cursor, VS Code...) over MCP, offline.
->md5method of stringThe MD5 hash of the text, in hex.
@mediancommand in KScript.MathThe middle number (or the mean of the two middle numbers).
->medianmethod of listThe middle number in the list.
menustatement in KScript.TerminalShows a numbered list and stores the chosen item. The element text is the title.
->mergemethod of mapA new map with other's keys added or replaced.
messageoption of errorThe message, with the fields as variables: No {$kind} with id {$id} . throw NotFound(id: 1, message: '...')…
Middlewarestatement in KScript.HttpMiddleware for the routes that follow it in this file or group.
Migrationerror typeA migration that can't be read or run, or a kscript db command that can't go ahead.
Migrationstatement in KScript.DataA migration file, in database/migrations: the steps that change the tables, run in order by kscript db migrate…
mimetypeA media type such as text/html or application/json, lowercased, with any parameters.
@mincommand in KScript.CoreThe smallest of the arguments (or of one list).
->minmethod of grouped_queryThe smallest value of a column in each group.
->minmethod of listThe smallest item, or the item with the smallest by: fn(item): ->min(by: .price).
->minmethod of modelThe smallest value of a column, or null when no rows match.
->minmethod of numberThe smaller of the two.
->minmethod of queryThe smallest value of a column, or null when no rows match.
->minmethod of setThe smallest item, or the item with the smallest by: fn(item).
minoption of typeThe smallest value allowed, read by the base type: a number for int and float, a date for date, a length for…
@mixcommand in KScript.StyleThe colour part way to the other: amount is how far (0 to 1, default 0.5, which is halfway).
->mixmethod of colorThe colour part way to the other: amount 0.5 (the default) is halfway.
mixinoption of modelDeclares reusable fields, methods and options for other models. A mixin has no table.
@modecommand in KScript.MathThe number that occurs most often. When several tie, the smallest of them.
modelstatement in KScript.DataDeclares a model: a <type> whose records are kept in a database table. User->where(role: admin)->get() reads…
ModelNotFounderror typeA KScript.Data record that isn't in the database: ->find_or_fail() and ->first_or_fail(). $err.model and…
ModelUpdatestatement in KScript.HttpLets a named HTML model form edit selected fields of a record owned by the signed-in user.
moneytypeAn amount with a currency. Write GBP9.50 directly in expressions. Typed money also accepts text such as 'GBP…
@movecommand in KScript.IOMoves (or renames) a file or folder, and returns it as a file value. to is a full path, or an existing folder…
->movemethod of storageMoves (or renames) a file or folder inside the folder. overwrite replaces what is at to.
->move_tomethod of fileMoves (or renames) the file or folder and returns it at its new place. to is a full path, or an existing…
MultipleRecordsFounderror type->sole() found more than one row, when it expects exactly one.

N

Nameerror typeA name that doesn't exist: a variable, function, field or method.
namekscript.json settingThe project's name.
->namedmethod of loggerA logger for a category, such as db (inside a named logger, db.queries).
nativeskscript.json settingWhere the project's native types are: folders (everything inside, subfolders too) or globs, relative to…
->needs_rehashmethod of passwordTrue when the stored hash was made with weaker settings or another algorithm than ->hash() uses now, so it…
->needs_rehashmethod of password_hashTrue when the hash was made with weaker settings (or another algorithm) than ->hash() uses now, so it should…
Networkerror typeA request that failed or got an error status. $err.status is the status, when there is one.
->nextmethod of cronThe next time the schedule runs, after a date or after now.
->next_timesmethod of cronThe next few times it runs.
NO_COLORenvironment variableSet to anything and kscript, echo and KScript.Terminal print without colours.
normalizestatementCleans up a value before a <type>'s rules check it, such as trimming or lower-casing. The value is $value …
->normalize_unicodemethod of stringNormalizes Unicode using the given form (NFC by default).
->notmethod of boolThe opposite bool.
notoption of typeValues that aren't allowed, each a value of the base type, such as reserved names: [@admin, @root] for a…
NotFounderror typeSomething that doesn't exist. Answers 404.
@nowcommand in KScript.CoreThe current date and time.
->nowmethod of timezoneThe time now in this zone.
Nullerror typeUsing null where a value is needed.
numbertypeAny number, whole or not.
->numbersmethod of listEvery number in the list, in order: numbers stay as they are, text gives the numbers in it, and lists inside…
->numbersmethod of stringEvery number in the text, in order, as numbers: 'x=-3, y=12'->numbers() is [-3, 12]. A minus makes a number…

O

->offsetmethod of modelSkips this many rows first.
->offsetmethod of querySkips this many rows first.
->offsetmethod of timezoneIts offset from UTC, such as +01:00, now or at a date.
@oidc_abortcommand in KScript.AuthEnds a sign-in step without signing in: the app is told access_denied. Gives the address to send the browser…
@oidc_account_deletedcommand in KScript.AuthCall as a user's account is deleted: their app grants go, and each app with an account_deletion_uri is sent a…
@oidc_connectionscommand in KScript.AuthThe apps the signed-in user has let sign them in, newest first: client_id, client_name, scopes, granted_at and…
@oidc_consentcommand in KScript.AuthAnswers a consent step: allow lets the app see what it asked for, from now on; otherwise the app is told…
@oidc_disconnectcommand in KScript.AuthTakes an app's access away from the signed-in user: the app's tokens stop working at once, and it asks again…
@oidc_interactioncommand in KScript.AuthThe sign-in step an app sent this browser to (http.auth.provider), for the page at {interaction}/{uid}: uid…
@oidc_subscriptionscommand in KScript.AuthAsks each app with a subscriptions_uri which subscriptions the user has there, all at once, before their…
->oldestmethod of modelSorts oldest first by the supplied column. Defaults to created_at, or the primary key for a model that doesn't…
->oldestmethod of querySorts oldest first by the supplied column. Defaults to created_at, or the primary key for a model that doesn't…
->omitmethod of mapA copy without the given keys, in the original map's order.
@on-actionpage handlerRuns when client code calls the action named by @live-action with KScriptLive.call() . What it sent is in…
@on-cancelpage handlerRuns when a <dialog> is cancelled, such as with Escape.
@on-changepage handlerRuns when a control's value is committed, such as a select being picked or a checkbox ticked.
@on-clickpage handlerRuns when the element is clicked: @on-click(toggle: $open) .
@on-closepage handlerRuns when a <dialog> closes.
@on-dblclickpage handlerRuns when the element is double-clicked.
@on-dragendpage handlerRuns when a drag of this element ends. After @drag , $event.x and $event.y are where it landed.
@on-droppage handlerRuns when something is dropped on the element: a @drag(copy) ghost, whose value is in $event.drag_value .
@on-enterpage handlerRuns when Enter is pressed in the element: <input @on-enter(add: $draft, to: $tags)> .
@on-escapepage handlerRuns when Escape is pressed in the element.
@on-eventpage handlerRuns when another live block on the page sends an event with @emit_event or emit: . Pick which with…
@on-focusinpage handlerRuns when the element, or something inside it, gets focus.
@on-focusoutpage handlerRuns when focus leaves the element and everything inside it.
@on-initpage handlerRuns once, when the component is first drawn: load what it shows here.
@on-inputpage handlerRuns each time a control's value changes as the person types. The new value is in $event.value .
@on-keydownpage handlerRuns when a key is pressed. Pick the key with key: , as in @on-keydown(save: $note, key: [ctrl, s]) .
@on-keyuppage handlerRuns when a key is let go.
@on-pointercancelpage handlerRuns when the browser takes over a pointer, such as to scroll the page.
@on-pointerdownpage handlerRuns when a mouse button, pen or finger goes down on the element.
@on-pointeruppage handlerRuns when the mouse button, pen or finger comes up.
@on-sortpage handlerRuns when the person drags one of the @sort-item children to a new place. $event.order is the new order.
@on-submitpage handlerRuns when a form is submitted, instead of the browser posting it: <form @on-submit($save)> .
@on-tickpage handlerRuns again and again, as often as @every says: <p @on-tick(increment: $seconds) every="1s"> .
@on-visiblepage handlerRuns when the element scrolls into view, such as to load the next page of a list.
on:option of @bindWhen the value is sent: input (as you type, the default for text), change, blur (when focus leaves) or action…
oncehandler modifierRuns the first time only: once.
one_ofoption of typeThe only values allowed, each a value of the base type: [gb, ie] for a country, [1, 2, 3] for an int. Compared…
->onlymethod of listThe items of a type (->only(semver), ->only(number)) or that a filter of the items' type keeps…
->only_trashedmethod of modelFor models that extend SoftDeletes: reads only the deleted records.
->only_trashedmethod of queryFor models that extend SoftDeletes: reads only the deleted records.
kscript openapicommand lineWrite the OpenAPI 3.1 document for a site's routes, made from the code. kscript serve also answers…
optionaloption of fnThe method may be omitted by a type implementing this signature.
Optionsstatement in KScript.HttpA route for OPTIONS requests to a path. It is answered by a controller (to), a view, a redirect, or the…
->ormethod of anyThe value if it is truthy, otherwise fallback.
->or_wheremethod of modelLike ->where(), joined with or: rows that match the conditions so far, or these.
->or_wheremethod of queryLike ->where(), joined with or: rows that match the conditions so far, or these.
->order_bymethod of modelSorts the rows: ->order_by(name) , ->order_by(created_at: desc, name: asc) .
->order_bymethod of querySorts the rows: ->order_by(name) , ->order_by(created_at: desc, name: asc) .
$osvariableThe computer: $os.name (windows, macos or linux), $os.user, $os.machine, $os.home, $os.temp, $os.separator…
->overlapsmethod of setTrue when the two share at least one item. not $a->overlaps($b) is true when they have nothing in common.
overrideoption of fnInside <extend>: true replaces the type's built-in method of the same name. Without it, reusing a built-in…
Ownablemixin in KScript.AuthRows that belong to one owner: the signed-in user, or the browser's guest. A model that extends Ownable gets a…

P

packageskscript.json settingPackages every script in the project uses without an <import>. KScript.Core is always imported.
->padmethod of stringThe text padded at the end to width, or at the start with start: '7'->pad(3, '0', start) is 007.
PageBreakstatement in KScript.DocumentStarts a new page.
->pagesmethod of documentHow many pages the PDF has.
->pagesmethod of latexHow many pages the PDF has.
->pagesmethod of markdownHow many pages the PDF has.
->paginatemethod of modelOne page of rows: { items, page, per_page, total, last_page, from, to, has_more }. per_page is 15 by default…
->paginatemethod of queryOne page of rows: { items, page, per_page, total, last_page, from, to, has_more }. per_page is 15 by default…
Paragraphstatement in KScript.DocumentA paragraph. Its text may hold bold , italic , code , links , ( maths ), [@key] citations, [#id]…
paramsoption of fnParameters, with optional types and defaults: who, greeting = 'Hello' or count: int = 1 .
->parsemethod of date_formatReads text written this way as a date: dd-MM-yyyy reads '07-03-2026'.
parseoption of typeOn a type with fields: an expression that turns text into a map of the fields, with the text as $value and the…
@parse_envcommand in KScript.CoreParses .env text (NAME=value lines) into a map. ${NAME} uses earlier lines or the environment.
@parse_querycommand in KScript.NetParses URL query text into a map. Repeated names have a list of values in order.
->partitionmethod of listReturns [matching, remaining], testing each item once.
@passkeycommand in KScript.AuthRuns one step of a passkey ceremony from one of the app's own POST routes, as /_ks/passkeys/{action}/{step}…
@passkeyscommand in KScript.AuthLists the signed-in session user's passkeys for this site: each one's id, created_at, last_used_at (null until…
passwordtypeA secret. It prints as ********, can't be compared with ==, and is hashed to be stored.
Patchstatement in KScript.HttpA route for PATCH requests to a path. It is answered by a controller (to), a view, a redirect, or the…
pathoption of typeA JSON file holding a sample of the data. Its keys become fields; <field> elements and fields replace the ones…
->path_ofmethod of storageThe full path of a file in the folder. The folder's own path is the field .path.
pathskscript.json settingWhere kscript make puts each kind of file, relative to the site folder. Leave a folder out to use the…
paths.componentskscript.json settingPage components (kscript make component).
paths.controllerskscript.json settingControllers (kscript make controller, kscript make route).
paths.datakscript.json settingJSON data that stores and caches write.
paths.documentskscript.json settingDocument scripts that write PDF and Word files (kscript make document).
paths.eventskscript.json settingEvents, dispatched with @dispatch_event() (kscript make event).
paths.jobskscript.json settingJobs (kscript make job).
paths.layoutskscript.json settingPage layouts (kscript make layout).
paths.libkscript.json settingShared functions and constants (kscript make module, kscript make const, kscript make cache).
paths.listenerskscript.json settingListeners, run the first time an event is dispatched (kscript make listener).
paths.localeskscript.json settingTranslations (kscript make locale).
paths.loggingkscript.json settingLog providers (kscript make logger).
paths.middlewarekscript.json settingMiddleware (kscript make middleware).
paths.modelskscript.json settingDatabase models (kscript make model).
paths.partialskscript.json settingHTML that pages <include> (kscript make partial).
paths.policieskscript.json settingPolicies, one per model, that @can and @authorize ask (kscript make policy).
paths.requestskscript.json settingTyped request bodies (kscript make request).
paths.routeskscript.json settingRoute files: web.kscript (served at /) and api.kscript (under /api).
paths.scriptskscript.json settingScripts (kscript make script).
paths.storagekscript.json settingJSON file stores (kscript make storage).
paths.styleskscript.json setting.ks.css stylesheets (kscript make css).
paths.testskscript.json settingTests (kscript make test).
paths.typeskscript.json settingTypes and enums (kscript make type, kscript make enum).
paths.viewskscript.json settingViews that controllers render with @view() (kscript make view). Also where @view() looks, unless http.views is…
paths.windowskscript.json settingDesktop windows (kscript make window).
patternoption of typeA regular expression the value's text must match: /^[a-z0-9-]+$/ . On a type made from a number, the text is…
pausestatement in KScript.TerminalWaits for a key press (or Enter when input is piped). The element text is the prompt.
@pendingpage directiveAdd classes while an action runs: @pending('saving'), or @pending('crumple', for: 'delete') for one method's…
@percentilecommand in KScript.MathThe value below which p percent of the numbers fall, from 0 to 100, between neighbours when it falls between…
Permissionerror typeA file outside the allowed folder, or a change to read-only files.
->permutationsmethod of listEvery ordering of size items (all of them by default), in list order: [1, 2, 3]->permutations(2) is [[1, 2]…
phonetypeA phone number in E.164: + then the country code and number, 8 to 15 digits. Spaces, dots, dashes and brackets…
$pivariableπ, about 3.14159.
@pickcommand in KScript.MathA random item from a list.
->pickmethod of mapA copy containing only the given keys, in the original map's order.
pickerstatement in KScript.TerminalAsks for a file or folder path, and asks again until it exists.
placeholderstatement in KScript.WebWhat a lazy or deferred live component shows before it loads.
Platformerror typeSomething this operating system can't do.
->pluckmethod of listOne field from each item, or a map of the selected fields for each item when given a list of keys.
->pluckmethod of modelOne column of every row that matches, as a list: User->pluck(email) .
->pluckmethod of queryOne column of every row that matches, as a list: User->pluck(email) .
@pluralcommand in KScript.CoreThe plural category of a number in a language: zero, one, two, few, many or other.
policystatement in KScript.AuthSays who may do what to a model's records. Each <fn> inside is an ability, named for what it allows (create…
->popmethod of listA new list without its last item.
porttypeA network port, a whole number from 1 to 65535.
->positions_ofmethod of listWhere an item is in a list of lists, such as a ->grid(): every cell equal to it (compared with ==), or for…
Poststatement in KScript.HttpA route for POST requests to a path. It is answered by a controller (to), a view, a redirect, or the…
->prependmethod of listA new list with items added to the start.
->pressmethod of page_visitPresses a key on the element with on-keydown (the one with this text, label or placeholder, when given in:)…
preventhandler modifierStops the browser's own action for the event, such as saving the page on ctrl+s: prevent.
privateoption of fnInside a <type> or <model>: true keeps the method to the type's own methods. In a .kscript file, private fn…
->productmethod of listThe items multiplied together (or fn for each item); 1 for an empty list: [2, 3, 4]->product() is 24.
progressstatement in KScript.TerminalShows a progress bar for work done in steps, and stores it: $bar->advance() moves it on. The element text is…
->promptsmethod of fake_llmThe prompts the script sent, oldest first: the text of each question.
propstatement in KScript.WebDeclares a value a layout or component receives from its caller.
kscript publishcommand lineCopy a model a package ships, such as User, Guest or Ownable, into your models folder to change it, or write…
->pullmethod of cacheThe value kept under a key, which is then removed; default (null) when it isn't there.
->pullmethod of sessionThe value kept under a key, which is then removed: a one-time value such as a code. default (null) when it…
->pushmethod of listA new list with items added to the end.
->pushedmethod of fake_queueThe jobs dispatched so far, or only those of one job type: pushed(SendWelcome).
Putstatement in KScript.HttpA route for PUT requests to a path. It is answered by a controller (to), a view, a redirect, or the statements…

Q

@queriescommand in KScript.DataThe SQL statements this run has sent, oldest first (the last 1000), each as { sql, bindings, database }. In a…
Queryerror typeA database query that failed, or a condition that can't be turned into SQL.
->querymethod of modelA query on the model with no conditions yet, to build on.
@query_stringcommand in KScript.NetA map as a URL query: a=1&b=two. A list is written once per item (tag=a&tag=b), the form @parse_query reads…
@queuecommand in KScript.QueueA queue, to look at or empty: @queue('mail')->size() . Defaults to the default queue of the default…
kscript queuecommand lineLook after the queues: what is waiting, what failed and why, and run failed jobs again.
queuekscript.json settingKScript.Queue: where dispatched jobs wait, and what kscript worker runs (see docs/queues.md).
queueoption of jobThe queue it goes on, unless the dispatch names one. Defaults to default.
queue.connectionskscript.json settingNamed connections. file, database, memory and sync are always there.
queue.defaultkscript.json settingThe connection jobs go to unless a job or dispatch names another: file, database, memory, sync, or one under…
queue.envkscript.json settingSettings per environment, e.g. { "test": { "default": "sync" } }. kscript test uses sync unless env.test says…
queue.failedkscript.json settingWhat happens to jobs that fail every try.
queue.failed.keepkscript.json settingHow long failed jobs are kept, such as "7d" or a number of seconds.
queue.queueskscript.json settingThe only queues a worker checks, first to last, e.g. ["high", "default"]. Without it a worker checks default…
queue.workerkscript.json settingHow kscript worker runs jobs.
queue.worker.concurrencykscript.json settingHow many jobs a worker runs at once.
queue.worker.sleepkscript.json settingHow long a worker waits when the queues are empty.
->queuedmethod of fake_mailThe mail that was sent with queue, or only the mail to one address.
Quotestatement in KScript.DocumentA quotation, set in from both margins.

R

@radianscommand in KScript.MathDegrees to radians.
@randomcommand in KScript.MathA random number: from 0 up to 1 with no arguments, or a whole number from low to high (both included).
@random_bytescommand in KScript.MathGenerates 1 to 65536 bytes with the operating system's cryptographic random generator. Returns lowercase hex…
@random_seedcommand in KScript.MathMakes @random(), @pick() and @shuffle() repeat the same sequence, for tests.
@rangecommand in KScript.CoreNumbers from start up to (not including) end; with one argument, from 0. start..end is the short form when the…
@rate_limitcommand in KScript.CacheA rate limit for anything, not just routes: at most limit attempts per key in each window of per, such as 5…
@rate_limitedcommand in KScript.QueueJob middleware, for fn middleware(): at most limit jobs with this key start in each period, across every…
->readmethod of loopback_json_streamReads one UTF-8 JSON object (up to 256 KiB) within the active transaction's deadline.
->readmethod of storageA file's text, or default (null) when it isn't there yet.
@read_bytescommand in KScript.IOReads every byte of a file as a base64 value, including binary data.
->read_bytesmethod of fileEvery byte of the file as a base64 value, including binary data.
->read_bytesmethod of storageEvery byte of a file as a base64 value, or default (null) when it isn't there yet.
@read_csvcommand in KScript.IOReads CSV as rows of maps (or rows of lists with header: false). An optional type validates the rows.
@read_envcommand in KScript.IOA .env file (NAME=value lines) read into a map. ${NAME} uses earlier lines or the environment.
@read_jsoncommand in KScript.IOA JSON file read into maps and lists. With as: a <type>, the data is checked and turned into records.
->read_jsonmethod of fileThe file read as JSON. With as: a type, the data is checked and turned into records.
->read_jsonmethod of storageReads JSON and checks it against the optional as type, mapping a list item by item. A missing file returns…
@read_linescommand in KScript.IOThe lines of a file.
->read_linesmethod of fileThe file's lines.
@read_markdowncommand in KScript.MarkdownReads a Markdown file: $doc.html, $doc.title, $doc.meta (front matter) and $doc.text. Relative paths are from…
@read_textcommand in KScript.IOThe text of a file. Relative paths are from the script's folder.
->read_textmethod of fileThe file's text.
@read_yamlcommand in KScript.IOA YAML file read into maps and lists.
@redirectcommand in KScript.HttpA redirect to another address (302 Found by default; 301 for a permanent move).
@redirect_backcommand in KScript.HttpA redirect to the page the request came from (its Referer), the usual answer to a form that didn't validate…
->reducemethod of listCombines the items into one value: fn(total, item) gives the next total from the last one and the next item…
->reducemethod of mapCombines the entries into one value: fn(total, value, key) gives the next total, starting from initial…
->reducemethod of setCombines the items, in the order they were added, into one value: fn(total, item) gives the next total…
Referenceerror typeA document that refers to a section, figure or source it doesn't have, or uses an id twice.
->regeneratemethod of sessionGives the session a new id, keeping its values. @login() does this for you.
regextypeA regular expression with flags i, m, s and x, written /.../ in code.
@registercommand in KScript.AuthAdds a user and returns it (without signing them in). The email and password are checked by the email and…
->rejectmethod of listThe items for which fn is false.
->rejectmethod of mapThe entries for which fn(value, key) is false.
->rejectmethod of setThe items for which fn(item) is false, as a set.
->relative_tomethod of fileThe path relative to a folder.
@release_jobcommand in KScript.QueueIn a job's handle: puts the job back on its queue without using up a try, to run again after a while…
->reloadmethod of configReads the files again.
@remcommand in KScript.StylePixels as rem: @rem(24) is 1.5rem (base 16).
->remainingmethod of rate_limitHow many attempts are left in this window.
->remembermethod of cacheThe value under a key; when there isn't one, calls compute, keeps what it returns and returns that.
->removemethod of cacheRemoves a key. True when it was there.
->removemethod of listA new list without any items equal to item.
->removemethod of mapA new map without the key.
->removemethod of queueDeletes a failed job of this queue for good, as kscript queue delete does. True when there was one with that…
->removemethod of sessionRemoves a value. True when it was there.
->removemethod of setA new set without the items. An item the set doesn't have is ignored.
remove:handler shorthandRemoves a value from a list field: remove: $tag, from: $tags.
->remove_atmethod of listA new list without the item at index.
RenameFieldstatement in KScript.DataRenames a column, keeping its rows.
RenameTablestatement in KScript.DataRenames a table. Foreign keys that point to it follow.
->repeatmethod of stringThe text repeated count times.
->replacemethod of documentReturns a document made from the source with every literal match replaced.
->replacemethod of formatted_fileReturns a copy with every literal match replaced.
->replacemethod of latexReturns a copy with every literal match replaced.
->replacemethod of markdownReturns a copy with every literal match replaced.
->replacemethod of regexThe text with every match replaced. with is text, where $1 and ${name} are groups, or fn(match) returning…
->replacemethod of stringThe text with every old replaced by new. old can be a regex: ->replace(/\s+/, ' '), and new can use its groups…
->replace_atmethod of listA new list with the item at index replaced; negative counts from the end.
->replicatemethod of recordA copy of the record that isn't saved yet, without its key and timestamps (and the fields named in except)…
kscript repocommand lineRegister a GitHub repository that provides named libraries.
$requestvariableThe HTTP request. Inside a matched route it also contains the client ip, parsed json, combined input and route…
->requiremethod of configA setting that must be set: fails with a clear message when it isn't.
->resetmethod of chatForgets the conversation (keeps the system prompt).
reset:handler shorthandPuts a field (or a list of fields) back to its declared default: reset: $draft, or reset: [$title, $done].
@reset_passwordcommand in KScript.AuthFinishes a password reset: gives the token's user the new password (checked by the password type) and ends…
@reset_tokencommand in KScript.AuthStarts a password reset: a token to put in a link you email to the person, or null when no user has that…
Resourcestatement in KScript.HttpThe usual routes of a JSON resource, answered by the functions a controller script exports: index (GET path)…
respondstatement in KScript.WebEnds the request with this response. header-<name>="..." attributes send headers, such as header-set-cookie.
@responsecommand in KScript.HttpA response with a status code and headers. A map or list body is sent as JSON, text as HTML, and a base64…
->restoremethod of modelFor models that extend SoftDeletes: brings back the deleted records that match. Returns how many.
->restoremethod of queryFor models that extend SoftDeletes: brings back the deleted records that match. Returns how many.
->restoremethod of recordBrings back a soft-deleted record. Returns the record.
Retirederror typeA KScript 1 feature that KScript 2 doesn't have.
@retrycommand in KScript.CoreCalls work, and calls it again when it throws, up to times calls in all; returns what it returns, or throws…
->retrymethod of queuePuts a failed job back on its queue, with its tries reset: true when there was one with that id. With all…
retry_onoption of jobOnly errors of these types are retried: [Timeout, Network]. Others fail the job at once.
retry_untiloption of jobHow long after it was dispatched it may still be retried, such as 1h.
returnstatementEnds the function with a value.
returnsoption of fnThe declared return type.
->revealmethod of cardThe whole number. Only use it to pass the card on to a payment provider; never store or log it.
->revealmethod of passwordThe password's text. Only use it to pass the password on, such as to another service's login.
->reversemethod of listA reversed copy.
->reversemethod of stringThe text backwards.
@revoke_passkeycommand in KScript.AuthRevokes one of the signed-in session user's passkeys by its id. True when it was removed.
@revoke_tokencommand in KScript.AuthRevokes an API token, given as the token or its id (from @api_tokens()). With user, only a token of theirs is…
->rgbmethod of colorIts red, green, blue (0-255) and alpha (0-1): { r, g, b, a }.
->rotatemethod of listThe items moved by places, wrapping round: [1, 2, 3, 4]->rotate(1) is [2, 3, 4, 1], and a negative by moves…
@roundcommand in KScript.MathRounded to a number of decimal places (0 by default). Halves round away from zero.
->roundmethod of numberRounded to a number of decimal places (0 by default).
@routecommand in KScript.HttpReturns the URL for a named route. Pass the route name as nonempty text and supply the values for its path…
Routestatement in KScript.HttpA route for several HTTP methods at once.
@route_iscommand in KScript.HttpTrue if the current request matched this route name or canonical pattern.
@route_matchcommand in KScript.HttpLooks up a path and method without dispatching it. Returns status, route, parameters, and allowed methods.
@routescommand in KScript.HttpLists declared HTTP routes and canonical file-based pages. Filter by kind or the declared type of attached…
kscript routescommand lineList the routes of a site.
Routesstatement in KScript.HttpA route file: maps HTTP methods and paths to controllers, views and redirects. kscript serve loads…
Rowstatement in KScript.UIPuts its items side by side.
Rulestatement in KScript.DocumentA horizontal line across the text.
->runmethod of chainRuns the jobs now, here, one after another.
->runmethod of jobRuns the job's handle now, here, without a queue. Errors reach the caller.
Runstatement in KScript.DataKScript that runs at its place among the steps, in the migration's transaction: to move rows into a table or…
->run_allmethod of fake_queueRuns the dispatched jobs in order (and any they dispatch), then forgets them. Returns how many ran.
@run_scriptcommand in KScript.TestRuns another script on its own and returns what happened: { output, code, error }. output is what it printed…

S

->satisfiesmethod of semverTrue when the version is in the range: ^1.2.0, ~1.2, >=1.0.0 <2.0.0, 1.x, or several joined with ||.
->savemethod of csvWrites the CSV to a file. Adds .csv when the path has no extension.
->savemethod of documentSaves the document. The filename extension selects the format unless as is given.
->savemethod of formatted_fileWrites the source to a file. Adds the fence extension when the path has no extension.
->savemethod of latexWrites the document to a file. The filename extension (or as:) picks the format: .tex keeps the source, and…
->savemethod of markdownWrites the document to a file. The filename extension (or as:) picks the format: .md keeps the source, and…
->savemethod of recordSaves the record: adds it when it is new, otherwise writes the fields that changed (and updated_at). Returns…
save:handler shorthandSaves a KScript.Data record: save: $note is $note->save().
->scanmethod of listLike ->reduce(), but keeps every running total: [1, 2, 3]->scan(fn(total, n) => $total + $n) is [1, 3, 6]…
kscript schedulecommand lineRun the tasks of the schedule file (schedule.kscript) at their times: once for this minute, every minute until…
Schedulestatement in KScript.QueueThe schedule file (schedule.kscript): the tasks kscript schedule work runs at their times, each a <Task> with…
->schemamethod of typeThe type as a JSON Schema map.
$scriptvariableThis script: $script.path, $script.dir, $script.name.
kscript <script>command lineRun a script ($args holds the arguments; --env picks kscript.staging.json, .env.staging...). The word run can…
Sectionstatement in KScript.DocumentA section with a numbered heading. A Section inside a Section is a subsection.
@secure_equalscommand in KScript.CoreTrue when two secrets, such as a webhook signature and the one you worked out, are the same. Takes the same…
->selectmethod of modelReads only these columns: ->select(id, name) . Records get null for the others.
->selectmethod of queryReads only these columns: ->select(id, name) . Records get null for the others.
Selectstatement in KScript.UIA drop-down list tied to a variable.
selfhandler modifierRuns only when the event starts on this element itself, not on something inside it: self.
semvertypeA semantic version such as 1.4.2, 2.0.0-beta.1 or 1.0.0+build.5. A leading v is dropped.
->sendmethod of loopback_json_streamWrites one newline-terminated UTF-8 JSON object (up to 256 KiB).
@send_mailcommand in KScript.MailSends an email and returns it as a map. to (and cc and bcc) take an address, a user with an email, or a list…
->sentmethod of fake_mailThe mail sent so far, queued or not, or only the mail to one address (or user): each a map of to, cc, bcc…
kscript servecommand lineServe pages, and routes.kscript / api.kscript routes.
servekscript.json settingDefaults for kscript serve. Options on the command line win.
serve.dockerkscript.json settingRun kscript serve through Docker Compose. True uses the default app service and mounts the working tree for…
serve.docker.buildkscript.json settingBuild the service image before starting.
serve.docker.compose_filekscript.json settingCompose file relative to the project folder.
serve.docker.enabledkscript.json settingLaunch Docker Compose by default.
serve.docker.mountkscript.json settingContainer path for a read-only project bind mount. Null uses the image's files.
serve.docker.servicekscript.json settingThe Compose service that runs the site.
serve.docskscript.json settingAlso serve the KScript docs, with a page about this project's routes, functions and types, on localhost while…
serve.docs_portkscript.json settingThe port the docs are served on. Without it, 4180, or a free port if that is in use.
serve.hostkscript.json settinglocalhost, an IP address to listen on, or * for every address.
serve.portkscript.json settingThe port to listen on.
serve.publickscript.json settingA folder, relative to kscript.json, whose files are served from the site's root as they are: /brand/logo.png…
serve.rootkscript.json settingThe site folder, relative to kscript.json. Its files and folders are the site's URLs.
$sessionvariableThe request's session: values kept between requests by a cookie. $session->set('cart', $items)…
->setmethod of cacheKeeps a value under a key. ttl is how long, such as 30s, 10m, 2h or 1d (a plain number is seconds). Without it…
->setmethod of mapA new map with the key set.
->setmethod of sessionKeeps a value in the session, for this request and the ones after it. It starts a session (and sends its…
setstatement, written $name += valueChanges an existing variable. Fails if the variable was never declared (a typo guard) or is const. Without…
settypeItems that each appear once, kept in the order they were first added: ['tea', 'milk'] as set . set(of: T) is a…
set:handler shorthandSets a field to a value: set: $tab, to: 'notes'.
@set_exchange_ratecommand in KScript.CoreSets a rate for this run. One unit of from buys rate units of to. Overrides the project's money.exchange_rates…
->set_if_absentmethod of cacheStores a value only when the key is missing or expired. True if this call stored it.
->set_passwordmethod of usersGives a user a new password, checked by the password type, and returns the user.
->sha1method of stringThe SHA-1 hash of the text, in hex. Use it only where another system asks for SHA-1.
->sha256method of fileThe SHA-256 hash of the file's bytes, in hex.
->sha256method of stringThe SHA-256 hash of the text, in hex.
->sha512method of stringThe SHA-512 hash of the text, in hex.
Shapeerror typeData that doesn't fit a <type>. $err.problems lists each problem with its JSON path.
->shapesmethod of listEvery place a mask fits (->shapes(Tree), or ->shapes([Block, Ell]) for several), and every square, rectangle…
->shapesmethod of stringEvery place a mask fits (->shapes(Tree), or ->shapes([Block, Ell]) for several), and every square, rectangle…
@showpage directiveShows the tag while the value is true and hides it (keeping it in the page) while false: @show($open).
@shufflecommand in KScript.MathA copy of a list in random order.
@signcommand in KScript.Math-1, 0 or 1.
signatureoption of fnDeclares a method signature without an implementation.
@signed_urlcommand in KScript.HttpA link only this app could have made, for unsubscribe, verify and download links: a route's name with its…
@sincommand in KScript.MathThe sine of an angle in radians.
->sincemethod of dateThe whole days, weeks, months or years from other to this date, negative when other is later. Months and years…
@sitemapcommand in KScript.HttpAn XML sitemap for an explicit list of public paths, with the given HTTP or HTTPS origin.
->sizemethod of queueHow many jobs are waiting, including delayed ones.
->skipmethod of listAll but the first count items.
->skip_lockedmethod of modelWith ->lock_for_update(): skips rows another transaction has locked, instead of waiting. Good for taking jobs…
->skip_lockedmethod of queryWith ->lock_for_update(): skips rows another transaction has locked, instead of waiting. Good for taking jobs…
@skip_rendercommand in KScript.WebKeeps the current HTML after a live action while saving its state and sending any effects.
->skip_whilemethod of listThe items after those at the start for which fn(item, index) is true.
slash_pathtypeNames joined by /, such as /docs/getting-started or /My Apps/Notes: a page, menu or category path rather than…
->slicemethod of listThe items from start up to (not including) end; negative positions count from the end.
->slicemethod of stringPart of the text; negative positions count from the end.
Sliderstatement in KScript.UIA slider tied to a number variable.
slotstatementIn a layout or component: where the page's (or caller's) content goes. In a component's render for a window, a…
slugtypeLowercase words joined by -, for URLs: my-first-post.
@slugifycommand in KScript.CoreTurns text into a slug: 'Hello, World!' gives hello-world. Accents are dropped.
SoftDeletesmixin in KScript.DataAdds deleted_at to a model: ->delete() sets it instead of removing the row, and queries leave those records…
->solemethod of modelThe one row that matches: a ModelNotFound error (a 404 in a route) when none do, and a MultipleRecordsFound…
->solemethod of queryThe one row that matches: a ModelNotFound error (a 404 in a route) when none do, and a MultipleRecordsFound…
->sortmethod of listA sorted copy: by: fn(item) gives the key to sort on, ->sort(by: .name), and order: desc puts the largest…
->sortmethod of mapA copy with its entries sorted by by: fn(value, key), as a list's ->sort(by:) is; order: desc puts the largest…
->sortmethod of setThe items as a sorted list: by: fn(item) gives the key and order: desc puts the largest first.
@sort-axispage directiveSays which way the @sort-item children run: vertical (the default) or horizontal.
@sort-itempage directiveMarks a child of an @on-sort element as one that can be dragged to a new place, with the value it is known by…
Sourcestatement in KScript.DocumentA work to cite, written out: id: is the key for [@key], and other attributes are BibTeX fields (author, title…
->sourcesmethod of configThe files the settings came from, in order: a list of { name, path, kind }.
Spacerstatement in KScript.UIEmpty space.
spawnstatementRuns a function in the background. The script waits for it before it ends.
->splitmethod of listThe list cut into lists at each separator item, which is dropped: ['tea', 'milk', '', 'juice']->split('') is…
->splitmethod of moneyThe amount shared into this many parts that add up to it exactly: GBP 10.00 in 3 is GBP 3.34, GBP 3.33 and GBP…
->splitmethod of regexThe text split at every match.
->splitmethod of stringThe parts between each separator (or between spaces), as a list. The separator can be a regex…
@sqlcommand in KScript.DataRuns SQL. Each { } in it is worked out and sent as a parameter, never pasted in: @sql("select * from users…
->sqlmethod of databaseRuns SQL, like @sql, on this connection.
->sqlmethod of modelThe SQL the query runs and its parameters, without running it: { sql, params }.
->sqlmethod of queryThe SQL the query runs and its parameters, without running it: { sql, params }.
Sqlstatement in KScript.DataSQL to run as it is, for what the other steps can't do. db diff doesn't see what it changes, and rollback…
@sqrtcommand in KScript.MathThe square root.
->sqrtmethod of numberThe square root.
->squishmethod of stringThe text trimmed, with each run of spaces, tabs and line breaks inside made one space.
standardkscript.json settingThe standard (or standards) whose lint rules and format settings this project starts from; kscript.json's own…
->start_ofmethod of dateThe first moment of the day, week, month, quarter or year the date is in. A week starts on the locale's first…
->starts_withmethod of stringTrue when the text starts with this text. With ignore_case: true, upper and lower case match.
statestatement in KScript.WebA variable of a <live> block that keeps its value between events.
statusoption of errorThe HTTP status a KScript.Http route answers with, such as 404. Inherited from the type it extends.
@stdevcommand in KScript.MathThe population standard deviation.
->stdevmethod of listThe population standard deviation of the list.
@storagecommand in KScript.StorageOne of the app's folders, in the right place for this platform: config (settings), data (the app's files)…
@streamcommand in KScript.WebSends an update to a visible live-stream target before the action finishes. Text is literal by default. Use…
->strengthmethod of passwordHow hard the password is to guess: { score (0 to 4), label, ok, problems }. Rules: min length (8), max, upper…
stringtypeText. Quoted with ' (as written) or " (with $name and { } filled in).
->stripmethod of stringThe text without one exact prefix, suffix or both, where present: 'v1.2'->strip(prefix: 'v')…
@stylesheetcommand in KScript.StyleCompiles a stylesheet written in KScript and returns the CSS (or Sass).
->submitmethod of page_visitRuns the on-submit handler of the form (the one with this text, when given) and redraws its block.
->subtractmethod of dateThe date this many years, months, weeks and days earlier: ->subtract(days: 7). For hours and minutes, take…
->subtractmethod of durationThe second length taken from this one: 1h30m->subtract(45m) is 45m.
->subtractmethod of moneyTakes another amount away, in this amount's currency, converting a foreign amount the same way ->add() does…
successstatement in KScript.TerminalPrints the text after a green DONE label.
@sumcommand in KScript.MathThe total of the numbers (or of one list).
->summethod of grouped_queryThe total of a column in each group (0 for a group with only empty values).
->summethod of listThe total of the items (or of fn for each item).
->summethod of modelThe total of a column over the rows that match (0 when none do).
->summethod of queryThe total of a column over the rows that match (0 when none do).
->summethod of setThe total of the items (or of fn for each item).
surfaceoption of fnFor a component's render: where it draws, when its content doesn't show it.
->syncmethod of queryLinks exactly these records through a many to many relation, unlinking the rest…
Syntaxerror typeA script that can't be read: bad syntax, an unknown element or a misplaced one.

T

@tcommand in KScript.CoreThe translation of a key in the current locale (from locales/fr.json and so on), with {name} filled in from…
->tablemethod of databaseA query on a table with no model: rows come back as maps.
tableoption of modelThe table its records are kept in. Default: the plural of the name in snake case (User is users, BlogPost…
Tablestatement in KScript.DocumentA table: from rows:, or from Tr rows inside it. Tables with a caption are numbered. It takes the same rows…
tablestatement in KScript.TerminalPrints a list of maps (or of lists) as a table with borders, like kscript queue status. It takes the same…
->tablesmethod of databaseThe names of the tables in the database.
->takemethod of listThe first count items.
->take_whilemethod of listThe items from the start for as long as fn(item, index) is true.
@tancommand in KScript.MathThe tangent of an angle in radians.
Taskstatement in KScript.QueueA task of the schedule: when it runs (cron or every) and what it does (job, dispatched to its queue, or run, a…
taskstatement in KScript.TerminalRuns what's inside, then prints " name ........ 12ms DONE" (or FAIL, when it throws: the error goes on to be…
$tauvariableτ (2π), about 6.28318.
->telmethod of phoneA tel: link for it: +447700900123 .
@temp_foldercommand in KScript.IOThe folder for temporary files.
TERMenvironment variableWhen it is dumb , kscript prints without colours.
@terminal_widthcommand in KScript.TerminalThe width of the terminal in characters (80 when it isn't a terminal).
kscript testcommand lineRun *.test.kscript and *.test.ks.xml tests.
testkscript.json settingUsed by kscript test.
->testmethod of regexTrue when the text matches somewhere (use ^ and $ to match all of it).
teststatement in KScript.TestA test. Its body runs on its own when kscript test runs the file, and it passes if nothing in it fails. Inside…
test.databasekscript.json settingThe database KScript.Data gives each test file: memory (a new SQLite database in memory, made from the…
test.envkscript.json settingThe environment the tests run in (KSCRIPT_ENV), so kscript.test.json can give tests their own database…
test.excludekscript.json settingFiles and folders that are never run as tests.
test.includekscript.json settingThe test files kscript test runs, as globs relative to kscript.json.
test.packageskscript.json settingPackages every test file imports, on top of the project's packages. KScript.Test is always imported in test…
test.timeoutkscript.json settingSeconds one test may run before it fails (0 for no limit). timeout="..." on a <test> and --timeout win.
Textstatement in KScript.UIShows text. { } inserts values.
TextBoxstatement in KScript.UIA box to type in, tied to a variable. on:, trim: and as: say when and how the typed value is stored, as with…
->thenmethod of batchThe job to dispatch once every job of the batch has succeeded. Returns the batch, to chain.
throttle:handler modifierRuns at most once in this long, however often the event fires: throttle: 1s.
throwstatementRaises an error, which a <catch> can handle. Without a <try>, the script stops with the message. value throws…
Timeouterror typeA request that took too long.
timeoutoption of jobThe longest one attempt may run, such as 30s or 5m. Past it the attempt stops with a JobTimeout error…
Timerstatement in KScript.UIRuns on_tick again and again while it is in the layout (and when is true). The next tick is counted from when…
->timesmethod of numberCalls fn(i) for i from 0 up to the number, and returns the results.
->timestampmethod of dateSeconds since 1970-01-01 UTC.
Timestampsmixin in KScript.DataAdds created_at and updated_at to a model. Both are set when a record is first saved, and updated_at changes…
timezonekscript.json settingThe time zone the project's stored dates are in, by its IANA name: Europe/London (the default)…
timezonetypeAn IANA time zone such as Europe/London or America/New_York, or UTC.
->titlemethod of stringThe text in Title Case.
->tomethod of anyWrites the value in a format: a shortcut for ->convert(to: type). headers: picks and orders csv columns, and…
->to_base64method of stringThe text encoded as base64. With url: true, it is URL-safe base64 without padding.
->to_boolmethod of stringText such as 'true', 'false', 'yes', 'no', '1' or '0' as a bool.
->to_datemethod of numberReads the number as a Unix timestamp, seconds since 1970-01-01 UTC: 1795996800->to_date() is 30 November 2026…
->to_datemethod of stringReads the text as a date: '2026-11-22'->to_date(), or with the way it is written…
->to_intmethod of numberThe whole-number part.
->to_intmethod of stringThe text as a whole number, or default when it isn't one.
->to_mapmethod of listA map with fn(item) as each item's key.
->to_numbermethod of hexIts value as a number: 'ff' gives 255.
->to_numbermethod of numberThe number itself.
->to_numbermethod of stringThe text as a number, or default when it isn't one.
->to_stringmethod of anyThe value as text.
@todaycommand in KScript.CoreToday's date, at midnight.
->togglemethod of queryLinks the records given that aren't linked and unlinks the ones that are. Returns { attached, detached }.
toggle:handler shorthandFlips a bool field: toggle: $open is open = not $open.
TooManyRequestserror typeToo many requests in a short time, such as failed sign-ins. Answers 429, with Retry-After when the error has a…
->totalmethod of money[]Adds the amounts in list order in the first currency, using the same exchange rates and rounding as +. An…
->touchmethod of recordSets updated_at to now and saves, for a model that extends Timestamps: a parent whose list changed shows it…
Trstatement in KScript.DocumentA table row: cells separated by |, each like a Paragraph's text. | is a | inside a cell.
->tracemethod of loggerLogs a message at trace level, with an optional map of fields.
->transactionmethod of databaseRuns work in a transaction on this connection and returns what it returns: everything it saves is kept…
->transactionmethod of loopback_json_connectionGives action exclusive use of the connection and returns its result. If action throws, the connection closes.
transactionstatement in KScript.DataRuns its statements in a transaction: what they save is kept when the block ends, and undone if anything in it…
translationsstatementSays where translation files are and which locale to fall back to. Usually set in config under i18n instead.
triesoption of jobAttempts before it counts as failed. Defaults to 3.
->trimmethod of stringThe text without spaces (or the given characters) at either end, or only at the start or the end…
trimoption of @bindTrims spaces from both ends on the way in: trim.
@trunccommand in KScript.MathWith the fraction removed.
->truncatemethod of stringShortens the text to length, adding suffix (… by default).
trystatementRuns its body, handing errors to its <catch> elements. <finally> always runs.
->ttlmethod of cacheHow long until a key runs out, as a duration, or null when it never does or isn't there.
Typeerror typeA value of the wrong type, such as text where a number is needed.
->typemethod of anyReturns the value's type name. A list with one element type returns its type followed by [] , such as number[]…
typeoption of const $name = valueConvert the value to this type, or fail early: a built-in such as int, an <enum>, a <type>, T[] for a list, T?…
typeoption of extendThe type to add methods to: date, string, number, bool, list, map, fn, email, handle, uuid, regex, password, a…
typestatementDeclares the shape of some data, such as an API response. ->convert(from: json, as: Repo) , Repo($data) , <let…
typeskscript.json settingDefault validation rules for built-in types. Arguments at a type's use site can override these defaults.
types.passwordkscript.json setting
types.stringkscript.json setting
types.uuidkscript.json settingRules for uuid values: the typeRules settings, plus v for the UUID version.

U

UIerror typeA desktop window that can't be opened, such as on a machine without the window library.
Unauthorizederror typeA request that needs someone to sign in. Answers 401.
@underlinecommand in KScript.TerminalUnderlined text.
->unionmethod of listThe items of both lists, each once: this list's first, then the new ones from other. Items match with ==, or…
->unionmethod of setThe items of both: this set's first, then the new ones from other. $set + $other gives this too.
->uniquemethod of listThe list without duplicates, using strict equality (===), or keeping the first item for each by: fn(item…
uniqueoption of modelFields no two records may share: [email] , or [email, [team_id, slug]] for a pair that is unique together…
unique_byoption of jobThe fields that make two dispatches the same for unique_for: [user_id]. Defaults to all of them.
unique_foroption of jobWhile a job with the same fields is waiting or running, another dispatch of it is dropped, for this long at…
UniqueViolationerror typeA save that would give two records the same value in a unique field. $err.fields names them. Answers 409.
@upcommand in KScript.StyleA media query for screens at least this wide: @up(768) or @up('md') is (min-width: 768px).
kscript updatecommand lineUpdate to the latest release.
->updatemethod of modelSets columns on every row that matches, without reading them: ->update(active: false) . Returns how many rows…
->updatemethod of querySets columns on every row that matches, without reading them: ->update(active: false) . Returns how many rows…
->updatemethod of recordSets fields and saves: $user->update(name: 'Joan') or ->update($form) . Each value is checked by its field's…
->updatemethod of usersChanges a user's fields (null removes one) and returns the user. A new email is checked like @register()'s.
->update_or_createmethod of modelUpdates the first record that matches with the values, or makes one from both maps. Returns the record…
->uppermethod of stringThe text in upper case.
->upsertmethod of modelAtomically inserts a row or updates supplied fields on unique conflict. The key must name a unique column. The…
->upsertmethod of queryAtomically inserts a row or updates supplied fields on unique conflict. The key must name a unique column. The…
urltypeAn absolute http, https, ftp, ws or wss URL. The scheme and host are lowercased.
->url_decodemethod of stringURL-escaped text decoded.
->url_encodemethod of stringThe text escaped for a URL.
@usercommand in KScript.AuthThe signed-in user (a map with id, email and the fields they registered with), or null for a guest. It comes…
Usermodel in KScript.AuthSomeone with an account. KScript.Auth keeps the users in this model when kscript.json says "http": { "auth": {…
@userscommand in KScript.AuthThe app's users, kept in its data folder: ->find(id), ->find_email(email), ->all(), ->count(), ->verify(email…
@uuidcommand in KScript.CoreA new UUID. Version 4 (the default) is random. Version 7 starts with the time, so newer ones sort later and…
uuidtypeA UUID, versions 1 to 8 and the nil and max UUIDs, lowercased to 8-4-4-4-12.

V

validatestatementA rule a <type> checks: the test must be true. In a type made from one other type, the value is $value . In a…
Validationerror typeInput that isn't valid. Answers 422 in a KScript.Http route.
Valueerror typeA value that isn't allowed here.
->valuemethod of modelOne column of the first row, or null.
->valuemethod of queryOne column of the first row, or null.
valueoption of const $name = valueIts value. Can be written as the element's text instead.
valueoption of fnFor one-line functions: the result, instead of a body.
->valuesmethod of mapThe values, as a list.
valuesoption of enumThe values, as a list: [small, medium, large] (in XML, small, medium, large ).
@variancecommand in KScript.MathThe population variance: the mean of the squared distances from the mean.
$varsvariableValues given to the stylesheet: @stylesheet(path, vars) or kscript css --var name=value.
@verification_tokencommand in KScript.AuthA token that proves a user owns their email address, to put in the link of a verify-your-email message…
->verifymethod of passwordTrue when this is the password the stored hash was made from. Takes the same time whether it matches or not.
->verifymethod of password_hashTrue when the password someone typed is the one this hash was made from…
->verifymethod of usersThe user with this email and password, or null. Unlike @attempt(), it doesn't sign them in or count failures.
@verify_emailcommand in KScript.AuthFinishes email verification: sets the token's user's email_verified_at to now and returns the user, or null…
kscript --versioncommand lineShow the version of KScript that runs here, and switch between versions.
@viewcommand in KScript.HttpRenders a page from the views folder (or the site folder) with its layout, giving it the named values as…
@visitcommand in KScript.WebFor tests: renders a page of this project as a browser gets it, the way kscript serve answers it: its routes…
VSpacestatement in KScript.DocumentVertical space.

W

waitstatementPauses the script.
->waitingmethod of queueThe waiting jobs: id, job, queue, fields, attempts, available_at.
->warnmethod of loggerLogs a message at warn level, with an optional map of fields.
warnstatement in KScript.TerminalPrints the text after a yellow WARN label.
kscript watchcommand lineRebuild everything the project makes from its code (the agent docs, the OpenAPI file http.openapi.file names…
->whenmethod of modelChanges the query only when the test is true: ->when($search != null, fn(q) => $q->where(fn(u) =>…
->whenmethod of queryChanges the query only when the test is true: ->when($search != null, fn(q) => $q->where(fn(u) =>…
->wheremethod of modelKeeps the rows that match: a lambda compiled to SQL, fn(u) => $u.age >= 18 and $u.name->starts_with('J') , or…
->wheremethod of queryKeeps the rows that match: a lambda compiled to SQL, fn(u) => $u.age >= 18 and $u.name->starts_with('J') , or…
->where_notmethod of modelLeaves out the rows that match.
->where_notmethod of queryLeaves out the rows that match.
whilestatementLoops while the test is true. test="true" loops until <break/>.
->windowmethod of listOverlapping runs of size items, each starting step items after the last (1 by default): [1, 2, 3]->window(2)…
Windowstatement in KScript.UIOpens a desktop window. Its direct <let>, <fn> and <import> children run once and hold its state; the rest is…
->withmethod of loggerA logger that adds these fields to everything it logs.
->withmethod of modelLoads relations with the records, one query per relation rather than one per record: ->with(author, tags) …
->withmethod of queryLoads relations with the records, one query per relation rather than one per record: ->with(author, tags) …
->withmethod of urlThe url with parts changed: a new path, query values added or replaced (null removes one), or a new fragment…
withoption of modelThe record types, models and mixins this model extends, in order.
withoption of typeOther types this one is made from. Types with fields are joined: with="User, Auditable" has all their fields…
->with_cachemethod of http_responseSets Cache-Control: ->with_cache('public, max-age=300'), or a number of seconds: ->with_cache(300).
@with_clockcommand in KScript.TestRuns work with @now() and @today() fixed to the given date.
->with_cookiemethod of http_responseSets a cookie and returns the response. The cookie is HttpOnly and SameSite=Lax unless told otherwise, Secure…
->with_countmethod of modelCounts a list relation for each record, as a field named after it: ->with_count(posts) gives each user…
->with_countmethod of queryCounts a list relation for each record, as a field named after it: ->with_count(posts) gives each user…
@with_environmentcommand in KScript.TestRuns work with overrides for @env() and $env. A null value hides a variable in this scope.
->with_etagmethod of http_responseSets the ETag: a hash of the value, or of the body without one. Add the etag middleware (or etag="true") to…
->with_headermethod of http_responseSets a header and returns the response: $next($request)->with_header('X-Frame-Options', 'DENY'). Set-Cookie…
@with_http_stubcommand in KScript.NetRuns work with outbound @api and HTTP client calls intercepted by handler(request).
@with_loopback_jsoncommand in KScript.NetConnects to a JSON Lines service on IPv4 loopback, returns action(connection), and closes it. Each transaction…
->with_statusmethod of http_responseChanges the status code and returns the response.
@with_temp_filecommand in KScript.IOCalls a function with a temporary file, then removes the file when the call ends.
@with_temp_foldercommand in KScript.IOCalls a function with a temporary folder, then removes it when the call ends.
->with_trashedmethod of modelFor models that extend SoftDeletes: keeps the deleted records, which queries leave out by default.
->with_trashedmethod of queryFor models that extend SoftDeletes: keeps the deleted records, which queries leave out by default.
->with_typemethod of http_responseChanges the Content-Type and returns the response.
->withoutmethod of listThe items that aren't of a type (->without(string)), or without the ones a filter of the items' type keeps…
->withoutmethod of urlThe url without parts: the whole query or fragment (->without(query, fragment)), or only some query values…
->without_cookiemethod of http_responseTells the browser to delete a cookie and returns the response. Give the path and domain it was set with.
@without_overlappingcommand in KScript.QueueJob middleware, for fn middleware(): only one job of this type with the same key runs at a time; another goes…
->wordsmethod of documentHow many words the text has, not counting maths and code.
->wordsmethod of latexHow many words the text has, not counting maths and code.
->wordsmethod of markdownHow many words the text has, not counting maths and code.
->wordsmethod of stringThe words in the text, as a list, without spaces or punctuation. Letters in any script count, and don't or…
kscript workercommand lineRun queued jobs until stopped. Ctrl+C lets the running jobs finish first.
->wrapmethod of stringThe text with line breaks between words so no line is longer than width (unless one word is). Works well with…
->writemethod of storageWrites text to a file, replacing it safely. Folders are created as needed.
@write_atomiccommand in KScript.IOReplaces a file atomically with text or the bytes of a base64 value.
@write_bytescommand in KScript.IOWrites the exact bytes held by a base64 value.
->write_bytesmethod of storageWrites the exact bytes of a base64 value (an upload's .bytes, say) to a file, replacing it safely.
@write_csvcommand in KScript.IOWrites maps as CSV with a header, or lists as rows. Optional headers select and order columns.
@write_jsoncommand in KScript.IOWrites a value to a file as indented JSON.
->write_jsonmethod of storageWrites a value to a file as indented JSON, replacing it safely.
@write_textcommand in KScript.IOWrites text to a file, replacing it. Folders are created as needed.
->write_textmethod of fileWrites text to the file, replacing it. Folders are created as needed. Returns the file.
@write_yamlcommand in KScript.IOWrites a value to a file as YAML.

Y

Yamlerror typeText that isn't valid YAML.

Z

->zipmethod of listPairs of items from both lists: [[a1, b1], [a2, b2]...].