FunctionalScript CLI

Install FunctionalScript to test and compile modules, manage content-addressable storage, and run local tools. Choose a command below for usage and documentation.

Install and run

npm install -g functionalscript
npx functionalscript <command> [args]
fjs <command> [args]

npx functionalscript invokes the package; fjs is the installed executable. Replace angle-bracket placeholders with your values; square brackets mark optional arguments.

Examples execute locally. This website is a reference, not an online shell.

fjs test

Run the FunctionalScript test suite

Aliases: fjs t

Usage

fjs test

Run from the directory whose proofs you want to test.

Examples

fjs test

Complete documentation

fjs cov

Check each module's own proof coverage with Node

Aliases: none

Usage

fjs cov node

Run from the directory whose modules you want to check. Each module directory runs separately and requires 100% line, branch and function coverage.

Examples

fjs cov node
npm start cov node

Complete documentation

fjs deps

Check syntax AST formation for module.f.js and module.f.mjs files

Aliases: none

Usage

fjs deps

Run from the directory whose module.f.js and module.f.mjs files you want to check. Only those exact filenames are selected recursively. Source files are parsed without executing them, resolving imports or lowering to FAST/EDAG.

Examples

fjs deps
npm start deps

Complete documentation

fjs compile

Compile a FunctionalScript module to JavaScript, or check every .f.js with no arguments

Aliases: fjs c

Usage

fjs compile
fjs compile <input> <output>

With no arguments, check every .f.js under the current directory. The POSIX shell example writes example.f.js and example.json in the current directory. The output extension selects its format.

Examples

fjs compile
printf 'export default 42;\n' > example.f.js
fjs compile ./example.f.js ./example.json

Complete documentation

fjs cas

Content-addressable storage operations

Aliases: fjs s

Usage

fjs cas <command> [args]

Choose add, get or list below for the store under ~/.cas/, or git for the same three over a Git branch.

Examples

fjs help cas

Complete documentation

fjs cas add

Store file content and print its hash

Aliases: fjs s add

Usage

fjs cas add <path>

Store an existing file and print its hash; this example uses a repository checkout.

Examples

fjs cas add ./README.md

Complete documentation

fjs cas get

Restore content by hash into a file

Aliases: fjs s get

Usage

fjs cas get <hash> <path>

Restore a stored hash to a file. This POSIX shell example requires a repository checkout and writes restored-README.md.

Examples

hash=$(fjs cas add ./README.md)
fjs cas get "$hash" ./restored-README.md

Complete documentation

fjs cas list

List all stored content hashes

Aliases: fjs s list

Usage

fjs cas list

Print all hashes in the local store.

Examples

fjs cas list

Complete documentation

fjs cas git

Use a Git branch as the store: add, get and list

Aliases: fjs s git

Usage

fjs cas git <command> <branch> [args]

The same three commands over a branch of the repository at the current directory, run from the root of the worktree. Nothing moves between repositories: git push, git fetch and git merge do.

Examples

fjs cas git help

Complete documentation

fjs cas git add

Store file content on the branch and print its key

Aliases: fjs s git add

Usage

fjs cas git add <branch> <path>

One commit on the branch, by the repository's configured user.name and user.email, or no commit where the branch already holds the content. The checkout is not touched.

Examples

fjs cas git add build-cache ./README.md

Complete documentation

fjs cas git get

Restore content of the branch by key into a file

Aliases: fjs s git get

Usage

fjs cas git get <branch> <key> <path>

Reads the key from the commit the branch is at. A key the branch does not hold fails.

Examples

fjs cas git get build-cache "$key" ./restored

Complete documentation

fjs cas git list

List the keys the branch holds

Aliases: fjs s git list

Usage

fjs cas git list <branch>

Prints every key the commit the branch is at holds, one per line; nothing for a branch that is not there.

Examples

fjs cas git list build-cache

Complete documentation

fjs cas git help

Print this help message

Aliases: fjs cas git h, fjs cas git ?, fjs s git help, fjs s git h, fjs s git ?

Usage

fjs cas git help

Both invocations list the subcommands and their aliases.

Examples

fjs help cas git

Complete documentation

fjs cas help

Print this help message

Aliases: fjs cas h, fjs cas ?, fjs s help, fjs s h, fjs s ?

Usage

fjs cas help

Both invocations list the subcommands and their aliases.

Examples

fjs help cas

Complete documentation

fjs mcp

Run an MCP server over stdio exposing the CAS and Evo (subjects/heads) as tools

Aliases: fjs m

Usage

fjs mcp

Start the stdio server from an MCP client. It waits for protocol input rather than printing an interactive prompt.

Examples

npx functionalscript mcp

Complete documentation

fjs ci

Generate CI workflows or cache successful checks

Aliases: fjs i

Usage

fjs ci
fjs ci init
fjs ci report <check>
fjs ci publish

Run in the project whose GitHub Actions workflows you want to generate. This writes .github/workflows/gen.ci.yml and gen.npm-publish.yml.

Examples

fjs ci
npm start ci init

Complete documentation

fjs web

Serve a directory over HTTP

Aliases: fjs w

Usage

fjs web [root] [port]

Defaults to the current directory and port 8080 on loopback. Both arguments are positional.

Examples

fjs web
fjs web . 3000

Complete documentation

fjs run

Run the `main` program or command table a FunctionalScript module exports

Aliases: fjs r

Usage

fjs run <module> [args...]

The module must export main as a program or command table. This repository-checkout example generates the website locally.

Examples

fjs run ./fjs/website/module.f.mjs

Complete documentation

fjs help

Print this help message

Aliases: fjs h, fjs ?

Usage

fjs help [command]

A command table target lists its subcommands. For a program target, help lists the top-level commands; it does not describe positional parameters.

Examples

fjs help
fjs help cas

Complete documentation