906 Commits

Author SHA1 Message Date
625862f5ae feat(15-01): add Logto service to Docker Compose and create init script
- Add Logto OIDC provider to docker-compose.yml and docker-compose.dev.yml
- Create docker/init-logto-db.sql to initialize separate Logto database on Postgres
- Add OIDC env vars (issuer, client ID/secret, auth secret) to app service
- Document all required env vars in .env.example
2026-04-04 20:37:57 +02:00
f2c1d04cfc docs(15): create phase plan for external authentication 2026-04-04 20:30:27 +02:00
7ba931352a docs(phase-15): add validation strategy 2026-04-04 20:22:42 +02:00
5b0190dbbc docs(15): research external authentication phase domain 2026-04-04 20:21:47 +02:00
4be3d26ae0 docs(state): record phase 15 context session 2026-04-04 20:15:47 +02:00
46e2d1896b docs(15): capture phase context 2026-04-04 20:15:40 +02:00
77bd3c55d0 docs(14-06): complete test suite async conversion plan
- SUMMARY.md: 18 test files converted, 161 tests passing on PGlite
- STATE.md: updated position, decisions, session
- ROADMAP.md: phase 14 complete (6/6 plans)
- REQUIREMENTS.md: DB-02, DB-03 marked complete

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 15:42:17 +02:00
f30d375544 feat(14-06): convert route tests + MCP tests to async PGlite
- All 8 route test files: async createTestApp(), async beforeEach
- MCP tools test: await createTestDb(), await getCollectionSummary()
- Fixed MCP tool files: added await to all service calls in items, categories, threads, setups tools
- Fixed MCP collection resource: made getCollectionSummary async
- Fixed MCP index.ts: await getCollectionSummary call
- Increased test timeout to 30s in bunfig.toml for PGlite WASM overhead
- Zero SQLite references remain in tests/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 15:40:14 +02:00
458b33f1c7 feat(14-06): convert all 9 service test files to async PGlite
- All beforeEach now use async/await createTestDb()
- All service calls in tests now awaited
- All direct DB calls (.run()/.all()) replaced with await
- All test callbacks made async
- Fixed PostgreSQL GROUP BY strictness in totals.service.ts (categories.name and categories.icon added to groupBy)
- db type changed to 'any' to accommodate PGlite type differences

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 13:11:52 +02:00
cb2a192cb5 docs(14-04): complete route handlers async conversion plan
- Add 14-04-SUMMARY.md documenting async conversion of all 9 route files and auth middleware
- Update STATE.md with progress (83%) and decisions
- Update ROADMAP.md with plan progress
2026-04-04 12:44:55 +02:00
22aaed76f2 feat(14-04): convert auth, OAuth, settings routes and auth middleware to async/await
- Add await before all service calls in auth, OAuth routes
- Convert settings.ts direct DB calls: remove .get()/.run(), use await + destructuring
- Auth middleware: await getUserCount, getSession, refreshSession
- Fix formatting in threads.ts for biome compliance
- All files pass lint
2026-04-04 12:43:29 +02:00
5edcc660e4 feat(14-04): convert data route handlers to async/await
- Add await before all service calls in items, categories, threads, setups, totals routes
- Make all handler callbacks async
- Covers getAllItems, createItem, updateItem, deleteItem, duplicateItem,
  getAllCategories, createCategory, updateCategory, deleteCategory,
  getAllThreads, getThreadWithCandidates, createThread, updateThread, deleteThread,
  resolveThread, createCandidate, updateCandidate, deleteCandidate, reorderCandidates,
  getAllSetups, getSetupWithItems, createSetup, updateSetup, deleteSetup,
  syncSetupItems, updateItemClassification, removeSetupItem,
  getCategoryTotals, getGlobalTotals, exportItemsCsv, importItemsCsv
2026-04-04 12:40:55 +02:00
fddbf8166d docs(14-03): complete service layer async conversion plan
- SUMMARY.md documents 30 async function conversions across 9 service files
- STATE.md updated with position, decisions, session info
- ROADMAP.md progress updated (4/6 summaries for phase 14)
- Requirements DB-01, DB-02 marked complete
2026-04-04 12:36:38 +02:00
75bf3e0dcd feat(14-03): convert auth/oauth/csv services to async, await seedDefaults
- auth.service.ts: 10 functions async, removed .all()/.get()/.run()
- oauth.service.ts: 7 functions async, boolean conversion (used: true/false)
- csv.service.ts: export/import functions async, removed .all()/.get()/.run()
- server index.ts: seedDefaults() now awaited for async DB
- PGlite smoke test confirms async services work end-to-end
2026-04-04 12:35:18 +02:00
4d705af3f1 feat(14-03): convert core data services to async PostgreSQL operations
- item.service.ts: 6 functions async, removed .all()/.get()/.run()
- category.service.ts: 4 functions async, transaction uses async callback
- thread.service.ts: 10 functions async, transactions in resolveThread/reorderCandidates use async callbacks
- setup.service.ts: 8 functions async, syncSetupItems transaction uses async callback
- totals.service.ts: 2 functions async, removed .all()/.get()
2026-04-04 12:32:58 +02:00
295be8c09d Merge branch 'worktree-agent-a5f21c17' into Develop
# Conflicts:
#	.planning/REQUIREMENTS.md
#	.planning/ROADMAP.md
#	.planning/STATE.md
2026-04-04 12:30:57 +02:00
85104f3687 docs(14-05): complete SQLite-to-Postgres migration script plan
- SUMMARY.md with execution results
- STATE.md updated with plan 05 completion
- ROADMAP.md updated with phase 14 progress
- DB-04 requirement marked complete
2026-04-04 12:30:31 +02:00
b4c38134e1 feat(14-05): create SQLite-to-Postgres data migration script
- One-time migration script with type conversions (unix timestamps to Date, int to bool)
- Migrates all 13 tables in FK dependency order
- Resets serial sequences after data migration
- Adds db:migrate-from-sqlite npm script
2026-04-04 12:28:19 +02:00
f7b830a6ff docs(14-02): complete Docker & Compose for PostgreSQL plan
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 12:25:16 +02:00
186e74bcea feat(14-02): update Dockerfile for PostgreSQL (remove native build deps)
- Remove apt-get install of python3/make/g++ (no longer needed without better-sqlite3)
- Change COPY drizzle to COPY drizzle-pg for PostgreSQL migrations
- Remove mkdir -p data (no SQLite data directory needed)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 12:24:00 +02:00
50b451bf65 feat(14-02): add Docker Compose files for PostgreSQL dev and production
- Create docker-compose.dev.yml with Postgres 16 for local development
- Rewrite docker-compose.yml with Postgres service, healthcheck, and app dependency chain
- Production uses externalized POSTGRES_PASSWORD and DATABASE_URL env vars

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 12:23:35 +02:00
ec8d1c362c Merge branch 'worktree-agent-a730aaff' into Develop
# Conflicts:
#	.planning/ROADMAP.md
#	.planning/STATE.md
2026-04-04 12:22:21 +02:00
d2d64279d3 docs(14-01): complete database foundation plan
- Created 14-01-SUMMARY.md with execution results
- Updated STATE.md with plan progress and decisions
- Updated ROADMAP.md progress table (1/6 plans)
- Marked DB-01 and DB-03 requirements complete
2026-04-04 12:21:50 +02:00
3bf1fd7cb8 feat(14-01): add PGlite test helper and generate initial PostgreSQL migration
- Rewrite tests/helpers/db.ts to use drizzle-orm/pglite with async createTestDb()
- Generate initial migration with 13 CREATE TABLE statements in drizzle-pg/
- Add drizzle-pg to biome ignore list (generated files)
- PGlite smoke test confirms migrations apply and seed works
2026-04-04 12:18:50 +02:00
3724cf8348 feat(14-01): rewrite database foundation from SQLite to PostgreSQL
- Replace all 13 sqliteTable definitions with pgTable (pg-core)
- Convert integer timestamps to native timestamp type with defaultNow()
- Convert real columns to doublePrecision, integer used to boolean
- Rewrite db connection to use postgres.js driver with DATABASE_URL
- Rewrite migrate.ts to use postgres-js migrator targeting drizzle-pg/
- Convert seed.ts to async
- Update drizzle.config.ts to postgresql dialect
- Install postgres and @electric-sql/pglite, remove better-sqlite3
2026-04-04 12:17:05 +02:00
f7048a267a docs: bring phase 14 planning files into worktree 2026-04-04 12:15:37 +02:00
1cd2af6a0f docs(state): record phase 14 planning session 2026-04-04 12:12:46 +02:00
30ec9b92d1 fix(14): revise plans based on checker feedback 2026-04-04 12:09:49 +02:00
88708f962a docs(14-postgresql-migration): create phase plan 2026-04-04 12:00:22 +02:00
ebc1693eb1 docs(phase-14): add validation strategy 2026-04-04 11:52:00 +02:00
fc49e63bee docs(14): research phase domain 2026-04-04 11:51:16 +02:00
6d966303c3 docs(state): record phase 14 context session 2026-04-04 11:42:10 +02:00
552817efec docs(14): capture phase context 2026-04-04 11:42:01 +02:00
f7c9f3dc94 fix: add Protected Resource Metadata endpoint (RFC 9728)
All checks were successful
CI / ci (push) Successful in 29s
CI / e2e (push) Successful in 1m1s
The MCP auth spec (2025-06-18+) requires /.well-known/oauth-protected-resource
in addition to /.well-known/oauth-authorization-server. Claude fetches
the protected resource metadata first after receiving a 401, then discovers
the authorization server from it. Also fixes WWW-Authenticate header to
use absolute URL pointing to the protected resource endpoint.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v1.4.3
2026-04-04 11:17:21 +02:00
b71833ef79 fix: await verifyAccessToken in MCP middleware
All checks were successful
CI / ci (push) Successful in 31s
CI / e2e (push) Successful in 1m4s
verifyAccessToken is async and returns a Promise. Without await,
the Promise object is always truthy, so any Bearer token (even
invalid ones) was accepted. This fixes MCP OAuth authentication.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v1.4.2
2026-04-04 11:03:30 +02:00
9c7bc2881c fix: add CORS headers for OAuth and MCP endpoints
All checks were successful
CI / ci (push) Successful in 31s
CI / e2e (push) Successful in 1m2s
Required for claude.ai browser-based OAuth flows that make
cross-origin requests to discovery, token, and MCP endpoints.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v1.4.1
2026-04-04 10:48:22 +02:00
412ca60e42 style: apply biome formatting to OAuth service and tests
All checks were successful
CI / ci (push) Successful in 37s
CI / e2e (push) Successful in 1m55s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v1.4.0
2026-04-04 09:27:57 +02:00
5fdf4c3019 docs: add MCP OAuth documentation and fix lint
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 09:27:34 +02:00
6dcb421fb0 test: add end-to-end OAuth to MCP flow integration test
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 09:26:25 +02:00
f01add3943 feat: add Bearer token auth to MCP alongside API key auth
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 09:24:10 +02:00
1fad25726d feat: add OAuth 2.1 endpoints (register, authorize, token)
Add well-known metadata, dynamic client registration, authorization
flow with PKCE, and token exchange/refresh endpoints with route-level
integration tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 09:22:58 +02:00
7309c080df feat: add OAuth service with PKCE, token management, and tests
Implements client registration, authorization code flow with PKCE (S256),
access/refresh token generation/verification, and cleanup utilities.
Follows TDD — all 12 service-level tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 09:20:09 +02:00
f47e1d74ae feat: add OAuth tables (clients, codes, tokens) to schema
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 09:17:53 +02:00
c04b9b0e09 docs: add MCP OAuth 2.1 implementation plan
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 09:09:30 +02:00
6a77995530 docs: add MCP OAuth 2.1 server design spec
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 09:03:11 +02:00
1344f2f87f docs: create milestone v2.0 roadmap (5 phases) 2026-04-03 22:24:24 +02:00
64403f6977 docs: define milestone v2.0 requirements 2026-04-03 22:19:52 +02:00
443802fc68 docs: complete project research 2026-04-03 22:14:27 +02:00
642ae0d43f docs: start milestone v2.0 Platform Foundation 2026-04-03 21:53:31 +02:00
f9c6693b63 docs: add releasing section to CLAUDE.md
All checks were successful
CI / ci (push) Successful in 27s
CI / e2e (push) Successful in 1m5s
Document the Gitea Actions release pipeline and how to trigger it
via API with patch/minor/major bump types.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 21:11:53 +02:00