Skip to content

CLI

The asc command compiles .as files using your project's Atscript configuration.

Usage

bash
npx asc [options]

Options

OptionDescription
-c, --config <path>Path to config file. If omitted, auto-detects atscript.config.js / .ts in the current directory
-f, --format <format>Output format: dts or js (default: dts)
--noEmitRun diagnostics only, don't write files
--skipDiagSkip diagnostics, always emit files
--helpDisplay help

Examples

bash
# Generate .d.ts files (default)
npx asc

# Generate .js files with runtime metadata
npx asc -f js

# Use a specific config file
npx asc -c path/to/atscript.config.js

# Validate without writing files (CI/lint check)
npx asc --noEmit

# Emit without running diagnostics
npx asc --skipDiag

The CLI logs created files, errors, and warnings with color-coded output. It exits with code 1 if any errors are found (unless --skipDiag is set).

TIP

If no config file is found, the CLI defaults to format: 'dts' with the TypeScript plugin enabled — so npx asc works out of the box.

Database Schema Sync

The CLI also includes a db sync command for synchronizing your database schema with your .as definitions:

bash
npx asc db sync [options]
OptionDescription
-c, --config <path>Path to config file
--dry-runShow planned changes without applying
--yesSkip confirmation prompt (for CI/CD)
--forceRe-sync even if schema hash matches
--safeSkip destructive operations (drops)
bash
# Preview changes
npx asc db sync --dry-run

# Auto-approve for CI
npx asc db sync --yes

# Safe mode — only additive changes
npx asc db sync --safe

This requires a db section in your config:

typescript
export default defineConfig({
  // ...
  db: {
    adapter: '@atscript/db-sqlite',
    connection: './myapp.db',
  },
})

See the Schema Sync guide for full documentation.

Next Steps

Released under the MIT License.