init
Purpose
Initialize BM25 indexes for the current Git project.
Usage
idx init
Arguments
- None.
Flags
- Global:
--quiet,-q.
Behavior and Side Effects
- Resolves the current working directory and Git project root.
- Ensures
.idx/is ignored in the root.gitignore. - If
.gitignoreis missing, creates it with.idx/. - Recursively indexes directories while skipping
.gitand.idx. - Applies
.gitignorerules while traversing files and directories. - Writes index data under each indexed directory in
.idx/. - Updates checksum snapshots used by
idx syncandidx status. - If an index already exists in the current directory, does not rebuild and returns an info message.
Output
- Success on first initialization:
โ Index created. You can now run idx search. - Already initialized in current directory:
โน๏ธ This project is already indexed. You can run idx search.
Errors
- Current directory cannot be resolved.
- Current directory is not inside a Git project.
.gitignorecannot be read or written.- Ignore matcher cannot be built from
.gitignore. - Directory/file read errors during traversal.
- Index/checksum persistence errors.
Examples
idx init