elastic / elastic/semantic-code-search-indexer

Unify default repo/queue base-dir resolution (avoid CWD/project-root split)

Open
#152 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
19
Forks
10
PR merge metrics
No merged PRs in 30d

Description

## Problem
The CLI currently uses different default roots for related runtime state:

- Repository clones for URL/repo-name inputs are rooted at `process.cwd()` (`.repos/...`) in `setup` and `index` flows.
- Queue state defaults to project root via `SCSI_QUEUE_BASE_DIR` resolution in config.

This can split state when commands are run from a different working directory (for example cron/job runners), causing repos and queue DBs to land in different base locations.

## Why this is risky
- Duplicate clones can be created across different CWDs.
- Queue/recovery operations become harder to reason about.
- Behavior is less predictable for automation and operators.

## Current behavior (example)
Running the index command from `/tmp` can place:
- repos under `/tmp/.repos/...`
- queues under `/.queues/...`

## Proposed direction
Unify default base-dir behavior for repo storage and queue storage.

Possible approach:
1. Introduce a single canonical repos base dir config (for example `SCSI_REPOS_BASE_DIR`) resolved from project root by default.
2. Use that base in both `setup_command` and `parseRepoArg` for URL/repo-name inputs.
3. Keep explicit absolute/relative repo path arguments working as-is.
4. Document the final default behavior in README/DEVELOPER_GUIDE.

## Acceptance criteria
- Invoking from different CWDs does not split default repo/queue state across unrelated directories.
- Existing explicit repo-path usage keeps working.
- Unit tests cover repo path resolution for URL/repo-name + explicit paths.

## Context
- PR discussion: https://github.com/elastic/semantic-code-search-indexer/pull/150
- Specifically raised in review threads on:
- `src/commands/setup_command.ts`
- `src/commands/index_command.ts`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.