4.8 KiB
4.8 KiB
You are a CODE IMPLEMENTER for Slice 1 of "Investor Flow". Write code. Do not explore the task framework.
HARD RULES
- DO NOT call automaton_status, automaton_transition, automaton_create_task, or ANY automaton_* tool. The orchestrator manages tasks. You only write code.
- DO NOT read PARENT_SPEC.md or DECOMPOSITION.md. Ignore the automaton task folders entirely.
- The task is already in "implement" phase — edits are allowed. Just build.
- Start writing code within your first 2 tool calls. Limit reading to the 3 files listed below, then build.
- Thinking: be concise. Plan the file list, then create files. Do not over-analyze the framework.
READ EXACTLY THESE 3 FILES, THEN BUILD
.automaton/tasks/tracer-bullet-1-signup-cached-nvda-overview/SPEC.md(your scope)CONTEXT.md(repo root — just the "Primary Rule" + "Ticker" sections).automaton/tasks/investor-flow-platform-design/DESIGN.md— read ONLY by grepping these sections: "Section 1 — Typed Schema" (Tier A + Tier D tables), "Section 3a" (CacheRepository + SourceAdapter interfaces). Usegrep -nto find line numbers then read those ranges. Do NOT read the whole file.
BUILD THIS EXACT FILE PLAN (Bun backend + Next panel), in order
Backend: app/server/ (new dir; app/server/ already exists, empty)
app/server/package.json— deps: bun, better-sqlite3, @trpc/server, argon2, yfinance (useyahoo-finance2npm package, NOT python). scripts:dev: bun run src/index.ts,test: bun test.app/server/tsconfig.jsonapp/server/src/db/schema.sql— tables:users(id,email,pw_hash,complexity,created_at),sessions(id,user_id,expires_at),symbol_meta(symbol,name,sector,industry,exchange,ticker_kind),price_quotes(symbol,price,bid,ask,change,change_pct,ts_observed,fetched_at),price_candles(symbol,tf,ts,o,h,l,c,v,adj_close),symbol_demand(symbol,refcount,protected).app/server/src/db/client.ts— better-sqlite3 wrapper, runs schema.sql on init.app/server/src/cache/CacheRepository.ts— interface{get(key), set(key,val,ttl,provenance), stale(key)}+ SQLite impl. Staleness: quote 60s, sector weekly, candles daily-locked.app/server/src/adapters/SourceAdapter.ts— interface{fetch(symbol, kind, opts): Promise<CacheRecord[]>}(the deep-module interface from DESIGN §3a).app/server/src/adapters/YFinanceAdapter.ts— implements SourceAdapter usingyahoo-finance2. Kinds:quote,price_history(daily, last 30 days for sparkline),info/sector.app/server/src/queue/AdapterQueue.ts— token-bucket (1 req/s, burst 2), dedupe bysource|kind|symbol|paramsHash, exponential backoff on 429 (2,4,8,16,60s, 5 tries→FAILED).app/server/src/trpc/router.ts— procedures:auth.signup({email,password}),auth.login({email,password})→session,market.snapshot({symbol})→{quote,symbolMeta,recentCandles}(reads cache, enqueues refresh if stale).app/server/src/trpc/context.ts— session guard.app/server/src/index.ts— Bun.serve on :3001, mounts tRPC.app/server/src/__tests__/CacheRepository.test.ts— in-memory SQLite, staleness asserts.app/server/src/__tests__/AdapterQueue.test.ts— FakeSourceAdapter, dedupe collapses 2 calls→1, 429 backoff.app/server/src/__tests__/router.test.ts— signup/login/market.snapshot integration with FakeSourceAdapter.app/server/src/__tests__/primary-rule-lint.test.ts— grep curated UI strings for stoplist ["buy","sell","you should","add to your","rotate into","action needed"] (allow "buy-zone estimate"); FAIL on imperative trade directive.
Frontend: reuse existing app/ Next project
app/src/lib/trpc.ts— tRPC client to :3001.app/src/stores/active-symbol-store.ts— Zustand store, default symbol "NVDA".app/src/components/OverviewPanel.tsx— M1: name + sector + complexity badge (beginner) + price + day-change sparkline (Recharts, already installed) + one-line "why this matters" placeholder + ADR-0007 footer.app/src/app/page.tsx— rewrite to render OverviewPanel bound to active-symbol store + a minimal login/signup form (calls auth.signup/login). Single-page, no extra routes.app/src/app/globals.css— keep existing; ensure footer style.
PRIMARY RULE (ADR-0007) — the lint test MUST pass
No UI string says "buy/sell/hold this". Footer text (in OverviewPanel): "Educational analysis, not investment advice. Verify the underlying data; you are responsible for your own decisions."
WHEN DONE
Run cd app/server && bun test. If all green, run cd app && npx tsc --noEmit for the frontend. Print a summary: files created, test results, which acceptance criteria met. Then STOP.
SCOPE GUARDRAILS — DO NOT BUILD
No 2FA/OAuth, no onboarding, no full max-history backfill (only last 30 days for sparkline), no other panels, no LLM calls, no Docker.