Skip to content

Init CLI

The init CLI (@xriptjs/init) scaffolds new xript projects with a manifest, package configuration, and a demo script. It supports interactive prompts or fully non-interactive mode for CI and scripting.

Terminal window
npx @xriptjs/init

Or install globally:

Terminal window
npm install -g @xriptjs/init
xript-init

Running without flags starts an interactive session:

$ npx @xriptjs/init my-mod
Project name (my-mod):
Tier: 2 (bindings) or 3 (full scripting)? (2):
Language: typescript or javascript? (typescript):
✓ Created my-mod in /path/to/my-mod
manifest.json
package.json
src/demo.ts
tsconfig.json
Next steps:
cd my-mod
npm install
npm run demo

Skip all prompts with --yes (or -y):

Terminal window
npx @xriptjs/init my-mod --yes

Defaults: tier 2, TypeScript.

OptionDescriptionDefault
[directory]Target directory for the projectCurrent directory
--yes, -ySkip prompts, use defaultsfalse
--tier <2|3>Adoption tier2
--typescriptGenerate TypeScript output(default)
--javascriptGenerate JavaScript output
--help, -hShow help

The init CLI generates project scaffolding tailored to two adoption tiers:

Tier 2 (Bindings): Simple host bindings with capability gating. Good for apps that need a few extension points like custom formatting, data transformations, or simple plugins.

Tier 3 (Full Scripting): Namespace bindings, hooks, custom types, and capabilities. Designed for apps with rich extension APIs like game engines, content tools, or extensible platforms.

Tier 1 (expression-only) is simple enough that no scaffolding is needed.

FileDescription
manifest.jsonxript manifest with bindings, capabilities, and (tier 3) hooks
package.jsonProject configuration with @xriptjs/runtime dependency and demo script
src/demo.ts or src/demo.jsWorking demo that creates a runtime and executes example scripts
tsconfig.jsonTypeScript configuration (TypeScript projects only)
import { writeProject, generateProjectFiles } from "@xriptjs/init";
const result = await writeProject("./my-mod", {
name: "my-mod",
tier: 2,
language: "typescript",
});
console.log(result.files); // ["manifest.json", "package.json", ...]

writeProject(directory, options): Promise<InitResult>

Section titled “writeProject(directory, options): Promise<InitResult>”

Writes a complete xript project scaffold to disk.

generateProjectFiles(options): ProjectFiles

Section titled “generateProjectFiles(options): ProjectFiles”

Returns the file contents as a Record<string, string> without writing to disk. Useful for testing or custom scaffolding workflows.