# RolePrep

Local-first job-market research, learning guides, and interview preparation.

RolePrep runs a dashboard on your own machine, stores data in local SQLite, and uses a dedicated local Chromium/Chrome profile for LinkedIn search automation. Browser cookies and generated application data stay on your computer unless you export or publish them yourself.

## Install

Run once with npx:

```bash
npx roleprep start
```

Or install globally:

```bash
npm install -g roleprep
roleprep start
```

The dashboard opens at `http://127.0.0.1:4310/` by default.

## CLI

```bash
roleprep help
roleprep start
roleprep stop
roleprep restart
roleprep status
roleprep api set sk-...
roleprep api status
roleprep ai provider openai
roleprep ai provider codex
roleprep ai status
roleprep changelog
roleprep login linkedin
roleprep doctor
roleprep reset-data --yes
```

Useful options:

```bash
roleprep start --port 4311 --no-open
roleprep start --data-dir ~/.roleprep
roleprep login linkedin --profile main
```

## Data Location

Default data directories:

- Linux: `~/.local/share/roleprep`
- macOS: `~/Library/Application Support/RolePrep`
- Windows: `%APPDATA%\\RolePrep`

Override with:

```bash
ROLEPREP_DATA_DIR="$HOME/.roleprep" roleprep start
```

The data directory contains the SQLite database, dashboard logs, generated artifacts, and dedicated browser profiles.

## LinkedIn Login

RolePrep does not use your normal browser profile. Connect a dedicated local profile:

```bash
roleprep login linkedin --profile main
```

Sign in in the opened browser window. After that, scheduler runs can reuse the same local profile. LinkedIn automation can violate LinkedIn policies, so use it only if you accept that account risk.

## Development

```bash
npm install
npm run dashboard:install
npm run build
npm run check
```

Start the local dashboard from source:

```bash
npm run dashboard:dev
```

Run the smoke tests:

```bash
npm run smoke
npm run dashboard:smoke
```

RolePrep changes are tracked in [CHANGELOG.md](CHANGELOG.md).

## Configuration

Copy `.env.example` to `.env` for source checkouts. The npm CLI works without an `.env` for the default local SQLite setup.

Important variables:

```bash
ROLEPREP_DATA_DIR="$HOME/.local/share/roleprep"
ROLEPREP_SQLITE_PATH="$ROLEPREP_DATA_DIR/roleprep.sqlite"
ROLEPREP_HOST="127.0.0.1"
ROLEPREP_PORT="4310"
ROLEPREP_BROWSER="chromium"
ROLEPREP_CHROME_PATH="google-chrome"
ROLEPREP_BROWSER_PROFILE_KEY="main"
ROLEPREP_WORKER_DATA_DIR="$ROLEPREP_DATA_DIR"
OPENAI_API_KEY=""
ROLEPREP_AI_PROVIDER="openai"
ROLEPREP_CODEX_MODEL=""
```

The public configuration surface uses `ROLEPREP_*` variables.
By default, both the npm package and source dashboard use `ROLEPREP_DATA_DIR`
for local SQLite data, browser profiles, LinkedIn search output, and generated
artifacts. Set it only when you want an isolated workspace.

Learning guides and market insights use OpenAI by default. Store a local API key
outside the repo with:

```bash
roleprep api set sk-...
```

For local owner testing, you can route learning-guide and insight generation
through an already logged-in Codex CLI instead:

```bash
roleprep ai provider codex
roleprep ai codex-model gpt-5.2
roleprep restart
```

Codex mode depends on the machine's local `codex` login and is intended for
single-user local runs, not hosted multi-user deployments.

## Publishing

Package publishing is intentionally manual because npm accounts commonly require interactive 2FA.

```bash
npm version patch
npm run publish:dry-run
npm run publish:npm
```

GitHub Actions build and dry-run the package. They do not publish to npm automatically.

## License

ISC
