Example 1
Example 1
import { runCli } from '@setu-ts/cli'; import { createDenoRuntimeServices } from '@setu-ts/runtime'; const runtime = createDenoRuntimeServices(); const code = await runCli(['generate', 'service', 'billing'], { fs: runtime.fs!, cwd: Deno.cwd(), now: () => runtime.now(), log: console.log, error: console.error, });
Derive all five naming forms from a raw input string.
Detects the @setu-ts packages a project depends on.
Parses argv, runs the requested command, and returns its exit code.
Everything the CLI reaches the outside world through.
-
ask: Prompter
Asks the questions
setu newalready accepts as flags. -
cwd: string
The working directory commands resolve relative paths against (absolute).
-
error: (message: string) => void
Writes a line of error output.
-
fs: IFileSystem
The filesystem all reads and writes go through.
-
load: ModuleLoader
Loads a custom schematic module; defaults to a real dynamic
import(). -
loadApp: AppLoader
Loads the target project's
setu.config.ts; defaults to a real dynamicimport(). Only the plugin-command paths use it. -
log: (message: string) => void
Writes a line of normal output.
-
now: () => number
Wall-clock milliseconds, for timestamped output.
-
portAvailable: PortProbe
Checks whether a workspace port can bind before the CLI assigns it.
The five naming forms derived from an input string.
-
camel: string
camelCase: lowercase first letter, no separators (e.g., userProfile).
-
kebab: string
kebab-case: lowercase with hyphens (e.g., user-profile).
-
pascal: string
PascalCase: uppercase first letter, no separators (e.g., UserProfile).
-
raw: string
The raw input as provided by the user.
-
screaming: string
SCREAMING_SNAKE_CASE: uppercase with underscores (e.g., USER_PROFILE).
One file a schematic asks the command layer to create.
-
contents: string
The file contents.
-
managed: boolean
Marks a file the CLI owns outright and regenerates, exempting it from the overwrite refusal in
findExisting. -
path: string
Path to write, relative to the command's target directory.
One selectable answer to a scaffold question.
-
label: string
One line describing what the choice does, shown above the question.
-
value: string
The value written into the flag record when chosen.
Asks the scaffold questions setu new accepts as flags.
-
select(): Promise<string | undefined>question: string,choices: readonly PromptChoice[]
Asks one question and reports the chosen value.
Options handed to every schematic.
-
artifacts: Readonly<Record<string, readonly string[]>>
The generated artifacts already present in the project, keyed by the schematic name that emits them (
{ 'health-indicator': ['external-api'] }). -
legacyModules: readonly string[]
Pre-module-declaration directories that retain the old controller/service barrel exports until their application converts to
MODULES. -
migrations: readonly string[]
The migrations already present, oldest first.
-
modules: readonly string[]
The domain modules already present under
src/modules/, sorted. -
now: () => number
Wall-clock milliseconds, injected so timestamped output (the migration schematic) is deterministic under test.
-
plugins: ReadonlySet<string>
The
@setu-tspackages detected in the target project. -
runtime: TargetRuntime
The project's runtime target, so a schematic can shape platform-specific output.
Loads the project's config module by URL.
Loads an ES module by absolute URL.
The contract every schematic satisfies — a pure function from a name to the files to create. Schematics perform no I/O; the command layer writes.
A project template accepted by setu new --template.
The name of the CLI executable.
Usage
import * as __setu_ts_cli____the__setu__command_line_tool___Provides_project_scaffolding___setu_new___and_plugin_aware_code_generation___setu_generate__schematic___name_____This_barrel_is_the_programmatic_surface__the_executable_entry_point_is__src_main_ts___ from "cli/src/index.ts";