feat: Phase 0 walking skeleton — monorepo, API, web, ML stub
Sets up the full Phase 0 foundation: - pnpm workspaces + turbo build graph; native module build approval - packages/shared-types: HTTP contracts (Tip, Auth, Integrations, User) - services/api: Express modular monolith with better-sqlite3/drizzle - auth: Google OAuth2 + PKCE via openid-client v6, cookie sessions - integrations: Todoist OAuth2 connect/disconnect, token vault - recommender: RandomPolicy over Todoist tasks, feedback sink - user: profile, consent capture, full account deletion (GDPR) - apps/web: Next.js 15, three pages (sign-in → connect → tip) - tip page: black canvas, hold-to-act gesture, action sheet - PWA manifest + theme - ml/serving: FastAPI stub implementing the POST /score contract - infra: docker-compose (core/full profiles), Dockerfiles, CI skeleton - .env.example with all required vars documented Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
21
packages/shared-types/package.json
Normal file
21
packages/shared-types/package.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "@oo/shared-types",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"type-check": "tsc --noEmit",
|
||||
"clean": "rm -rf dist"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.7.3"
|
||||
}
|
||||
}
|
||||
12
packages/shared-types/src/http/auth.ts
Normal file
12
packages/shared-types/src/http/auth.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/** Session user returned by /api/auth/session */
|
||||
export interface SessionUser {
|
||||
id: string;
|
||||
email: string;
|
||||
name?: string;
|
||||
image?: string;
|
||||
}
|
||||
|
||||
/** GET /api/auth/session response */
|
||||
export interface SessionResponse {
|
||||
user: SessionUser | null;
|
||||
}
|
||||
18
packages/shared-types/src/http/integrations.ts
Normal file
18
packages/shared-types/src/http/integrations.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
export type IntegrationProvider = 'todoist';
|
||||
export type IntegrationStatus = 'connected' | 'disconnected' | 'error';
|
||||
|
||||
export interface Integration {
|
||||
provider: IntegrationProvider;
|
||||
status: IntegrationStatus;
|
||||
connectedAt?: string; // ISO 8601
|
||||
}
|
||||
|
||||
/** GET /api/integrations response */
|
||||
export interface IntegrationsResponse {
|
||||
integrations: Integration[];
|
||||
}
|
||||
|
||||
/** DELETE /api/integrations/:provider — revokes token */
|
||||
export interface DisconnectResponse {
|
||||
ok: boolean;
|
||||
}
|
||||
19
packages/shared-types/src/http/tip.ts
Normal file
19
packages/shared-types/src/http/tip.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
/** A single recommendation surfaced to the user */
|
||||
export interface Tip {
|
||||
id: string;
|
||||
content: string;
|
||||
source: 'todoist' | 'advice';
|
||||
sourceId?: string;
|
||||
createdAt: string; // ISO 8601
|
||||
}
|
||||
|
||||
/** POST /recommend response */
|
||||
export interface RecommendResponse {
|
||||
tip: Tip;
|
||||
}
|
||||
|
||||
/** POST /tip/:id/feedback request body */
|
||||
export interface TipFeedback {
|
||||
action: 'done' | 'dismiss' | 'snooze';
|
||||
snoozedUntil?: string; // ISO 8601, required when action = snooze
|
||||
}
|
||||
14
packages/shared-types/src/http/user.ts
Normal file
14
packages/shared-types/src/http/user.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
/** GET /api/user/me */
|
||||
export interface UserProfile {
|
||||
id: string;
|
||||
email: string;
|
||||
name?: string;
|
||||
image?: string;
|
||||
createdAt: string;
|
||||
consentGiven: boolean;
|
||||
}
|
||||
|
||||
/** DELETE /api/user/me — account deletion */
|
||||
export interface DeleteAccountResponse {
|
||||
ok: boolean;
|
||||
}
|
||||
4
packages/shared-types/src/index.ts
Normal file
4
packages/shared-types/src/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from './http/tip.js';
|
||||
export * from './http/auth.js';
|
||||
export * from './http/integrations.js';
|
||||
export * from './http/user.js';
|
||||
8
packages/shared-types/tsconfig.json
Normal file
8
packages/shared-types/tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"rootDir": "src"
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
Reference in New Issue
Block a user