Skip to content

Cli usage

See full usage documentation by typing tsp --help:

When using tsp init with an external template URL, be aware that downloading or using an untrusted template may contain malicious packages that can compromise your system and data. Proceed with caution and verify the source.

Terminal window
>tsp --help
TypeSpec compiler v0.36.1
tsp <command>
Commands:
tsp compile <path> Compile TypeSpec source.
tsp code Manage VS Code Extension.
tsp vs Manage Visual Studio Extension.
tsp format <include...> Format given list of TypeSpec files.
tsp init [templatesUrl] Create a new TypeSpec project.
tsp install Install TypeSpec dependencies
tsp info Show information about the current TypeSpec compiler.
Options:
--help Show help [boolean]
--debug Output debug log messages. [boolean] [default: false]
--pretty Enable color and formatting in TypeSpec's output to make compiler error
s easier to read. [boolean] [default: true]
--version Show version number [boolean]

Set the npm-compatible registry URL used by tsp init when resolving package versions and by tsp install when downloading the configured package manager. This is useful in corporate environments where a private registry is required.

Terminal window
TYPESPEC_NPM_REGISTRY=https://my-corp-registry.example.com tsp init

If this variable is not set, TypeSpec defaults to https://registry.npmjs.org.

This variable does not configure the package manager invoked by tsp init or tsp install. Configure that package manager separately using its own registry and authentication settings. TypeSpec does not read those authentication settings: its package metadata request and the tarball URL returned by the registry must be accessible to the TypeSpec process.