Commit Graph

46 Commits

Author SHA1 Message Date
saravanakumardb1
832eccafed feat: add package tests (58 new) + @bytelyst/fastify-core package
Package tests added:
- @bytelyst/cosmos: 12 tests (client singleton, env vars, container registry)
- @bytelyst/config: 15 tests (base schema, loadConfig, product identity)
- @bytelyst/auth: 10 tests (JWT round-trip, password hash/verify)
- @bytelyst/api-client: 10 tests (fetch, safeFetch, auth injection)
- @bytelyst/design-tokens: 11 tests (loadTokens, generated file checks)

New package:
- @bytelyst/fastify-core: 8 tests (createServiceApp factory with CORS,
  x-request-id, health endpoint, ServiceError handler)

Total: 246 tests passing (was 180)
2026-02-12 22:17:17 -08:00
saravanakumardb1
81452bc157 docs(roadmap): update task statuses — 59% complete (165/278 tasks)
Cross-referenced every task against actual codebase state:
- Phase 0: 14/14  (scaffolding complete)
- Phase 1A: 22/23  (errors — Docker verify pending)
- Phase 1B: 29/33 ⚠️ (cosmos — package tests pending)
- Phase 2A: 22/25 ⚠️ (config — package tests pending)
- Phase 2B: 22/29 ⚠️ (auth — tracker + E2E pending)
- Phase 2C: 0/24 🔲 (fastify-core — not started)
- Phase 3A: 13/17 ⚠️ (api-client — tests pending)
- Phase 3B: 6/28 ⚠️ (react-auth — extracted, not integrated)
- Phase 4: 19/24 ⚠️ (design-tokens — tests pending)
- Phase 5: 3/23 🔲 (CI/Docker — mostly not started)
- Phase 6: 15/28 ⚠️ (regression done, E2E pending)
- Bonus: @bytelyst/logger (not in original roadmap)
2026-02-12 22:10:24 -08:00
saravanakumardb1
d2cd0aa321 docs(skills): add dual-network setup guide
Documents NETWORK=corp|home env var approach for seamless
switching between corporate proxy and home network.
Covers npm, pnpm, pip, curl, Node.js, lock file cleanup.
2026-02-12 20:52:06 -08:00
saravanakumardb1
2c588c51a3 refactor(scripts): simplify switch-network to env-var based approach
Single env var NETWORK=corp|home controls all proxy config.
Source from ~/.zshrc — sets http_proxy, NPM_CONFIG_REGISTRY,
PIP_TRUSTED_HOST, NODE_TLS_REJECT_UNAUTHORIZED automatically.
No more ~/.npmrc rewriting.
2026-02-12 20:38:57 -08:00
saravanakumardb1
97b6f4b8d1 chore: remove AT&T-specific refs, add dual-network switch script
- Replace hardcoded /Users/sd9235/ paths with $HOME in all SKILLS docs
- Use WORKSPACE_DIR variable in backup-main.sh (auto-resolves from script location)
- Genericize 'Forcepoint CertChecker' / 'corporate proxy' to 'SSL-intercepting proxy'
- Add scripts/switch-network.sh for toggling npm between corporate proxy and home
- No functional code changes — only comments, docs, and paths
2026-02-12 20:34:48 -08:00
saravanakumardb1
2e86353e77 fix(backup): show commits since last backup instead of total count 2026-02-12 20:17:46 -08:00
saravanakumardb1
66899f3891 fix(backup): fix set -e crash on arithmetic increment and repo errors 2026-02-12 20:14:38 -08:00
saravanakumardb1
f82afb3872 fix(backup): fix duplicate detection, add push + rich summary table
Bug fix: cut -d'/' -f2 truncated 'origin/backup/main-*' to just
'backup', so rev-parse always failed and duplicate detection never
worked. Fixed with sed to strip 'origin/' prefix properly.

New features:
- Push unpushed main commits before backing up
- Fetch remote backup refs before comparing
- Rich summary table: repo, status, commit count, push status, last msg
- Color-coded output with dim/bold formatting
- Proper cleanup using sed instead of broken cut
2026-02-12 20:13:57 -08:00
saravanakumardb1
f2a5dcecda fix: improve backup script error handling
- Check if directory is a git repository before proceeding
- Add fallback for git switch (use checkout if switch fails)
- Handle offline/no-origin scenarios gracefully
- Use local HEAD instead of origin/main for comparison
- Add error handling for push operations
- Continue backup locally if remote push fails
2026-02-12 20:02:21 -08:00
saravanakumardb1
ae2e757fb2 feat: add backup main branch workflow with smart duplicate detection
- Create Backup Main Branch skill with comprehensive documentation
- Add Windsurf workflow for easy access
- Implement bash script with multi-repo support
- Smart detection to avoid duplicate backups
- Automatic cleanup of old backups (keeps 7 days)
- Color-coded output for better visibility
- Always returns to main branch after backup
2026-02-12 19:54:29 -08:00
saravanakumardb1
85e0689021 chore: remove test file 2026-02-12 17:29:42 -08:00
saravanakumardb1
61f61862fe test: pre-commit in common_plat 2026-02-12 17:29:36 -08:00
saravanakumardb1
c3b869ceb9 feat: create AI.dev/SKILLS repository with reusable development skills
- Add 15 comprehensive skills extracted from Windsurf workflows
- Cover debugging, testing, releases, deployment, security, and documentation
- Each skill includes step-by-step instructions and copy-pasteable commands
- Skills organized by category with cross-references and difficulty levels
2026-02-12 17:13:16 -08:00
saravanakumardb1
90b9cf93d8 fix(common): configure ESLint 9 and fix lint issues
- Added @eslint/js dependency
- Updated eslint.config.js for ESLint 9 compatibility
- Added required globals (crypto, localStorage, React, etc.)
- Fixed unused imports and variables
- Disabled sort-imports temporarily
- Formatted all files with Prettier
2026-02-12 16:37:30 -08:00
saravanakumardb1
92cb800d32 chore: remove test file 2026-02-12 16:17:29 -08:00
saravanakumardb1
4afd39bd85 test: husky enabled in common_plat 2026-02-12 16:16:57 -08:00
saravanakumardb1
a5c00ebb23 test: husky in common_plat 2026-02-12 16:16:54 -08:00
saravanakumardb1
ca7a770309 feat: add Husky git hooks with enable/disable flag
 Added Husky and lint-staged to all package.json files
- common_plat: root package.json
- voice_agent: all 3 dashboards (admin, user, tracker)

 Created setup scripts
- scripts/setup-husky.sh in both repos
- Creates .husky/pre-commit with HUSKY_ENABLED flag check

 Added documentation
- HUSKY_SETUP.md: Complete setup and usage guide
- SHELL_ALIASES.md: Shell aliases for easy toggle

Features:
- Environment variable control: HUSKY_ENABLED=false/true
- lint-staged runs only on changed files (~2-5s)
- Auto-fixes ESLint and formats with Prettier
- Can be bypassed with --no-verify or husky-off alias

To activate after pulling:
1. pnpm install (or npm install)
2. pnpm prepare (or npm run prepare)
3. ./scripts/setup-husky.sh
2026-02-12 16:08:30 -08:00
saravanakumardb1
def855f032 feat: add quick wins - prettier, bundle limits, coverage
 Prettier config (.prettierrc) added to all 3 repos
- Consistent formatting: semicolons, single quotes, 100 char width
- Added format/format:check scripts to all package.json
- Added prettier devDependency

 Bundle size limits enforcement
- Added .bundlesizerc.json to all 3 dashboards
- Configured limits: _app (150kb), main (50kb), webpack (50kb), framework (100kb)
- Added bundlesize package and size:check script

 Test coverage with 80% thresholds
- Added coverage config to all dashboard vitest configs
- Enforces minimum coverage on branches, functions, lines, statements
- Generates text, json, and html reports

 TypeScript strict mode already enabled everywhere
- All repos already using strict: true in tsconfig

 EditorConfig already present in MindLyst
2026-02-12 15:54:06 -08:00
saravanakumardb1
dca1587efb feat: tighten production-readiness workflow
Quick wins implemented:
- Add ESLint to common_plat (12 projects now linted)
- Add test coverage with 80% thresholds
- Add security audit for all dependencies
- Add bundle analysis for Next.js builds
- Update Makefile with audit target

Enhanced coverage:
- common_plat: +lint, +coverage, +security
- dashboards: +coverage, +bundle analysis, +security
- Python: +security audit via make target

Workflow now validates 7 dimensions instead of 4.
2026-02-12 15:49:46 -08:00
saravanakumardb1
fbcb39d52c feat(logger): add @bytelyst/logger shared package
createLogger(config) factory for structured logging across dashboards and services.
- Dev: pretty-prints to stderr/stdout
- Prod: JSON structured output for log ingestion (Loki, Datadog, etc.)
- Exports: createLogger, Logger, LoggerConfig, LogLevel, LogPayload
2026-02-12 15:35:27 -08:00
saravanakumardb1
8930aa5af7 docs: update agent docs via /update-agent-docs
- AGENTS.md: add plans/licenses/rate-limit/promos modules, add dashboard consumer table, update test count
- CLAUDE.md: unchanged (already current)
2026-02-12 15:31:20 -08:00
saravanakumardb1
e310bd67ae docs: add missing agent configs (.windsurfrules, .clinerules, .aider.conf.yml)
Matches voice agent repo — now all 8 agentic tool configs present.
2026-02-12 15:21:53 -08:00
saravanakumardb1
86a56339ab fix: replace Math.random() IDs with crypto.randomUUID() across all services
- billing-service: licenses, subscriptions (pay_, lic_)
- growth-service: invitations, referrals (inv_, ref_)
- platform-service: auth, audit (usr_, aud_)
- tracker-service: items, comments, votes, public (trk_, cmt_, vote_)
- Add votes.test.ts — closes the only missing module test
2026-02-12 13:03:09 -08:00
saravanakumardb1
d39c447c52 docs: add .cursorrules and .github/copilot-instructions.md
Completes the AI agent config set for the common platform repo:
- .cursorrules — Cursor inline completions + chat rules
- .github/copilot-instructions.md — GitHub Copilot code generation patterns

Both reference AGENTS.md for full instructions and are tailored
to the @bytelyst/* packages + @lysnrai/* services structure.
2026-02-12 12:55:32 -08:00
saravanakumardb1
5cd4bc69ea docs: add AGENTS.md and CLAUDE.md for AI coding agent onboarding
AGENTS.md covers:
- Project identity and scopes (@bytelyst/* packages, @lysnrai/* services)
- Full monorepo layout with all 7 packages and 5 services
- Tech stack rules (ESM, Fastify 5, Zod, Vitest, pnpm)
- Coding conventions (MUST/MUST NOT rules)
- File ownership map (27 domains)
- Build/test/dev commands
- Common patterns (new module, new package, token workflow)
- Environment variables reference
- Dependency graph and build order
- 12 common pitfalls

CLAUDE.md is a compact summary referencing AGENTS.md.
2026-02-12 12:51:39 -08:00
saravanakumardb1
09c767295a feat(design-tokens): generate platform token files (CSS, TS, Kotlin, Swift)
Updated generator to match existing MindLyst conventions:
- Kotlin: SCREAMING_SNAKE_CASE, Palette/Dark/Light/BrainGradient/Typography/Motion/Layout
- Swift: Color(hex: UInt), dark/light prefixes, Gradient(colors:), MindLystMotion, Color ext
- CSS: [data-theme] selectors, --ml-fs-*, --ml-elevation-*, --ml-motion-*, light theme

Generated 4 files:
- generated/tokens.css — CSS custom properties (dark + light themes)
- generated/tokens.ts — Full token tree as const
- generated/MindLystTokens.kt — KMP shared module (drop-in for existing)
- generated/MindLystTheme.swift — SwiftUI structs (drop-in for existing)
2026-02-12 12:15:07 -08:00
saravanakumardb1
4ae7a9d023 refactor(services): rewire lib/ to @bytelyst/* packages + add docker-compose
Rewired all 4 services:
- lib/errors.ts → re-exports from @bytelyst/errors
- lib/cosmos.ts → re-exports from @bytelyst/cosmos
- lib/product-config.ts → uses loadProductIdentity()/getProductId() from @bytelyst/config
- lib/config.ts → kept self-contained (zod v3/v4 type mismatch with loadConfig)

Added workspace deps (@bytelyst/errors, @bytelyst/cosmos, @bytelyst/config) to all 4 services.
Added docker-compose.yml with Loki, Grafana, Traefik, and all 4 services.
Added .env.example with required env vars.
Added passWithNoTests to vitest.config.ts.
Pinned root zod to ^3.24.0 to match service zod versions.

All 12 projects build. 175 tests passing.
2026-02-12 11:49:42 -08:00
saravanakumardb1
772df7785b docs: update README with services section and full repo structure 2026-02-12 11:40:15 -08:00
saravanakumardb1
c97e697097 feat(services): add monitoring (Loki + Grafana config, health-check)
- Copied as-is from learning_voice_ai_agent/services/monitoring
- Grafana dashboards + provisioning for Loki datasource
- health-check.ts for service health polling
- Updated pnpm-workspace.yaml to include services/*
2026-02-12 11:39:24 -08:00
saravanakumardb1
2738124ab9 feat(services): add tracker-service (items, comments, votes, public roadmap)
- Copied as-is from learning_voice_ai_agent/services/tracker-service
- 45 tests passing (vitest)
- Fastify 5 + Cosmos DB + jose + Zod + @fastify/rate-limit
- Modules: items, comments, votes, public
- Port 4004
2026-02-12 11:39:17 -08:00
saravanakumardb1
b94510aeb9 feat(services): add growth-service (invitations, referrals, promos)
- Copied as-is from learning_voice_ai_agent/services/growth-service
- 33 tests passing (vitest)
- Fastify 5 + Cosmos DB + Stripe + Zod
- Modules: invitations, referrals, promos
- Port 4001
2026-02-12 11:39:11 -08:00
saravanakumardb1
fc5f2bf296 feat(services): add billing-service (subscriptions, Stripe, usage, licenses, plans)
- Copied as-is from learning_voice_ai_agent/services/billing-service
- 32 tests passing (vitest)
- Fastify 5 + Cosmos DB + Stripe + Zod
- Modules: subscriptions, licenses, plans, usage, stripe
- Port 4002
2026-02-12 11:39:05 -08:00
saravanakumardb1
e1ab956ac3 feat(services): add platform-service (auth, audit, flags, notifications, blob)
- Copied as-is from learning_voice_ai_agent/services/platform-service
- 55 tests passing (vitest)
- Fastify 5 + Cosmos DB + jose + bcryptjs + Zod
- Modules: auth, audit, flags, notifications, blob, ratelimit
- Port 4003
2026-02-12 11:39:00 -08:00
saravanakumardb1
72c6e64854 chore: add pnpm lockfile 2026-02-12 11:23:09 -08:00
saravanakumardb1
b80d249c78 feat(design-tokens): add @bytelyst/design-tokens package
- Canonical bytelyst.tokens.json with colors, typography, spacing, radius, elevation, motion, breakpoints
- loadTokens() for programmatic access
- generate.ts script outputs 4 platform formats:
  - tokens.css (CSS custom properties with --ml-* prefix)
  - tokens.ts (TypeScript constants)
  - MindLystTokens.kt (Kotlin object for KMP shared module)
  - MindLystTheme.swift (Swift structs for SwiftUI)
- Shared across LysnrAI dashboards and MindLyst native apps
2026-02-12 11:22:52 -08:00
saravanakumardb1
cf8781cc11 feat(react-auth): add @bytelyst/react-auth package
- createAuthProvider<TUser>() factory returns typed AuthProvider + useAuth hook
- Configurable storagePrefix, loginEndpoint, mapLoginResponse, onLogout
- localStorage persistence for user, access token, refresh token
- Uses @bytelyst/api-client for login requests
- Replaces 3 duplicated auth-context.tsx files across LysnrAI dashboards
- Peer dep: react >=18.0.0, workspace dep: @bytelyst/api-client
2026-02-12 11:22:41 -08:00
saravanakumardb1
01624a2231 feat(api-client): add @bytelyst/api-client package
- createApiClient() factory with baseUrl, getToken, defaultHeaders
- fetch() method that throws on error
- safeFetch() method that returns { data, error } tuple (never throws)
- Auto-injects Authorization header from getToken callback
- Replaces duplicated apiFetch patterns in 3 dashboards
2026-02-12 11:20:04 -08:00
saravanakumardb1
602fa50216 feat(auth): add @bytelyst/auth package
- createJwtUtils() factory with configurable issuer and expiry (jose)
- extractAuth() middleware for Fastify request auth extraction
- requireRole() guard with multi-role support
- hashPassword() / verifyPassword() via bcryptjs
- getCurrentUser() helper for Next.js API routes (generic TUser)
- AuthPayload, TokenPayload, JwtUtils types
- NO dependency on @bytelyst/config (reads JWT_SECRET from process.env directly)
- Peer deps: jose >=5.0.0, bcryptjs >=2.4.0
2026-02-12 11:19:58 -08:00
saravanakumardb1
65bf79203b feat(config): add @bytelyst/config package
- Zod-based baseEnvSchema (PORT, HOST, NODE_ENV, CORS_ORIGIN, SERVICE_NAME, COSMOS_*)
- loadConfig() with extension support for service-specific fields
- loadProductIdentity() reads product.json or falls back to env vars
- getProductId() convenience function
- Replaces 5 duplicated product-config.ts files across LysnrAI
- Peer dep: zod >=3.20.0
2026-02-12 11:19:49 -08:00
saravanakumardb1
2e9dcf49a8 feat(cosmos): add @bytelyst/cosmos package
- Singleton CosmosClient with env var config (COSMOS_ENDPOINT, COSMOS_KEY, COSMOS_DATABASE)
- Simple getContainer() for services
- Container registry with registerContainers(), getRegisteredContainer(), initializeAllContainers() for dashboards
- ContainerConfig type with partitionKeyPath and optional defaultTtl
- _resetClient() and _resetRegistry() for test isolation
- Peer dep: @azure/cosmos >=4.0.0
2026-02-12 11:19:42 -08:00
saravanakumardb1
9c0ab36171 feat(errors): add @bytelyst/errors package
- ServiceError base class with statusCode, message, details
- HTTP errors: BadRequest, Unauthorized, Forbidden, NotFound, Conflict, TooManyRequests
- 10 tests passing (vitest)
- Superset of all 4 service error files in LysnrAI
2026-02-12 11:19:35 -08:00
saravanakumardb1
d875df09a3 chore(scaffold): initialize pnpm workspace with build tooling
- Root package.json with @bytelyst/root, pnpm scripts (build, test, typecheck, clean)
- pnpm-workspace.yaml declaring packages/*
- tsconfig.base.json (ESM, strict, ES2022, NodeNext)
- vitest.config.ts (globals, node environment)
- .gitignore, .nvmrc (Node 20), .editorconfig
- README.md with package overview and quick start
2026-02-12 11:19:29 -08:00
saravanakumardb1
bf22b5ee4c docs(roadmap): address 15 gaps found via codebase cross-reference
Gap Analysis added:
- G1: Route-level import rewiring (22 error files, 13 cosmos, 34 product-config)
- G2: Existing errors.test.ts files in 3 services need updating
- G3: 5th product-config copy in user-dashboard-web
- G4/G5: Admin dashboard API routes + repositories import product-config
- G6: growth-service webhooks.ts imports product-config
- G7: file: reference paths differ (services=3 levels, dashboards=2 levels)
- G8: pnpm install + lock file steps added to each integration
- G9: Rollback strategy added to Phase 0
- G10: Git branching strategy added to Phase 0
- G11: Docker file: reference solution (pre-copy script) in Phase 5
- G12: 24 auth-context consumer files need path updates (thin re-export pattern)
- G13: MindLyst Android MindLystTheme.kt added to Phase 4
- G14: @bytelyst/auth false dep on config removed (reads JWT_SECRET from env)
- G15: Dashboard repositories (8 files) importing cosmos added to Phase 1B

Revised: ~278 tasks, ~37-51 hours estimated
2026-02-12 10:55:03 -08:00
saravanakumardb1
69f18f2588 docs: add detailed phased roadmap with task checklists
- 7 phases (0-6 + future): scaffolding, P0 packages, P1 packages, P2 packages, design tokens, CI/CD, verification
- ~150 checkboxed tasks covering extract, test, integrate, cleanup, Docker, and docs
- Dependency-ordered execution: errors → cosmos → config → auth → fastify-core → api-client → react-auth → design-tokens
- Estimated ~28-41 hours total effort
2026-02-12 10:48:38 -08:00
saravanakumardb1
a874a4332b docs: add common platform analysis, ecosystem architecture, and drawio diagram
- COMMON_PLATFORM_ANALYSIS.md: identifies 8 shared packages to extract from LysnrAI and MindLyst repos (~1,580 LOC duplication eliminated)
- ECOSYSTEM_ARCHITECTURE.md: detailed post-refactor architecture with components, services, migration plan, advantages, cautions, versioning, testing, and CI/CD impact
- ecosystem-after-refactor.drawio: 4-layer architecture diagram (clients, repos, common platform, Azure infra)
2026-02-12 10:40:28 -08:00