@danhachuel/jobfinder 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +81 -0
- package/LICENSE +21 -0
- package/README.md +110 -2
- package/package.json +57 -4
- package/scripts/cli.mjs +234 -0
- package/src/server/app.mjs +79 -0
- package/src/server/context.mjs +20 -0
- package/src/server/index.mjs +88 -0
- package/src/server/middleware/errors.mjs +47 -0
- package/src/server/middleware/rateLimiter.mjs +90 -0
- package/src/server/paths.mjs +30 -0
- package/src/server/routes/applications.mjs +64 -0
- package/src/server/routes/channels.mjs +285 -0
- package/src/server/routes/config.mjs +92 -0
- package/src/server/routes/dashboard.mjs +107 -0
- package/src/server/routes/dms.mjs +111 -0
- package/src/server/routes/health.mjs +39 -0
- package/src/server/routes/index.mjs +35 -0
- package/src/server/routes/jobs.mjs +148 -0
- package/src/server/routes/outreach.mjs +65 -0
- package/src/server/routes/posts.mjs +252 -0
- package/src/server/routes/topics.mjs +81 -0
- package/src/server/services/jobs/easyApply.mjs +210 -0
- package/src/server/services/jobs/jobSearch.mjs +96 -0
- package/src/server/services/jobs/matcher.mjs +139 -0
- package/src/server/services/jobs/resumeParser.mjs +133 -0
- package/src/server/services/linkedin/cookies.mjs +90 -0
- package/src/server/services/linkedin/dryRun.mjs +144 -0
- package/src/server/services/linkedin/index.mjs +171 -0
- package/src/server/services/linkedin/officialApi.mjs +156 -0
- package/src/server/services/linkedin/voyagerClient.mjs +391 -0
- package/src/server/services/llm/index.mjs +148 -0
- package/src/server/services/outreach/cascades.mjs +298 -0
- package/src/server/services/outreach/invitations.mjs +118 -0
- package/src/server/services/outreach/templates.mjs +62 -0
- package/src/server/services/posting/generator.mjs +62 -0
- package/src/server/services/posting/publisher.mjs +71 -0
- package/src/server/services/posting/scheduler.mjs +45 -0
- package/src/server/services/workers.mjs +36 -0
- package/src/server/storage/bootstrap.mjs +149 -0
- package/src/server/storage/jsonStore.mjs +164 -0
- package/src/server/storage/logger.mjs +107 -0
- package/src/ui/dist/assets/index-B0UfcKxl.js +13 -0
- package/src/ui/dist/assets/index-B3mNUM7P.css +2 -0
- package/src/ui/dist/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/src/ui/dist/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/src/ui/dist/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/src/ui/dist/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/src/ui/dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/src/ui/dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/src/ui/dist/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/src/ui/dist/favicon.svg +4 -0
- package/src/ui/dist/index.html +15 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to JobFinder are documented in this file.
|
|
4
|
+
|
|
5
|
+
**Version labels** use a two-digit PATCH (`0.0.01` → after `0.0.99` comes `0.1.00`; after `0.9.99` comes `1.0.00`). npm publishes the normalized SemVer form (`0.0.01` → `0.0.1`), which is what install commands must use.
|
|
6
|
+
|
|
7
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
8
|
+
|
|
9
|
+
## [0.1.01] — 2026-11-12
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **Porta padrão `3030` → `4040`**: `config.json` (default + `officialRedirectUri`), fallback do servidor e do launcher, proxy do Vite em dev, textos de ajuda e documentação.
|
|
14
|
+
- **`jsonStore` tolerante a BOM**: arquivos JSON editados por ferramentas externas (ex.: `Set-Content` do PowerShell grava BOM) não são mais tratados como corrompidos — o store remove o BOM antes do parse.
|
|
15
|
+
- **Compatibilidade publicada no npm**: `@danhachuel/jobfinder@0.1.0` (visual `0.1.00`) publicada via workflow (`latest` + `next`), instalável via `npx`.
|
|
16
|
+
|
|
17
|
+
## [0.1.00] — 2026-11-12
|
|
18
|
+
|
|
19
|
+
First functional release of JobFinder (deliverables of PRD §12):
|
|
20
|
+
|
|
21
|
+
- App installable via `npx @danhachuel/jobfinder` with a local React+Vite+Tailwind UI at `localhost:4040`
|
|
22
|
+
- Módulo 1 (Postagens): manual + agendada + geração por LLM (OpenAI, Anthropic, DeepSeek, Ollama local)
|
|
23
|
+
- Módulo 2 (Conexões & DMs): convites com variáveis, limite semanal de 100, cascatas com até 5 mensagens/dia
|
|
24
|
+
- Módulo 3 (Vagas): match semântico currículo↔vaga, busca com score, Easy Apply em dry-run (Playwright opcional para live)
|
|
25
|
+
- Armazenamento 100% local em JSON (`~/.jobfinder/`) — nenhum banco externo, nenhum servidor do JobFinder
|
|
26
|
+
- Workflow `publish-npm.yml` ativo (smoke tests + dist-tag `next` → `latest`)
|
|
27
|
+
- Pasta `legal/` completa em inglês
|
|
28
|
+
- `README.md` com instalação/uso e `CHANGELOG.md` histórico
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- `.gitignore`: o padrão amplo `storage/` escondia `src/server/storage/` do commit (quebrava o `npm ci` do CI e o pacote npx). Agora ancorado na raiz: `/storage/` e `/.jobfinder/`.
|
|
33
|
+
- `package-lock.json` (raiz e `src/ui`) sincronizados com o bump `0.1.00` ( exigência do `npm ci` no CI).
|
|
34
|
+
|
|
35
|
+
## [0.0.01] — 2026-11-12
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- **npx launcher** `jobfinder` (`scripts/cli.mjs`): `install` creates the `~/.jobfinder/` skeleton (idempotent, never overwrites data); the default command starts the local server on `localhost:4040`. Flags: `--port`, `--host`, `--data-dir`, `--open/--no-open`, `--dry-run`, `--version`, `--help`.
|
|
40
|
+
- **Root `package.json`**: `@danhachuel/jobfinder`, ESM, `bin.jobfinder`, scripts `dev`/`dev:server`/`dev:ui`/`build`/`start`/`install`, engines `node >= 20.19`. Dependencies: `express`, `mammoth`, `pdfjs-dist`; optional: `playwright` (loaded on demand for Easy Apply); dev: `concurrently`.
|
|
41
|
+
- **Local JSON store bootstrap** (`src/server/storage/bootstrap.mjs`): `config.json` (LLM provider, LinkedIn auth mode, rate limits, dry-run), `channels/topics/posts/connections/dm-cascades/jobs/applications/resume.json`, `logs/`, plus 3 seed topics. Data directory: `~/.jobfinder/`, overridable via `JOBFINDER_HOME` or `--data-dir`.
|
|
42
|
+
- **Backend core**:
|
|
43
|
+
- `src/server/storage/jsonStore.mjs` — atomic JSON reads/writes (tmp + rename) with a per-file serialization queue, plus collection helpers (query with filter/sort/pagination, create/patch/remove).
|
|
44
|
+
- `src/server/storage/logger.mjs` — daily JSONL logs in `logs/YYYY-MM-DD.jsonl` with automatic secret redaction and a `tail`/`dates` reader for the UI.
|
|
45
|
+
- `src/server/middleware/rateLimiter.mjs` — central `RateLimiter` (human-like random delays 1–4 s, per-action-key throttle) + `countToday` / `countThisWeek` quota helpers.
|
|
46
|
+
- `src/server/middleware/errors.mjs` — `HttpError` + `asyncRoute`; the central error handler maps errors to a stable `{ error: { code, message } }` shape.
|
|
47
|
+
- `src/server/app.mjs` — Express 5 app factory: JSON body parsing, `/api` router, static serving of the built UI with SPA fallback, 503 hint when the UI build is missing.
|
|
48
|
+
- `src/server/index.mjs` — entrypoint with `EADDRINUSE` guidance and graceful shutdown; env overrides `JOBFINDER_PORT` / `JOBFINDER_HOST` / `JOBFINDER_DATA_DIR` / `JOBFINDER_DRY_RUN`.
|
|
49
|
+
- Routes: `GET /api/health`, `GET /api/logs`, `GET /api/config`, `PUT /api/config` (validated partial merge; secrets are redacted in responses).
|
|
50
|
+
- **LinkedIn layer** (`src/server/services/linkedin/`):
|
|
51
|
+
- `cookies.mjs` — Netscape/JSON `cookies.txt` parsing, cookie-header builder, session sanity check (`li_at` + `JSESSIONID`).
|
|
52
|
+
- `officialApi.mjs` — OAuth 2.0 (authorization URL, code exchange, refresh) + REST `/rest/posts` (fallback `ugcPosts`) + OpenID profile; outreach clearly flagged as unsupported on the official API.
|
|
53
|
+
- `voyagerClient.mjs` — cookie fallback client (ported from cv-cat/LinkedinApis, davidobbs anti-detection, Isaac-Foster invitations): people search, invitations, messaging (conversations/events), job search, cookie posting, JSESSIONID rotation on 403.
|
|
54
|
+
- `dryRun.mjs` — simulation client (people, conversations, jobs, posts, DMs) so the whole app is explorable with zero credentials; every result is flagged `simulated: true`.
|
|
55
|
+
- `index.mjs` — unified facade selecting `dry-run` (default) / `official` / `cookie` per the active channel; channel factory + secret redaction.
|
|
56
|
+
- Routes: `GET /api/channels`, `GET /api/linkedin/status`, `POST /api/linkedin/test`, `POST /api/channels/official`, `POST /api/channels/oauth/start`, `GET /api/channels/oauth/callback`, `POST /api/channels/cookies` (raw body), `POST|DELETE /api/channels/:id`.
|
|
57
|
+
- **Módulo Conexões & DMs** (`src/server/services/outreach/`):
|
|
58
|
+
- `templates.mjs` — `{{nome}}`/`{{empresa}}`/`{{cargo}}` interpolation with headline parsing; 300-char invitation limit.
|
|
59
|
+
- `invitations.mjs` — keyword search + batch sends through the central rate limiter; weekly quota (default 100) enforced per invite; history in `connections.json`.
|
|
60
|
+
- `cascades.mjs` — DM cascade engine: sequences up to 5 messages/day (hard limit), min interval (default 30 min), per-step `delayDays`, automatic pause on reply detection, manual approval gate; stats ("X de 5 hoje").
|
|
61
|
+
- Routes: `POST /api/connections/search`, `POST /api/connections/invitations`, `GET /api/connections`, `GET /api/connections/limits`, `GET|POST /api/cascades`, `POST /api/cascades/:id/status|approve`, `GET /api/cascades/stats`, `POST /api/cascades/tick|check-replies`.
|
|
62
|
+
- **Módulo Vagas** (`src/server/services/jobs/`):
|
|
63
|
+
- `resumeParser.mjs` — local extraction for PDF (pdfjs-dist), DOCX (mammoth) and TXT; skills, titles, years, education and languages; stored in `resume.json`.
|
|
64
|
+
- `matcher.mjs` — TF-IDF + cosine semantic match (offline), calibrated 0–100 score, skill gaps and recommendation (ported from Parthshewale18/AI-Resume-Job-Matcher).
|
|
65
|
+
- `jobSearch.mjs` — job search through the LinkedIn facade with automatic scoring; save/discard/status in `jobs.json`.
|
|
66
|
+
- `easyApply.mjs` — Easy Apply automation: dry-run is the default; live mode uses Playwright (optional dependency) with the channel session cookies, human pacing and `needs_intervention` reports; daily quota (default 20).
|
|
67
|
+
- Routes: `POST|GET /api/resume`, `POST /api/jobs/search`, `GET|POST /api/jobs`, `POST /api/jobs/:id/status|match`, `GET /api/jobs/stats`, `GET|POST /api/applications`, `POST /api/applications/:id/retry`, `GET /api/applications/limits`.
|
|
68
|
+
- **Dashboard**: `GET /api/dashboard` aggregates connection state, module counters, 7-day publishing series, invitations series, DM daily state and recent logs for the Painel page.
|
|
69
|
+
- **Workers**: `src/server/services/workers.mjs` — single internal cron (every minute) running the post scheduler + cascade engine and inbox monitoring every 10 minutes.
|
|
70
|
+
- **UI React + Vite + Tailwind v4** (`src/ui/`, visual base = LeadMaster):
|
|
71
|
+
- `index.css` — Tailwind v4 CSS-first theme: sidebar `#1e1b4b`, accent `#818cf8`, Inter (bundled via @fontsource-variable/inter), component classes (card, btn, input, sidebar-link).
|
|
72
|
+
- `components/Sidebar.jsx` — sidebar escura com grupos colapsáveis (Conexões, Vagas) e o botão fixo "Criar API Oficial do LinkedIn" com badge "⚠ Recomendado" quando não configurado.
|
|
73
|
+
- `components/Layout.jsx` + `Header.jsx` — shell com título da página, badge de dry-run/conectado, "Ver tutorial" e avatar.
|
|
74
|
+
- `components/` — `MetricCard`, `ProgressBar`, `QuotaBar` (Goal Gradient), `StatusBadge`, `Spinner`, `EmptyState`, `Modal`, `Toast` e charts Chart.js (`BarsChart` horizontais + `DoughnutChart`).
|
|
75
|
+
- Páginas (9 rotas): `Dashboard` (cards, quotas, 2 gráficos, checklist de onboarding, atividade), `Postagens` (compositor manual + preview lado a lado + histórico com filtros/paginação), `Agendar` (geração LLM com preview obrigatório, fila com barra de progresso), `Conexoes` (busca por palavra-chave, seleção em lote, `{{variáveis}}`, barra "X de 100"), `DmCascades` (até 5 mensagens/dia, delays em dias, aprovação manual, pausa por resposta, "X de 5 hoje"), `Vagas` (upload de currículo PDF/DOCX/TXT, match score + lacunas, salvar/descartar, candidatar dry-run), `Candidaturas` (histórico, relatório, retry, cota diária), `Integracoes` (OAuth oficial, upload de cookies.txt com passo a passo, canais ativar/remover, avisos de risco, suporte), `Config` (LLM, limites de rate, servidor, temas CRUD).
|
|
76
|
+
- `vite.config.js` — dev em :5173 com proxy `/api` → :4040; build em `src/ui/dist` (servido pelo backend em produção).
|
|
77
|
+
- **CI/CD**: `.github/workflows/publish-npm.yml` (adaptado do modelo Thunderbolt): triggers `workflow_dispatch` (inputs `version`, `dist_tag=next`) + push de tags `v*`; validação da versão visual `MAJOR.MINOR.PATCH` com PATCH de 2 dígitos, `npm ci`, build da UI, `node --check` do launcher, checagem de metadados do pacote (nome `@danhachuel/jobfinder`, `bin.jobfinder`), `npm pack --dry-run`, smoke test do `install` (skeleton JSON completo) e boot da API em dry-run, publish com `--tag next`, verificação do tarball publicada e promoção a `latest` no push de tag.
|
|
78
|
+
- **`legal/` (em inglês)**: `index.html` (índice + fatos-chave), `privacy.html` (política de privacidade) e `terms.html` (termos de uso), adaptados do Thunderbolt para o domínio JobFinder, com as menções obrigatórias: uso por conta e risco do usuário, possível violação dos Termos de Serviço do LinkedIn, armazenamento 100% local (sem coleta de dados), nenhum dado transmitido a servidores do JobFinder, cookies de sessão armazenados localmente e nunca compartilhados, usuário responsável por respeitar os limites de rate do LinkedIn.
|
|
79
|
+
- **README.md completo**: o que é/onde o faz, requisitos (Node ≥ 20.19, Playwright e Ollama opcionais), comandos de instalação (CMD/MobaXterm + normal), fluxo de uso, flags do launcher, layout de `~/.jobfinder/`, desenvolvimento, política de publicação (versionamento visual + GitHub Actions) e links legais. Remoção dos `.gitkeep` obsoletos e `*.tgz` adicionado ao `.gitignore`.
|
|
80
|
+
- **Directory skeleton** for the backend (`src/server/routes`, `src/server/storage`, `src/server/services/{linkedin,llm,posting,outreach,jobs}`) and the UI (`src/ui/{public,src/{components,pages,lib}}`).
|
|
81
|
+
- **`.gitignore`** protecting `node_modules/`, `dist/`, `storage/`, `.jobfinder/`, `.env`, `cookies.txt` and logs.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dan Pariente Hachuel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,111 @@
|
|
|
1
|
-
#
|
|
1
|
+
# JobFinder
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Local-first LinkedIn automation.** Single user, no cloud account, no external database — everything runs on your machine and is stored in JSON.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@danhachuel/jobfinder)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://nodejs.org)
|
|
8
|
+
|
|
9
|
+
> ⚠️ **Use at your own risk.** Automating LinkedIn may violate LinkedIn's Terms of Service and can restrict your account. JobFinder is not affiliated with LinkedIn. The official LinkedIn API is the recommended path; the cookie fallback exists because the official API does not cover outreach and job applications. See [legal/terms.html](legal/terms.html).
|
|
10
|
+
|
|
11
|
+
## What it does
|
|
12
|
+
|
|
13
|
+
| Module | Capabilities |
|
|
14
|
+
|---|---|
|
|
15
|
+
| **Postagens** | Automatic posts from predefined themes (LLM), scheduled posts (date/time), manual text posts, history with filters, preview mandatory before publishing |
|
|
16
|
+
| **Conexões & DMs** | Keyword people search, batch invitations with `{{nome}}`/`{{empresa}}`/`{{cargo}}` variables, DM cascades (up to 5 messages/day, configurable interval, day delays, auto-pause on reply, manual approval), weekly/daily quotas |
|
|
17
|
+
| **Vagas** | Resume upload (PDF/DOCX/TXT) parsed locally, semantic match score 0–100 with skill gaps, job search, save/discard, Easy Apply automation (dry-run first) |
|
|
18
|
+
|
|
19
|
+
Everything is driven from a React dashboard at `http://localhost:4040` — metric cards, Chart.js charts, progress and quota bars, toasts.
|
|
20
|
+
|
|
21
|
+
## Requirements
|
|
22
|
+
|
|
23
|
+
- **Node.js ≥ 20.19** (developed/tested on Node 22)
|
|
24
|
+
- Optional: **Playwright** for live Easy Apply (`npm i -g playwright && npx playwright install chromium`) — without it, applications stay in dry-run
|
|
25
|
+
- Optional: **Ollama** running locally for free LLM drafts (`ollama serve`) — or configure OpenAI / DeepSeek / Anthropic keys in the UI
|
|
26
|
+
|
|
27
|
+
## Install (delivered per version)
|
|
28
|
+
|
|
29
|
+
Windows / CMD / MobaXterm:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx.cmd --yes --prefer-online @danhachuel/jobfinder@<VERSAO> install
|
|
33
|
+
npx.cmd --yes --prefer-online @danhachuel/jobfinder@<VERSAO>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Normal terminal:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx --yes @danhachuel/jobfinder@<VERSAO> install
|
|
40
|
+
npx --yes @danhachuel/jobfinder@<VERSAO>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`install` creates `~/.jobfinder/` (config, channels, topics, posts, connections, dm-cascades, jobs, applications, resume, logs). It is safe to re-run: existing data is never overwritten.
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
1. Start the app → it opens `http://localhost:4040`
|
|
48
|
+
2. **Integrações** → connect LinkedIn:
|
|
49
|
+
- **Recommended:** create your LinkedIn app ([Criar API Oficial do LinkedIn](legal/)) → paste Client ID/Secret → run the OAuth flow
|
|
50
|
+
- **Fallback:** export cookies with ["Get cookies.txt LOCALLY"](https://chromewebstore.google.com/) and upload `cookies.txt`
|
|
51
|
+
3. **Configurações** → choose your LLM provider and tune the rate limits (100 invites/week, 5 DMs/day, 20 applications/day by default)
|
|
52
|
+
4. **Dry-run is ON by default** — explore the whole app safely; disable it in Configurações when you are ready
|
|
53
|
+
5. Publish posts, connect with people, run DM cascades, match and apply to jobs
|
|
54
|
+
|
|
55
|
+
### Useful flags
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
node scripts/cli.mjs start --port 3031 # custom port
|
|
59
|
+
node scripts/cli.mjs start --data-dir . # custom data directory
|
|
60
|
+
node scripts/cli.mjs start --dry-run # force dry-run
|
|
61
|
+
node scripts/cli.mjs --version # version info
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Screenshots
|
|
65
|
+
|
|
66
|
+
> Painel, Postagens, Conexões, Cascatas de DM, Vagas, Candidaturas, Integrações e Configurações — see the walkthrough in the app header (**Ver tutorial**) or open the app to explore in dry-run mode. Screenshots are published with each release in the GitHub Releases.
|
|
67
|
+
|
|
68
|
+
## Where the data lives
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
~/.jobfinder/
|
|
72
|
+
├── config.json # LLM provider, LinkedIn auth, rate limits, dry-run
|
|
73
|
+
├── channels.json # LinkedIn accounts (OAuth tokens or cookies — local only)
|
|
74
|
+
├── topics.json # themes for automatic posts
|
|
75
|
+
├── posts.json # drafts, scheduled, published, failed
|
|
76
|
+
├── connections.json # invitations sent
|
|
77
|
+
├── dm-cascades.json # DM sequences in progress
|
|
78
|
+
├── jobs.json # saved/discarded jobs + match scores
|
|
79
|
+
├── applications.json # applications + reports
|
|
80
|
+
├── resume.json # parsed resume
|
|
81
|
+
└── logs/YYYY-MM-DD.jsonl
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
No cloud sync, no telemetry, no accounts.
|
|
85
|
+
|
|
86
|
+
## Development
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm install # root (server) deps
|
|
90
|
+
npm run dev # API (4040) + UI dev server (5173) in parallel
|
|
91
|
+
npm run build # builds the UI into src/ui/dist
|
|
92
|
+
npm start # production-style start (serves the built UI)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Layout: `scripts/cli.mjs` (launcher) · `src/server/` (Express API, JSON store, LinkedIn + LLM services, workers) · `src/ui/` (React + Vite + Tailwind v4).
|
|
96
|
+
|
|
97
|
+
## Publishing
|
|
98
|
+
|
|
99
|
+
Versions use the visual `MAJOR.MINOR.PATCH` scheme with a two-digit PATCH (`0.0.01` → after `0.0.99` comes `0.1.00`; after `0.9.99` comes `1.0.00`). npm publishes the normalized SemVer form (`0.0.01` → `0.0.1`) — always use the canonical registry version in install commands.
|
|
100
|
+
|
|
101
|
+
Releases happen **exclusively via GitHub Actions** (`.github/workflows/publish-npm.yml`): bump version → commit/push → dispatch with dist-tag `next` → push tag `vX.Y.ZZ` → the workflow verifies the tarball and promotes it to `latest`. Every change is recorded in [CHANGELOG.md](CHANGELOG.md).
|
|
102
|
+
|
|
103
|
+
## Legal
|
|
104
|
+
|
|
105
|
+
- [Legal index](legal/index.html) · [Privacy Policy](legal/privacy.html) · [Terms of Use](legal/terms.html)
|
|
106
|
+
|
|
107
|
+
Key points: 100% local storage, no data sent to any JobFinder server, cookies never shared, you are responsible for respecting LinkedIn's rate limits and for every action taken on your account.
|
|
108
|
+
|
|
109
|
+
## License
|
|
110
|
+
|
|
111
|
+
[MIT](LICENSE) © 2026 Dan Pariente Hachuel
|
package/package.json
CHANGED
|
@@ -1,6 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danhachuel/jobfinder",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.01",
|
|
4
|
+
"description": "JobFinder — local-first LinkedIn automation (posts, connections/DMs, job matching) with a React + Vite UI. Single-user, JSON storage, no external database.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"linkedin",
|
|
7
|
+
"automation",
|
|
8
|
+
"jobs",
|
|
9
|
+
"local-first",
|
|
10
|
+
"cli",
|
|
11
|
+
"npx"
|
|
12
|
+
],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"author": "Dan Pariente Hachuel",
|
|
16
|
+
"main": "src/server/index.mjs",
|
|
17
|
+
"bin": {
|
|
18
|
+
"jobfinder": "scripts/cli.mjs"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"scripts/",
|
|
22
|
+
"src/server/",
|
|
23
|
+
"src/ui/dist/",
|
|
24
|
+
"CHANGELOG.md",
|
|
25
|
+
"README.md",
|
|
26
|
+
"LICENSE"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"install": "node scripts/cli.mjs install",
|
|
30
|
+
"dev": "concurrently -k -n server,ui -c blue,magenta \"npm:dev:server\" \"npm:dev:ui\"",
|
|
31
|
+
"dev:server": "node --watch src/server/index.mjs",
|
|
32
|
+
"dev:ui": "npm --prefix src/ui run dev",
|
|
33
|
+
"build": "npm --prefix src/ui run build",
|
|
34
|
+
"start": "node scripts/cli.mjs start",
|
|
35
|
+
"smoke": "node scripts/cli.mjs install && node scripts/cli.mjs --version"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=20.19.0"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"express": "^5.3.0",
|
|
42
|
+
"mammoth": "^1.13.0",
|
|
43
|
+
"pdfjs-dist": "^6.5.438"
|
|
44
|
+
},
|
|
45
|
+
"optionalDependencies": {
|
|
46
|
+
"playwright": "^1.65.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"concurrently": "^10.0.7"
|
|
50
|
+
},
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "git+https://github.com/DanHachuel/JobFinder.git"
|
|
54
|
+
},
|
|
55
|
+
"homepage": "https://github.com/DanHachuel/JobFinder#readme",
|
|
56
|
+
"bugs": {
|
|
57
|
+
"url": "https://github.com/DanHachuel/JobFinder/issues"
|
|
58
|
+
}
|
|
59
|
+
}
|
package/scripts/cli.mjs
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* JobFinder CLI launcher (npx entrypoint).
|
|
4
|
+
*
|
|
5
|
+
* Commands:
|
|
6
|
+
* jobfinder install create ~/.jobfinder/ skeleton (safe to re-run)
|
|
7
|
+
* jobfinder start the local server (backend + UI) on localhost:4040
|
|
8
|
+
* jobfinder start alias of the default command
|
|
9
|
+
* jobfinder --version print version info
|
|
10
|
+
* jobfinder --help print usage
|
|
11
|
+
*
|
|
12
|
+
* Flags:
|
|
13
|
+
* --port <n> override the API/UI port (default: 4040)
|
|
14
|
+
* --host <addr> bind address (default: 127.0.0.1)
|
|
15
|
+
* --data-dir <path> override the data directory (default: ~/.jobfinder or $JOBFINDER_HOME)
|
|
16
|
+
* --open / --no-open open/do not open the browser on start
|
|
17
|
+
* --dry-run start with automation in dry-run mode (nothing is really sent)
|
|
18
|
+
*/
|
|
19
|
+
import { spawn } from 'node:child_process';
|
|
20
|
+
import fs from 'node:fs';
|
|
21
|
+
import path from 'node:path';
|
|
22
|
+
import os from 'node:os';
|
|
23
|
+
import process from 'node:process';
|
|
24
|
+
import { fileURLToPath } from 'node:url';
|
|
25
|
+
|
|
26
|
+
import { ensureDataDir, resolveDataDir, isDataDirHealthy } from '../src/server/storage/bootstrap.mjs';
|
|
27
|
+
|
|
28
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
29
|
+
const ROOT = path.resolve(__dirname, '..');
|
|
30
|
+
const SERVER_ENTRY = path.join(ROOT, 'src', 'server', 'index.mjs');
|
|
31
|
+
const UI_DIST = path.join(ROOT, 'src', 'ui', 'dist');
|
|
32
|
+
|
|
33
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8'));
|
|
34
|
+
const VISUAL_VERSION = pkg.version;
|
|
35
|
+
const NPM_VERSION = normalizeNpmVersion(pkg.version);
|
|
36
|
+
|
|
37
|
+
/** npm normalizes SemVer: 0.0.01 -> 0.0.1, 0.1.00 -> 0.1.0 */
|
|
38
|
+
function normalizeNpmVersion(v) {
|
|
39
|
+
return v
|
|
40
|
+
.split('.')
|
|
41
|
+
.map((part) => String(Number(part)))
|
|
42
|
+
.join('.');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const USAGE = `
|
|
46
|
+
JobFinder — local-first LinkedIn automation
|
|
47
|
+
|
|
48
|
+
Usage:
|
|
49
|
+
jobfinder install Create the local JSON data store (~/.jobfinder/)
|
|
50
|
+
jobfinder [start] [flags] Start the app at http://localhost:4040
|
|
51
|
+
jobfinder --version Show version
|
|
52
|
+
jobfinder --help Show this help
|
|
53
|
+
|
|
54
|
+
Flags:
|
|
55
|
+
--port <n> Port to listen on (default 4040)
|
|
56
|
+
--host <addr> Bind address (default 127.0.0.1)
|
|
57
|
+
--data-dir <path> Data directory (default ~/.jobfinder, override with JOBFINDER_HOME)
|
|
58
|
+
--open Open the browser after start (default)
|
|
59
|
+
--no-open Do not open the browser after start
|
|
60
|
+
--dry-run Run with automations in dry-run mode (no real LinkedIn actions)
|
|
61
|
+
|
|
62
|
+
Install commands (canonical npm version):
|
|
63
|
+
npx --yes @danhachuel/jobfinder@${NPM_VERSION} install
|
|
64
|
+
npx --yes @danhachuel/jobfinder@${NPM_VERSION}
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
function parseArgs(argv) {
|
|
68
|
+
const args = { command: null, port: null, host: null, dataDir: null, open: null, dryRun: false };
|
|
69
|
+
const rest = [...argv];
|
|
70
|
+
const first = rest[0];
|
|
71
|
+
if (first && !first.startsWith('-')) {
|
|
72
|
+
args.command = first;
|
|
73
|
+
rest.shift();
|
|
74
|
+
}
|
|
75
|
+
for (let i = 0; i < rest.length; i += 1) {
|
|
76
|
+
const token = rest[i];
|
|
77
|
+
switch (token) {
|
|
78
|
+
case '--port':
|
|
79
|
+
args.port = Number(rest[i + 1]);
|
|
80
|
+
i += 1;
|
|
81
|
+
break;
|
|
82
|
+
case '--host':
|
|
83
|
+
args.host = rest[i + 1];
|
|
84
|
+
i += 1;
|
|
85
|
+
break;
|
|
86
|
+
case '--data-dir':
|
|
87
|
+
args.dataDir = rest[i + 1];
|
|
88
|
+
i += 1;
|
|
89
|
+
break;
|
|
90
|
+
case '--open':
|
|
91
|
+
args.open = true;
|
|
92
|
+
break;
|
|
93
|
+
case '--no-open':
|
|
94
|
+
args.open = false;
|
|
95
|
+
break;
|
|
96
|
+
case '--dry-run':
|
|
97
|
+
args.dryRun = true;
|
|
98
|
+
break;
|
|
99
|
+
case '--help':
|
|
100
|
+
case '-h':
|
|
101
|
+
args.command = 'help';
|
|
102
|
+
break;
|
|
103
|
+
case '--version':
|
|
104
|
+
case '-v':
|
|
105
|
+
args.command = 'version';
|
|
106
|
+
break;
|
|
107
|
+
default:
|
|
108
|
+
if (token.startsWith('-')) {
|
|
109
|
+
console.warn(`[jobfinder] ignoring unknown flag: ${token}`);
|
|
110
|
+
}
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return args;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function printBanner() {
|
|
118
|
+
const line = '-'.repeat(58);
|
|
119
|
+
console.log(line);
|
|
120
|
+
console.log(` JobFinder v${VISUAL_VERSION} (npm: ${NPM_VERSION})`);
|
|
121
|
+
console.log(' Local-first LinkedIn automation • JSON storage • single user');
|
|
122
|
+
console.log(line);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function commandInstall({ dataDir }) {
|
|
126
|
+
const resolved = resolveDataDir(dataDir);
|
|
127
|
+
printBanner();
|
|
128
|
+
const report = ensureDataDir(resolved);
|
|
129
|
+
console.log(` Data directory: ${resolved}`);
|
|
130
|
+
if (report.created.length) {
|
|
131
|
+
console.log(` Created: ${report.created.join(', ')}`);
|
|
132
|
+
} else {
|
|
133
|
+
console.log(' Already initialized — no files were changed.');
|
|
134
|
+
}
|
|
135
|
+
if (!isDataDirHealthy(resolved)) {
|
|
136
|
+
console.error('[jobfinder] data directory is incomplete. Check permissions and try again.');
|
|
137
|
+
process.exitCode = 1;
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
console.log('\nNext steps:');
|
|
141
|
+
console.log(` 1. Connect LinkedIn in the app (Integracoes) — official API or cookies.txt fallback`);
|
|
142
|
+
console.log(` 2. Pick an LLM provider (OpenAI, Anthropic, DeepSeek or local Ollama) in Config`);
|
|
143
|
+
console.log(` 3. Start the app: npx --yes @danhachuel/jobfinder@${NPM_VERSION}`);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async function commandStart({ port, host, dataDir, open, dryRun }) {
|
|
147
|
+
const resolved = resolveDataDir(dataDir);
|
|
148
|
+
ensureDataDir(resolved);
|
|
149
|
+
|
|
150
|
+
if (!fs.existsSync(SERVER_ENTRY)) {
|
|
151
|
+
console.error(`[jobfinder] server entry not found at ${SERVER_ENTRY}`);
|
|
152
|
+
process.exit(1);
|
|
153
|
+
}
|
|
154
|
+
if (!fs.existsSync(path.join(UI_DIST, 'index.html'))) {
|
|
155
|
+
console.warn(
|
|
156
|
+
'[jobfinder] UI build not found (src/ui/dist). The API will run, but the UI will be blank.\n' +
|
|
157
|
+
' Build it with: npm run build (requires the UI dependencies installed)'
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const env = {
|
|
162
|
+
...process.env,
|
|
163
|
+
JOBFINDER_DATA_DIR: resolved,
|
|
164
|
+
JOBFINDER_DRY_RUN: dryRun ? '1' : process.env.JOBFINDER_DRY_RUN || '',
|
|
165
|
+
};
|
|
166
|
+
if (port) env.JOBFINDER_PORT = String(port);
|
|
167
|
+
if (host) env.JOBFINDER_HOST = host;
|
|
168
|
+
|
|
169
|
+
printBanner();
|
|
170
|
+
const listenPort = port || Number(process.env.JOBFINDER_PORT) || 4040;
|
|
171
|
+
const listenHost = host || process.env.JOBFINDER_HOST || '127.0.0.1';
|
|
172
|
+
const url = `http://${listenHost === '0.0.0.0' ? 'localhost' : listenHost}:${listenPort}`;
|
|
173
|
+
console.log(` Data directory : ${resolved}`);
|
|
174
|
+
console.log(` Mode : ${dryRun ? 'DRY-RUN (no real actions are sent)' : 'live'}`);
|
|
175
|
+
console.log(` URL : ${url}`);
|
|
176
|
+
console.log(' Press Ctrl+C to stop.\n');
|
|
177
|
+
|
|
178
|
+
const child = spawn(process.execPath, [SERVER_ENTRY], { stdio: 'inherit', env, cwd: ROOT });
|
|
179
|
+
const forward = (signal) => () => {
|
|
180
|
+
child.kill(signal);
|
|
181
|
+
};
|
|
182
|
+
process.on('SIGINT', forward('SIGINT'));
|
|
183
|
+
process.on('SIGTERM', forward('SIGTERM'));
|
|
184
|
+
|
|
185
|
+
const shouldOpen = open === null ? !process.env.CI && process.env.JOBFINDER_NO_OPEN !== '1' : open;
|
|
186
|
+
if (shouldOpen) {
|
|
187
|
+
setTimeout(() => openBrowser(url), 1200);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
child.on('exit', (code, signal) => {
|
|
191
|
+
process.exit(code ?? (signal ? 1 : 0));
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function openBrowser(url) {
|
|
196
|
+
const cmd = process.platform === 'win32' ? 'cmd' : process.platform === 'darwin' ? 'open' : 'xdg-open';
|
|
197
|
+
const args =
|
|
198
|
+
process.platform === 'win32' ? ['/c', 'start', '', url] : [url];
|
|
199
|
+
try {
|
|
200
|
+
spawn(cmd, args, { stdio: 'ignore', detached: true }).unref();
|
|
201
|
+
} catch {
|
|
202
|
+
/* opening the browser is best-effort */
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function commandVersion() {
|
|
207
|
+
console.log(`JobFinder v${VISUAL_VERSION} (npm: ${NPM_VERSION})`);
|
|
208
|
+
console.log(`os: ${os.type()} ${os.arch()} • node: ${process.version}`);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
async function main() {
|
|
212
|
+
const args = parseArgs(process.argv.slice(2));
|
|
213
|
+
switch (args.command) {
|
|
214
|
+
case 'install':
|
|
215
|
+
commandInstall(args);
|
|
216
|
+
break;
|
|
217
|
+
case 'help':
|
|
218
|
+
console.log(USAGE.trim());
|
|
219
|
+
break;
|
|
220
|
+
case 'version':
|
|
221
|
+
commandVersion();
|
|
222
|
+
break;
|
|
223
|
+
case 'start':
|
|
224
|
+
case null:
|
|
225
|
+
await commandStart(args);
|
|
226
|
+
break;
|
|
227
|
+
default:
|
|
228
|
+
console.error(`[jobfinder] unknown command: ${args.command}`);
|
|
229
|
+
console.log(USAGE.trim());
|
|
230
|
+
process.exit(1);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
await main();
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JobFinder — Express application factory.
|
|
3
|
+
*
|
|
4
|
+
* Serves:
|
|
5
|
+
* /api/* REST API consumed by the React UI
|
|
6
|
+
* / the built UI (src/ui/dist) when available
|
|
7
|
+
*/
|
|
8
|
+
import express from 'express';
|
|
9
|
+
import fs from 'node:fs';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
|
|
12
|
+
import { UI_DIST, REPO_ROOT } from './paths.mjs';
|
|
13
|
+
import { createApiRouter } from './routes/index.mjs';
|
|
14
|
+
|
|
15
|
+
function readPkgVersion() {
|
|
16
|
+
try {
|
|
17
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(REPO_ROOT, 'package.json'), 'utf8'));
|
|
18
|
+
return pkg.version;
|
|
19
|
+
} catch {
|
|
20
|
+
return '0.0.00';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function createApp({ store, logger, config, rateLimiter, dataDir }) {
|
|
25
|
+
const app = express();
|
|
26
|
+
app.disable('x-powered-by');
|
|
27
|
+
|
|
28
|
+
app.locals.version = readPkgVersion();
|
|
29
|
+
app.locals.dataDir = dataDir;
|
|
30
|
+
app.locals.config = config;
|
|
31
|
+
|
|
32
|
+
app.use(express.json({ limit: '4mb' }));
|
|
33
|
+
|
|
34
|
+
// Request log (cheap, useful for the local UI activity feed).
|
|
35
|
+
app.use((req, res, next) => {
|
|
36
|
+
if (req.path.startsWith('/api')) {
|
|
37
|
+
logger.info('http', `${req.method} ${req.originalUrl}`);
|
|
38
|
+
}
|
|
39
|
+
next();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const api = createApiRouter({ store, logger, config, rateLimiter, dataDir });
|
|
43
|
+
app.use('/api', api);
|
|
44
|
+
|
|
45
|
+
// Static UI (built by Vite). In dev, the Vite server proxies /api here.
|
|
46
|
+
if (fs.existsSync(UI_DIST)) {
|
|
47
|
+
app.use(express.static(UI_DIST, { index: false, maxAge: '1h' }));
|
|
48
|
+
// SPA fallback: any other GET serves index.html.
|
|
49
|
+
app.use((req, res, next) => {
|
|
50
|
+
if (req.method !== 'GET') return next();
|
|
51
|
+
res.sendFile(`${UI_DIST}/index.html`);
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
app.get('/', (req, res) => {
|
|
55
|
+
res
|
|
56
|
+
.status(503)
|
|
57
|
+
.type('text/plain')
|
|
58
|
+
.send('JobFinder API is running, but the UI build is missing.\nRun "npm run build" (or "npm run dev" for the dev server).');
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// 404 for unknown API routes.
|
|
63
|
+
app.use('/api', (req, res) => {
|
|
64
|
+
res.status(404).json({ error: { code: 'not_found', message: `No route for ${req.method} ${req.originalUrl}` } });
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Central error handler.
|
|
68
|
+
app.use((err, req, res, next) => {
|
|
69
|
+
const status = Number.isInteger(err?.status) ? err.status : 500;
|
|
70
|
+
const code = err?.code ?? 'internal_error';
|
|
71
|
+
const message = status >= 500 && !err?.expose ? 'Internal server error' : err?.message ?? 'Unexpected error';
|
|
72
|
+
logger.error('http', 'request failed', { status, message: err?.message, url: req.originalUrl });
|
|
73
|
+
res.status(status).json({
|
|
74
|
+
error: { code, message, ...(err?.details ? { details: err.details } : {}) },
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
return app;
|
|
79
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JobFinder — server context.
|
|
3
|
+
*
|
|
4
|
+
* Builds the singletons shared by every route and service from the
|
|
5
|
+
* resolved data directory: the JSON store, the logger, the rate limiter
|
|
6
|
+
* and the current configuration.
|
|
7
|
+
*/
|
|
8
|
+
import { JsonStore } from './storage/jsonStore.mjs';
|
|
9
|
+
import { Logger } from './storage/logger.mjs';
|
|
10
|
+
import { RateLimiter } from './middleware/rateLimiter.mjs';
|
|
11
|
+
import { ensureDataDir } from './storage/bootstrap.mjs';
|
|
12
|
+
|
|
13
|
+
export function createContext(dataDir) {
|
|
14
|
+
ensureDataDir(dataDir);
|
|
15
|
+
const store = new JsonStore(dataDir);
|
|
16
|
+
const logger = new Logger(dataDir);
|
|
17
|
+
const config = store.read('config.json', {});
|
|
18
|
+
const rateLimiter = new RateLimiter({ config, logger });
|
|
19
|
+
return { dataDir, store, logger, config, rateLimiter };
|
|
20
|
+
}
|