# Phase 1: Project Setup — UAT Testing

## Summary

Phase 1 establishes the Python package structure, configuration system, and CLI entry points. The package is installable, all imports resolve, and all CLI commands respond with placeholder output.

## Automated Verification

These checks were run during build:

```bash
# Install package in development mode
pip install -e ".[dev]"

# Run linter
ruff check src/

# Run type checker
mypy src/

# Verify package imports
python -c "import unfamiliar; print(unfamiliar.__version__)"
```

All checks pass.

## Manual Testing Steps

### 1. Verify Package Installation

```bash
pip install -e ".[dev]"
unfamiliar --version
```

**Expected:** Outputs `unfamiliar 0.1.0`

### 2. Verify CLI Help

```bash
unfamiliar --help
```

**Expected:** Shows help with 5 commands: `investigate`, `campaigns`, `resume`, `reconnect`, `upgrade`

### 3. Test investigate Command

```bash
# With valid git repo
unfamiliar investigate .

# With non-git directory
unfamiliar investigate /tmp

# With nonexistent path
unfamiliar investigate /nonexistent
```

**Expected:**
- Valid repo: Shows `[placeholder] Would start investigation for: /path/to/repo`
- Non-git: Shows error `Error: '/tmp' is not a git repository.`
- Nonexistent: Shows error `Directory '/nonexistent' does not exist.`

### 4. Test Other Commands

```bash
unfamiliar campaigns
unfamiliar resume
unfamiliar upgrade
unfamiliar upgrade some-campaign
```

**Expected:** Each shows `[placeholder]` message indicating the command is recognized but not yet implemented.

### 5. Test reconnect Command

```bash
# With non-git directory (should error)
unfamiliar reconnect test-campaign /tmp

# With valid git repo
unfamiliar reconnect test-campaign .
```

**Expected:**
- Non-git: Shows error about not being a git repository
- Valid repo: Shows `[placeholder] Would reconnect campaign 'test-campaign' to: /path/to/repo`

### 6. Verify Configuration System

```bash
# Check that config directory is created on first run
ls -la ~/.unfamiliar/

# Verify config file was created
cat ~/.unfamiliar/config.toml
```

**Expected:**
- Directory `~/.unfamiliar/` exists with mode 700
- File `~/.unfamiliar/config.toml` exists with mode 600
- Config contains `[general]` section with defaults

### 7. Verify Enum Properties

```bash
python -c "from unfamiliar.constants import MissionDifficulty; print(MissionDifficulty.QUICK.time_minutes)"
```

**Expected:** Outputs `15`

## Edge Cases to Check

- [x] Running CLI from outside a git repository (commands that don't need a repo should work)
- [x] Config file with invalid TOML syntax (should show clear error)
- [x] Config file with group/world-readable permissions containing API keys (keys should be ignored)

## Phase Completion Checklist

- [x] Package installs via `pip install -e ".[dev]"`
- [x] `unfamiliar --help` shows all 5 commands
- [x] `unfamiliar --version` shows version
- [x] All commands validate config on entry
- [x] Git repository validation works for `investigate` and `reconnect`
- [x] Nonexistent paths are rejected with clear error
- [x] Non-git directories are rejected with clear error
- [x] All enums from requirements are defined in `constants.py`
- [x] `MissionDifficulty.time_minutes` returns correct values
- [x] `ruff check src/` passes
- [x] `mypy src/` passes
- [x] All `__init__.py` files have docstrings
- [x] `tomli` listed as conditional dependency for Python 3.10
- [x] Version defined in single location (`__init__.py`), read by hatchling
- [x] Campaign dir collision loop is bounded with clear error on overflow
