Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
197 commits
Select commit Hold shift + click to select a range
62f73a5
chore(chapter-01): organize the repo into readable workspaces
amal66 May 24, 2026
5ad6715
docs(chapter-02): add the community scaffolding for contributors
amal66 May 24, 2026
c72b8c7
feat(chapter-03): add Supabase migrations as database history
amal66 May 24, 2026
9f15ed1
fix(chapter-04): fail fast on config and compare secrets safely
amal66 May 24, 2026
bfc5539
feat(chapter-05): add structured logs with request IDs
amal66 May 24, 2026
91f9548
fix(chapter-06): remove console logs and avoid PII in logs
amal66 May 24, 2026
0a153ed
fix(chapter-07): add security headers and readiness checks
amal66 May 24, 2026
be60ae9
chore(chapter-08): give the API workspace its own project config
amal66 May 24, 2026
eea82f6
chore(chapter-09): move API source into the workspace path
amal66 May 24, 2026
bfb2466
refactor(chapter-10): split routes into modules with validation and a…
amal66 May 24, 2026
16de324
test(chapter-11): cover token storage and API-key helpers
amal66 May 24, 2026
7c1b463
ci(chapter-12): add automated checks for pull requests
amal66 May 24, 2026
54dcdf7
fix(chapter-13): time-limit stalled LLM streams
amal66 May 24, 2026
112a9a5
fix(chapter-14): give download tokens an expiration time
amal66 May 24, 2026
e3efabf
fix(chapter-15): default public tables to deny-all RLS
amal66 May 24, 2026
08dd715
fix(chapter-16): normalize shared-email access checks
amal66 May 24, 2026
f38ea30
fix(chapter-17): paginate chat history requests
amal66 May 24, 2026
8664afc
fix(chapter-18): bound JSON bodies and log process failures
amal66 May 24, 2026
93b1f1a
feat(chapter-19): add API linting with security rules
amal66 May 24, 2026
fd36246
ci(chapter-20): add dependency updates and ownership gates
amal66 May 24, 2026
bb249e0
ci(chapter-21): run audit and security lint checks in CI
amal66 May 24, 2026
5762ee7
fix(chapter-22): derive API-key encryption keys with HKDF salts
amal66 May 24, 2026
41ede55
fix(chapter-23): enforce monthly message credits before LLM calls
amal66 May 24, 2026
761f612
fix(chapter-24): spotlight untrusted content for prompt-injection def…
amal66 May 24, 2026
b358c58
fix(chapter-25): validate uploads by file signature
amal66 May 24, 2026
ca69fd8
refactor(chapter-26): bring chat tools into structured logging
amal66 May 24, 2026
5719dd1
feat(chapter-27): add Docker Compose for local self-hosting
amal66 May 24, 2026
e7a0976
test(chapter-28): add HTTP integration tests around the Express app
amal66 May 24, 2026
b7ef398
feat(chapter-29): retry transient LLM provider failures
amal66 May 24, 2026
5b82eff
fix(chapter-30): convert user IDs to UUID foreign keys
amal66 May 24, 2026
4378b6a
feat(chapter-31): make workflows exportable and importable
amal66 May 24, 2026
c32e930
docs(chapter-32): define the workflow pack format
amal66 May 24, 2026
0de6170
docs(chapter-33): warn contributors how to test safely
amal66 May 24, 2026
27694ca
test(chapter-34): cover message-credit enforcement edges
amal66 May 24, 2026
1f77a3f
test(chapter-35): cover spotlight nonces and document label lookup
amal66 May 24, 2026
d2406f4
test(chapter-36): cover model routing and safe fallbacks
amal66 May 24, 2026
213ee26
docs(chapter-37): make the README a guide to the whole fork
amal66 May 24, 2026
3031c9e
fix(chapter-38): close action-plan gaps that can be automated
amal66 May 24, 2026
2be2fa8
feat(chapter-39): automate safe manual follow-ups
amal66 May 24, 2026
05be49c
Cleanup
amal66 May 25, 2026
f98c209
refactor: provider registry, storage adapter, table-driven api-key lo…
amal66 May 25, 2026
c0dfd7e
feat(law-libraries): plugin registry for jurisdiction-specific law in…
amal66 May 25, 2026
97b37ca
feat(python-sdk): httpx-based sync/async client for the Mike API
amal66 May 25, 2026
abe78b7
refactor(chatTools): split 3412-line monolith into focused modules
amal66 May 25, 2026
57c1c1b
feat(google-cloud): GCS storage adapter + Vertex AI Gemini provider (#2)
amal66 May 25, 2026
3bbc927
Merge upstream willchen96/mike into the hardened fork
amal66 Jun 30, 2026
2e31d4e
fix(merge): resolve and DB-validate the flagged post-merge items
amal66 Jun 30, 2026
ecb27bd
fix(merge): restore two fork hardening behaviors the merge regressed
amal66 Jun 30, 2026
b3b59e3
build: lock @modelcontextprotocol/sdk added for the upstream MCP feature
amal66 Jun 30, 2026
0eb1d17
feat(word-addin): integrate the Word add-in onto the synced fork via …
amal66 Jun 30, 2026
ed1737b
fix(word-addin): @source the shared package so apps/web doesn't purge…
amal66 Jun 30, 2026
50f17ed
test(e2e): bring the Playwright web suite onto main + non-gating CI
amal66 Jun 30, 2026
6d6dca7
feat(api): BullMQ job queue for document conversion (ACTION_PLAN 3.2)
amal66 Jun 30, 2026
5d427b7
docs: acquisition tech due-diligence + phased remediation plan
amal66 Jun 30, 2026
4a0bed8
fix(api): Phase 0 must-fixes — prompt injection, shutdown, SSRF, cred…
amal66 Jun 30, 2026
1aecad9
refactor(api): Phase 1 quick wins — dead code, FK indexes, version/to…
amal66 Jun 30, 2026
d93ca26
refactor(api): structured logging everywhere + zip-download N+1 fix
amal66 Jun 30, 2026
3ecd02d
docs: update remediation progress log (Phase 0 + Phase 1 done)
amal66 Jun 30, 2026
3ffca8c
docs(security): document the real authz posture (service-role + app-l…
amal66 Jun 30, 2026
39c2800
test(api): route-level integration tests for the critical paths (Phas…
amal66 Jun 30, 2026
916816e
refactor(api): split the 3,900-line chatTools god-file into lib/tools…
amal66 Jun 30, 2026
e8c8415
feat(api): optional Sentry error monitoring (Phase 5)
amal66 Jun 30, 2026
235c727
test(web): establish frontend unit-test foundation (vitest + RTL) + CI
amal66 Jun 30, 2026
e2c1d52
refactor(api): extract documents service layer; thin the route handle…
amal66 Jun 30, 2026
80fcde6
docs: remediation progress — Phases 2 done, 3-5 partial
amal66 Jun 30, 2026
04a3712
refactor(api): extract projects service layer, tests-first (Phase 3)
amal66 Jun 30, 2026
0b34666
test(api): route-level tests for the tabular module (baseline before …
amal66 Jun 30, 2026
35ef5c6
refactor(api): extract tabular service layer (Phase 3)
amal66 Jun 30, 2026
db07316
test(api): route tests for the user module (sensitive — baseline befo…
amal66 Jun 30, 2026
bf5bd24
refactor(api): extract user service layer (Phase 3, sensitive module)
amal66 Jun 30, 2026
4523494
refactor(api): partial service extraction for chat + project-chat (Ph…
amal66 Jun 30, 2026
326e725
refactor(web): break up the 2,571-line AssistantMessage god-component…
amal66 Jun 30, 2026
ce8ec6c
refactor(web): break up the 2,967-line ProjectDocumentsView god-compo…
amal66 Jun 30, 2026
346ee83
feat(api): optional OpenTelemetry tracing (Phase 5) — completes obser…
amal66 Jun 30, 2026
b1b1650
feat(web): toast-surface swallowed errors + types pass (Phase 4/5)
amal66 Jun 30, 2026
19a5872
feat(web): add React Query caching layer + migrate projects list (Pha…
amal66 Jun 30, 2026
88e3e70
docs: remediation plan complete — all phases done
amal66 Jun 30, 2026
0b3fbfd
test: explicit vitest timeouts to kill cold-start flake
amal66 Jun 30, 2026
6e79991
chore(api): enforce no-console (error) + drop dead uuid shadow columns
amal66 Jun 30, 2026
ef6f7b3
perf(db): cap the unbounded overview RPCs (TECH_DUE_DILIGENCE §4.3)
amal66 Jun 30, 2026
8bc30ea
refactor(api): standardize chat route validation on zod + parseBody (…
amal66 Jun 30, 2026
5340873
feat(web): migrate workflows + tabular-reviews lists to React Query (…
amal66 Jun 30, 2026
60176cb
refactor(api): types pass (typed PDF.js facade, drop redundant casts)…
amal66 Jun 30, 2026
976edc3
ci(api): enforce a no-regression coverage floor
amal66 Jun 30, 2026
dffb4b3
a11y(web): ARIA semantics for the document tree + data grids (Phase 4)
amal66 Jun 30, 2026
369ba3a
refactor(web): extract TRChatPanel + DocumentSidePanel sub-components…
amal66 Jun 30, 2026
74897d9
test(e2e): make the suite runnable out-of-the-box + fix account-email…
amal66 Jun 30, 2026
17b8183
docs: final hardening round complete (every plan item closed)
amal66 Jun 30, 2026
e0aeb96
feat(api): configurable S3 region so the storage adapter is provider-…
amal66 Jul 1, 2026
d15d88a
fix(security): make prompt-injection spotlighting unforgeable (nonce …
amal66 Jul 1, 2026
a3cfeb1
chore: pin node engines to >=22 (match .nvmrc + CI); drop stale empty…
amal66 Jul 1, 2026
2d2423f
docs: upstream attribution + OSS hygiene (NOTICE, README lineage, CHA…
amal66 Jul 1, 2026
17f019c
fix(security): SSRF depth + secret strength + prod CORS (review findi…
amal66 Jul 1, 2026
676602d
feat(api): make the conversion queue a correct distributed job (revie…
amal66 Jul 1, 2026
d071cb1
perf(db): index workflow_shares.shared_by_user_id (FK cascade)
amal66 Jul 1, 2026
fc41e54
test(api): Postgres-backed concurrency regression for the credit row-…
amal66 Jul 1, 2026
f3c2a25
fix(web): resolve bare /workflows/<id> URLs instead of 404ing (kills …
amal66 Jul 1, 2026
d516019
fix(api): don't construct the Supabase client in a skipped describe body
amal66 Jul 1, 2026
6c1aebf
fix(security): per-row HKDF keys for MCP connector secrets (P2, review)
amal66 Jul 1, 2026
f790b28
fix(security): reject download tokens without an expiry (P2, review)
amal66 Jul 1, 2026
43549b1
fix(api): bound SSE heap growth with a slow-consumer guard (P2, review)
amal66 Jul 1, 2026
ae776ec
fix(build): make the release image start, drop lockfile ambiguity, sh…
amal66 Jul 1, 2026
b277c15
fix(sdk-python): authenticate with Authorization: Bearer, not a sessi…
amal66 Jul 1, 2026
9065093
docs: correct the privacy claim, refresh the risk register, document …
amal66 Jul 1, 2026
64dca1f
fix(security): fail-safe defaults for external tools and quota accoun…
amal66 Jul 1, 2026
ee580ac
feat(evals): runnable starter harness for legal-AI output quality
amal66 Jul 1, 2026
fa84c7d
fix(api): SSE heartbeats keep long-tool-call streams alive (port of #…
amal66 Jul 1, 2026
6179fbe
test(api): stack-level integration harness (real Supabase: auth + RLS…
amal66 Jul 1, 2026
957762b
feat(llm): enable local Ollama models behind ENABLE_OLLAMA (part of #…
amal66 Jul 1, 2026
eb25a0e
chore: drop unused `resend` dependency and its dead email config
amal66 Jul 1, 2026
c632608
docs: plan for turnkey air-gapped self-hosting (#196 delta c)
amal66 Jul 1, 2026
2d5a2e5
docs: revise air-gapped self-hosting plan (v2) after adversarial review
amal66 Jul 1, 2026
3f5fa2c
feat(api): AIRGAPPED mode — enforce local-only LLM in code (plan phas…
amal66 Jul 1, 2026
76451ff
feat(api): idempotent SQL migration runner (plan phase 2)
amal66 Jul 1, 2026
16cc054
feat(airgap): embedded Supabase stack — 3 services + nginx gateway (p…
amal66 Jul 1, 2026
cc58fef
feat(airgap): secret generation + boot guard (plan phase 5 security c…
amal66 Jul 1, 2026
2f3992d
feat(airgap): supply chain, LibreOffice, web-egress removal, lifecycl…
amal66 Jul 1, 2026
5864ee1
feat(airgap): air-gap-aware default model + configurable email relay …
amal66 Jul 1, 2026
45b141c
fix(airgap): close final red-team blockers — real egress gate, secret…
amal66 Jul 1, 2026
580871e
fix(airgap): boot-guard sign-verify, app services, and lifecycle-scri…
amal66 Jul 1, 2026
01002d6
fix(compose): pin MinIO/mc to image tags that actually exist
amal66 Jul 2, 2026
20edeca
feat(auth): dev-only "continue as guest" login, hard-gated off in pro…
amal66 Jul 2, 2026
73482eb
docs(onboarding): local-first quick start — working defaults, fewer d…
amal66 Jul 2, 2026
ad98591
docs(hygiene): make every planning doc tell the truth about current s…
amal66 Jul 2, 2026
67f13c1
refactor(workflows): extract the service layer the architecture docs …
amal66 Jul 2, 2026
a87eea6
refactor(documents): decompose the 1,521-line service behind a stable…
amal66 Jul 2, 2026
865e868
refactor(tabular): decompose the 1,574-line service along its own sec…
amal66 Jul 2, 2026
f679317
refactor(tools): replace the 39-branch tool dispatcher with a handler…
amal66 Jul 2, 2026
0a77465
docs(architecture): describe the codebase that exists, not the one on…
amal66 Jul 2, 2026
b454dc7
docs(hygiene): close the last two stale-reference stragglers
amal66 Jul 2, 2026
6cfe70e
docs(prune): delete the four historical planning docs; keep one forwa…
amal66 Jul 2, 2026
4224528
docs(strategy): add Harvey/Legora competitive analysis and Tier-1 roa…
amal66 Jul 2, 2026
4c4e45f
feat(orgs): multi-tenant organizations + owner/admin/member RBAC
amal66 Jul 2, 2026
c5df0d7
feat(rag): pgvector semantic retrieval + search_documents tool
amal66 Jul 2, 2026
d22a77d
feat(citations): verify document quotes against source text server-side
amal66 Jul 2, 2026
bdc8c23
feat(dms): native iManage / NetDocuments connectors behind a pluggabl…
amal66 Jul 2, 2026
acf4cf6
feat(tabular): durable async extraction queue + reconnectable generat…
amal66 Jul 2, 2026
7e1f56d
fix(api): chat-stream failure cleanup crashed the whole API process
amal66 Jul 2, 2026
f00af00
fix(documents): seed NOT NULL documents.filename on every insert path
amal66 Jul 2, 2026
5b97161
test: fix web unit-test bootstrap and stabilize four e2e specs
amal66 Jul 2, 2026
e1a6358
chore: gitignore Playwright artifacts and the e2e auth session
amal66 Jul 2, 2026
a3a1de1
feat(assistant): keyless demo mode + graceful provider-error UX
amal66 Jul 3, 2026
5ae4815
feat(documents): always-confirm deletion + clearer version display
amal66 Jul 3, 2026
cf93e58
feat(web): upload feedback, sidebar data-fetch, and copy/tooltip polish
amal66 Jul 3, 2026
db69c67
feat(word-addin): local-dev guest sign-in
amal66 Jul 3, 2026
7e59f13
chore(api): fix ESLint config so lint passes (no-undef on TS + .mjs)
amal66 Jul 3, 2026
6347350
test(e2e): stabilize specs against refactored UI + shared-user pagina…
amal66 Jul 3, 2026
7a9d5f4
refactor(api): split projects.service by concern (1212 LOC -> focused…
amal66 Jul 4, 2026
64fc00e
refactor(web): decompose useAssistantChat (1300 LOC -> 4 focused units)
amal66 Jul 4, 2026
165d7c3
refactor(web): container/presenter split for ProjectDocumentsView (18…
amal66 Jul 4, 2026
1c8eed7
refactor(web): split connectors page into container + component files…
amal66 Jul 4, 2026
3aa5683
docs(readme): add an Architecture cheat-sheet for reading the codebase
amal66 Jul 4, 2026
246c0ac
feat(api): thread request_id + trace ids onto every log line
amal66 Jul 4, 2026
8a09d44
feat(api): propagate W3C trace context across the BullMQ queue boundary
amal66 Jul 4, 2026
1794463
feat(api): Prometheus metrics behind a default-off METRICS_ENABLED gate
amal66 Jul 4, 2026
e3411b9
refactor(web): decompose the ProjectDocuments god-hook by concern
amal66 Jul 4, 2026
7734a7c
refactor(web): reuse the citation badge label in its tooltip
amal66 Jul 4, 2026
d9f4976
test(web): wire a coverage ratchet mirroring apps/api
amal66 Jul 4, 2026
deb9316
test(api-client): pin the server→client field remap against drift
amal66 Jul 4, 2026
86a239d
docs(runbook): add an operational "it's 3am" runbook
amal66 Jul 4, 2026
ba42db0
docs(adr): retrofit four ADRs for the load-bearing design calls
amal66 Jul 4, 2026
3880b5e
fix(llm): jitter retry backoff, unify the abort signal, comment break…
amal66 Jul 4, 2026
d257b7e
refactor(projects): extract loadDisplayNames from the two label helpers
amal66 Jul 4, 2026
c0a786b
refactor(api): split user.service by concern (1124 LOC -> focused files)
amal66 Jul 4, 2026
ea67fce
chore: snapshot in-progress extensibility & test work
amal66 Jul 5, 2026
3608a57
refactor(core): single-source built-in workflows in @mike/core
amal66 Jul 5, 2026
44fecd7
feat(web): add FileTypeIcon and PillButton UI primitives
amal66 Jul 5, 2026
8c4fd69
fix(web): shared FullScreenLoader for consistent auth-gate loading
amal66 Jul 5, 2026
249e2d6
feat: API-key-aware tabular model fallback
amal66 Jul 5, 2026
b91da46
docs: add live feature walkthrough
amal66 Jul 5, 2026
84e4744
test(web): fix CaseCitationQuote fixture missing required fields
amal66 Jul 5, 2026
4a3d05a
ci(web): install lightningcss native binary before next build
amal66 Jul 5, 2026
4f1d3a6
ci(e2e): install lightningcss native binary so dev servers boot
amal66 Jul 5, 2026
1d0396b
fix(deps): patch form-data and tmp high advisories via scoped overrides
amal66 Jul 5, 2026
724478d
fix(e2e): supply USER_API_KEYS_ENCRYPTION_SECRET so the API boots
amal66 Jul 5, 2026
ebb8721
test(api): make userSettings env setup override CI's short secrets
amal66 Jul 5, 2026
39d5d69
merge: e2e API boot env fix
amal66 Jul 5, 2026
662c2a5
ci(api): raise dummy secrets to >=32 chars for the API tests job
amal66 Jul 5, 2026
31b54e5
fix(e2e): make Playwright suite green without any provider key
amal66 Jul 5, 2026
7165c64
ci(e2e): raise tunable rate limits so the write-heavy suite doesn't 429
amal66 Jul 5, 2026
7859750
feat(api): surface pre-existing docx redlines to model reads + extrac…
amal66 Jul 6, 2026
a8066ed
fix(word-addin): disable dev-server compression so SSE tokens stream
amal66 Jul 6, 2026
86d70c4
docs: add codebase overview to CONTRIBUTING + refresh README
amal66 Jul 6, 2026
db7db90
ci(e2e): provision MinIO storage + fix login-redirect password mismatch
amal66 Jul 6, 2026
ff435a9
chore: move the Word add-in out of main for standalone review (#22)
amal66 Jul 6, 2026
5683db0
Sync workflow, asst extra input, excel + ppt support and modal updates
willchen96 Jul 4, 2026
82e1eee
feat: workflow, UI and document support updates
willchen96 Jul 8, 2026
1e21622
fix: adapt tests, deps and shims to the upstream sync
amal66 Jul 10, 2026
9a3c930
merge: record Open-Legal-Products/mike@e32daad as merged into main
amal66 Jul 10, 2026
cf14235
fix(e2e): realign the suite with upstream's UI, and repoint build-wor…
amal66 Jul 10, 2026
b25a51e
fix(web): snap the smoothed reveal to full text when a stream ends
amal66 Jul 10, 2026
3f375f8
fix(web): lift the projects bulk-actions menu above the sticky table …
amal66 Jul 10, 2026
a1cff66
fix(lint): satisfy this fork's stricter eslint on merged-in upstream …
amal66 Jul 10, 2026
b3166dd
feat: sync olp UI as source of truth (PRs #215, #216)
amal66 Jul 16, 2026
3d46814
fix(e2e): realign the suite with the olp UI refresh (PRs #215/#216)
amal66 Jul 17, 2026
40b2dcb
docs: in-file attribution for code adapted from community PRs
Jul 17, 2026
5424a81
fix(chat): apply the keyless-demo fallback to title generation
Jul 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
node_modules
*/node_modules
**/node_modules

# Build artifacts
apps/api/dist
apps/web/.next
apps/web/out

# Development files that should not leak into images
.env
**/.env
.env.local
**/.env.local

# VCS and editor noise
.git
.gitignore
.github
*.md
!apps/api/.env.example

# Test outputs
coverage
.nyc_output
31 changes: 31 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# CODEOWNERS — automatic reviewer assignment
#
# HOW THIS WORKS:
# When a pull request touches a file matched by a pattern below, GitHub
# automatically adds the listed user(s) as required reviewers. The PR
# cannot be merged until the CODEOWNER approves it.
#
# This is especially valuable for security-sensitive files: if someone
# submits a PR that modifies the auth middleware, you want a security-
# aware reviewer automatically in the loop — not relying on a reviewer
# happening to notice which files changed.
#
# SYNTAX: <pattern> <@user or @org/team>
# Patterns follow .gitignore rules. The LAST matching rule wins.

# Default owner for everything
* @amal66

# Security-sensitive backend files — always need a careful review
apps/api/src/middleware/auth.ts @amal66
apps/api/src/lib/env.ts @amal66
apps/api/src/lib/userApiKeys.ts @amal66
apps/api/src/core/downloadTokens.ts @amal66
apps/api/src/lib/access.ts @amal66

# Database migrations — irreversible in production, need careful sign-off
supabase/migrations/ @amal66

# CI/CD pipelines — changes here can break deployments or weaken security
.github/workflows/ @amal66
.github/CODEOWNERS @amal66
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Bug report
about: Report a reproducible problem
title: ""
labels: bug
assignees: ""
---

## Summary

## Steps To Reproduce

## Expected Behavior

## Actual Behavior

## Environment
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Feature request
about: Suggest an improvement
title: ""
labels: enhancement
assignees: ""
---

## Problem

## Proposal

## Alternatives

## Additional Context
30 changes: 30 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Summary

<!-- What does this PR do, in one or two sentences? -->

## Why / Motivation

<!-- What problem does this solve? Why now, and why this approach?
Link the issue or context that prompted it. -->

## Changes

<!-- The notable changes, at a high level. Describe the outcome, not the diff. -->

## Tradeoffs & risks

<!-- What did you weigh? What could break, what's out of scope, and what
follow-ups (if any) does this leave behind? Note any security or
migration implications. -->

## How verified

<!-- How do you know this works? Tests added/run, manual steps, commands,
screenshots. Include the exact commands where relevant. -->

## Checklist

- [ ] Ran the relevant build/test command for the area changed.
- [ ] Reviewed `git diff` and removed unrelated changes.
- [ ] Updated docs / env examples if setup, config, or behavior changed.
- [ ] No secrets, API keys, real documents, or `.env` files committed.
67 changes: 67 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Dependabot automatically opens PRs to keep dependencies up to date.
#
# WHY DEPENDABOT MATTERS:
# The Node.js ecosystem has thousands of transitive dependencies. A
# vulnerability found in a package you've never heard of (e.g. a nested
# transitive dep of express) becomes your problem if it's exploitable in
# your context.
#
# Dependabot monitors the GitHub Advisory Database and opens a PR within
# hours of a new CVE being published. Without it, you'd find out about
# a vulnerability when a security researcher reports it against YOUR app.
#
# HOW IT WORKS:
# Every day (for security alerts) or weekly (for version bumps), Dependabot
# reads your package-lock.json and checks whether any installed version has
# a known CVE. If so, it opens a PR that bumps the affected package to the
# patched version.
#
# You still review and merge the PR — Dependabot never pushes directly.
# CI runs on the PR so you can see if the update breaks anything before
# merging.

version: 2
updates:
# Root workspace / monorepo tooling
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
open-pull-requests-limit: 10
groups:
# Group all minor/patch dev-dep bumps into one PR per week
dev-dependencies:
dependency-type: "development"
update-types: ["minor", "patch"]

# API workspace
- package-ecosystem: "npm"
directory: "/apps/api"
schedule:
interval: "weekly"
day: "monday"
open-pull-requests-limit: 10
groups:
dev-dependencies:
dependency-type: "development"
update-types: ["minor", "patch"]

# Web workspace
- package-ecosystem: "npm"
directory: "/apps/web"
schedule:
interval: "weekly"
day: "monday"
open-pull-requests-limit: 10
groups:
dev-dependencies:
dependency-type: "development"
update-types: ["minor", "patch"]

# GitHub Actions version pinning
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
193 changes: 193 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
api:
name: API tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/api
env:
# Dummy values so env.ts validation passes at test time
SUPABASE_URL: http://localhost:54321
SUPABASE_SECRET_KEY: test-secret-key
# env.ts enforces a >=32-char minimum on these; keep the dummies above it
# so the test suite AND the built-app smoke import both pass env validation.
DOWNLOAD_SIGNING_SECRET: ci-download-signing-secret-32bytes-min!
USER_API_KEYS_ENCRYPTION_SECRET: ci-user-api-keys-encryption-secret-32bytes-min!
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: package-lock.json

- run: npm ci
working-directory: .

# Fail the build if any high or critical CVEs exist in dependencies.
# `--audit-level=high` means: pass if only low/moderate vulns exist,
# fail if any high or critical ones do.
# Why not --audit-level=critical? High CVEs are often exploitable too
# and should not be silently ignored.
- name: Dependency security audit
run: npm audit --audit-level=high
working-directory: apps/api

- run: npm run lint
# Run with coverage so the no-regression thresholds in vitest.config.mts
# are enforced in CI (fails the build if lib coverage drops).
- run: npm run test:coverage
- run: npm run build
- name: Smoke import built API app
run: node -e "require('./dist/apps/api/src/app.js'); console.log('api app import ok')"

packages:
name: Package typecheck and tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: package-lock.json

- run: npm ci
working-directory: .

- run: ./node_modules/.bin/tsc -p packages/core/tsconfig.json --noEmit
- run: ./node_modules/.bin/tsc -p packages/api-client/tsconfig.json --noEmit
- run: ./node_modules/.bin/tsc -p packages/sdk-js/tsconfig.json --noEmit
# packages/shared is consumed as raw TSX by apps/web (transpilePackages)
# and word-addin (webpack alias), so neither consumer typechecks it as a
# unit — this is the only gate that does.
- run: ./node_modules/.bin/tsc -p packages/shared/tsconfig.json --noEmit
# Run the package test suites, not just the compiler: api-client pins the
# server→client field remapping and sdk-js pins the public SDK surface.
# Typechecking alone would miss a behavioral regression in either.
- run: npm test --workspace packages/api-client
- run: npm test --workspace packages/sdk-js

# -----------------------------------------------------------------------
# Offline eval harness: deterministic scorecard for citation accuracy,
# prompt-injection resistance, and privilege/PII leakage. Runs against
# committed fixtures (no network, no LLM calls, no secrets), so it is cheap
# enough to gate every PR. --threshold 1.0 = every case must pass.
# -----------------------------------------------------------------------
evals:
name: Eval harness
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22

- run: node evals/run.mjs --threshold 1.0

# -----------------------------------------------------------------------
# Python SDK: installed and tested on the oldest supported Python (3.9,
# per pyproject requires-python) so compatibility claims stay honest.
# Tests are offline (respx-mocked httpx), so no secrets are needed.
# -----------------------------------------------------------------------
python-sdk:
name: Python SDK tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: sdks/python
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.9"

- run: pip install -e .[dev]
- run: python -m pytest

web:
name: Web lint and build
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/web
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: package-lock.json

- run: npm ci
working-directory: .
# `npm ci` intermittently skips lightningcss's platform-native optional
# dependency on Linux (npm/cli#4828), which breaks `next build` with
# "Cannot find module '../lightningcss.linux-x64-gnu.node'". Reinstalling
# lightningcss (without touching the lockfile) fetches the runner's
# matching native binary.
- run: npm install --no-save lightningcss
working-directory: .
- run: npm run lint
# Coverage mode so the no-regression thresholds in vitest.config.mts are
# enforced (same ratchet pattern as apps/api).
- run: npm run test:coverage
- run: npm run build

# -----------------------------------------------------------------------
# Slower job: migration validation against real local Supabase (3-5 min)
# Runs on PRs and pushes. Supabase's local stack applies the migrations
# against a real Postgres/Auth environment, which catches SQL drift that
# mocked unit tests cannot see.
# -----------------------------------------------------------------------
migrations:
name: Migration validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: supabase/setup-cli@v2
with:
version: latest

- name: Start Supabase
run: supabase start

- name: Reset DB (applies all migrations from scratch)
run: supabase db reset

- name: Stop Supabase
run: supabase stop --no-backup

# -----------------------------------------------------------------------
# Deploy job: push migrations to production on merge to main
# -----------------------------------------------------------------------
deploy-migrations:
name: Deploy migrations
runs-on: ubuntu-latest
needs: [api, packages, web, migrations, evals, python-sdk]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- uses: actions/checkout@v4

- uses: supabase/setup-cli@v2
with:
version: latest

- name: Push migrations to production
run: supabase db push --db-url "${{ secrets.DATABASE_URL }}"
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
Loading