@cerefox/memory 0.9.0 → 0.9.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/AGENT_GUIDE.md +28 -26
- package/AGENT_QUICK_REFERENCE.md +12 -12
- package/dist/bin/cerefox.js +507 -355
- package/dist/frontend/assets/{index-CAp2_lFX.js → index-De3R6K8J.js} +29 -29
- package/dist/frontend/assets/{index-CAp2_lFX.js.map → index-De3R6K8J.js.map} +1 -1
- package/dist/frontend/index.html +1 -1
- package/dist/server-assets/_shared/ef-meta/index.ts +1 -1
- package/dist/server-assets/_shared/mcp-tools/get-help-content.ts +2 -2
- package/docs/guides/access-paths.md +40 -34
- package/docs/guides/cli.md +158 -16
- package/docs/guides/configuration.md +20 -29
- package/docs/guides/connect-agents.md +154 -177
- package/docs/guides/ops-scripts.md +73 -53
- package/docs/guides/quickstart.md +26 -20
- package/docs/guides/setup-cloud-run.md +12 -2
- package/docs/guides/setup-local.md +14 -8
- package/docs/guides/setup-supabase.md +57 -162
- package/docs/guides/upgrading.md +43 -30
- package/package.json +1 -1
|
@@ -4,23 +4,36 @@ Reference guide for the operational scripts in `scripts/`. Run these from the pr
|
|
|
4
4
|
|
|
5
5
|
> Looking for `cerefox <subcommand>` reference (ingest, search, get-doc, etc.)? See [`docs/guides/cli.md`](cli.md). This guide covers the `scripts/` directory only.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Who this guide is for
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
There are two audiences:
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
| `backup_create.py` | Python | `uv run python scripts/backup_create.py` |
|
|
18
|
-
| `backup_restore.py` | Python | `uv run python scripts/backup_restore.py` |
|
|
19
|
-
| `reindex_all.py` | Python | `uv run python scripts/reindex_all.py` |
|
|
11
|
+
- **End users** (installed via the installer or `npm install -g @cerefox/memory`, no repo
|
|
12
|
+
clone) do not run the `scripts/` directory at all. The user-facing equivalents are CLI
|
|
13
|
+
commands: `cerefox server deploy` (schema + RPCs + Edge Functions), `cerefox server reindex`,
|
|
14
|
+
and `cerefox backup create` / `cerefox backup restore`. Skip to [CLI commands](#cli-commands).
|
|
15
|
+
- **Contributors** (clone the repo, use `bun`) run the `scripts/` directly. That's the rest
|
|
16
|
+
of this guide.
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
## Contributor scripts
|
|
22
19
|
|
|
23
|
-
The
|
|
20
|
+
The canonical scripts are **TypeScript**, run with [Bun](https://bun.sh) (install with
|
|
21
|
+
`curl -fsSL https://bun.sh/install | bash`):
|
|
22
|
+
|
|
23
|
+
| Script | Run with |
|
|
24
|
+
|---|---|
|
|
25
|
+
| `db_status.ts` | `bun scripts/db_status.ts` |
|
|
26
|
+
| `sync_docs.ts` | `bun scripts/sync_docs.ts` |
|
|
27
|
+
| `db_deploy.ts` | `bun scripts/db_deploy.ts` |
|
|
28
|
+
| `db_migrate.ts` | `bun scripts/db_migrate.ts` |
|
|
29
|
+
| `backup_create.ts` | `bun scripts/backup_create.ts` |
|
|
30
|
+
| `backup_restore.ts` | `bun scripts/backup_restore.ts` |
|
|
31
|
+
| `reindex_all.ts` | `bun scripts/reindex_all.ts` |
|
|
32
|
+
|
|
33
|
+
The `.py` equivalents are **legacy** — they still exist as a migration aid but are no longer
|
|
34
|
+
maintained; use the `.ts` scripts. The legacy `db_status.py` and `sync_docs.py` are
|
|
35
|
+
deprecation shims that exit non-zero with a pointer to the TS replacement, so update any cron
|
|
36
|
+
jobs / CI / make targets that invoke them.
|
|
24
37
|
|
|
25
38
|
### TS scripts and `.env` resolution
|
|
26
39
|
|
|
@@ -34,28 +47,28 @@ See [`docs/specs/polish-and-distribution-design.md` §7b](../specs/polish-and-di
|
|
|
34
47
|
|
|
35
48
|
---
|
|
36
49
|
|
|
37
|
-
## db_deploy.
|
|
50
|
+
## db_deploy.ts — Schema deployment
|
|
38
51
|
|
|
39
|
-
Applies the full Cerefox schema (tables, indexes, RPC functions) to a Postgres database. Use this for **fresh installs** or to re-apply the schema after a Cerefox update.
|
|
52
|
+
Applies the full Cerefox schema (tables, indexes, RPC functions) to a Postgres database. Use this for **fresh installs** or to re-apply the schema after a Cerefox update. (End users use `cerefox server deploy` instead.)
|
|
40
53
|
|
|
41
54
|
```bash
|
|
42
|
-
|
|
55
|
+
bun scripts/db_deploy.ts [OPTIONS]
|
|
43
56
|
```
|
|
44
57
|
|
|
45
58
|
| Option | Description |
|
|
46
59
|
|--------|-------------|
|
|
47
60
|
| `--dry-run` | Print the SQL that would be executed, without running it |
|
|
48
|
-
| `--reset` | Drop all `cerefox_*` tables before deploying (destructive) |
|
|
61
|
+
| `--reset` | Drop all `cerefox_*` tables before deploying (destructive; typed-`yes` guard) |
|
|
49
62
|
|
|
50
63
|
**Requires**: `CEREFOX_DATABASE_URL` — a direct Postgres connection URL (not the Supabase API URL).
|
|
51
64
|
|
|
52
|
-
After applying the schema, `db_deploy.
|
|
65
|
+
After applying the schema, `db_deploy.ts` automatically stamps any migration files in `src/cerefox/db/migrations/` into the `cerefox_migrations` table. This ensures `db_migrate.ts` does not re-apply changes that are already incorporated in the base schema.
|
|
53
66
|
|
|
54
67
|
Example:
|
|
55
68
|
```bash
|
|
56
69
|
# Deploy to local Docker Postgres
|
|
57
70
|
CEREFOX_DATABASE_URL=postgresql://cerefox:cerefox@localhost:5432/cerefox \
|
|
58
|
-
|
|
71
|
+
bun scripts/db_deploy.ts
|
|
59
72
|
```
|
|
60
73
|
|
|
61
74
|
---
|
|
@@ -77,16 +90,16 @@ Reports:
|
|
|
77
90
|
|
|
78
91
|
Exit code 0 if everything is healthy; 1 if any check fails; 2 on configuration error.
|
|
79
92
|
|
|
80
|
-
**Function-existence detection** routes through the `cerefox_pg_function_exists()` introspection RPC for reliability. Legacy deployments missing that RPC fall back to a naive "call with no args" probe — the legacy fallback will misreport RPCs that take required parameters as missing, which is itself a signal that the deployment needs `db_deploy.
|
|
93
|
+
**Function-existence detection** routes through the `cerefox_pg_function_exists()` introspection RPC for reliability. Legacy deployments missing that RPC fall back to a naive "call with no args" probe — the legacy fallback will misreport RPCs that take required parameters as missing, which is itself a signal that the deployment needs `db_deploy.ts`.
|
|
81
94
|
|
|
82
95
|
---
|
|
83
96
|
|
|
84
|
-
## db_migrate.
|
|
97
|
+
## db_migrate.ts — Schema migrations
|
|
85
98
|
|
|
86
|
-
Applies incremental migration files to an **existing** database with data. Use this when upgrading Cerefox on a database that already has documents — it applies only the changes that haven't been applied yet.
|
|
99
|
+
Applies incremental migration files to an **existing** database with data. Use this when upgrading Cerefox on a database that already has documents — it applies only the changes that haven't been applied yet. (End users get the same effect via `cerefox server deploy`, which applies pending migrations on an existing DB.)
|
|
87
100
|
|
|
88
101
|
```bash
|
|
89
|
-
|
|
102
|
+
bun scripts/db_migrate.ts [OPTIONS]
|
|
90
103
|
```
|
|
91
104
|
|
|
92
105
|
| Option | Description |
|
|
@@ -94,31 +107,31 @@ uv run python scripts/db_migrate.py [OPTIONS]
|
|
|
94
107
|
| `--dry-run` | Show which migrations would run, without applying them |
|
|
95
108
|
| `--status` | List all migration files and whether each has been applied |
|
|
96
109
|
|
|
97
|
-
**When to use `db_deploy.
|
|
110
|
+
**When to use `db_deploy.ts` vs `db_migrate.ts`:**
|
|
98
111
|
|
|
99
112
|
| Situation | Use |
|
|
100
113
|
|-----------|-----|
|
|
101
|
-
| Fresh database, no data | `db_deploy.
|
|
102
|
-
| Existing database, upgrading to a new version | `db_migrate.
|
|
114
|
+
| Fresh database, no data | `db_deploy.ts` |
|
|
115
|
+
| Existing database, upgrading to a new version | `db_migrate.ts` |
|
|
103
116
|
|
|
104
|
-
On a freshly deployed database, `db_migrate.
|
|
117
|
+
On a freshly deployed database, `db_migrate.ts` is always a no-op — `db_deploy.ts` has already stamped all existing migrations.
|
|
105
118
|
|
|
106
119
|
Migration files live in `src/cerefox/db/migrations/` and are applied in filename order (`0001_...`, `0002_...`). Each file is applied exactly once; applied filenames are recorded in the `cerefox_migrations` table.
|
|
107
120
|
|
|
108
121
|
Always run a backup before migrating:
|
|
109
122
|
|
|
110
123
|
```bash
|
|
111
|
-
|
|
124
|
+
bun scripts/backup_create.ts && bun scripts/db_migrate.ts
|
|
112
125
|
```
|
|
113
126
|
|
|
114
127
|
---
|
|
115
128
|
|
|
116
|
-
## backup_create.
|
|
129
|
+
## backup_create.ts — Create a backup
|
|
117
130
|
|
|
118
|
-
Exports all documents, chunks, and metadata to a JSON file in the backup directory.
|
|
131
|
+
Exports all documents, chunks, and metadata to a JSON file in the backup directory. (End users use `cerefox backup create`.)
|
|
119
132
|
|
|
120
133
|
```bash
|
|
121
|
-
|
|
134
|
+
bun scripts/backup_create.ts [OPTIONS]
|
|
122
135
|
```
|
|
123
136
|
|
|
124
137
|
| Option | Description |
|
|
@@ -133,19 +146,19 @@ Backup filename format: `cerefox-{YYYYMMDDTHHMMSSZ}[-{label}].json`
|
|
|
133
146
|
|
|
134
147
|
Example:
|
|
135
148
|
```bash
|
|
136
|
-
|
|
149
|
+
bun scripts/backup_create.ts --label before-v2-migration
|
|
137
150
|
```
|
|
138
151
|
|
|
139
152
|
Output: `backup-data/cerefox-20260308T143022Z-before-v2-migration.json`
|
|
140
153
|
|
|
141
154
|
---
|
|
142
155
|
|
|
143
|
-
## backup_restore.
|
|
156
|
+
## backup_restore.ts — Restore from a backup
|
|
144
157
|
|
|
145
|
-
Restores documents and chunks from a previously created backup file. Idempotent — documents with the same content hash are skipped.
|
|
158
|
+
Restores documents and chunks from a previously created backup file. Idempotent — documents with the same content hash are skipped. (End users use `cerefox backup restore`.)
|
|
146
159
|
|
|
147
160
|
```bash
|
|
148
|
-
|
|
161
|
+
bun scripts/backup_restore.ts BACKUP_FILE [OPTIONS]
|
|
149
162
|
```
|
|
150
163
|
|
|
151
164
|
| Option | Description |
|
|
@@ -155,10 +168,10 @@ uv run python scripts/backup_restore.py BACKUP_FILE [OPTIONS]
|
|
|
155
168
|
Example:
|
|
156
169
|
```bash
|
|
157
170
|
# Preview what will be restored
|
|
158
|
-
|
|
171
|
+
bun scripts/backup_restore.ts backup-data/cerefox-20260308T143022Z.json --dry-run
|
|
159
172
|
|
|
160
173
|
# Restore
|
|
161
|
-
|
|
174
|
+
bun scripts/backup_restore.ts backup-data/cerefox-20260308T143022Z.json
|
|
162
175
|
```
|
|
163
176
|
|
|
164
177
|
Restore output shows counts of restored / skipped / error documents.
|
|
@@ -208,7 +221,7 @@ The backup directory (`./backup-data/` by default) is gitignored. Back up the ba
|
|
|
208
221
|
|
|
209
222
|
## sync_docs.ts — Sync project documentation into Cerefox
|
|
210
223
|
|
|
211
|
-
|
|
224
|
+
Ingests `README.md`, `AGENT_GUIDE.md`, `AGENT_QUICK_REFERENCE.md`, and every Markdown file under `docs/` into your Cerefox knowledge base, updating existing documents in-place. Run this any time after editing documentation so AI agents always have access to the current state of the project.
|
|
212
225
|
|
|
213
226
|
Replaces the legacy `sync_docs.py`, which now prints a deprecation notice and exits non-zero.
|
|
214
227
|
|
|
@@ -223,7 +236,7 @@ bun scripts/sync_docs.ts [OPTIONS]
|
|
|
223
236
|
|
|
224
237
|
**Requires**: `CEREFOX_SUPABASE_URL` and `CEREFOX_SUPABASE_ANON_KEY` (the legacy anon JWT — `eyJ…` — used to invoke Edge Functions). Embedding happens server-side inside the `cerefox-ingest` Edge Function, so you don't need an OpenAI / Fireworks key in your local env for the TS script.
|
|
225
238
|
|
|
226
|
-
The target project must already exist (create it with `
|
|
239
|
+
The target project must already exist (create it with `cerefox project create cerefox` if needed).
|
|
227
240
|
|
|
228
241
|
**What gets synced**: `README.md` + `AGENT_GUIDE.md` + `AGENT_QUICK_REFERENCE.md` + all `.md` files under `docs/` (including `docs/research/` and `docs/specs/`). Research notes are included because Cerefox is a shared memory layer for multiple agents — exploratory notes, experiments, and decision rationale are exactly the kind of context agents benefit from. Files are matched to existing documents by their relative path (`source_path`), so re-running the script updates content in-place rather than creating duplicates.
|
|
229
242
|
|
|
@@ -244,7 +257,10 @@ Done. 0 new · 1 updated · 21 unchanged · 0 errors
|
|
|
244
257
|
For a personal knowledge base, a simple daily cron is sufficient:
|
|
245
258
|
|
|
246
259
|
```cron
|
|
247
|
-
|
|
260
|
+
# End user (CLI):
|
|
261
|
+
0 3 * * * cerefox backup create --label daily
|
|
262
|
+
# Contributor (repo clone):
|
|
263
|
+
0 3 * * * cd /path/to/cerefox && bun scripts/backup_create.ts --label daily
|
|
248
264
|
```
|
|
249
265
|
|
|
250
266
|
Backups include embeddings so they are larger than pure-text exports, but for a personal knowledge base they typically remain well under 100 MB.
|
|
@@ -253,19 +269,23 @@ Backups include embeddings so they are larger than pure-text exports, but for a
|
|
|
253
269
|
|
|
254
270
|
## CLI commands
|
|
255
271
|
|
|
256
|
-
The `cerefox` CLI also provides data management commands:
|
|
272
|
+
The `cerefox` CLI also provides data management commands (these are the end-user equivalents of the contributor scripts above):
|
|
257
273
|
|
|
258
274
|
| Command | Description |
|
|
259
275
|
|---------|-------------|
|
|
260
|
-
| `
|
|
261
|
-
| `
|
|
262
|
-
| `
|
|
263
|
-
| `
|
|
264
|
-
| `
|
|
265
|
-
| `
|
|
266
|
-
| `
|
|
267
|
-
| `
|
|
268
|
-
| `
|
|
269
|
-
| `
|
|
270
|
-
|
|
271
|
-
|
|
276
|
+
| `cerefox server deploy` | Deploy/update schema + RPCs + the 9 Edge Functions |
|
|
277
|
+
| `cerefox server reindex` | Re-embed all chunks |
|
|
278
|
+
| `cerefox backup create` | Create a backup |
|
|
279
|
+
| `cerefox backup restore FILE` | Restore from a backup |
|
|
280
|
+
| `cerefox document ingest FILE` | Ingest a markdown file |
|
|
281
|
+
| `cerefox document ingest --paste --title TITLE` | Ingest text from stdin |
|
|
282
|
+
| `cerefox search QUERY` | Search the knowledge base |
|
|
283
|
+
| `cerefox document list` | List all documents |
|
|
284
|
+
| `cerefox document delete ID` | Delete a document by ID |
|
|
285
|
+
| `cerefox project list` | List all projects |
|
|
286
|
+
| `cerefox document version list ID` | List all archived versions of a document |
|
|
287
|
+
| `cerefox document get ID` | Retrieve current content of a document |
|
|
288
|
+
| `cerefox document get ID --version VERSION_ID` | Retrieve a specific archived version |
|
|
289
|
+
| `cerefox web` | Start the web UI |
|
|
290
|
+
|
|
291
|
+
Run `cerefox --help` or `cerefox COMMAND --help` for details.
|
|
@@ -11,7 +11,7 @@ clone, no Python required.**
|
|
|
11
11
|
## Prerequisites
|
|
12
12
|
|
|
13
13
|
- **Node.js 20+** (`node --version`) or **Bun 1.0+** (`bun --version`)
|
|
14
|
-
- A **Supabase account** -- [supabase.com](https://supabase.com) (free tier works)
|
|
14
|
+
- A **Supabase account** -- [supabase.com](https://supabase.com) (free tier works). A fresh project is fine — `cerefox server deploy` (Step 2) deploys the schema for you.
|
|
15
15
|
- An **OpenAI API key** -- [platform.openai.com/api-keys](https://platform.openai.com/api-keys)
|
|
16
16
|
|
|
17
17
|
---
|
|
@@ -39,11 +39,26 @@ cerefox doctor # green across the board if everything's wired correctly
|
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
`cerefox init` validates each entry against the live service before saving,
|
|
42
|
-
writes `~/.cerefox/.env` (mode 0600),
|
|
42
|
+
writes `~/.cerefox/.env` (mode 0600), offers to deploy the schema + RPCs +
|
|
43
|
+
Edge Functions to a fresh Supabase project, and optionally ingests the bundled
|
|
43
44
|
self-docs into the `_cerefox-self-docs` project so agents can search for
|
|
44
45
|
Cerefox usage guidance.
|
|
45
46
|
|
|
46
|
-
## 3.
|
|
47
|
+
## 3. Deploy the server side (fresh project only)
|
|
48
|
+
|
|
49
|
+
If `cerefox init` didn't already do it, deploy the schema, RPCs, and Edge
|
|
50
|
+
Functions to your Supabase project — straight from the npm-bundled assets, no
|
|
51
|
+
source clone:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
cerefox server deploy # detects fresh vs. existing DB; --dry-run to preview
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
On an existing database this applies pending migrations and re-applies RPCs
|
|
58
|
+
in place, so re-run it after upgrading. Detailed walkthrough:
|
|
59
|
+
[`setup-supabase.md`](setup-supabase.md).
|
|
60
|
+
|
|
61
|
+
## 4. Wire up an AI agent
|
|
47
62
|
|
|
48
63
|
```bash
|
|
49
64
|
# Run the commands that apply to your setup:
|
|
@@ -62,7 +77,7 @@ Then restart your client:
|
|
|
62
77
|
All five writers configure the local stdio server. For the remote (Edge Function)
|
|
63
78
|
HTTP transport, or to edit configs by hand, see [`connect-agents.md`](connect-agents.md).
|
|
64
79
|
|
|
65
|
-
##
|
|
80
|
+
## 5. Try it
|
|
66
81
|
|
|
67
82
|
From your AI agent, ask:
|
|
68
83
|
|
|
@@ -72,22 +87,13 @@ You should see results from the bundled self-docs.
|
|
|
72
87
|
|
|
73
88
|
---
|
|
74
89
|
|
|
75
|
-
##
|
|
76
|
-
|
|
77
|
-
If your Supabase project is **brand new**, the Cerefox schema needs to be
|
|
78
|
-
deployed once before the CLI works. Until v0.6 ports the schema deploy to
|
|
79
|
-
TypeScript, this is the one step that still requires the source-checkout
|
|
80
|
-
path:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
git clone https://github.com/fstamatelopoulos/cerefox.git && cd cerefox
|
|
84
|
-
uv sync
|
|
85
|
-
# Add CEREFOX_DATABASE_URL to your .env, then:
|
|
86
|
-
uv run python scripts/db_deploy.py
|
|
87
|
-
```
|
|
90
|
+
## Contributing instead?
|
|
88
91
|
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
The path above is for **end users** (no clone). If you want to hack on Cerefox,
|
|
93
|
+
clone the repo, run `bun install`, and use the contributor scripts
|
|
94
|
+
(`bun scripts/db_deploy.ts`, `bun scripts/db_migrate.ts`). `uv` is only needed
|
|
95
|
+
for the legacy Python MCP fallback. See [`setup-local.md`](setup-local.md) and
|
|
96
|
+
`CONTRIBUTING.md`.
|
|
91
97
|
|
|
92
98
|
---
|
|
93
99
|
|
|
@@ -97,7 +103,7 @@ After v0.6.0, `cerefox init` will offer to do this for you.
|
|
|
97
103
|
`cerefox document ingest-dir ./notes/ --recursive`
|
|
98
104
|
- **Search from the CLI**: `cerefox search "your query"`
|
|
99
105
|
- **Discover all commands**: `cerefox --help`
|
|
100
|
-
- **Run the web UI
|
|
106
|
+
- **Run the web UI**: `cerefox web` (TypeScript — Hono backend + React SPA); see [`setup-local.md`](setup-local.md)
|
|
101
107
|
- **Connect more AI clients** (Cursor, Codex, ChatGPT GPT Actions, etc.):
|
|
102
108
|
[`connect-agents.md`](connect-agents.md)
|
|
103
109
|
- **Configuration reference**: [`configuration.md`](configuration.md)
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Deploy the Cerefox web UI to Google Cloud Run for a lightweight, serverless hosting option. This guide uses Supabase (free tier) for the database.
|
|
4
4
|
|
|
5
|
+
> **Note (v0.9):** The Cerefox web UI is now the TypeScript server (`cerefox web` — Hono
|
|
6
|
+
> backend + React/Mantine SPA), not the retired Python/FastAPI app. The container build and
|
|
7
|
+
> env-var wiring below still apply, but the `Dockerfile` must build/serve the TS `cerefox web`
|
|
8
|
+
> server (port 8000), and any reference to the old Python image should be treated as **needing
|
|
9
|
+
> revalidation** against the current `Dockerfile`. The "Securing access" middleware example is
|
|
10
|
+
> flagged inline.
|
|
11
|
+
|
|
5
12
|
---
|
|
6
13
|
|
|
7
14
|
## Prerequisites
|
|
@@ -61,7 +68,7 @@ gcloud run deploy $SERVICE_NAME \
|
|
|
61
68
|
CEREFOX_MAX_RESPONSE_BYTES=200000
|
|
62
69
|
```
|
|
63
70
|
|
|
64
|
-
**Memory**: Cerefox uses cloud embeddings (OpenAI API) — no local model is loaded. `--memory 512Mi` is sufficient for the web server alone.
|
|
71
|
+
**Memory**: Cerefox uses cloud embeddings (OpenAI API) — no local model is loaded. `--memory 512Mi` is sufficient for the TS `cerefox web` server alone.
|
|
65
72
|
|
|
66
73
|
**CPU**: `--cpu 1` is sufficient for personal use. Scale up for concurrent users.
|
|
67
74
|
|
|
@@ -113,5 +120,8 @@ Use Identity-Aware Proxy (IAP) in front of Cloud Run for Google SSO.
|
|
|
113
120
|
|
|
114
121
|
### Option 3 — Add HTTP basic auth
|
|
115
122
|
|
|
116
|
-
|
|
123
|
+
Add a Hono middleware to the TS `cerefox web` server that checks `Authorization: Basic ...`
|
|
124
|
+
headers, using `CEREFOX_BASIC_AUTH_USER` / `CEREFOX_BASIC_AUTH_PASSWORD` env vars. (The
|
|
125
|
+
old Python `src/cerefox/api/app.py` middleware path is retired — this needs revalidation
|
|
126
|
+
against the current TS web server's middleware hook.)
|
|
117
127
|
|
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Run the Cerefox web server and database on your own machine using Docker for Postgres+pgvector. Embeddings use the OpenAI API — an `OPENAI_API_KEY` is required even for local setups.
|
|
4
4
|
|
|
5
|
+
This guide is aimed at **contributors** who want a fully local stack (no hosted Supabase). End users on a hosted Supabase project should follow [`quickstart.md`](quickstart.md) instead.
|
|
6
|
+
|
|
5
7
|
---
|
|
6
8
|
|
|
7
9
|
## Prerequisites
|
|
8
10
|
|
|
9
11
|
- Docker and Docker Compose
|
|
10
|
-
-
|
|
12
|
+
- **Node.js 20+** or **Bun 1.0+** (the CLI runtime)
|
|
11
13
|
- An OpenAI API key (for embeddings — [platform.openai.com/api-keys](https://platform.openai.com/api-keys))
|
|
12
14
|
|
|
15
|
+
> The Python implementation is legacy and slated for removal in a future release; only the Python MCP server remains as a fallback. `uv` is only needed if you intend to run that fallback (`uv run cerefox mcp`).
|
|
16
|
+
|
|
13
17
|
---
|
|
14
18
|
|
|
15
19
|
## Step 1 — Clone and install
|
|
@@ -17,7 +21,7 @@ Run the Cerefox web server and database on your own machine using Docker for Pos
|
|
|
17
21
|
```bash
|
|
18
22
|
git clone https://github.com/fstamatelopoulos/cerefox.git
|
|
19
23
|
cd cerefox
|
|
20
|
-
|
|
24
|
+
bun install
|
|
21
25
|
```
|
|
22
26
|
|
|
23
27
|
---
|
|
@@ -68,7 +72,7 @@ OPENAI_API_KEY=sk-...
|
|
|
68
72
|
## Step 4 — Deploy the schema
|
|
69
73
|
|
|
70
74
|
```bash
|
|
71
|
-
|
|
75
|
+
bun scripts/db_deploy.ts
|
|
72
76
|
```
|
|
73
77
|
|
|
74
78
|
This creates all tables, indexes, and RPC functions. Run with `--dry-run` to preview SQL without executing.
|
|
@@ -76,18 +80,20 @@ This creates all tables, indexes, and RPC functions. Run with `--dry-run` to pre
|
|
|
76
80
|
To start fresh:
|
|
77
81
|
|
|
78
82
|
```bash
|
|
79
|
-
|
|
83
|
+
bun scripts/db_deploy.ts --reset # drops all cerefox_ tables first (typed-`yes` guard)
|
|
80
84
|
```
|
|
81
85
|
|
|
86
|
+
> End users on a hosted Supabase project use `cerefox server deploy` instead (no clone). The `bun scripts/db_*.ts` scripts are the low-level contributor path.
|
|
87
|
+
|
|
82
88
|
---
|
|
83
89
|
|
|
84
90
|
## Step 5 — Verify the setup
|
|
85
91
|
|
|
86
92
|
```bash
|
|
87
|
-
|
|
93
|
+
bun scripts/db_migrate.ts --status
|
|
88
94
|
```
|
|
89
95
|
|
|
90
|
-
You should see
|
|
96
|
+
You should see the schema reported as up to date with all migrations applied.
|
|
91
97
|
|
|
92
98
|
---
|
|
93
99
|
|
|
@@ -162,10 +168,10 @@ docker compose down -v # stop and delete database volume
|
|
|
162
168
|
When a new version of Cerefox introduces schema changes, run:
|
|
163
169
|
|
|
164
170
|
```bash
|
|
165
|
-
|
|
171
|
+
bun scripts/db_migrate.ts # --status to preview, --dry-run to see SQL
|
|
166
172
|
```
|
|
167
173
|
|
|
168
|
-
This applies incremental migrations without losing data. Always back up first (see `ops-scripts.md`).
|
|
174
|
+
This applies incremental migrations without losing data. Always back up first (see `ops-scripts.md`). End users on a hosted Supabase project run `cerefox server deploy` instead.
|
|
169
175
|
|
|
170
176
|
---
|
|
171
177
|
|