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
@abort | command in KScript.Http | Stops the request with an error status, such as @abort(404) or @abort(403, 'Admins only'). |
@abs | command in KScript.Math | The number without its sign. |
->abs | method of number | Without its sign. |
Abstract | statement in KScript.Document | The summary under the title. A blank line starts a new paragraph. |
Access | error type | The operating system refused access to a file. |
@acos | command in KScript.Math | The angle in radians whose cosine is the number. |
@acting_as | command in KScript.Auth | In a test, sets who @can, @authorize and @user() ask about until the test ends, in the test and in routes it… |
@acting_as_guest | command in KScript.Auth | In a test, acts as a guest until the test ends, in the test and in routes it calls with @api(/...) or… |
->add | method of date | The date this many years, months, weeks and days later: ->add(months: 1, days: 2). Months and years keep the… |
->add | method of duration | The two lengths added: 1h30m->add(45m) is 2h15m. |
->add | method of money | Adds another amount in this amount's currency. For a foreign amount, rate gives units of the receiving… |
->add | method of set | A new set with the items added. An item the set has already is left where it is. |
add: | handler shorthand | Adds a value to a list field: add: $draft, to: $tags. |
AddField | statement in KScript.Data | Adds a column to a table. A required column needs a default when the table has rows. |
AddIndex | statement in KScript.Data | Adds an index to a table. |
@adjust_lightness | command in KScript.Style | Adds a signed amount to HSL lightness and returns CSS colour text. Use 0.1 to add ten percentage points or… |
->advance | method of progress_bar | Moves the bar on by a number of steps (1 by default) and returns it. Reaching the total finishes the bar. |
->after | method of duration | The time this long after a date, or after now. |
->after | method of string | The text after the first time text occurs (or the last time, with last), or the whole text when it doesn't… |
after_each | statement in KScript.Test | Runs after every test in its file or <describe>, even when the test fails. Use it to tidy up files a test… |
kscript agents | command line | Write AGENTS.md and .kscript/agents from project code, packages and Markdown listed in agents.merge. |
agents | kscript.json setting | Settings for generated AGENTS.md. |
agents. | kscript.json setting | Project-relative Markdown files to include in AGENTS.md, in the listed order. |
AI | error type | A call to a language model that failed. |
alert | statement in KScript.Terminal | Prints the text after a label: type is info (the default), success, warn or error. Errors go to stderr. |
->all | method of config | Every setting, as a map. |
->all | method of list | True when fn is true for every item. |
->all | method of map | True when fn(value, key) is true for every entry. |
->all | method of model | Every record (leaving out soft-deleted ones). |
->all | method of session | Every value in the session, as a map. |
->all | method of set | True when fn is true for every item: ->all(fn(name) => $name->count() > 2). An empty set gives true. |
->all | method of users | Every user, oldest first. |
->allocate | method of money | The 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… |
@alpha | command in KScript.Style | The colour see-through: opacity from 0 to 1 (or '50%'). |
ANTHROPIC_API_KEY | environment variable | The API key KScript.AI sends to Claude. Scripts never hold the key themselves. |
ANTHROPIC_AUTH_TOKEN | environment variable | An OAuth token KScript.AI sends instead of an API key, when ANTHROPIC_API_KEY isn't set. Without either, it… |
ANTHROPIC_BASE_URL | environment variable | Sends KScript.AI's requests to another host, such as a proxy or a stand-in server for tests. |
->any | method of list | True when fn is true for any item (or, without fn, if the list isn't empty). |
->any | method of map | True when fn(value, key) is true for any entry. |
->any | method of set | True when fn is true for any item, or without fn, when the set isn't empty. |
Any | statement in KScript.Http | A route for any method requests to a path. It is answered by a controller (to), a view, a redirect, or the… |
any | type | Any value. The type a field or parameter has when none is given. |
@api | command in KScript.Net | Makes an HTTP request and returns the response. Give an absolute HTTP(S) URL or a path such as '/api/notes' to… |
@api_token | command in KScript.Auth | Makes an API token for a user and returns it. Show it once: only its hash is kept. Requests that send it as… |
@api_tokens | command in KScript.Auth | A user's API tokens, without the tokens themselves: [{ id, name, created_at, last_used_at, expires_at }]. |
app | kscript.json setting | Used by kscript compile, which builds a script, desktop app or site into a program for macOS, Windows and… |
app. | kscript.json setting | An icon file relative to kscript.json: .icns for macOS, .ico for Windows, .png for Linux. |
app. | kscript.json setting | A reverse-DNS id such as com.example.lifelab (the macOS bundle id). |
app. | kscript.json setting | The script the app runs, relative to kscript.json. Usually one that imports KScript.UI and holds a Window { }… |
app. | kscript.json setting | The app's name in the Dock, Start menu or launcher. Defaults to the project's name. |
app. | kscript.json setting | true lays the person's own settings over $config: config.json in the app's config folder, such as… |
app. | kscript.json setting | The app's version, such as 1.0.0. |
@app_folders | command in KScript.Storage | Every folder of the app, by kind: { config: ..., data: ..., cache: ..., state: ..., logs: ... }. |
@app_name | command in KScript.Storage | The name the app's folders are named after: app.name in kscript.json, else name, else the script's name. |
->append | method of storage | Adds text to the end of a file. |
@append_text | command in KScript.IO | Adds text to the end of a file. |
$args | variable | The command line arguments after the script path. |
Argument | error type | A call with the wrong arguments. |
as: | option of @bind | Reads the value as this type before it reaches the field, and refuses one that isn't: as: int. |
->ascii | method of domain | The form DNS uses, with international labels as xn--: xn--bcher-kva.example for bücher.example. |
@asin | command in KScript.Math | The angle in radians whose sine is the number. |
->ask | method of chat | Sends a message and returns the answer, keeping the history. With a schema the answer is a map. |
@assert | command in KScript.Test | Fails the test unless the condition is true. A failed comparison shows the value of each side. message is what… |
@assert_response | command in KScript.Test | Checks an HTTP response's status, headers, redirect or JSON. An optional type validates the body. |
Assertion | error type | A failed check in a test. |
@asset_url | command in KScript.Http | Builds a public asset URL using assets.base and the optional assets.manifest map in project configuration. |
->at | method of list | The item at an index; negative counts from the end. |
@atan | command in KScript.Math | The angle in radians whose tangent is the number. |
@atan2 | command in KScript.Math | The angle in radians of the point (x, y). |
->attach | method of query | Links records through a many to many relation's pivot table: $post->tags()->attach([$a, $b]) or keys… |
@attempt | command in KScript.Auth | Signs someone in with an email and password: returns the user, or null when they don't match. session: false… |
->attempt | method of rate_limit | Counts an attempt and runs work, returning what it returns. When the limit is used up, work doesn't run: it is… |
Author | statement in KScript.Document | An author, with an affiliation and email. Its text is the name. |
@authorize | command in KScript.Auth | Stops unless the model's policy lets the user use the ability: a Forbidden error (403 in a route), or… |
auto_create | option of model | Creates this model's table and indexes on first use if the table is missing. |
@autogrow | page directive | Makes a <textarea> grow taller as its text grows. |
->available_in | method of rate_limit | How long until attempts are allowed again, as a duration: 0s when some are left. |
@average | command in KScript.Math | The mean of the numbers (or of one list). |
->average | method of grouped_query | The average of a column in each group. |
->average | method of list | The mean of the items (or of fn for each item), or null when empty. |
->average | method of model | The average of a column, or null when no rows match. |
->average | method of query | The average of a column, or null when no rows match. |
->average | method of set | The mean of the items (or of fn for each item), or null when the set is empty. |
B
backoff | option of job | How long to wait before each retry: one time (30s), a list ([10s, 1m, 5m], the last one repeats), or… |
BadRequest | error type | A request that can't be handled as sent. Answers 400. |
base64 | type | Base64 text (standard or URL-safe). ->decode() gives the text it holds. |
@batch | command in KScript.Queue | Jobs dispatched together, whose progress the queue keeps: @batch($rows->map(fn(r) => ImportRow(id… |
->batch | method of queue | A batch dispatched on this connection, as the queue has it now, or null: @queue()->batch($id).progress . |
->before | method of duration | The time this long before a date, or before now. |
->before | method of string | The text before the first time text occurs (or the last time, with last), or the whole text when it doesn't… |
before_each | statement in KScript.Test | Runs before every test in its file or <describe>, in the test's own scope. Use it to reset shared variables… |
@between | command in KScript.Style | A media query for screens from one width up to (not including) another. |
Bibliography | statement in KScript.Document | The list of works cited with [@key]: from a BibTeX file, Source elements inside it, or both. Without one, the… |
@bind | page directive | Keeps a control and a field in step: @bind($title) . Options such as on: blur and trim go after the field. |
->bits | method of number | Works on the number's bits, as a whole number: and: keeps the bits both have (12->bits(and: 10) is 8), or: the… |
->blocks | method of string | The parts of the text between blank lines, each trimmed of the line breaks around it: 'a\nb\n\nc'->blocks() is… |
@bold | command in KScript.Terminal | Bold text. |
bool | type | true or false . |
Box | statement in KScript.UI | A rectangle: a coloured cell, a card or a panel. It can hold other items, and on_click (or a shorthand such as… |
break | statement | Leaves the innermost loop. |
bullets | statement in KScript.Terminal | Prints each item of a list on its own line, after a ⇂. |
->bump | method of semver | The next version: bump('major'), bump('minor') or bump('patch'). The prerelease is dropped. |
Button | statement in KScript.UI | A button. Its text is the label; on_click runs when it is pressed, or name the action straight on it… |
->bytes | method of document | The document rendered as pdf, docx or html, as a base64 value, ready for @response($doc->bytes(as: pdf), type… |
C
@cache | command in KScript.Cache | A cache store: memory (the default, like $cache), file, which keeps values in files in the app's cache folder… |
$cache | variable | The app's cache in memory: $cache->remember('repos', fn() => @get_json($url), ttl: 10m). It lasts while… |
->call | method of fn | Calls the function with these arguments. |
call | statement | Calls a function for its effect, optionally keeping the result. |
call: | handler shorthand | Calls a function or one of the component's methods: call: $save, with: [$note.id]. |
@can | command in KScript.Auth | True when the model's policy lets the user use the ability on a record: @can(update, $post). For an ability… |
Cancelled | error type | The script was stopped. |
@cannot | command in KScript.Auth | The opposite of @can: true when the policy doesn't let the user use the ability. |
->capitalize | method of string | The text with its first letter upper-cased. |
capture | statement in KScript.Test | Runs its body and keeps what it prints in a variable instead of showing it. input gives it lines to read. |
card | type | A payment card number, checked with the Luhn digit. It prints masked apart from the last four digits. |
->case | method of string | The text as an identifier in one style: 'User ID'->case(snake) is user_id, kebab gives user-id, camel userId… |
case | statement, written value => … | A branch of <match>: runs when the value equals one of is , or when when is true (with both, the value must… |
->catch | method of batch | The job to dispatch when the first job of the batch fails. Returns the batch, to chain. |
catch | statement, written catch err | Handles matching errors in a try block, a function call, or calls to methods of a type or model. The nearest… |
@cbrt | command in KScript.Math | The cube root. |
@ceil | command in KScript.Math | Rounded up. |
->ceil | method of number | Rounded up. |
->cells | method of csv | Its cells. On its own, or with rows , every row; with columns , every column. row: picks one row, counted from… |
->cells | method of list | The cells of a list of lists, such as a ->grid(). On its own, or with rows , every row; with columns , every… |
@chain | command in KScript.Queue | Jobs that run one after another: each starts when the one before it succeeds, and a failure stops the rest… |
->chain | method of error | The error's type and the types it extends, nearest first: ['NotFound', 'Validation', 'Error']. |
->change | method of page_visit | Runs the on-change handler of the input with this label (the text of the <label> around it), such as a… |
ChangeField | statement in KScript.Data | Changes a column to the one described: its type, whether it may be null, its default or what it references… |
@char_of | command in KScript.Core | The character with this character code: @char_of(65) is A. |
->chars | method of string | The characters, as a list. |
@chat | command in KScript.AI | A conversation with a language model that keeps its history: $chat->ask(text). tools, model and max_tokens are… |
kscript check | command line | Check scripts and pages without running them (no path: the current project). |
->check | method of response | Throws a Network error unless the status is 2xx; otherwise returns the response. |
->check | method of type | The problems that stop the data fitting this type, as { path, field, message } maps. Empty when it fits. |
@check_script | command in KScript.Test | Checks another script as kscript check does, without running it, and returns its problems: a list of { line… |
CheckBox | statement in KScript.UI | A tick box tied to a true/false variable. Its text is the label. |
->chunk | method of list | The items in lists of size. |
->chunk | method of model | Reads the rows a batch at a time and calls work with each batch (and its number from 0): for going through… |
->chunk | method of query | Reads the rows a batch at a time and calls work with each batch (and its number from 0): for going through… |
CI | environment variable | Set by CI services such as GitHub Actions. When it is set (and not false or 0 ), kscript test runs every test… |
cidr | type | A block of IP addresses: an address, / and a prefix length, such as 10.0.0.0/8. |
@clamp | command in KScript.Math | The number kept between min and max. |
->clamp | method of number | The number limited to min..max. |
@class | page directive | Switch classes on by conditions: @class(done: $todo.done) or @class({ $todo.done: ['done', 'struck'] }). |
->classes | method of page_visit | The classes of the first element whose own text is this: classes('Buy milk'). |
->clear | method of cache | Removes every key. Returns how many there were. |
->clear | method of fake_mail | Forgets the mail sent so far, and returns how many there were. |
->clear | method of fake_queue | Forgets the dispatched jobs. |
->clear | method of queue | Removes every waiting job and returns how many there were. With failed, deletes every failed job of this queue… |
->clear | method of rate_limit | Forgets the attempts, such as after a successful sign-in. |
->clear | method of session | Removes every value, keeping the session (and who is signed in). Returns how many there were. |
->clear | method of storage | Deletes everything in the folder. Returns how many files were deleted. |
clear | statement in KScript.Terminal | Clears the terminal. |
->clear_group | method of cache | Clears this named cache group and returns how many entries were removed. |
->click | method of page_visit | Runs the live on-click handler of the element with this text (or aria-label or title) and redraws its block… |
@close_window | command in KScript.UI | Closes the window, so the script carries on after </KScript.Window>. |
Code | statement in KScript.Document | A block of source code in a monospaced font, used as written. |
collection | statement | Builds a list or map from nested <item> elements, for data that reads better as markup than as a literal. |
@color | command in KScript.Terminal | Text in a colour: red, green, yellow, blue, magenta, cyan, white, gray (or a bright_ one). Plain text when the… |
color | type | A colour: #rgb, #rrggbb, #rrggbbaa, rgb(...) or a CSS name. Kept as lowercase #rrggbb (#rrggbbaa with alpha). |
Column | statement in KScript.UI | Stacks its items top to bottom. |
COLUMNS | environment variable | How wide kscript's tables, lines of dots and wrapped text are, instead of the terminal's own width. |
->combinations | method of list | Every way to pick size items, order not mattering, in list order: [1, 2, 3]->combinations(2) is [[1, 2], [1… |
->common | method of list | The items that occur most often, most first, each once and as they are (numbers stay numbers): [3, 7, 7, 9, 9… |
->compare | method of semver | -1, 0 or 1 as this version comes before, with or after the other (build metadata is ignored). |
kscript compile | command line | Build programs that run without kscript. |
Config | error type | A missing or invalid setting. |
config | kscript.json setting | The app's own settings, read as $config: "config": { "app": { "name": "Shop" } } gives $config.app.name… |
config | statement | Reads the script's settings with other options: an environment, other files, a prefix for environment… |
$config | variable | The project's settings: the "config" section of kscript.json, with kscript.<env>.json and config.kscript laid… |
config. | kscript.json setting | Settings about the app, such as its name: $config.app.name. |
config. | kscript.json setting | KScript.Cache settings, such as "store": "memory" and "ttl": "5m". |
config. | kscript.json setting | KScript.Data's database connections. |
config. | kscript.json setting | Connections by name, such as "main": { "url": "sqlite:data/app.sqlite" }. |
config. | kscript.json setting | The connection used when none is named (default: main). |
config. | kscript.json setting | Translations: folder, default and locale, such as "default": "en-GB". |
config. | kscript.json setting | Log level and providers, such as "level": "info". |
config. | kscript.json setting | KScript.Mail: how @send_mail sends (see docs/mail.md). |
config. | kscript.json setting | smtp sends through a mail server, log writes each message to the log, and fake keeps them in memory. |
config. | kscript.json setting | tls upgrades the connection with STARTTLS; none sends in the clear, for a local test server. |
config. | kscript.json setting | The address mail comes from unless @send_mail names one: "hello@example.com", or { "address"… |
config. | kscript.json setting | The SMTP server. |
config. | kscript.json setting | The SMTP password. Leave it out to read the MAIL_PASSWORD environment variable. |
config. | kscript.json setting | The SMTP port: 587 for STARTTLS, 25 or a test server's port otherwise. |
config. | kscript.json setting | The queue mail sent with queue goes on. |
config. | kscript.json setting | The SMTP user. Defaults to the MAIL_USERNAME environment variable. |
config. | kscript.json setting | Money settings, such as exchange_rates: { "EUR": { "GBP": 0.85 } }. |
confirm | statement in KScript.Terminal | Asks a yes/no question and stores true or false. |
confirm: | handler modifier | Asks first, and runs only if the person says yes: confirm: 'Delete this note?'. |
Conflict | error type | A change that clashes with the current state. Answers 409. |
Connection | error type | A database that can't be reached or opened. Answers 503. |
connection | option of job | The connection in kscript.json's queue.connections it goes to, unless the dispatch names one. Defaults to… |
connection | option of model | The database connection, from database.connections in your config. Default: the default connection (main). |
Const | error type | Changing a const. |
const | statement, written const $name = value | Declares a value that can't change: the same as <let const="true">. Top-level consts are exported to scripts… |
construct | statement | A type's constructor. Its fields are what a caller may pass, as Point(x: 1) or as a component's attributes… |
->contains | method of cidr | True when the address is in the block. |
->contains | method of list | True when the list contains the item. |
->contains | method of set | True when the item is in the set, matched with ===. It stays quick however big the set gets, and so does item… |
->contains | method of string | True when the text contains this text. With ignore_case: true, upper and lower case match. |
Contents | statement in KScript.Document | The table of contents, with page numbers in PDFs. |
Context | error type | Something used where it doesn't work. |
continue | statement | Skips to the next turn of the innermost loop. |
@contrast_color | command in KScript.Style | The text colour that reads best on a background: dark (default #000000) on light colours, light (default… |
->contrast_ratio | method of color | The WCAG contrast ratio with the other colour, from 1 to 21. Text needs 4.5 or more. |
kscript convert | command line | Write the .kscript version of an XML script, or the reverse. |
->convert | method of any | Changes the value's format. from: reads text written in a format (json, yaml, csv, markdown or latex), and to… |
->convert | method of timezone | The same moment as the local time in this zone. |
@convert_length | command in KScript.Math | A length in other units: @convert_length(12, in, cm) is 30.48. Units: mm, cm, m, km, in, ft, yd, mi, pt and px… |
@copy | command in KScript.IO | Copies a file or folder, and returns the copy as a file value. to is a full path, or an existing folder to… |
->copy | method of storage | Copies a file or folder inside the folder. overwrite replaces what is at to. |
->copy_to | method of file | Copies the file or folder and returns the copy. to is a full path, or an existing folder to copy it into. |
@cos | command in KScript.Math | The cosine of an angle in radians. |
->count | method of chain | How many jobs are in the chain. |
->count | method of fake_llm | How many times the script asked the model. |
->count | method of fake_mail | How many messages were sent. |
->count | method of fake_queue | How many jobs were dispatched. |
->count | method of grouped_query | How many rows each group has: Order->group_by(status)->count() gives { open: 3, paid: 5 }. |
->count | method of list | The number of items. |
->count | method of map | The number of keys. |
->count | method of model | How many rows match. |
->count | method of query | How many rows match. |
->count | method of set | How many items the set has. |
->count | method of string | The number of characters. |
->count | method of users | How many users there are. |
->count_by | method of list | A map from fn's result to how many items gave it: ['a', 'bb', 'cc']->count_by(->count()) is { 1: 1, 2: 2 }. |
->count_by | method of set | A map from fn's result to how many items gave it. |
->count_of | method of fake_mail | How many messages went to one address (or user). |
->count_of | method of fake_queue | How many jobs of one job type were dispatched: count_of(SendWelcome). |
->count_of | method of list | Counts items for which a function is true, or items equal to a value using ==. |
->count_of | method of string | How many times a piece of text occurs. |
country | type | An ISO 3166 country code. Two-letter, three-letter and English names are read; it is kept as two capitals… |
->create | method of model | Checks the values against the model, saves a new record and returns it: User->create({ name: 'Joan', email… |
->create | method of query | Adds a record to the relation: $user->posts()->create(title: 'Hi') sets the post's author to the user. For a… |
@create_folder | command in KScript.IO | Creates a folder (and any folders above it), and returns it as a file value. Does nothing if it is already… |
->create_table | method of database | Makes a model's table and indexes, if the database doesn't have them yet, and the pivot tables of its many to… |
CreateTable | statement in KScript.Data | Makes a table, with a Field for each column, its Index lines and a Key of two columns if it has one. |
cron | type | A cron schedule of five fields (minute hour day month weekday), or @daily, @hourly and the like. |
@csrf_field | command in KScript.Auth | A hidden form field holding the CSRF token: write {! @csrf_field() } inside each <form method="post">. |
@csrf_token | command in KScript.Auth | The session's CSRF token. Forms send it back as _token, and scripts as an X-CSRF-Token header. |
kscript css | command line | Compile .ks.css, .ks.scss and .ks.sass stylesheets. |
->css | method of color | Its CSS form: #rrggbb, or rgb(r g b / a) with transparency. |
css_text | statement in KScript.Style | CSS text in a stylesheet, with {$name} and { @fn() } filled in. kscript writes these for you around the… |
@css_var | command in KScript.Style | var(--name), with a fallback when given. |
@css_vars | command in KScript.Style | Custom properties from a map, one per line: { primary: '#36f', space: { sm: '4px' } } with prefix 'theme'… |
csv | type | Text that holds valid CSV, such as a ```csv block. ->cells() reads its rows, columns and cells. |
currency | type | An ISO 4217 currency code, kept in capitals: GBP, USD, EUR. |
->cursor_paginate | method of model | Reads one page using a unique, non-null key (the model key by default). Returns { items, has_more, next }… |
->cursor_paginate | method of query | Reads one page using a unique, non-null key (the model key by default). Returns { items, has_more, next }… |
@cwd | command in KScript.IO | The folder kscript was run from. |
cycle: | handler shorthand | Moves a field to the next value of its enum, or of a list given with through:, wrapping round: cycle: $view… |
D
@darken | command in KScript.Style | Subtracts from HSL lightness. For example, @darken('red', '10%') gives the same CSS as… |
->darken | method of color | Mixed with black: amount 0.2 (the default) is a fifth of the way. |
DATABASE_URL | environment variable | The database to use when kscript.json and the config files don't set one, such as… |
->date | method of date | The date at midnight. |
date | type | A date and time: @now() , @today() , '2026-11-19'->to_date() . |
date_format | type | How 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… |
@db | command in KScript.Data | A query on a table with no model ( @db('users')->where(active: 1)->get() gives maps), or with no table the… |
kscript db | command line | Migrations and seeders: write a migration from the models, run it on the database, undo it, and fill the… |
$db | variable | The default database connection: $db->table('users'), $db->tables(), $db->create_table(User). With no config… |
debounce: | handler modifier | Waits until the events stop for this long, then runs once: debounce: 300ms. |
debounce: | option of @bind | Sends the value once typing has stopped for this long: debounce: 300ms. |
kscript debug | command line | Start the step debugger (Debug Adapter Protocol over stdio). |
->debug | method of logger | Logs a message at debug level, with an optional map of fields. |
->decode | method of base64 | The text it holds (read as UTF-8). |
->decrement | method of model | Takes away from a number column on every row that matches (1 by default). Returns how many rows changed. |
->decrement | method of number | The number minus 1. |
->decrement | method of query | Takes away from a number column on every row that matches (1 by default). Returns how many rows changed. |
->decrement | method of record | Takes away from a number field in the database in one statement and sets the record's field to the new value… |
decrement: | handler shorthand | Takes 1 (or by:) from a number field, never going below its min: (stock: int(min: 0)): decrement: $stock. |
@decrypt | command in KScript.Core | The value @encrypt() was given. Text that was changed, or encrypted with another KSCRIPT_SECRET, is a Format… |
->deep_merge | method of map | Recursively merges maps. The right value replaces lists, nulls, and other leaves. |
default | statement, written _ => … | The branch of <match> that runs when no case matched. In a .kscript file it is the arm _ => ... . |
@degrees | command in KScript.Math | Radians to degrees. |
@delete | command in KScript.IO | Deletes a file, or a folder and everything in it. Does nothing if it isn't there. |
->delete | method of file | Deletes the file, or the folder and everything in it. True if something was deleted. |
->delete | method of model | Deletes every row that matches: models that extend SoftDeletes only mark them deleted. Returns how many. |
->delete | method of query | Deletes every row that matches: models that extend SoftDeletes only mark them deleted. Returns how many. |
->delete | method of record | Deletes the record. For a model that extends SoftDeletes it is only marked deleted (->restore() brings it… |
->delete | method of storage | Deletes a file, or a folder and everything in it. True if something was deleted. |
->delete | method of users | Deletes a user, with their sessions and tokens. True if there was one. |
Delete | statement in KScript.Http | A route for DELETE requests to a path. It is answered by a controller (to), a view, a redirect, or the… |
delete: | handler shorthand | Deletes a KScript.Data record: delete: $note is $note->delete(). |
describe | statement in KScript.Test | A group of tests. Its name goes in front of each test's name, and its <before_each> and <after_each> apply to… |
->describe_table | method of database | Returns columns, indexes, and keys for the named table or model. |
->detach | method of query | Unlinks records from a many to many relation, or every record when none are given. Returns how many links were… |
detail | statement in KScript.Terminal | Prints a name, a line of dots and a value: " Version ........ 1.2". The text is the value. |
->difference | method of list | The items that aren't in other, each once and in order. Items match with ==, or by what by: gives for each. |
->difference | method of set | The items that aren't in other, as $set - $other gives. With symmetric, the items in exactly one of the two… |
@dim | command in KScript.Terminal | Dimmed text. |
->dirty | method of record | The names of the fields with changes that aren't saved. |
disable | handler modifier | Disables the element while its action runs: disable. |
->dispatch | method of batch | Queues the batch's jobs and returns the batch, with its id. Inside a transaction it waits for the commit, as a… |
->dispatch | method of chain | Queues the first job of the chain; each of the others is queued when the one before it succeeds. Inside a… |
->dispatch | method of job | Queues the job and returns what was queued: { id, job, queue, connection, available_at }. delay (10m) or at (a… |
@dispatch_event | command in KScript.Queue | Tells every listener of an event: runs each listener for function with it, in order, then queues each job that… |
->dispatches | method of fake_queue | What each dispatch asked for: job, queue, connection, delay, available_at. |
->distinct | method of model | Leaves out rows that repeat an earlier one, in the columns selected. |
->distinct | method of query | Leaves out rows that repeat an earlier one, in the columns selected. |
do | statement, written $name = value; … | Runs assignment statements and calls, separated by ; . A call that names a statement, such as locale(set… |
kscript docs | command line | Open these docs: a local website with every package, element, command and method, and examples you can run. |
@document | command in KScript.Document | Makes a document from Markdown or LaTeX source. A fenced value supplies the format. A plain string defaults to… |
Document | statement in KScript.Document | A document. Its content (Section, Paragraph, List, Table, Figure, Math...) is laid out by the template and… |
document | type | A document built with KScript.Document, ready to save as PDF, Word, HTML or Markdown. |
@document_templates | command in KScript.Document | The built-in document templates and what each is for: { paper: '...', report: '...' }. |
domain | type | A domain name such as example.com or api.example.co.uk, lowercased, without a trailing dot. |
@down | command in KScript.Style | A media query for screens narrower than this: @down('md') is (max-width: 767.98px). |
Down | statement in KScript.Data | The steps that undo the migration, run by kscript db rollback in place of undoing each step. |
@download | command in KScript.Net | Downloads a URL to a file and returns the file's full path. Folders are created as needed, and a relative path… |
@drag | page directive | Move this element with the pointer, and run its on-dragend handler where it lands: @drag(front). With copy… |
@drop-class | page directive | Add classes while something this element accepts is dragged over it: @drop-class('file-over'). |
@drop-files | page directive | Send files dropped on this element through the named live-upload input inside it: @drop-files('upload'). |
->drop_table | method of database | Deletes a table and everything in it, if it is there: a name, or a model's table. True when there was one. |
DropField | statement in KScript.Data | Drops a column, with its indexes. Rollback adds it back, empty. |
DropIndex | statement in KScript.Data | Drops the index on these columns. |
DropTable | statement in KScript.Data | Drops a table and its rows. Rollback makes it again, empty. |
duration | type | A length of time: 1h30m, 90s, 2d, 5y10mo or ISO 8601 such as PT1H30M. Kept in its short form. |
E
$e | variable | e, about 2.71828. |
->each | method of list | Calls fn for each item and returns the list. |
->each | method of set | Calls fn for each item, in the order they were added, and gives back the set. |
@each | page directive | Draws the tag once for each item: @each($tasks, as: task, at: i). Same as <for each="task" in="$tasks"> around… |
echo | statement | Prints its text. { expr } inserts a value; $name and $name->method() work directly. |
elif | statement | Runs when the earlier <if>/<elif> tests were false and this test is true. |
else | statement | Runs when the earlier <if>/<elif> tests were all false, or after a <for> that had nothing to loop over. |
email | type | An email address such as joan@example.com. Spaces are trimmed and the domain is lowercased. |
emit: | handler shorthand | Sends an event to the page's live blocks: emit: 'notes-changed' is @emit_event('notes-changed'). |
@emit_event | command in KScript.Web | Sends an event from a live action to the page's live blocks. A target limits it to one block ID. |
@encrypt | command in KScript.Core | Encrypts a value (text, a number, a map or a list) with the app's secret, KSCRIPT_SECRET, so only the app can… |
->end_of | method of date | The last moment of the day, week, month, quarter or year the date is in: ->end_of(month) is 23:59:59 on its… |
->ends_with | method of string | True when the text ends with this text. With ignore_case: true, upper and lower case match. |
->entries | method of logger | What memory providers kept: a list of { time, level, category, message, fields, script, line }. |
->entries | method of map | The entries, as a list of { key, value } maps. |
enum | statement | Declares a set of named values. Size.small is 'small', and a parameter typed with it ( params="size: Size" )… |
@env | command in KScript.Core | An environment variable, or default when it isn't set. |
$env | variable | Environment variables: $env.HOME, $env['PATH']. |
->environment | method of config | The environment the settings are for (staging, production), or null. |
Error | error type | Any error. Every error type extends Error. |
->error | method of logger | Logs a message at error level, with an optional map of fields. |
error | statement | Declares an error type. throw NotFound(id: 42) raises one, catch NotFound as e catches it and the error types… |
->escape | method of string | The text HTML-escaped. |
@escape_regex | command in KScript.Core | Text with every character that means something in a regular expression escaped, so it matches only itself… |
@etag | command in KScript.Http | Tags the answer with an ETag made from a value (such as a record's version or updated time). When the… |
event | statement in KScript.Queue | Declares an event: something that happened in the app, with the fields its listeners need, typed like a… |
$event | variable | The event a handler runs for, in on-* attributes and <on> blocks: $event.value , $event.key , $event.data … |
$event | variable in page handlers | The browser event a handler runs for, with its fields. |
@event-name | page directive | Runs @on-event only for events with this name: event-name="notes-changed" . |
@every | page directive | How often @on-tick runs: every="1s" . |
@exists | command in KScript.IO | True if a file or folder is at the path. |
->exists | method of model | True when any row matches. |
->exists | method of query | True when any row matches. |
->exists | method of storage | True if the file (or, without a name, the folder) is there. |
exit | statement | Ends the script, with an exit code for the shell (0 means success). |
@exp | command in KScript.Math | e to the power of the number. |
expect | statement in KScript.Test | Checks a value and fails the test if the check doesn't hold. Give the value and one check, such as equals="5". |
expect_error | statement in KScript.Test | Fails the test unless its body stops with an error. type and contains check which error; as keeps it for more… |
extend | statement | Adds methods to a type: a built-in one such as date, string or list, a package's (file, response), or a… |
extends | option of error | The error type it is a kind of, such as Validation or another <error>. catch of that type catches this one… |
extends | option of type | A type whose required method signatures this type implements. |
extensions | kscript.json setting | Where the project's extension files are: folders (everything inside, subfolders too) or globs, relative to… |
extra | option of model | Keys ->create() is given that the model doesn't have: drop them (the default), keep them, or make them an… |
extra | option of type | Keys in the data that the type doesn't list: drop them (the default), keep them, or make them an error… |
F
@factorial | command in KScript.Math | n! for a whole number from 0 to 5000, exact. |
@fail | command in KScript.Test | Fails the test now. |
@fail_job | command in KScript.Queue | In a job's handle: fails the job now, without more tries. Give an error ( @fail_job(Validation('Bad data')) )… |
fail_on | option of job | Errors of these types fail the job at once, without more tries: [Validation, NotFound]. |
->failed | method of queue | The jobs of this queue that failed: id, job, fields, attempts, failed_at and error. |
->fake | method of model | Saves a record with made-up values for the fields that need one, and these values: User->fake(role: 'admin') … |
@fake_llm | command in KScript.AI | For tests: from now on in this run, @llm, llm and $chat->ask() answer from replies instead of asking Claude: a… |
@fake_mail | command in KScript.Mail | For tests: from now on in this run, mail is kept instead of sent, queued or not… |
->fake_many | method of model | Saves count fake records, each with these values, and returns them: Post->fake_many(3, author: $joan) . |
@fake_queue | command in KScript.Queue | For tests: from now on in this run, dispatched jobs are kept instead of queued or run. $q->pushed(SendWelcome)… |
->fatal | method of logger | Logs a message at fatal level, with an optional map of fields. |
Field | statement in KScript.Data | A column of the table CreateTable makes. |
field | statement, written name: type | One field of a <type>, <error>, <model> or <job>: in a .kscript file, one line of the block, stars: int from… |
fields | option of error | The fields on one line, like fn params: id: int, kind: string = 'item' . |
fields | option of event | The fields on one line, like fn params: order_id: int, total: number . Bigger events list them one per line. |
fields | option of job | The fields on one line, like fn params: user_id: int, email: email . Bigger jobs list them one per line. |
fields | option of model | A short model's fields on one line: name: string, email: email . Bigger models list one <field> per line. |
fields | option of type | A short type's fields on one line, like fn params: login: string, id: int, avatar_url?: string . Bigger types… |
Figure | statement in KScript.Document | An image (PNG or JPEG) with a caption. Figures with a caption are numbered. |
@file | command in KScript.IO | A file value for a path, with fields like .name, .extension and .size, and methods like ->read_text(). |
->file | method of storage | A file in the folder as a file value, with .size, .modified, .mime and the file methods. |
file_path | type | Where a file or folder is: ./data/input.txt from the script's folder, ../shared/rates.json from the folder… |
@file_users | command in KScript.Auth | The users kept as files in the app's data folder, as before http.auth.users kept them in a model: each with… |
FileNotFound | error type | A file or folder that doesn't exist. |
@files | command in KScript.IO | The files in a folder, as file values. pattern is a wildcard like '*.txt'. |
->fill | method of page_visit | Types a value into the input bound to this field (bind="$draft"), sent with the next click or submit. |
->filter | method of list | The items for which fn(item, index) is true. |
->filter | method of map | The entries for which fn(value, key) is true. |
->filter | method of set | The items for which fn(item) is true, as a set. |
->finally | method of batch | The job to dispatch once every job of the batch has run, whether or not they succeeded. Returns the batch, to… |
finally | statement | Runs after the <try> body and any <catch>, whether or not there was an error. |
->find | method of document | The zero-based match offset in the document's source, or -1. |
->find | method of formatted_file | The zero-based source offset of the first literal match, or -1. |
->find | method of latex | The zero-based source offset of the first literal match, or -1. |
->find | method of list | The first item for which fn(item, index) is true, or with last, the last one; null when none is. |
->find | method of map | The first entry for which fn(value, key) is true, as { key, value }, or null. |
->find | method of markdown | The zero-based source offset of the first literal match, or -1. |
->find | method of model | The record with this key, or null. |
->find | method of query | The record with this key, or null. |
->find | method of set | The first item (in the order they were added) for which fn(item) is true, or null. |
->find | method of users | The user with this id, or null. |
->find_all | method of string | Every match of a regular expression, as a list. |
->find_email | method of users | The user with this email (case doesn't matter), or null. |
->find_or_fail | method of model | The record with this key, or a ModelNotFound error (a 404 in a route). |
->find_or_fail | method of query | The record with this key, or a ModelNotFound error (a 404 in a route). |
->first | method of list | The first item, or null. |
->first | method of model | The first row, or null when none match. |
->first | method of query | The first row, or null when none match. |
->first | method of string | The first character. |
->first_or_create | method of model | The first record that matches, or a new one made from both maps. |
->first_or_fail | method of model | The first row, or a ModelNotFound error (a 404 in a route) when none match. |
->first_or_fail | method of query | The first row, or a ModelNotFound error (a 404 in a route) when none match. |
->first_or_new | method of model | The first record that matches, or a new one made from both maps that isn't saved yet: call ->save() to keep… |
->flash | method of session | Keeps a value for this request and the next one only: a message to show after a redirect, or the form's input… |
->flat_map | method of list | Maps each item, then spreads each result list by one level. |
->flatten | method of list | Lists inside the list are spread into it. |
float | type | A number that may have a fraction: 0.5 , 3.14 . |
@floor | command in KScript.Math | Rounded down. |
->floor | method of number | Rounded down. |
@fluid | command in KScript.Style | A size that grows with the screen: min (px) on screens up to from (default 640px), max on screens from to… |
->flush | method of logger | Writes out entries that providers hold back (they are also written when the script ends). |
kscript fmt | command line | Tidy scripts and pages. |
fn | statement | Declares a function, called like a command: @name(args) , or piped: $x | > @name() . Functions can be called… |
fn | type | A function: a lambda fn(x) => $x * 2 , or a declared function passed as @name . |
@focus | page directive | Give this element focus when it appears, or when its condition turns true: @focus() or @focus($editing). |
->folder | method of storage | A folder inside this one, with the same methods. |
@folders | command in KScript.IO | The folders in a folder, as file values. |
for | option of listener | The event it listens for. |
for | option of policy | The model, or type, the policy is for. |
for | statement, written for item in list | Loops over a list, a map or a range such as 0..10 (end exclusive) or 0..100 step 5. $loop holds index, first… |
Forbidden | error type | A request the signed-in user isn't allowed to make. Answers 403. |
FORCE_COLOR | environment variable | Set to 1 to keep colours when the output isn't a terminal, such as in CI logs. 0 and false turn them off. |
->force_delete | method of model | Deletes every row that matches, even for models that extend SoftDeletes. Returns how many. |
->force_delete | method of query | Deletes every row that matches, even for models that extend SoftDeletes. Returns how many. |
->force_delete | method of record | Deletes the record from the table, even for a model that extends SoftDeletes. |
ForeignKeyViolation | error type | A save or delete that would leave a record pointing at one that isn't there. Answers 409. |
Format | error type | Text that isn't in the expected format, such as a date. |
format | kscript.json setting | Used by kscript fmt and the editor's Format Document. Values set here win over the editor's tab settings. |
->format | method of currency | An amount written in this currency: £1,234.50. |
->format | method of date | Writes the date the way a date_format says: ->format(dd-MM-yyyy), ->format('d MMMM yyyy') or… |
->format | method of date_format | The date written this way: 07-03-2026. |
->format | method of locale | A number or date written the way this locale writes it: 1.234,5 in de-DE. |
->format | method of money | The amount written for a locale, or the current one: £10.00 in en, 10,00 £ in fr. |
->format | method of number | Formats the number (.NET format, N0 by default: 1,234). |
format. | kscript.json setting | false turns formatting off for the project: kscript fmt skips its files and Format Document makes no changes. |
format. | kscript.json setting | Line endings to write. auto keeps the ones each file already uses. |
format. | kscript.json setting | Files and folders kscript fmt leaves alone. |
format. | kscript.json setting | Files kscript fmt formats in a project folder, as globs relative to kscript.json. .xml files that start with… |
format. | kscript.json setting | Spaces per indent level, or "tab" to indent with tabs. |
format. | kscript.json setting | Blank lines kept in a row; extra ones are removed. |
format. | kscript.json setting | Elements whose content is kept exactly as written, on top of <pre>, <textarea>, <script>, <style> and CDATA… |
format. | kscript.json setting | The longest a line should be (80 by default). Longer lines are wrapped: a start tag gets one attribute per… |
format. | kscript.json setting | Turn individual formatting rules off, e.g. { "statement_per_line": false }. Every rule is on unless listed. To… |
format. | kscript.json setting | .kscript files: put else, elif, catch and finally on the line of the closing '}'. Off: they stay where they… |
format. | kscript.json setting | Shrink runs of blank lines to max_blank_lines. |
format. | kscript.json setting | End the file with exactly one newline. Off: the file ends as it did. |
format. | kscript.json setting | Re-indent elements by how deeply they are nested. Off: lines keep their indentation. |
format. | kscript.json setting | .kscript files: one space after commas and colons, around assignments and =>, and before a block's '{'. Off… |
format. | kscript.json setting | Put each statement and block-level element on its own line. Off: line breaks only change where there was… |
format. | kscript.json setting | One space between attributes, and <x /> for self-closing tags. Off: start tags are kept exactly as written. |
format. | kscript.json setting | Remove spaces at the ends of lines of text. |
format. | kscript.json setting | One attribute per line for long start tags and tags already written that way. Off: tags are never wrapped or… |
format. | kscript.json setting | .kscript files: a one-line function (fn name() => body) that runs past print_width moves its body to the next… |
format. | kscript.json setting | .kscript files: a -> chain or |> pipe that runs past print_width puts each call on its own line, indented… |
format. | kscript.json setting | .kscript files: a // or /// comment line that runs past print_width is broken between words onto a new comment… |
format. | kscript.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. | kscript.json setting | With "indent": "tab", how many columns a tab counts as when lining up existing text. |
@format_bytes | command in KScript.Core | A number of bytes for people: 1.4 MB, in powers of 1000. With binary: true, powers of 1024 (1.3 MiB). |
@format_currency | command in KScript.Core | An amount of money for the locale: @format_currency(9.5, 'EUR') is €9.50 in en and 9,50 € in fr. |
@format_date | command in KScript.Core | A date for the locale. style: short, medium (the default), long, full, time, datetime, or a pattern such as 'd… |
@format_duration | command in KScript.Core | A length of time in words for the locale: 1h30m is 1 hour 30 minutes, 1 heure 30 minutes in fr. |
@format_list | command in KScript.Core | Items joined for the locale: a, b and c (or a, b or c with style: or). |
@format_number | command in KScript.Core | A number written for the locale: 1,234.5 in en, 1 234,5 in fr. |
@format_ordinal | command in KScript.Core | A whole number as an ordinal for the locale: 1st, 2nd, 23rd in en, 1er and 2e in fr. |
@format_percent | command in KScript.Core | A fraction as a percentage for the locale: 0.25 is 25%. |
@format_relative | command in KScript.Core | How long ago or ahead a date is, in words for the locale: 3 hours ago, in 2 days, il y a 3 jours. Measured… |
->formatted | method of iban | The IBAN in groups of four, the way it is printed: GB82 WEST 1234 5698 7654 32. |
formatted_file | type | Source code from a text block tagged with a file type such as ps1 , with .extension and .text . |
->fresh | method of record | The record as the database has it now (a new record), or null if it was deleted. |
->from | method of any | Reads text written in a format: a shortcut for ->convert(from: type). ->from(type: csv, not header) reads csv… |
->from_base64 | method of string | Base64 text decoded. |
@full_path | command in KScript.IO | The absolute path. |
G
@gcd | command in KScript.Math | The greatest common divisor of two whole numbers, exact at any size. |
->get | method of cache | The value kept under a key, or default (null) when it isn't there or has run out. |
->get | method of config | A setting by path (database.port, servers.0.name), or default when it isn't set. |
->get | method of map | The value for a key, or the default. |
->get | method of model | Runs the query: a list of records (maps, for a table with no model). |
->get | method of query | Runs the query: a list of records (maps, for a table with no model). |
->get | method of session | The value kept under a key, or default (null). |
Get | statement in KScript.Http | A route for GET requests to a path. It is answered by a controller (to), a view, a redirect, or the statements… |
GITHUB_TOKEN | environment variable | A GitHub token kscript update and kscript ide install send with their requests, so they aren't limited the way… |
go: | handler shorthand | Sends the browser to a path on this site: go: '/notes' is @live_redirect('/notes'). |
->grid | method of string | The text as rows of characters, one list per line, for maps and mazes: '#.\n.#'->grid() is [['#', '.'], ['.'… |
Grid | statement in KScript.UI | Lays its items out in equal columns, filling each row in turn: a board, a keypad, a gallery. |
->group | method of cache | A separate cache namespace inside this store. |
Group | statement in KScript.Http | Routes that share a path prefix, middleware or a name prefix. |
->group_by | method of list | A map from fn's result to the items that gave it. |
->group_by | method of model | Splits the rows into groups with the same values in these columns, for totals per group… |
->group_by | method of query | Splits the rows into groups with the same values in these columns, for totals per group… |
->group_by | method of set | A map from fn's result to a list of the items that gave it. |
guard | statement | Checks a precondition. When the test is false, its body must leave the current flow. |
guarded | option of model | Fields ->create($form) and ->update($form) don't set, so a form can't change them: [role] . Set them on the… |
@guest | command in KScript.Auth | The browser's guest id: the key of its Guest (a uuid, unless your copy of Guest says otherwise), kept in a… |
Guest | model in KScript.Auth | Someone using the app without an account. Each browser gets one, kept in a long-lived cookie, and it is stored… |
H
handle | type | @ followed by letters, digits, _, . or -: a username such as @joan. Lowercased. |
->has | method of cache | True when a value is kept under the key and hasn't run out. |
->has | method of config | True when the setting is set. |
->has | method of map | True when the key exists. |
->has | method of session | True when a value is kept under the key. |
@has_passkeys | command in KScript.Auth | True when this site has a configured passkey origin. |
->has_sent | method of fake_mail | True when mail went to the address (or user), as to, cc or bcc. |
@has_t | command in KScript.Core | True when a key has a translation in the current locale (or its fallbacks). |
->has_table | method of database | True when the database has a model's table or a table with the given name: $db->has_table(User) or… |
->hash | method of password | A hash to store instead of the password: argon2id (the default) or bcrypt, with a new random salt each time. |
->header | method of http_response | One header (or null). For Set-Cookie set more than once, the first; .headers has them all. |
->header | method of response | One response header (or null). For a header sent more than once, such as Set-Cookie, the first; .headers has… |
heading | statement in KScript.Terminal | Prints a heading in bold yellow, like the sections of kscript --help. |
->hex | method of color | Its #rrggbb form, without the alpha. |
hex | type | Hexadecimal digits, such as a hash: a3f9c0. Lowercased; 0x is dropped. |
hidden | option of model | Fields left out of JSON (and so out of route responses): [password] . |
->highlight | method of string | The code as highlighted HTML for a <pre>, coloured with the grammars the VS Code extension uses: each token in… |
->hit | method of rate_limit | Counts an attempt without running anything, such as a failed sign-in, and returns how many are left. |
->hmac | method of string | The HMAC of the text with a secret key, in hex (SHA-256 by default), as webhook signatures are made. Compare… |
@home | command in KScript.IO | The user's home folder. |
Http | error type | A mistake in a KScript.Http app, or a request that failed. |
http | kscript.json setting | KScript.Http: route files, middleware and their settings for kscript serve. |
http. | kscript.json setting | The prefix of api.* route files. |
http. | kscript.json setting | Sign-in with KScript.Auth, and the auth middleware. Times are seconds, or text such as "15m", "2h" or "30d". |
http. | kscript.json setting | Moves a guest's rows of Ownable models to their account when they sign in. |
http. | kscript.json setting | Failed sign-ins allowed per email and address before @attempt() makes them wait. |
http. | kscript.json setting | With sessions: database, false leaves making the kscript_sessions table to the project's migrations (kscript… |
http. | kscript.json setting | How long after a sign-in or a passkey check someone may add or remove a passkey, such as "5m". Unset allows it… |
http. | kscript.json setting | The session cookie's name. |
http. | kscript.json setting | False turns off the CSRF check that web routes get when their file imports KScript.Auth. |
http. | kscript.json setting | A folder, relative to the site, for users, sessions and tokens. By default they go in the app's data and state… |
http. | kscript.json setting | The guest id cookie's name. |
http. | kscript.json setting | How long a browser keeps its @guest() id. |
http. | kscript.json setting | Where the guest middleware sends people who are signed in, and @intended()'s default. |
http. | kscript.json setting | How long a session lasts after the last request. |
http. | kscript.json setting | How long failed sign-ins are counted over, and how long @attempt() then waits. |
http. | kscript.json setting | Where the auth middleware sends people who aren't signed in. |
http. | kscript.json setting | The public HTTPS origin for passkeys, or http://localhost with an optional development port. Setting this… |
http. | kscript.json setting | Keeps a passkey sign-in for the remember time, not only the browser session. |
http. | kscript.json setting | An optional relying party domain, such as example.com. Defaults to the passkey origin's hostname. |
http. | kscript.json setting | Allows new accounts to sign up with a passkey. Requires passkey_origin. |
http. | kscript.json setting | Where passkeys are kept: file (a SQLite file in the app's data folder) or database (the kscript_passkeys… |
http. | kscript.json setting | Signs people in to other apps (OpenID Connect, the code flow with PKCE). true uses the defaults. |
http. | kscript.json setting | How long a "remember me" sign-in lasts. |
http. | kscript.json setting | How long a password reset token works. |
http. | kscript.json setting | The cookie's SameSite. |
http. | kscript.json setting | Forces the cookie's Secure flag on or off. By default it is set for https requests. |
http. | kscript.json setting | Where sessions, API tokens, reset tokens and passkey challenges are kept: file (the app's state folder, so… |
http. | kscript.json setting | The environment variable holding the shared bearer token the auth middleware also accepts. |
http. | kscript.json setting | A KScript.Data model in the models folder, such as "User", that holds the users. By default they are JSON… |
http. | kscript.json setting | Settings for the cors middleware. |
http. | kscript.json setting | true allows cookies and Authorization from other origins. |
http. | kscript.json setting | Request headers allowed in preflight requests. |
http. | kscript.json setting | Methods allowed in preflight requests. |
http. | kscript.json setting | Origins allowed to call the API, or ["*"] (the default) for any. |
http. | kscript.json setting | Names for lists of middleware, used like a middleware name: { "admin": ["auth", "log"] }. |
http. | kscript.json setting | Response headers sent with everything the server answers (pages, files, routes and sign-in) unless a response… |
http. | kscript.json setting | Middleware run for every route, such as ["log"]. Built-ins: log, cors, auth, guest, csrf, throttle, etag… |
http. | kscript.json setting | The OpenAPI 3.1 document made from the routes. kscript serve answers /_openapi.json, /_openapi.yaml and the… |
http. | kscript.json setting | Believe a reverse proxy's X-Forwarded-For when the request carries its secret, so rate limits and sign-in… |
http. | kscript.json setting | The request header the proxy sends its secret in. |
http. | kscript.json setting | The environment variable holding the secret the proxy sends. |
http. | kscript.json setting | The route files, relative to the site folder. Without this, kscript serve loads routes.kscript and api.kscript… |
http. | kscript.json setting | Settings for the throttle middleware. |
http. | kscript.json setting | Requests allowed per window, per address and route. |
http. | kscript.json setting | The length of the window. |
http. | kscript.json setting | Where requests are counted: memory (this process), file (the app's cache folder) or database (shared by every… |
http. | kscript.json setting | The most bytes of files one request may upload ($request.files and live uploads): a number of bytes, or text… |
http. | kscript.json setting | The folder @view() looks in first. It is never served as pages. |
http. | kscript.json setting | false makes controllers read-only, like pages. Writes never leave the site folder. |
@http_client | command in KScript.Net | Returns a callable HTTP client. Call it with a relative path and optional request options. |
@hypot | command in KScript.Math | The length of the hypotenuse: sqrt(x² + y²). |
I
iban | type | An international bank account number, checked with its mod-97 digits. Kept in capitals without spaces. |
kscript ide | command line | Set up VS Code, Cursor, VSCodium or another editor. |
@if | page directive | Draws the tag only while the condition is true: @if($note). Same as <if $note> around it. |
if | statement | Runs its body when the test is true. Follow it with <elif> and <else> for other cases. |
Import | error type | An import that can't be found or a package that isn't imported. |
import | statement | Imports a package ( package="KScript.Terminal" ), or the top-level <fn> functions and <let const> values of… |
->in | method of ip | True when the address is in the block, such as '10.0.0.0/8'. |
->in_random_order | method of model | Reads the rows in a random order, a new one each time: Quote->in_random_order()->first() . |
->in_random_order | method of query | Reads the rows in a random order, a new one each time: Quote->in_random_order()->first() . |
include | statement in KScript.Web | Renders another page file here. Other attributes become its variables. |
->increment | method of cache | Adds to the number under a key (1 by default; 0 when it isn't there) and returns the new number. |
->increment | method of model | Adds to a number column on every row that matches (1 by default). Returns how many rows changed. |
->increment | method of number | The number plus 1. |
->increment | method of query | Adds to a number column on every row that matches (1 by default). Returns how many rows changed. |
->increment | method of record | Adds to a number field in the database in one statement, so two requests at once both count, and sets the… |
increment: | handler shorthand | Adds 1 (or by:) to a number field: increment: $count, by: 5. |
Index | error type | A position outside a list. |
index | option of model | Fields to index, so queries on them are fast: [team_id, [team_id, created_at]] . |
Index | statement in KScript.Data | An index of the table CreateTable makes. |
->index_of | method of list | The index of an item (compared with ==), or of the first item for which a fn(item, index) is true; with last… |
->index_of | method of string | Where text first occurs, or with last, where it last occurs; -1 when it doesn't. With ignore_case, upper and… |
->info | method of logger | Logs a message at info level, with an optional map of fields. |
info | statement in KScript.Terminal | Prints the text after a blue INFO label, as kscript's own commands do. [Bracketed] parts are shown bold. |
@inject | command in KScript.Core | The record of a model that the route being answered holds. As the default of an input, post: Post = @inject()… |
Input | error type | Input that couldn't be read. |
input | statement in KScript.Terminal | Asks for a line of input and stores it. The element text is the prompt. With type , the answer is converted… |
->insert | method of document | Returns a document with same-format source or plain text added at the given offset. |
->insert | method of formatted_file | Returns a copy with text or source of the same format inserted at a zero-based offset. With no offset… |
->insert | method of latex | Returns a copy with text or source of the same format inserted at a zero-based offset. With no offset… |
->insert | method of list | A new list with item inserted at index. |
->insert | method of markdown | Returns a copy with text or source of the same format inserted at a zero-based offset. With no offset… |
->insert | method of model | Adds rows: a map, or a list of maps. On a model each one is checked like ->create(). Returns how many were… |
->insert | method of query | Adds rows: a map, or a list of maps. On a model each one is checked like ->create(). Returns how many were… |
int | type | A whole number: 42 , -7 . A number with a fraction isn't an int. |
@intended | command in KScript.Auth | Where to go after signing in: the page the auth middleware sent someone away from, else default… |
Internal | error type | A fault in KScript itself, not in the script. |
->intersect | method of list | The items that are in other too, each once and in order. Items match with ==, or by what by: gives for each. |
->intersect | method of set | The items that are in other too, in this set's order. |
Invoice | statement in KScript.Document | An invoice: from and to addresses, the invoice number and dates, a table of items with subtotal, tax and… |
IO | error type | Reading or writing a file failed. |
ip | type | An IPv4 or IPv6 address, written the standard way: 192.168.0.1 or 2001:db8::1. |
->is | method of error | True when the error is this type or one that extends it: $err->is(NotFound), $err->is(IO). |
->is | method of mime | True when it matches text/html, text/* or / . |
->is | method of record | True when the other record is the same row: a record of the same model with the same key, or that key itself… |
->is | method of type | True when the value is a record of this type, or of a type built on it with with [...]. Given a type, true… |
->is_a | method of any | True when the value has this type, or when text passes validation for a native type such as uuid. |
->is_blank | method of string | True when the text is empty or contains only whitespace. |
@is_confirmed | command in KScript.Auth | True when the signed-in user signed in or checked their passkey within this long (http.auth.confirm_within, or… |
->is_dirty | method of record | True when the record has changes that aren't saved: any field, or the one named. |
->is_dst | method of timezone | True when summer time is in effect, now or at a date. |
->is_empty | method of list | True when the list has no items. |
->is_empty | method of map | True when the map has no keys. |
->is_empty | method of set | True when the set has no items. |
->is_empty | method of string | True when the text has zero characters. |
->is_enabled | method of logger | True when entries at this level would be written, so costly messages can be skipped. |
->is_even | method of number | True when the number is even. |
@is_file | command in KScript.IO | True if a file is at the path. |
@is_folder | command in KScript.IO | True if a folder is at the path. |
->is_limited | method of rate_limit | True when the attempts are used up for now. |
->is_null | method of any | True when the value is null. |
->is_numeric | method of string | True when the whole text is a number, such as '42', '-3.5' or '1e3'. Spaces around it are allowed. |
->is_odd | method of number | True when the number is odd. |
->is_same | method of date | True when both dates are in the same day (the default), week, month, quarter or year. |
->is_saved | method of record | True when the record is in the database: it was read from it or has been saved. |
@is_signed_in | command in KScript.Auth | True when someone is signed in (by the session or an API token). |
->is_strong | method of password | True when the password passes ->strength() with these rules. |
->is_subdomain_of | method of domain | True when it is the other domain or under it: api.example.com is under example.com. |
->is_subset | method of set | True when every item is also in of. With strict, of must have at least one item more. Turn it round for a… |
@is_terminal | command in KScript.Terminal | True when a person is at a terminal, false when input or output is redirected (a pipe, a file, a test). Use it… |
->is_within | method of slash_path | True when it is the other path or under it: /docs/guides/start is within /docs. Names are compared exactly… |
->iso | method of date | The date in ISO 8601 format. |
->iso | method of duration | The length in ISO 8601: PT1H30M. |
@italic | command in KScript.Terminal | Italic text. |
item | statement | An entry of <collection>. With key it is a map entry, without it a list item. Its text is the value (numbers… |
Item | statement in KScript.Document | An item of a list. Its text works like a Paragraph's. |
J
job | statement in KScript.Queue | Declares a job: work to do later, on a queue, by kscript worker . Its fields are the data it needs, typed like… |
JobFailed | error type | A queued job that used up its tries. $err.cause is the last error. |
JobTimeout | error type | A queued job that ran longer than its timeout. |
->join | method of file | A file value for the joined path. Parts can be separate arguments or a list, as in $dir->join(['a', 'b.txt']). |
->join | method of list | The items joined into text (', ' by default). |
->join | method of set | The items joined into text (', ' by default), in the order they were added. |
->join | method of slash_path | The path with more names added on the end and tidied: /docs joined with 'guides/../start' is /docs/start. A /… |
->join | method of url | The url a link to path leads to from here: ../img/a.png or /about. |
@join_path | command in KScript.IO | Joins a folder and the parts below it with the right separator. Parts may be a list: @join_path(base: $folder… |
Json | error type | Text that isn't valid JSON. |
json | type | Text that holds valid JSON. ->convert(from: json) gives the value. |
jwt | type | A JSON Web Token: three base64url parts. Its claims can be read; its signature isn't checked. |
K
key | option of model | The field that is the key. Default: id, an int the database numbers, added when the model doesn't declare it. |
Key | statement in KScript.Data | A key of two or more columns, for the table CreateTable makes: a pivot table's. |
key: | handler modifier | Runs only for this key, with any modifier keys: key: enter, key: [ctrl, s]. |
->keys | method of cache | The keys that are kept and haven't run out. |
->keys | method of map | The keys, as a list. |
@known_folder | command in KScript.IO | A standard folder: home, desktop, documents, downloads, music, pictures, videos, appdata or temp. |
kscript | kscript.json setting | The KScript release the project is written for: 0.51.0, or 0.51 for the newest 0.51.x. Every kscript command… |
kscript | statement, written a .kscript file | The root of a script. Everything the script does goes inside. |
KScript. | package | Language models (Claude): @llm, @chat and <llm>. |
KScript. | package | Sign-in for kscript serve apps: users, sessions, the auth and guest middleware, CSRF, password resets and API… |
kscript. | VS Code setting | Add the end tag when you finish typing a start tag in a .ks.xml script: <echo> becomes <echo></echo> . |
kscript. | VS Code setting | Draw a thin line between the top-level blocks of a script (functions, loops and comment-headed sections), like… |
KScript. | package | A cache of values by key, with time limits: in memory, or in files in the app's cache folder. |
kscript. | VS Code setting | Show Run above a script, Run test above each test and how many times each function is used. |
KScript. | package | The language itself: variables, branches, loops, functions, errors, imports and echo. Always imported. |
KScript. | package | Databases: models, a query builder, transactions and raw SQL, on SQLite, Postgres, MySQL and MariaDB. |
KScript. | package | Papers, reports, letters and invoices with LaTeX maths, saved as PDF, LaTeX, Word, Markdown or HTML without a… |
KScript. | package | Routes, controllers and middleware: <KScript.Routes> files served by kscript serve. |
KScript. | package | Files and folders: read, write, list, move, copy and delete. |
KScript. | package | Email: @send_mail over SMTP, to the log or to a fake, now or on a queue, with HTML, text or a view, and… |
KScript. | package | Markdown to HTML, with front matter. |
KScript. | package | Roots, powers, trigonometry, logarithms, random numbers and statistics. |
KScript. | package | HTTP requests (@api) and downloads. |
kscript. | VS Code setting | Check KScript in .html and .md pages (sites run with kscript serve ). |
kscript. | VS Code setting | List problems for every KScript file in the project, as kscript check reports them, not only for open files. |
KScript. | package | Queued jobs: job declarations, dispatch, retries with backoff, failed jobs, the worker that runs them, and the… |
kscript. | VS Code setting | Arguments that start the language server. |
kscript. | VS Code setting | The kscript executable that runs the language server. Leave empty to use the installed KScript (… |
KScript. | package | App folders for config, data, cache, state and logs, in the right place on each platform. |
KScript. | package | Stylesheets written in KScript (.ks.css, .ks.scss, .ks.sass), with colour, size and responsive helpers. |
KScript. | package | Prompts, menus, colours, Markdown, and artisan-style labels, tasks and tables for terminal scripts. |
KScript. | package | Tests run by kscript test: <test>, <describe>, <expect>, <expect_error>, <capture> and @assert(). |
kscript. | VS Code setting | Log the messages between VS Code and the language server. |
KScript. | package | Desktop windows with buttons, text, inputs and timers, on macOS, Windows and Linux. |
KScript. | package | Web pages run by kscript serve: layouts, components and live blocks. |
KSCRIPT_AI_MODEL | environment variable | The model llm and @llm() use when a script doesn't name one with model: . |
KSCRIPT_ENV | environment variable | The environment a script or server runs in, such as staging or production . Its settings files (… |
KSCRIPT_ERROR_PATHS | environment variable | Set to full and the error a script stops with names its file by its whole path, so an editor that runs scripts… |
KSCRIPT_INSTALL | environment variable | The folder the install script puts kscript in. The binary goes in its bin folder. |
KSCRIPT_LIVE_RELOAD | environment variable | Set to 0 to turn off live reload in kscript serve , as --no-reload does, so open pages aren't refreshed when a… |
KSCRIPT_LOCALE | environment variable | The locale for translations when the script doesn't choose one with locale(set: ...) and $config.i18n.locale… |
KSCRIPT_NO_MODIFY_PATH | environment variable | Set to 1 and the install script doesn't add kscript to your shell profile or your Windows PATH. |
KSCRIPT_PROJECT_DATA_ROOT | environment variable | The folder relative auth and SQLite paths in kscript.json are under, instead of the project folder, such as… |
KSCRIPT_REPO | environment variable | The GitHub repository the install scripts, kscript update , kscript version , kscript compile and kscript ide… |
KSCRIPT_SECRET | environment variable | The app's secret: kscript serve signs live pages and components with it, and @signed_url() , @encrypt() and… |
KSCRIPT_SERVE_IN_DOCKER | environment variable | Tells kscript serve it is already inside a container, so it starts the web server instead of handing over to… |
KSCRIPT_SERVE_MIGRATE | environment variable | Set to 1 and kscript serve applies pending migrations before it serves, and stops if one fails. kscript serve… |
KSCRIPT_SOURCE | environment variable | The KScript checkout the Docker files kscript make docker writes build from, for an unpublished or modified… |
KSCRIPT_STACK_TRACE | environment variable | Set to 1 to show the .NET exception and stack trace under an error, as kscript --stack-trace does. 0 and false… |
KSCRIPT_STORAGE_ROOT | environment variable | Moves every app's folders to <root>/<app>/<kind> , such as <root>/notes/data : KScript.Auth's users and… |
KSCRIPT_SWITCHED | environment variable | Set by kscript for the version of KScript it runs for you (see KSCRIPT_USE ), so that version runs the command… |
KSCRIPT_TEMPLATES | environment variable | The folder of your own kscript make project templates. kscript make templates project copies the built-in ones… |
KSCRIPT_USE | environment variable | The version of KScript to run, for every command in this terminal or just one: an exact release such as 0.50.0… |
KSCRIPT_VERSION | environment variable | The release the install script installs, such as v0.34.0 . The Dockerfiles kscript make project writes take it… |
L
->last | method of list | The last item, or null. |
->last | method of string | The last character. |
->latest | method of model | Sorts newest first by the supplied column. Defaults to created_at, or the primary key for a model that doesn't… |
->latest | method of query | Sorts newest first by the supplied column. Defaults to created_at, or the primary key for a model that doesn't… |
->latest | method of semver[] | The highest release, leaving out prereleases (null when there is none). ->max() includes prereleases. |
Latex | statement in KScript.Document | LaTeX, from its text, a latex value or a .tex file, read as a document part reads it: sections, paragraphs… |
latex | type | A LaTeX document, from a text block tagged latex . See Documents . |
@latex_escape | command in KScript.Document | Text made safe to put in a LaTeX file: \ { } $ & % # _ ~ ^ escaped. |
layout | statement in KScript.Web | Wraps the page in a layout file. Extra attributes become variables in the layout ( $title ). |
@lcm | command in KScript.Math | The least common multiple of two whole numbers, exact at any size: @lcm(4, 6) is 12. |
let | statement, written $name = value | Declares a variable in the current scope. The value goes in value , or in the element text for longer values… |
Letter | statement in KScript.Document | A letter: the sender's address and date on the right, the recipient, a subject line, a greeting, the body… |
kscript lib | command line | Install a KScript source library or restore the project's pinned libraries. |
libraries | kscript.json setting | Installed source libraries by folder name. kscript lib add records the exact revision; kscript lib restore… |
library | kscript.json setting | Declares an installable library or points to its folder. |
@lighten | command in KScript.Style | Adds to HSL lightness, as @adjust_lightness(color, amount) does. The amount can be a fraction (0.1) or a… |
->lighten | method of color | Mixed with white: amount 0.2 (the default) is a fifth of the way. |
Limit | error type | A limit was reached, such as too much recursion. |
->limit | method of model | Reads at most this many rows. |
->limit | method of query | Reads at most this many rows. |
->lines | method of string | The lines of the text, as a list. |
lint | kscript.json setting | Used by kscript check and by the editor (language server). |
lint. | kscript.json setting | Files and folders that are never checked, by kscript check or the editor. A name without / (such as… |
lint. | kscript.json setting | Files kscript check looks at, as globs relative to kscript.json. .xml files that start with <kscript> are… |
lint. | kscript.json setting | Severity per diagnostic code (KS3003) or code prefix (KS3*). The longest match wins. |
lint. | kscript.json setting | Make kscript check fail on warnings too (same as --warnings-as-errors). |
->list | method of storage | The names of the files in the folder, such as ['notes/a.txt', 'settings.json']. pattern is a wildcard like '… |
List | statement in KScript.Document | A bulleted or numbered list of Item elements. A List right after an Item is nested in it. |
list | type | A list of values: [1, 2, 3] . T[] is a list of T, such as string[] . |
listener | statement in KScript.Queue | Listens for an event. Each <fn> inside takes the event and runs, in order, when @dispatch_event() dispatches… |
listens_to | option of job | An event the job listens to: each @dispatch_event() of it queues the job, with its fields filled from the… |
live | statement in KScript.Web | A reactive block: its on-* handlers run on the server and only this block is redrawn. No page JavaScript… |
@live-action | page directive | Names the @on-action handler, so client code can call it with KScriptLive.call() . |
@live-client | page directive | Runs a client action registered with KScriptLive when the element is clicked, without a trip to the server. |
@live-cloak | page directive | Hides the element until the page's live code has started, so nothing half-drawn shows. |
@live-dirty | page directive | Shows the element while a binding has edits not yet sent. Name a field to watch only that one… |
@live-disable | page directive | Disable this control while an action is pending, or while a condition holds: @live-disable(while: $saving). |
@live-error | page directive | Shows the element only after an action fails. |
@live-id | page directive | Gives this component a name that stays the same between updates, so two of the same component keep their own… |
@live-ignore | page directive | Leaves everything inside the element alone during updates, for a widget the browser or a script manages. |
@live-key | page directive | Gives each repeated element a key that stays the same between updates, so a moved row keeps its focus and… |
@live-loading | page directive | Shows the element only while an action is running, such as a spinner. |
@live-navigate | page directive | Follows the link without a full page load, swapping in the new page. |
@live-navigate-once | page directive | Runs this <script> only once, even when in-page navigation comes back to the page. |
@live-offline | page directive | Shows the element only while the browser is offline. |
@live-portal | page directive | Draws this <template> 's content somewhere else in the page, at the CSS selector given: live-portal="#modals"… |
@live-replace | page directive | Replaces the element whole on each update instead of patching it. |
@live-stream | page directive | Receives what an action streams to this name, as it arrives. |
@live-upload | page directive | Sends the files picked in this file input with the next action. They are in $event.files . |
@live-use-name | page directive | Attaches a client directive registered with KScriptLive , by its name: @live-use-autosize() . |
@live_download | command in KScript.Web | Downloads bytes from a live action as a file. Use a filename without directory separators. |
@live_redirect | command in KScript.Web | Sends the browser to a path on this site after a live action. |
@llm | command in KScript.AI | Asks a language model (Claude) and returns its answer. The options are the llm statement's, given by name… |
llm | statement in KScript.AI | Sends its text as a prompt to a language model (Claude) and stores the answer. @llm(prompt, ...) takes the… |
->load | method of record | Loads relations onto the record now (again, if they were loaded): $post->load(author, tags) . Returns the… |
@locale | command in KScript.Core | The current locale, such as fr or en-GB. |
locale | statement | Changes the current locale, which @t() and the @format_ commands use. Without set , picks the best available… |
locale | type | A language tag (BCP 47) such as en, en-GB or pt-BR, in its usual case. |
@locale_path | command in KScript.Core | A site path for a locale, for language links: @locale_path('/about', 'fr') is /fr/about. The default locale… |
@locales | command in KScript.Core | The locales there are translation files for. |
->lock | method of cache | Runs work while holding a lock that no other request or worker using this store can hold, and returns what… |
->lock_for_update | method of model | Locks the rows read until the transaction ends, so nobody else changes them first. Use it inside a… |
->lock_for_update | method of query | Locks the rows read until the transaction ends, so nobody else changes them first. Use it inside a… |
->log | method of logger | Logs a message at a level given by name. |
log | statement | Logs its text through $log's providers, at a level. Fields add values such as { user: $id }. |
$log | variable | The script's logger: $log->info('Saved', { id: $id }), $log->named('db')->debug(...). Providers and levels… |
@log10 | command in KScript.Math | The base 10 logarithm. |
@log2 | command in KScript.Math | The base 2 logarithm. |
log_provider | statement | Adds somewhere for log entries to go: the console, a file, memory (for tests), a function, or a type a package… |
@logarithm | command in KScript.Math | The logarithm: natural (base e) unless a base is given. |
@login | command in KScript.Auth | Signs a user in: the session gets a new id and the user. remember keeps them signed in for http.auth.remember… |
@logout | command in KScript.Auth | Signs out: the session ends and its cookie is removed. everywhere ends the user's sessions on every device. |
->lower | method of string | The text in lower case. |
kscript lsp | command line | Start the language server (LSP over stdio). |
M
mac | type | A network card's MAC address, written as six lowercase pairs: 00:1a:2b:3c:4d:5e. |
kscript make | command line | Start a new project, or generate a file: a route (added to the routes file), controller, request, middleware… |
make | kscript.json setting | Settings for kscript make. |
make. | kscript.json setting | The syntax kscript make writes scripts, tests, routes and desktop apps in: kscript (.kscript files) or xml… |
->map | method of list | A new list with fn(item, index) applied to each item. |
->map | method of map | A new map with fn(value, key) applied to each value. |
->map | method of set | A set of fn(item) for each item. Items that map to the same value become one. |
map | type | Names and values: { name: 'Joan', age: 82 } . |
->map_keys | method of map | A new map with each key replaced by fn(key, value). A later entry wins when two get the same key. |
@markdown | command in KScript.Markdown | Renders Markdown: $doc.html, $doc.title, $doc.meta (front matter) and $doc.text. |
Markdown | statement in KScript.Document | Markdown, from its text or a file: # headings become sections, with paragraphs, lists, tables, code, quotes… |
markdown | statement in KScript.Web | Renders its Markdown text (with { } values, escaped) to HTML. |
markdown | type | A Markdown document, from a text block tagged markdown . See Documents . |
->markdown_escape | method of string | The text escaped so Markdown shows it as written. |
->mask | method of string | The text with each character replaced by char (* by default), apart from the last keep_end characters… |
->match | method of regex | The first match: { text, index, groups, captures }, where groups holds named groups (?<name>...) and captures… |
match | statement | Compares one value against several cases. Inside, $it is the value. |
->match_all | method of regex | Every match, as { text, index, groups, captures } maps. |
->matches | method of string | True when the text matches a regular expression: ->matches(/^[a-z]+$/i). |
Math | error type | A calculation with no answer, such as dividing by zero, or maths in a document that can't be read. |
Math | statement in KScript.Document | A displayed equation in LaTeX, numbered unless numbered: false. Its text is used as written, so braces are… |
@max | command in KScript.Core | The largest of the arguments (or of one list). |
->max | method of grouped_query | The largest value of a column in each group. |
->max | method of list | The largest item, or the item with the largest by: fn(item): ->max(by: .score). |
->max | method of model | The largest value of a column, or null when no rows match. |
->max | method of number | The larger of the two. |
->max | method of query | The largest value of a column, or null when no rows match. |
->max | method of set | The largest item, or the item with the largest by: fn(item). |
max | option of type | The largest value allowed, read by the base type: a number for int and float, a date for date, a length for… |
kscript mcp | command line | Serve these docs to AI coding assistants (Claude Code, Cursor, VS Code...) over MCP, offline. |
->md5 | method of string | The MD5 hash of the text, in hex. |
@median | command in KScript.Math | The middle number (or the mean of the two middle numbers). |
->median | method of list | The middle number in the list. |
menu | statement in KScript.Terminal | Shows a numbered list and stores the chosen item. The element text is the title. |
->merge | method of map | A new map with other's keys added or replaced. |
message | option of error | The message, with the fields as variables: No {$kind} with id {$id} . throw NotFound(id: 1, message: '...')… |
Middleware | statement in KScript.Http | Middleware for the routes that follow it in this file or group. |
Migration | error type | A migration that can't be read or run, or a kscript db command that can't go ahead. |
Migration | statement in KScript.Data | A migration file, in database/migrations: the steps that change the tables, run in order by kscript db migrate… |
mime | type | A media type such as text/html or application/json, lowercased, with any parameters. |
@min | command in KScript.Core | The smallest of the arguments (or of one list). |
->min | method of grouped_query | The smallest value of a column in each group. |
->min | method of list | The smallest item, or the item with the smallest by: fn(item): ->min(by: .price). |
->min | method of model | The smallest value of a column, or null when no rows match. |
->min | method of number | The smaller of the two. |
->min | method of query | The smallest value of a column, or null when no rows match. |
->min | method of set | The smallest item, or the item with the smallest by: fn(item). |
min | option of type | The smallest value allowed, read by the base type: a number for int and float, a date for date, a length for… |
@mix | command in KScript.Style | The colour part way to the other: amount is how far (0 to 1, default 0.5, which is halfway). |
->mix | method of color | The colour part way to the other: amount 0.5 (the default) is halfway. |
mixin | option of model | Declares reusable fields, methods and options for other models. A mixin has no table. |
@mode | command in KScript.Math | The number that occurs most often. When several tie, the smallest of them. |
model | statement in KScript.Data | Declares a model: a <type> whose records are kept in a database table. User->where(role: admin)->get() reads… |
ModelNotFound | error type | A KScript.Data record that isn't in the database: ->find_or_fail() and ->first_or_fail(). $err.model and… |
ModelUpdate | statement in KScript.Http | Lets a named HTML model form edit selected fields of a record owned by the signed-in user. |
money | type | An amount with a currency. Write GBP9.50 directly in expressions. Typed money also accepts text such as 'GBP… |
@move | command in KScript.IO | Moves (or renames) a file or folder, and returns it as a file value. to is a full path, or an existing folder… |
->move | method of storage | Moves (or renames) a file or folder inside the folder. overwrite replaces what is at to. |
->move_to | method of file | Moves (or renames) the file or folder and returns it at its new place. to is a full path, or an existing… |
MultipleRecordsFound | error type | ->sole() found more than one row, when it expects exactly one. |
N
Name | error type | A name that doesn't exist: a variable, function, field or method. |
name | kscript.json setting | The project's name. |
->named | method of logger | A logger for a category, such as db (inside a named logger, db.queries). |
natives | kscript.json setting | Where the project's native types are: folders (everything inside, subfolders too) or globs, relative to… |
->needs_rehash | method of password | True when the stored hash was made with weaker settings or another algorithm than ->hash() uses now, so it… |
->needs_rehash | method of password_hash | True when the hash was made with weaker settings (or another algorithm) than ->hash() uses now, so it should… |
Network | error type | A request that failed or got an error status. $err.status is the status, when there is one. |
->next | method of cron | The next time the schedule runs, after a date or after now. |
->next_times | method of cron | The next few times it runs. |
NO_COLOR | environment variable | Set to anything and kscript, echo and KScript.Terminal print without colours. |
normalize | statement | Cleans up a value before a <type>'s rules check it, such as trimming or lower-casing. The value is $value … |
->normalize_unicode | method of string | Normalizes Unicode using the given form (NFC by default). |
->not | method of bool | The opposite bool. |
not | option of type | Values that aren't allowed, each a value of the base type, such as reserved names: [@admin, @root] for a… |
NotFound | error type | Something that doesn't exist. Answers 404. |
@now | command in KScript.Core | The current date and time. |
->now | method of timezone | The time now in this zone. |
Null | error type | Using null where a value is needed. |
number | type | Any number, whole or not. |
->numbers | method of list | Every number in the list, in order: numbers stay as they are, text gives the numbers in it, and lists inside… |
->numbers | method of string | Every number in the text, in order, as numbers: 'x=-3, y=12'->numbers() is [-3, 12]. A minus makes a number… |
O
->offset | method of model | Skips this many rows first. |
->offset | method of query | Skips this many rows first. |
->offset | method of timezone | Its offset from UTC, such as +01:00, now or at a date. |
@oidc_abort | command in KScript.Auth | Ends a sign-in step without signing in: the app is told access_denied. Gives the address to send the browser… |
@oidc_account_deleted | command in KScript.Auth | Call as a user's account is deleted: their app grants go, and each app with an account_deletion_uri is sent a… |
@oidc_connections | command in KScript.Auth | The apps the signed-in user has let sign them in, newest first: client_id, client_name, scopes, granted_at and… |
@oidc_consent | command in KScript.Auth | Answers a consent step: allow lets the app see what it asked for, from now on; otherwise the app is told… |
@oidc_disconnect | command in KScript.Auth | Takes an app's access away from the signed-in user: the app's tokens stop working at once, and it asks again… |
@oidc_interaction | command in KScript.Auth | The sign-in step an app sent this browser to (http.auth.provider), for the page at {interaction}/{uid}: uid… |
@oidc_subscriptions | command in KScript.Auth | Asks each app with a subscriptions_uri which subscriptions the user has there, all at once, before their… |
->oldest | method of model | Sorts oldest first by the supplied column. Defaults to created_at, or the primary key for a model that doesn't… |
->oldest | method of query | Sorts oldest first by the supplied column. Defaults to created_at, or the primary key for a model that doesn't… |
->omit | method of map | A copy without the given keys, in the original map's order. |
@on-action | page handler | Runs when client code calls the action named by @live-action with KScriptLive.call() . What it sent is in… |
@on-cancel | page handler | Runs when a <dialog> is cancelled, such as with Escape. |
@on-change | page handler | Runs when a control's value is committed, such as a select being picked or a checkbox ticked. |
@on-click | page handler | Runs when the element is clicked: @on-click(toggle: $open) . |
@on-close | page handler | Runs when a <dialog> closes. |
@on-dblclick | page handler | Runs when the element is double-clicked. |
@on-dragend | page handler | Runs when a drag of this element ends. After @drag , $event.x and $event.y are where it landed. |
@on-drop | page handler | Runs when something is dropped on the element: a @drag(copy) ghost, whose value is in $event.drag_value . |
@on-enter | page handler | Runs when Enter is pressed in the element: <input @on-enter(add: $draft, to: $tags)> . |
@on-escape | page handler | Runs when Escape is pressed in the element. |
@on-event | page handler | Runs when another live block on the page sends an event with @emit_event or emit: . Pick which with… |
@on-focusin | page handler | Runs when the element, or something inside it, gets focus. |
@on-focusout | page handler | Runs when focus leaves the element and everything inside it. |
@on-init | page handler | Runs once, when the component is first drawn: load what it shows here. |
@on-input | page handler | Runs each time a control's value changes as the person types. The new value is in $event.value . |
@on-keydown | page handler | Runs when a key is pressed. Pick the key with key: , as in @on-keydown(save: $note, key: [ctrl, s]) . |
@on-keyup | page handler | Runs when a key is let go. |
@on-pointercancel | page handler | Runs when the browser takes over a pointer, such as to scroll the page. |
@on-pointerdown | page handler | Runs when a mouse button, pen or finger goes down on the element. |
@on-pointerup | page handler | Runs when the mouse button, pen or finger comes up. |
@on-sort | page handler | Runs when the person drags one of the @sort-item children to a new place. $event.order is the new order. |
@on-submit | page handler | Runs when a form is submitted, instead of the browser posting it: <form @on-submit($save)> . |
@on-tick | page handler | Runs again and again, as often as @every says: <p @on-tick(increment: $seconds) every="1s"> . |
@on-visible | page handler | Runs when the element scrolls into view, such as to load the next page of a list. |
on: | option of @bind | When the value is sent: input (as you type, the default for text), change, blur (when focus leaves) or action… |
once | handler modifier | Runs the first time only: once. |
one_of | option of type | The only values allowed, each a value of the base type: [gb, ie] for a country, [1, 2, 3] for an int. Compared… |
->only | method of list | The items of a type (->only(semver), ->only(number)) or that a filter of the items' type keeps… |
->only_trashed | method of model | For models that extend SoftDeletes: reads only the deleted records. |
->only_trashed | method of query | For models that extend SoftDeletes: reads only the deleted records. |
kscript openapi | command line | Write the OpenAPI 3.1 document for a site's routes, made from the code. kscript serve also answers… |
optional | option of fn | The method may be omitted by a type implementing this signature. |
Options | statement in KScript.Http | A route for OPTIONS requests to a path. It is answered by a controller (to), a view, a redirect, or the… |
->or | method of any | The value if it is truthy, otherwise fallback. |
->or_where | method of model | Like ->where(), joined with or: rows that match the conditions so far, or these. |
->or_where | method of query | Like ->where(), joined with or: rows that match the conditions so far, or these. |
->order_by | method of model | Sorts the rows: ->order_by(name) , ->order_by(created_at: desc, name: asc) . |
->order_by | method of query | Sorts the rows: ->order_by(name) , ->order_by(created_at: desc, name: asc) . |
$os | variable | The computer: $os.name (windows, macos or linux), $os.user, $os.machine, $os.home, $os.temp, $os.separator… |
->overlaps | method of set | True when the two share at least one item. not $a->overlaps($b) is true when they have nothing in common. |
override | option of fn | Inside <extend>: true replaces the type's built-in method of the same name. Without it, reusing a built-in… |
Ownable | mixin in KScript.Auth | Rows that belong to one owner: the signed-in user, or the browser's guest. A model that extends Ownable gets a… |
P
packages | kscript.json setting | Packages every script in the project uses without an <import>. KScript.Core is always imported. |
->pad | method of string | The text padded at the end to width, or at the start with start: '7'->pad(3, '0', start) is 007. |
PageBreak | statement in KScript.Document | Starts a new page. |
->pages | method of document | How many pages the PDF has. |
->pages | method of latex | How many pages the PDF has. |
->pages | method of markdown | How many pages the PDF has. |
->paginate | method of model | One page of rows: { items, page, per_page, total, last_page, from, to, has_more }. per_page is 15 by default… |
->paginate | method of query | One page of rows: { items, page, per_page, total, last_page, from, to, has_more }. per_page is 15 by default… |
Paragraph | statement in KScript.Document | A paragraph. Its text may hold bold , italic , code , links , ( maths ), [@key] citations, [#id]… |
params | option of fn | Parameters, with optional types and defaults: who, greeting = 'Hello' or count: int = 1 . |
->parse | method of date_format | Reads text written this way as a date: dd-MM-yyyy reads '07-03-2026'. |
parse | option of type | On a type with fields: an expression that turns text into a map of the fields, with the text as $value and the… |
@parse_env | command in KScript.Core | Parses .env text (NAME=value lines) into a map. ${NAME} uses earlier lines or the environment. |
@parse_query | command in KScript.Net | Parses URL query text into a map. Repeated names have a list of values in order. |
->partition | method of list | Returns [matching, remaining], testing each item once. |
@passkey | command in KScript.Auth | Runs one step of a passkey ceremony from one of the app's own POST routes, as /_ks/passkeys/{action}/{step}… |
@passkeys | command in KScript.Auth | Lists the signed-in session user's passkeys for this site: each one's id, created_at, last_used_at (null until… |
password | type | A secret. It prints as ********, can't be compared with ==, and is hashed to be stored. |
Patch | statement in KScript.Http | A route for PATCH requests to a path. It is answered by a controller (to), a view, a redirect, or the… |
path | option of type | A JSON file holding a sample of the data. Its keys become fields; <field> elements and fields replace the ones… |
->path_of | method of storage | The full path of a file in the folder. The folder's own path is the field .path. |
paths | kscript.json setting | Where kscript make puts each kind of file, relative to the site folder. Leave a folder out to use the… |
paths. | kscript.json setting | Page components (kscript make component). |
paths. | kscript.json setting | Controllers (kscript make controller, kscript make route). |
paths. | kscript.json setting | JSON data that stores and caches write. |
paths. | kscript.json setting | Document scripts that write PDF and Word files (kscript make document). |
paths. | kscript.json setting | Events, dispatched with @dispatch_event() (kscript make event). |
paths. | kscript.json setting | Jobs (kscript make job). |
paths. | kscript.json setting | Page layouts (kscript make layout). |
paths. | kscript.json setting | Shared functions and constants (kscript make module, kscript make const, kscript make cache). |
paths. | kscript.json setting | Listeners, run the first time an event is dispatched (kscript make listener). |
paths. | kscript.json setting | Translations (kscript make locale). |
paths. | kscript.json setting | Log providers (kscript make logger). |
paths. | kscript.json setting | Middleware (kscript make middleware). |
paths. | kscript.json setting | Database models (kscript make model). |
paths. | kscript.json setting | HTML that pages <include> (kscript make partial). |
paths. | kscript.json setting | Policies, one per model, that @can and @authorize ask (kscript make policy). |
paths. | kscript.json setting | Typed request bodies (kscript make request). |
paths. | kscript.json setting | Route files: web.kscript (served at /) and api.kscript (under /api). |
paths. | kscript.json setting | Scripts (kscript make script). |
paths. | kscript.json setting | JSON file stores (kscript make storage). |
paths. | kscript.json setting | .ks.css stylesheets (kscript make css). |
paths. | kscript.json setting | Tests (kscript make test). |
paths. | kscript.json setting | Types and enums (kscript make type, kscript make enum). |
paths. | kscript.json setting | Views that controllers render with @view() (kscript make view). Also where @view() looks, unless http.views is… |
paths. | kscript.json setting | Desktop windows (kscript make window). |
pattern | option of type | A regular expression the value's text must match: /^[a-z0-9-]+$/ . On a type made from a number, the text is… |
pause | statement in KScript.Terminal | Waits for a key press (or Enter when input is piped). The element text is the prompt. |
@pending | page directive | Add classes while an action runs: @pending('saving'), or @pending('crumple', for: 'delete') for one method's… |
@percentile | command in KScript.Math | The value below which p percent of the numbers fall, from 0 to 100, between neighbours when it falls between… |
Permission | error type | A file outside the allowed folder, or a change to read-only files. |
->permutations | method of list | Every ordering of size items (all of them by default), in list order: [1, 2, 3]->permutations(2) is [[1, 2]… |
phone | type | A phone number in E.164: + then the country code and number, 8 to 15 digits. Spaces, dots, dashes and brackets… |
$pi | variable | π, about 3.14159. |
@pick | command in KScript.Math | A random item from a list. |
->pick | method of map | A copy containing only the given keys, in the original map's order. |
picker | statement in KScript.Terminal | Asks for a file or folder path, and asks again until it exists. |
placeholder | statement in KScript.Web | What a lazy or deferred live component shows before it loads. |
Platform | error type | Something this operating system can't do. |
->pluck | method of list | One field from each item, or a map of the selected fields for each item when given a list of keys. |
->pluck | method of model | One column of every row that matches, as a list: User->pluck(email) . |
->pluck | method of query | One column of every row that matches, as a list: User->pluck(email) . |
@plural | command in KScript.Core | The plural category of a number in a language: zero, one, two, few, many or other. |
policy | statement in KScript.Auth | Says who may do what to a model's records. Each <fn> inside is an ability, named for what it allows (create… |
->pop | method of list | A new list without its last item. |
port | type | A network port, a whole number from 1 to 65535. |
->positions_of | method of list | Where an item is in a list of lists, such as a ->grid(): every cell equal to it (compared with ==), or for… |
Post | statement in KScript.Http | A route for POST requests to a path. It is answered by a controller (to), a view, a redirect, or the… |
->prepend | method of list | A new list with items added to the start. |
->press | method of page_visit | Presses a key on the element with on-keydown (the one with this text, label or placeholder, when given in:)… |
prevent | handler modifier | Stops the browser's own action for the event, such as saving the page on ctrl+s: prevent. |
private | option of fn | Inside a <type> or <model>: true keeps the method to the type's own methods. In a .kscript file, private fn… |
->product | method of list | The items multiplied together (or fn for each item); 1 for an empty list: [2, 3, 4]->product() is 24. |
progress | statement in KScript.Terminal | Shows a progress bar for work done in steps, and stores it: $bar->advance() moves it on. The element text is… |
->prompts | method of fake_llm | The prompts the script sent, oldest first: the text of each question. |
prop | statement in KScript.Web | Declares a value a layout or component receives from its caller. |
kscript publish | command line | Copy a model a package ships, such as User, Guest or Ownable, into your models folder to change it, or write… |
->pull | method of cache | The value kept under a key, which is then removed; default (null) when it isn't there. |
->pull | method of session | The value kept under a key, which is then removed: a one-time value such as a code. default (null) when it… |
->push | method of list | A new list with items added to the end. |
->pushed | method of fake_queue | The jobs dispatched so far, or only those of one job type: pushed(SendWelcome). |
Put | statement in KScript.Http | A route for PUT requests to a path. It is answered by a controller (to), a view, a redirect, or the statements… |
Q
@queries | command in KScript.Data | The SQL statements this run has sent, oldest first (the last 1000), each as { sql, bindings, database }. In a… |
Query | error type | A database query that failed, or a condition that can't be turned into SQL. |
->query | method of model | A query on the model with no conditions yet, to build on. |
@query_string | command in KScript.Net | A 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… |
@queue | command in KScript.Queue | A queue, to look at or empty: @queue('mail')->size() . Defaults to the default queue of the default… |
kscript queue | command line | Look after the queues: what is waiting, what failed and why, and run failed jobs again. |
queue | kscript.json setting | KScript.Queue: where dispatched jobs wait, and what kscript worker runs (see docs/queues.md). |
queue | option of job | The queue it goes on, unless the dispatch names one. Defaults to default. |
queue. | kscript.json setting | Named connections. file, database, memory and sync are always there. |
queue. | kscript.json setting | The connection jobs go to unless a job or dispatch names another: file, database, memory, sync, or one under… |
queue. | kscript.json setting | Settings per environment, e.g. { "test": { "default": "sync" } }. kscript test uses sync unless env.test says… |
queue. | kscript.json setting | What happens to jobs that fail every try. |
queue. | kscript.json setting | How long failed jobs are kept, such as "7d" or a number of seconds. |
queue. | kscript.json setting | The only queues a worker checks, first to last, e.g. ["high", "default"]. Without it a worker checks default… |
queue. | kscript.json setting | How kscript worker runs jobs. |
queue. | kscript.json setting | How many jobs a worker runs at once. |
queue. | kscript.json setting | How long a worker waits when the queues are empty. |
->queued | method of fake_mail | The mail that was sent with queue, or only the mail to one address. |
Quote | statement in KScript.Document | A quotation, set in from both margins. |
R
@radians | command in KScript.Math | Degrees to radians. |
@random | command in KScript.Math | A random number: from 0 up to 1 with no arguments, or a whole number from low to high (both included). |
@random_bytes | command in KScript.Math | Generates 1 to 65536 bytes with the operating system's cryptographic random generator. Returns lowercase hex… |
@random_seed | command in KScript.Math | Makes @random(), @pick() and @shuffle() repeat the same sequence, for tests. |
@range | command in KScript.Core | Numbers from start up to (not including) end; with one argument, from 0. start..end is the short form when the… |
@rate_limit | command in KScript.Cache | A rate limit for anything, not just routes: at most limit attempts per key in each window of per, such as 5… |
@rate_limited | command in KScript.Queue | Job middleware, for fn middleware(): at most limit jobs with this key start in each period, across every… |
->read | method of loopback_json_stream | Reads one UTF-8 JSON object (up to 256 KiB) within the active transaction's deadline. |
->read | method of storage | A file's text, or default (null) when it isn't there yet. |
@read_bytes | command in KScript.IO | Reads every byte of a file as a base64 value, including binary data. |
->read_bytes | method of file | Every byte of the file as a base64 value, including binary data. |
->read_bytes | method of storage | Every byte of a file as a base64 value, or default (null) when it isn't there yet. |
@read_csv | command in KScript.IO | Reads CSV as rows of maps (or rows of lists with header: false). An optional type validates the rows. |
@read_env | command in KScript.IO | A .env file (NAME=value lines) read into a map. ${NAME} uses earlier lines or the environment. |
@read_json | command in KScript.IO | A JSON file read into maps and lists. With as: a <type>, the data is checked and turned into records. |
->read_json | method of file | The file read as JSON. With as: a type, the data is checked and turned into records. |
->read_json | method of storage | Reads JSON and checks it against the optional as type, mapping a list item by item. A missing file returns… |
@read_lines | command in KScript.IO | The lines of a file. |
->read_lines | method of file | The file's lines. |
@read_markdown | command in KScript.Markdown | Reads a Markdown file: $doc.html, $doc.title, $doc.meta (front matter) and $doc.text. Relative paths are from… |
@read_text | command in KScript.IO | The text of a file. Relative paths are from the script's folder. |
->read_text | method of file | The file's text. |
@read_yaml | command in KScript.IO | A YAML file read into maps and lists. |
@redirect | command in KScript.Http | A redirect to another address (302 Found by default; 301 for a permanent move). |
@redirect_back | command in KScript.Http | A redirect to the page the request came from (its Referer), the usual answer to a form that didn't validate… |
->reduce | method of list | Combines the items into one value: fn(total, item) gives the next total from the last one and the next item… |
->reduce | method of map | Combines the entries into one value: fn(total, value, key) gives the next total, starting from initial… |
->reduce | method of set | Combines the items, in the order they were added, into one value: fn(total, item) gives the next total… |
Reference | error type | A document that refers to a section, figure or source it doesn't have, or uses an id twice. |
->regenerate | method of session | Gives the session a new id, keeping its values. @login() does this for you. |
regex | type | A regular expression with flags i, m, s and x, written /.../ in code. |
@register | command in KScript.Auth | Adds a user and returns it (without signing them in). The email and password are checked by the email and… |
->reject | method of list | The items for which fn is false. |
->reject | method of map | The entries for which fn(value, key) is false. |
->reject | method of set | The items for which fn(item) is false, as a set. |
->relative_to | method of file | The path relative to a folder. |
@release_job | command in KScript.Queue | In a job's handle: puts the job back on its queue without using up a try, to run again after a while… |
->reload | method of config | Reads the files again. |
@rem | command in KScript.Style | Pixels as rem: @rem(24) is 1.5rem (base 16). |
->remaining | method of rate_limit | How many attempts are left in this window. |
->remember | method of cache | The value under a key; when there isn't one, calls compute, keeps what it returns and returns that. |
->remove | method of cache | Removes a key. True when it was there. |
->remove | method of list | A new list without any items equal to item. |
->remove | method of map | A new map without the key. |
->remove | method of queue | Deletes a failed job of this queue for good, as kscript queue delete does. True when there was one with that… |
->remove | method of session | Removes a value. True when it was there. |
->remove | method of set | A new set without the items. An item the set doesn't have is ignored. |
remove: | handler shorthand | Removes a value from a list field: remove: $tag, from: $tags. |
->remove_at | method of list | A new list without the item at index. |
RenameField | statement in KScript.Data | Renames a column, keeping its rows. |
RenameTable | statement in KScript.Data | Renames a table. Foreign keys that point to it follow. |
->repeat | method of string | The text repeated count times. |
->replace | method of document | Returns a document made from the source with every literal match replaced. |
->replace | method of formatted_file | Returns a copy with every literal match replaced. |
->replace | method of latex | Returns a copy with every literal match replaced. |
->replace | method of markdown | Returns a copy with every literal match replaced. |
->replace | method of regex | The text with every match replaced. with is text, where $1 and ${name} are groups, or fn(match) returning… |
->replace | method of string | The text with every old replaced by new. old can be a regex: ->replace(/\s+/, ' '), and new can use its groups… |
->replace_at | method of list | A new list with the item at index replaced; negative counts from the end. |
->replicate | method of record | A copy of the record that isn't saved yet, without its key and timestamps (and the fields named in except)… |
kscript repo | command line | Register a GitHub repository that provides named libraries. |
$request | variable | The HTTP request. Inside a matched route it also contains the client ip, parsed json, combined input and route… |
->require | method of config | A setting that must be set: fails with a clear message when it isn't. |
->reset | method of chat | Forgets the conversation (keeps the system prompt). |
reset: | handler shorthand | Puts a field (or a list of fields) back to its declared default: reset: $draft, or reset: [$title, $done]. |
@reset_password | command in KScript.Auth | Finishes a password reset: gives the token's user the new password (checked by the password type) and ends… |
@reset_token | command in KScript.Auth | Starts a password reset: a token to put in a link you email to the person, or null when no user has that… |
Resource | statement in KScript.Http | The usual routes of a JSON resource, answered by the functions a controller script exports: index (GET path)… |
respond | statement in KScript.Web | Ends the request with this response. header-<name>="..." attributes send headers, such as header-set-cookie. |
@response | command in KScript.Http | A response with a status code and headers. A map or list body is sent as JSON, text as HTML, and a base64… |
->restore | method of model | For models that extend SoftDeletes: brings back the deleted records that match. Returns how many. |
->restore | method of query | For models that extend SoftDeletes: brings back the deleted records that match. Returns how many. |
->restore | method of record | Brings back a soft-deleted record. Returns the record. |
Retired | error type | A KScript 1 feature that KScript 2 doesn't have. |
@retry | command in KScript.Core | Calls work, and calls it again when it throws, up to times calls in all; returns what it returns, or throws… |
->retry | method of queue | Puts a failed job back on its queue, with its tries reset: true when there was one with that id. With all… |
retry_on | option of job | Only errors of these types are retried: [Timeout, Network]. Others fail the job at once. |
retry_until | option of job | How long after it was dispatched it may still be retried, such as 1h. |
return | statement | Ends the function with a value. |
returns | option of fn | The declared return type. |
->reveal | method of card | The whole number. Only use it to pass the card on to a payment provider; never store or log it. |
->reveal | method of password | The password's text. Only use it to pass the password on, such as to another service's login. |
->reverse | method of list | A reversed copy. |
->reverse | method of string | The text backwards. |
@revoke_passkey | command in KScript.Auth | Revokes one of the signed-in session user's passkeys by its id. True when it was removed. |
@revoke_token | command in KScript.Auth | Revokes an API token, given as the token or its id (from @api_tokens()). With user, only a token of theirs is… |
->rgb | method of color | Its red, green, blue (0-255) and alpha (0-1): { r, g, b, a }. |
->rotate | method of list | The items moved by places, wrapping round: [1, 2, 3, 4]->rotate(1) is [2, 3, 4, 1], and a negative by moves… |
@round | command in KScript.Math | Rounded to a number of decimal places (0 by default). Halves round away from zero. |
->round | method of number | Rounded to a number of decimal places (0 by default). |
@route | command in KScript.Http | Returns the URL for a named route. Pass the route name as nonempty text and supply the values for its path… |
Route | statement in KScript.Http | A route for several HTTP methods at once. |
@route_is | command in KScript.Http | True if the current request matched this route name or canonical pattern. |
@route_match | command in KScript.Http | Looks up a path and method without dispatching it. Returns status, route, parameters, and allowed methods. |
@routes | command in KScript.Http | Lists declared HTTP routes and canonical file-based pages. Filter by kind or the declared type of attached… |
kscript routes | command line | List the routes of a site. |
Routes | statement in KScript.Http | A route file: maps HTTP methods and paths to controllers, views and redirects. kscript serve loads… |
Row | statement in KScript.UI | Puts its items side by side. |
Rule | statement in KScript.Document | A horizontal line across the text. |
->run | method of chain | Runs the jobs now, here, one after another. |
->run | method of job | Runs the job's handle now, here, without a queue. Errors reach the caller. |
Run | statement in KScript.Data | KScript that runs at its place among the steps, in the migration's transaction: to move rows into a table or… |
->run_all | method of fake_queue | Runs the dispatched jobs in order (and any they dispatch), then forgets them. Returns how many ran. |
@run_script | command in KScript.Test | Runs another script on its own and returns what happened: { output, code, error }. output is what it printed… |
S
->satisfies | method of semver | True when the version is in the range: ^1.2.0, ~1.2, >=1.0.0 <2.0.0, 1.x, or several joined with ||. |
->save | method of csv | Writes the CSV to a file. Adds .csv when the path has no extension. |
->save | method of document | Saves the document. The filename extension selects the format unless as is given. |
->save | method of formatted_file | Writes the source to a file. Adds the fence extension when the path has no extension. |
->save | method of latex | Writes the document to a file. The filename extension (or as:) picks the format: .tex keeps the source, and… |
->save | method of markdown | Writes the document to a file. The filename extension (or as:) picks the format: .md keeps the source, and… |
->save | method of record | Saves the record: adds it when it is new, otherwise writes the fields that changed (and updated_at). Returns… |
save: | handler shorthand | Saves a KScript.Data record: save: $note is $note->save(). |
->scan | method of list | Like ->reduce(), but keeps every running total: [1, 2, 3]->scan(fn(total, n) => $total + $n) is [1, 3, 6]… |
kscript schedule | command line | Run the tasks of the schedule file (schedule.kscript) at their times: once for this minute, every minute until… |
Schedule | statement in KScript.Queue | The schedule file (schedule.kscript): the tasks kscript schedule work runs at their times, each a <Task> with… |
->schema | method of type | The type as a JSON Schema map. |
$script | variable | This script: $script.path, $script.dir, $script.name. |
kscript <script> | command line | Run a script ($args holds the arguments; --env picks kscript.staging.json, .env.staging...). The word run can… |
Section | statement in KScript.Document | A section with a numbered heading. A Section inside a Section is a subsection. |
@secure_equals | command in KScript.Core | True when two secrets, such as a webhook signature and the one you worked out, are the same. Takes the same… |
->select | method of model | Reads only these columns: ->select(id, name) . Records get null for the others. |
->select | method of query | Reads only these columns: ->select(id, name) . Records get null for the others. |
Select | statement in KScript.UI | A drop-down list tied to a variable. |
self | handler modifier | Runs only when the event starts on this element itself, not on something inside it: self. |
semver | type | A semantic version such as 1.4.2, 2.0.0-beta.1 or 1.0.0+build.5. A leading v is dropped. |
->send | method of loopback_json_stream | Writes one newline-terminated UTF-8 JSON object (up to 256 KiB). |
@send_mail | command in KScript.Mail | Sends an email and returns it as a map. to (and cc and bcc) take an address, a user with an email, or a list… |
->sent | method of fake_mail | The mail sent so far, queued or not, or only the mail to one address (or user): each a map of to, cc, bcc… |
kscript serve | command line | Serve pages, and routes.kscript / api.kscript routes. |
serve | kscript.json setting | Defaults for kscript serve. Options on the command line win. |
serve. | kscript.json setting | Run kscript serve through Docker Compose. True uses the default app service and mounts the working tree for… |
serve. | kscript.json setting | Build the service image before starting. |
serve. | kscript.json setting | Compose file relative to the project folder. |
serve. | kscript.json setting | Launch Docker Compose by default. |
serve. | kscript.json setting | Container path for a read-only project bind mount. Null uses the image's files. |
serve. | kscript.json setting | The Compose service that runs the site. |
serve. | kscript.json setting | Also serve the KScript docs, with a page about this project's routes, functions and types, on localhost while… |
serve. | kscript.json setting | The port the docs are served on. Without it, 4180, or a free port if that is in use. |
serve. | kscript.json setting | localhost, an IP address to listen on, or * for every address. |
serve. | kscript.json setting | The port to listen on. |
serve. | kscript.json setting | A folder, relative to kscript.json, whose files are served from the site's root as they are: /brand/logo.png… |
serve. | kscript.json setting | The site folder, relative to kscript.json. Its files and folders are the site's URLs. |
$session | variable | The request's session: values kept between requests by a cookie. $session->set('cart', $items)… |
->set | method of cache | Keeps a value under a key. ttl is how long, such as 30s, 10m, 2h or 1d (a plain number is seconds). Without it… |
->set | method of map | A new map with the key set. |
->set | method of session | Keeps a value in the session, for this request and the ones after it. It starts a session (and sends its… |
set | statement, written $name += value | Changes an existing variable. Fails if the variable was never declared (a typo guard) or is const. Without… |
set | type | Items that each appear once, kept in the order they were first added: ['tea', 'milk'] as set . set(of: T) is a… |
set: | handler shorthand | Sets a field to a value: set: $tab, to: 'notes'. |
@set_exchange_rate | command in KScript.Core | Sets a rate for this run. One unit of from buys rate units of to. Overrides the project's money.exchange_rates… |
->set_if_absent | method of cache | Stores a value only when the key is missing or expired. True if this call stored it. |
->set_password | method of users | Gives a user a new password, checked by the password type, and returns the user. |
->sha1 | method of string | The SHA-1 hash of the text, in hex. Use it only where another system asks for SHA-1. |
->sha256 | method of file | The SHA-256 hash of the file's bytes, in hex. |
->sha256 | method of string | The SHA-256 hash of the text, in hex. |
->sha512 | method of string | The SHA-512 hash of the text, in hex. |
Shape | error type | Data that doesn't fit a <type>. $err.problems lists each problem with its JSON path. |
->shapes | method of list | Every place a mask fits (->shapes(Tree), or ->shapes([Block, Ell]) for several), and every square, rectangle… |
->shapes | method of string | Every place a mask fits (->shapes(Tree), or ->shapes([Block, Ell]) for several), and every square, rectangle… |
@show | page directive | Shows the tag while the value is true and hides it (keeping it in the page) while false: @show($open). |
@shuffle | command in KScript.Math | A copy of a list in random order. |
@sign | command in KScript.Math | -1, 0 or 1. |
signature | option of fn | Declares a method signature without an implementation. |
@signed_url | command in KScript.Http | A link only this app could have made, for unsubscribe, verify and download links: a route's name with its… |
@sin | command in KScript.Math | The sine of an angle in radians. |
->since | method of date | The whole days, weeks, months or years from other to this date, negative when other is later. Months and years… |
@sitemap | command in KScript.Http | An XML sitemap for an explicit list of public paths, with the given HTTP or HTTPS origin. |
->size | method of queue | How many jobs are waiting, including delayed ones. |
->skip | method of list | All but the first count items. |
->skip_locked | method of model | With ->lock_for_update(): skips rows another transaction has locked, instead of waiting. Good for taking jobs… |
->skip_locked | method of query | With ->lock_for_update(): skips rows another transaction has locked, instead of waiting. Good for taking jobs… |
@skip_render | command in KScript.Web | Keeps the current HTML after a live action while saving its state and sending any effects. |
->skip_while | method of list | The items after those at the start for which fn(item, index) is true. |
slash_path | type | Names joined by /, such as /docs/getting-started or /My Apps/Notes: a page, menu or category path rather than… |
->slice | method of list | The items from start up to (not including) end; negative positions count from the end. |
->slice | method of string | Part of the text; negative positions count from the end. |
Slider | statement in KScript.UI | A slider tied to a number variable. |
slot | statement | In a layout or component: where the page's (or caller's) content goes. In a component's render for a window, a… |
slug | type | Lowercase words joined by -, for URLs: my-first-post. |
@slugify | command in KScript.Core | Turns text into a slug: 'Hello, World!' gives hello-world. Accents are dropped. |
SoftDeletes | mixin in KScript.Data | Adds deleted_at to a model: ->delete() sets it instead of removing the row, and queries leave those records… |
->sole | method of model | The one row that matches: a ModelNotFound error (a 404 in a route) when none do, and a MultipleRecordsFound… |
->sole | method of query | The one row that matches: a ModelNotFound error (a 404 in a route) when none do, and a MultipleRecordsFound… |
->sort | method of list | A sorted copy: by: fn(item) gives the key to sort on, ->sort(by: .name), and order: desc puts the largest… |
->sort | method of map | A copy with its entries sorted by by: fn(value, key), as a list's ->sort(by:) is; order: desc puts the largest… |
->sort | method of set | The items as a sorted list: by: fn(item) gives the key and order: desc puts the largest first. |
@sort-axis | page directive | Says which way the @sort-item children run: vertical (the default) or horizontal. |
@sort-item | page directive | Marks a child of an @on-sort element as one that can be dragged to a new place, with the value it is known by… |
Source | statement in KScript.Document | A work to cite, written out: id: is the key for [@key], and other attributes are BibTeX fields (author, title… |
->sources | method of config | The files the settings came from, in order: a list of { name, path, kind }. |
Spacer | statement in KScript.UI | Empty space. |
spawn | statement | Runs a function in the background. The script waits for it before it ends. |
->split | method of list | The list cut into lists at each separator item, which is dropped: ['tea', 'milk', '', 'juice']->split('') is… |
->split | method of money | The 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… |
->split | method of regex | The text split at every match. |
->split | method of string | The parts between each separator (or between spaces), as a list. The separator can be a regex… |
@sql | command in KScript.Data | Runs SQL. Each { } in it is worked out and sent as a parameter, never pasted in: @sql("select * from users… |
->sql | method of database | Runs SQL, like @sql, on this connection. |
->sql | method of model | The SQL the query runs and its parameters, without running it: { sql, params }. |
->sql | method of query | The SQL the query runs and its parameters, without running it: { sql, params }. |
Sql | statement in KScript.Data | SQL to run as it is, for what the other steps can't do. db diff doesn't see what it changes, and rollback… |
@sqrt | command in KScript.Math | The square root. |
->sqrt | method of number | The square root. |
->squish | method of string | The text trimmed, with each run of spaces, tabs and line breaks inside made one space. |
standard | kscript.json setting | The standard (or standards) whose lint rules and format settings this project starts from; kscript.json's own… |
->start_of | method of date | The first moment of the day, week, month, quarter or year the date is in. A week starts on the locale's first… |
->starts_with | method of string | True when the text starts with this text. With ignore_case: true, upper and lower case match. |
state | statement in KScript.Web | A variable of a <live> block that keeps its value between events. |
status | option of error | The HTTP status a KScript.Http route answers with, such as 404. Inherited from the type it extends. |
@stdev | command in KScript.Math | The population standard deviation. |
->stdev | method of list | The population standard deviation of the list. |
@storage | command in KScript.Storage | One of the app's folders, in the right place for this platform: config (settings), data (the app's files)… |
@stream | command in KScript.Web | Sends an update to a visible live-stream target before the action finishes. Text is literal by default. Use… |
->strength | method of password | How hard the password is to guess: { score (0 to 4), label, ok, problems }. Rules: min length (8), max, upper… |
string | type | Text. Quoted with ' (as written) or " (with $name and { } filled in). |
->strip | method of string | The text without one exact prefix, suffix or both, where present: 'v1.2'->strip(prefix: 'v')… |
@stylesheet | command in KScript.Style | Compiles a stylesheet written in KScript and returns the CSS (or Sass). |
->submit | method of page_visit | Runs the on-submit handler of the form (the one with this text, when given) and redraws its block. |
->subtract | method of date | The date this many years, months, weeks and days earlier: ->subtract(days: 7). For hours and minutes, take… |
->subtract | method of duration | The second length taken from this one: 1h30m->subtract(45m) is 45m. |
->subtract | method of money | Takes another amount away, in this amount's currency, converting a foreign amount the same way ->add() does… |
success | statement in KScript.Terminal | Prints the text after a green DONE label. |
@sum | command in KScript.Math | The total of the numbers (or of one list). |
->sum | method of grouped_query | The total of a column in each group (0 for a group with only empty values). |
->sum | method of list | The total of the items (or of fn for each item). |
->sum | method of model | The total of a column over the rows that match (0 when none do). |
->sum | method of query | The total of a column over the rows that match (0 when none do). |
->sum | method of set | The total of the items (or of fn for each item). |
surface | option of fn | For a component's render: where it draws, when its content doesn't show it. |
->sync | method of query | Links exactly these records through a many to many relation, unlinking the rest… |
Syntax | error type | A script that can't be read: bad syntax, an unknown element or a misplaced one. |
T
@t | command in KScript.Core | The translation of a key in the current locale (from locales/fr.json and so on), with {name} filled in from… |
->table | method of database | A query on a table with no model: rows come back as maps. |
table | option of model | The table its records are kept in. Default: the plural of the name in snake case (User is users, BlogPost… |
Table | statement in KScript.Document | A table: from rows:, or from Tr rows inside it. Tables with a caption are numbered. It takes the same rows… |
table | statement in KScript.Terminal | Prints a list of maps (or of lists) as a table with borders, like kscript queue status. It takes the same… |
->tables | method of database | The names of the tables in the database. |
->take | method of list | The first count items. |
->take_while | method of list | The items from the start for as long as fn(item, index) is true. |
@tan | command in KScript.Math | The tangent of an angle in radians. |
Task | statement in KScript.Queue | A task of the schedule: when it runs (cron or every) and what it does (job, dispatched to its queue, or run, a… |
task | statement in KScript.Terminal | Runs what's inside, then prints " name ........ 12ms DONE" (or FAIL, when it throws: the error goes on to be… |
$tau | variable | τ (2π), about 6.28318. |
->tel | method of phone | A tel: link for it: +447700900123 . |
@temp_folder | command in KScript.IO | The folder for temporary files. |
TERM | environment variable | When it is dumb , kscript prints without colours. |
@terminal_width | command in KScript.Terminal | The width of the terminal in characters (80 when it isn't a terminal). |
kscript test | command line | Run *.test.kscript and *.test.ks.xml tests. |
test | kscript.json setting | Used by kscript test. |
->test | method of regex | True when the text matches somewhere (use ^ and $ to match all of it). |
test | statement in KScript.Test | A test. Its body runs on its own when kscript test runs the file, and it passes if nothing in it fails. Inside… |
test. | kscript.json setting | The database KScript.Data gives each test file: memory (a new SQLite database in memory, made from the… |
test. | kscript.json setting | The environment the tests run in (KSCRIPT_ENV), so kscript.test.json can give tests their own database… |
test. | kscript.json setting | Files and folders that are never run as tests. |
test. | kscript.json setting | The test files kscript test runs, as globs relative to kscript.json. |
test. | kscript.json setting | Packages every test file imports, on top of the project's packages. KScript.Test is always imported in test… |
test. | kscript.json setting | Seconds one test may run before it fails (0 for no limit). timeout="..." on a <test> and --timeout win. |
Text | statement in KScript.UI | Shows text. { } inserts values. |
TextBox | statement in KScript.UI | A box to type in, tied to a variable. on:, trim: and as: say when and how the typed value is stored, as with… |
->then | method of batch | The job to dispatch once every job of the batch has succeeded. Returns the batch, to chain. |
throttle: | handler modifier | Runs at most once in this long, however often the event fires: throttle: 1s. |
throw | statement | Raises an error, which a <catch> can handle. Without a <try>, the script stops with the message. value throws… |
Timeout | error type | A request that took too long. |
timeout | option of job | The longest one attempt may run, such as 30s or 5m. Past it the attempt stops with a JobTimeout error… |
Timer | statement in KScript.UI | Runs on_tick again and again while it is in the layout (and when is true). The next tick is counted from when… |
->times | method of number | Calls fn(i) for i from 0 up to the number, and returns the results. |
->timestamp | method of date | Seconds since 1970-01-01 UTC. |
Timestamps | mixin in KScript.Data | Adds created_at and updated_at to a model. Both are set when a record is first saved, and updated_at changes… |
timezone | kscript.json setting | The time zone the project's stored dates are in, by its IANA name: Europe/London (the default)… |
timezone | type | An IANA time zone such as Europe/London or America/New_York, or UTC. |
->title | method of string | The text in Title Case. |
->to | method of any | Writes the value in a format: a shortcut for ->convert(to: type). headers: picks and orders csv columns, and… |
->to_base64 | method of string | The text encoded as base64. With url: true, it is URL-safe base64 without padding. |
->to_bool | method of string | Text such as 'true', 'false', 'yes', 'no', '1' or '0' as a bool. |
->to_date | method of number | Reads the number as a Unix timestamp, seconds since 1970-01-01 UTC: 1795996800->to_date() is 30 November 2026… |
->to_date | method of string | Reads the text as a date: '2026-11-22'->to_date(), or with the way it is written… |
->to_int | method of number | The whole-number part. |
->to_int | method of string | The text as a whole number, or default when it isn't one. |
->to_map | method of list | A map with fn(item) as each item's key. |
->to_number | method of hex | Its value as a number: 'ff' gives 255. |
->to_number | method of number | The number itself. |
->to_number | method of string | The text as a number, or default when it isn't one. |
->to_string | method of any | The value as text. |
@today | command in KScript.Core | Today's date, at midnight. |
->toggle | method of query | Links the records given that aren't linked and unlinks the ones that are. Returns { attached, detached }. |
toggle: | handler shorthand | Flips a bool field: toggle: $open is open = not $open. |
TooManyRequests | error type | Too many requests in a short time, such as failed sign-ins. Answers 429, with Retry-After when the error has a… |
->total | method of money[] | Adds the amounts in list order in the first currency, using the same exchange rates and rounding as +. An… |
->touch | method of record | Sets updated_at to now and saves, for a model that extends Timestamps: a parent whose list changed shows it… |
Tr | statement in KScript.Document | A table row: cells separated by |, each like a Paragraph's text. | is a | inside a cell. |
->trace | method of logger | Logs a message at trace level, with an optional map of fields. |
->transaction | method of database | Runs work in a transaction on this connection and returns what it returns: everything it saves is kept… |
->transaction | method of loopback_json_connection | Gives action exclusive use of the connection and returns its result. If action throws, the connection closes. |
transaction | statement in KScript.Data | Runs its statements in a transaction: what they save is kept when the block ends, and undone if anything in it… |
translations | statement | Says where translation files are and which locale to fall back to. Usually set in config under i18n instead. |
tries | option of job | Attempts before it counts as failed. Defaults to 3. |
->trim | method of string | The text without spaces (or the given characters) at either end, or only at the start or the end… |
trim | option of @bind | Trims spaces from both ends on the way in: trim. |
@trunc | command in KScript.Math | With the fraction removed. |
->truncate | method of string | Shortens the text to length, adding suffix (… by default). |
try | statement | Runs its body, handing errors to its <catch> elements. <finally> always runs. |
->ttl | method of cache | How long until a key runs out, as a duration, or null when it never does or isn't there. |
Type | error type | A value of the wrong type, such as text where a number is needed. |
->type | method of any | Returns the value's type name. A list with one element type returns its type followed by [] , such as number[]… |
type | option of const $name = value | Convert the value to this type, or fail early: a built-in such as int, an <enum>, a <type>, T[] for a list, T?… |
type | option of extend | The type to add methods to: date, string, number, bool, list, map, fn, email, handle, uuid, regex, password, a… |
type | statement | Declares the shape of some data, such as an API response. ->convert(from: json, as: Repo) , Repo($data) , <let… |
types | kscript.json setting | Default validation rules for built-in types. Arguments at a type's use site can override these defaults. |
types. | kscript.json setting | |
types. | kscript.json setting | |
types. | kscript.json setting | Rules for uuid values: the typeRules settings, plus v for the UUID version. |
U
UI | error type | A desktop window that can't be opened, such as on a machine without the window library. |
Unauthorized | error type | A request that needs someone to sign in. Answers 401. |
@underline | command in KScript.Terminal | Underlined text. |
->union | method of list | The items of both lists, each once: this list's first, then the new ones from other. Items match with ==, or… |
->union | method of set | The items of both: this set's first, then the new ones from other. $set + $other gives this too. |
->unique | method of list | The list without duplicates, using strict equality (===), or keeping the first item for each by: fn(item… |
unique | option of model | Fields no two records may share: [email] , or [email, [team_id, slug]] for a pair that is unique together… |
unique_by | option of job | The fields that make two dispatches the same for unique_for: [user_id]. Defaults to all of them. |
unique_for | option of job | While a job with the same fields is waiting or running, another dispatch of it is dropped, for this long at… |
UniqueViolation | error type | A save that would give two records the same value in a unique field. $err.fields names them. Answers 409. |
@up | command in KScript.Style | A media query for screens at least this wide: @up(768) or @up('md') is (min-width: 768px). |
kscript update | command line | Update to the latest release. |
->update | method of model | Sets columns on every row that matches, without reading them: ->update(active: false) . Returns how many rows… |
->update | method of query | Sets columns on every row that matches, without reading them: ->update(active: false) . Returns how many rows… |
->update | method of record | Sets fields and saves: $user->update(name: 'Joan') or ->update($form) . Each value is checked by its field's… |
->update | method of users | Changes a user's fields (null removes one) and returns the user. A new email is checked like @register()'s. |
->update_or_create | method of model | Updates the first record that matches with the values, or makes one from both maps. Returns the record… |
->upper | method of string | The text in upper case. |
->upsert | method of model | Atomically inserts a row or updates supplied fields on unique conflict. The key must name a unique column. The… |
->upsert | method of query | Atomically inserts a row or updates supplied fields on unique conflict. The key must name a unique column. The… |
url | type | An absolute http, https, ftp, ws or wss URL. The scheme and host are lowercased. |
->url_decode | method of string | URL-escaped text decoded. |
->url_encode | method of string | The text escaped for a URL. |
@user | command in KScript.Auth | The signed-in user (a map with id, email and the fields they registered with), or null for a guest. It comes… |
User | model in KScript.Auth | Someone with an account. KScript.Auth keeps the users in this model when kscript.json says "http": { "auth": {… |
@users | command in KScript.Auth | The app's users, kept in its data folder: ->find(id), ->find_email(email), ->all(), ->count(), ->verify(email… |
@uuid | command in KScript.Core | A new UUID. Version 4 (the default) is random. Version 7 starts with the time, so newer ones sort later and… |
uuid | type | A UUID, versions 1 to 8 and the nil and max UUIDs, lowercased to 8-4-4-4-12. |
V
validate | statement | A rule a <type> checks: the test must be true. In a type made from one other type, the value is $value . In a… |
Validation | error type | Input that isn't valid. Answers 422 in a KScript.Http route. |
Value | error type | A value that isn't allowed here. |
->value | method of model | One column of the first row, or null. |
->value | method of query | One column of the first row, or null. |
value | option of const $name = value | Its value. Can be written as the element's text instead. |
value | option of fn | For one-line functions: the result, instead of a body. |
->values | method of map | The values, as a list. |
values | option of enum | The values, as a list: [small, medium, large] (in XML, small, medium, large ). |
@variance | command in KScript.Math | The population variance: the mean of the squared distances from the mean. |
$vars | variable | Values given to the stylesheet: @stylesheet(path, vars) or kscript css --var name=value. |
@verification_token | command in KScript.Auth | A token that proves a user owns their email address, to put in the link of a verify-your-email message… |
->verify | method of password | True when this is the password the stored hash was made from. Takes the same time whether it matches or not. |
->verify | method of password_hash | True when the password someone typed is the one this hash was made from… |
->verify | method of users | The user with this email and password, or null. Unlike @attempt(), it doesn't sign them in or count failures. |
@verify_email | command in KScript.Auth | Finishes email verification: sets the token's user's email_verified_at to now and returns the user, or null… |
kscript --version | command line | Show the version of KScript that runs here, and switch between versions. |
@view | command in KScript.Http | Renders a page from the views folder (or the site folder) with its layout, giving it the named values as… |
@visit | command in KScript.Web | For tests: renders a page of this project as a browser gets it, the way kscript serve answers it: its routes… |
VSpace | statement in KScript.Document | Vertical space. |
W
wait | statement | Pauses the script. |
->waiting | method of queue | The waiting jobs: id, job, queue, fields, attempts, available_at. |
->warn | method of logger | Logs a message at warn level, with an optional map of fields. |
warn | statement in KScript.Terminal | Prints the text after a yellow WARN label. |
kscript watch | command line | Rebuild everything the project makes from its code (the agent docs, the OpenAPI file http.openapi.file names… |
->when | method of model | Changes the query only when the test is true: ->when($search != null, fn(q) => $q->where(fn(u) =>… |
->when | method of query | Changes the query only when the test is true: ->when($search != null, fn(q) => $q->where(fn(u) =>… |
->where | method of model | Keeps the rows that match: a lambda compiled to SQL, fn(u) => $u.age >= 18 and $u.name->starts_with('J') , or… |
->where | method of query | Keeps the rows that match: a lambda compiled to SQL, fn(u) => $u.age >= 18 and $u.name->starts_with('J') , or… |
->where_not | method of model | Leaves out the rows that match. |
->where_not | method of query | Leaves out the rows that match. |
while | statement | Loops while the test is true. test="true" loops until <break/>. |
->window | method of list | Overlapping runs of size items, each starting step items after the last (1 by default): [1, 2, 3]->window(2)… |
Window | statement in KScript.UI | Opens a desktop window. Its direct <let>, <fn> and <import> children run once and hold its state; the rest is… |
->with | method of logger | A logger that adds these fields to everything it logs. |
->with | method of model | Loads relations with the records, one query per relation rather than one per record: ->with(author, tags) … |
->with | method of query | Loads relations with the records, one query per relation rather than one per record: ->with(author, tags) … |
->with | method of url | The url with parts changed: a new path, query values added or replaced (null removes one), or a new fragment… |
with | option of model | The record types, models and mixins this model extends, in order. |
with | option of type | Other types this one is made from. Types with fields are joined: with="User, Auditable" has all their fields… |
->with_cache | method of http_response | Sets Cache-Control: ->with_cache('public, max-age=300'), or a number of seconds: ->with_cache(300). |
@with_clock | command in KScript.Test | Runs work with @now() and @today() fixed to the given date. |
->with_cookie | method of http_response | Sets a cookie and returns the response. The cookie is HttpOnly and SameSite=Lax unless told otherwise, Secure… |
->with_count | method of model | Counts a list relation for each record, as a field named after it: ->with_count(posts) gives each user… |
->with_count | method of query | Counts a list relation for each record, as a field named after it: ->with_count(posts) gives each user… |
@with_environment | command in KScript.Test | Runs work with overrides for @env() and $env. A null value hides a variable in this scope. |
->with_etag | method of http_response | Sets the ETag: a hash of the value, or of the body without one. Add the etag middleware (or etag="true") to… |
->with_header | method of http_response | Sets a header and returns the response: $next($request)->with_header('X-Frame-Options', 'DENY'). Set-Cookie… |
@with_http_stub | command in KScript.Net | Runs work with outbound @api and HTTP client calls intercepted by handler(request). |
@with_loopback_json | command in KScript.Net | Connects to a JSON Lines service on IPv4 loopback, returns action(connection), and closes it. Each transaction… |
->with_status | method of http_response | Changes the status code and returns the response. |
@with_temp_file | command in KScript.IO | Calls a function with a temporary file, then removes the file when the call ends. |
@with_temp_folder | command in KScript.IO | Calls a function with a temporary folder, then removes it when the call ends. |
->with_trashed | method of model | For models that extend SoftDeletes: keeps the deleted records, which queries leave out by default. |
->with_trashed | method of query | For models that extend SoftDeletes: keeps the deleted records, which queries leave out by default. |
->with_type | method of http_response | Changes the Content-Type and returns the response. |
->without | method of list | The items that aren't of a type (->without(string)), or without the ones a filter of the items' type keeps… |
->without | method of url | The url without parts: the whole query or fragment (->without(query, fragment)), or only some query values… |
->without_cookie | method of http_response | Tells the browser to delete a cookie and returns the response. Give the path and domain it was set with. |
@without_overlapping | command in KScript.Queue | Job middleware, for fn middleware(): only one job of this type with the same key runs at a time; another goes… |
->words | method of document | How many words the text has, not counting maths and code. |
->words | method of latex | How many words the text has, not counting maths and code. |
->words | method of markdown | How many words the text has, not counting maths and code. |
->words | method of string | The words in the text, as a list, without spaces or punctuation. Letters in any script count, and don't or… |
kscript worker | command line | Run queued jobs until stopped. Ctrl+C lets the running jobs finish first. |
->wrap | method of string | The text with line breaks between words so no line is longer than width (unless one word is). Works well with… |
->write | method of storage | Writes text to a file, replacing it safely. Folders are created as needed. |
@write_atomic | command in KScript.IO | Replaces a file atomically with text or the bytes of a base64 value. |
@write_bytes | command in KScript.IO | Writes the exact bytes held by a base64 value. |
->write_bytes | method of storage | Writes the exact bytes of a base64 value (an upload's .bytes, say) to a file, replacing it safely. |
@write_csv | command in KScript.IO | Writes maps as CSV with a header, or lists as rows. Optional headers select and order columns. |
@write_json | command in KScript.IO | Writes a value to a file as indented JSON. |
->write_json | method of storage | Writes a value to a file as indented JSON, replacing it safely. |
@write_text | command in KScript.IO | Writes text to a file, replacing it. Folders are created as needed. |
->write_text | method of file | Writes text to the file, replacing it. Folders are created as needed. Returns the file. |
@write_yaml | command in KScript.IO | Writes a value to a file as YAML. |
Y
Yaml | error type | Text that isn't valid YAML. |
Z
->zip | method of list | Pairs of items from both lists: [[a1, b1], [a2, b2]...]. |