Kronika CLI command

kronika init

Adopt Markdown that already exists in a repository into the exact kronika.sync.json project format consumed by kronika sync. This command does not generate, copy, or rewrite documentation and does not call Brama or execute repository commands.

Invocation

kronika init [--repo <path>] [--docs <path> ...] [--source <path> ...]
             [--manifest <path>] [--instruction <text>] [--replace]

For the same adoption boundary in a browser workspace, run kronika gui --repo <path>; see the graphical importer.

Accepted input

The repository defaults to the current directory. With no --docs, init selects an existing root README.md and every Markdown file beneath an existing docs/ directory. Repeat --docs to select exact Markdown files or directories instead. Non-Markdown file selections, symbolic links, missing paths, and paths outside the repository are rejected.

Every imported document receives the repeated --source paths as its evidence declaration. With no explicit source, the established manifest value is .. Sources must exist inside the repository and cannot be symbolic links. --instruction supplies one standing instruction for every imported document; otherwise init records its built-in maintenance instruction without changing any document.

State and downstream use

The only possible mutation is one atomic write of the schema-version-1 manifest selected by --manifest, default kronika.sync.json. That manifest contains each existing document as output, its exact evidence paths as sources, and its standing instruction. A later kronika sync loads this same file; no second import store exists.

Duplicates, conflicts, and failures

  • An identical retained manifest returns status: unchanged and lists every document in unchanged.
  • A different retained manifest returns status: conflicting, exits 1, and leaves that manifest untouched.
  • --replace is the explicit instruction to atomically replace a conflicting manifest; unrelated repository files remain untouched.
  • Invalid JSON in an existing manifest, an empty selection, and every invalid or escaping path return status: rejected, exit 1, and write nothing.
  • Successful output lists imported, unchanged, conflicting, and rejected separately. It contains paths and reasons, never document bodies.

First use and replay

kronika onboarding leads to this command. Onboarding completes only after init writes a valid manifest or accepts an identical retained one. kronika onboarding --reset replays the journey; repeating init is idempotent and completes the new attempt.

Import success is not a claim that onboarding bookkeeping succeeded. Text and JSON output retain onboarding.completed and, on failure, onboarding.error with the actual cause. The accepted manifest remains accepted and the command exits successfully even when onboarding state cannot be read. Correct that state problem and repeat init; the unchanged project can record first success without rewriting the manifest. The graphical import result shows the same independent outcome.

The graphical importer submits to this same function and reads the accepted manifest back. It does not maintain a second parser, project store, or document copy.