Overview
Theinit command takes a project from configuration through its first schema
pull in one interactive flow.
What it does
- Prompts for the generated schema path
- Creates
notcms.config.json - Loads existing credentials from
.env,.env.local, or.dev.vars - If credentials are missing, offers browser login and saves them to
.env.local - Ensures
notcmsis both a direct project dependency and resolvable - Pulls the schema automatically
- Prints a first query using the generated
ncclient
notcms login later. It does not attempt to pull without
credentials.
Options
Interactive setup
The command first asks where to save the generated schema:init considers setup complete only when notcms is declared directly in
dependencies or devDependencies and can be resolved from the target project.
If it is declared but not installed, init offers the package manager’s plain
install command so local, workspace, and pinned dependency specs are preserved:
init offers the corresponding add command:
cmd.exe to
invoke the package manager’s .cmd shim; project-controlled text is never
interpolated into that command. If installation is declined, fails, or the
session is non-interactive, schema generation continues and the manual
installation command is printed as the final action.
The package manager is selected from a valid packageManager field, the closest
lockfiles, or the invoking package manager. An invalid explicit field, or
conflicting closest lockfiles that the invoking package manager cannot
disambiguate, stops automatic installation. Schema generation still completes
and init explains how to resolve the package-manager configuration manually.
Examples
Basic initialization
Load credentials from a custom env file
Next steps
Import thenc client from the generated schema file and run the query printed
by the command. When the Notion database structure changes, refresh it with: