arkor init
Scaffolds src/arkor/index.ts, src/arkor/trainer.ts, arkor.config.ts, and a starter package.json in the current directory. Use this when you want to add Arkor to an existing repo (the Quickstart scaffolding flow runs the same scaffolder one directory up).
Synopsis
Options
--git and --skip-git are mutually exclusive; passing both throws.
Behavior
Default flow
By default, the command is partly interactive: it prompts for a project name, a starter template, and (when not in a git repo) whether to rungit init, and only then starts the package manager’s install step (no confirmation prompt) unless --skip-install is set. The git init confirmation is surfaced before install so you can answer every prompt upfront and walk away while install runs unattended; the actual git init + initial commit still execute after install so the generated lockfile lands in the initial commit. If no package manager can be resolved (no --use-* flag and detection from npm_config_user_agent fails), the install step is skipped and the outro prints a manual install hint.
Templates
All three pair the same small open-weight base (
gemma-4-E4B-it) with a curated public dataset on HuggingFace.
Package manager detection
When no--use-* flag is passed, the CLI inspects npm_config_user_agent to detect the package manager that invoked it (this is the standard mechanism corepack uses, so pnpm dlx, yarn dlx, bunx, etc. all work).
If detection fails and no flag is passed, the install step is skipped and the outro prints a manual install hint.
Git policy
arkor init decides whether to run git init + initial commit by walking these rules in order:
- If the current directory is already inside a git repo, skip (and log it).
- If
--skip-gitis passed, skip. - If
--gitor-yis passed, run without asking. - In an interactive shell, prompt (default: yes).
- In a non-interactive shell with no flag, skip.
<pm> install), but git init execution still runs after install so the lockfile generated by the package manager is part of the initial commit. If commit signing fails (e.g. GPG agent isn’t running), the CLI falls back to an unsigned commit and warns; you can re-sign with git commit --amend -S later.
CI / non-interactive shells
Whenprocess.stdout is not a TTY, or CI is set in the environment, arkor init is non-interactive: prompts skip with their default values and never block waiting for input. To get a deterministic scaffold from CI:
--yes accepts the project-name and template defaults (the directory’s basename and triage), --use-pnpm (or the matching --use-<pm>) short-circuits package-manager detection, and --skip-git opts out of git init. Pass --skip-install as well if your CI image already has node_modules/.
If you forget --yes in a non-interactive shell, the command still completes (prompts use their defaults) but the experience is silent and easy to miss in logs. Prefer the explicit form above.
Errors
Examples
Interactive:What gets written
The scaffolder touches six paths. None of them overwrites existing user content:
The CLI prints the file list as a “Files” note before installing, with an
action (created / kept / patched / ok) per path so you can see exactly what changed.
See also
- Quickstart for the greenfield scaffolding flow
- Project structure for what each generated file is for
arkor devfor the next step after init