learning_ai_common_plat/packages/design-tokens
Saravana Achu Mac 8f541c9f87 chore(audit): unblock workspace lint pipeline + 13 mechanical fixes
The first `pnpm -r exec eslint .` run was bailing at the very first
package (design-tokens), hiding any lint state in the rest of the 69
workspace packages. This commit fixes the structural blockers so the
pipeline runs end-to-end, then sweeps the small, low-risk lint errors
in the next 4 packages it surfaces. Real lint debt that remains
(85 errors, mostly @typescript-eslint/no-unused-vars across many
unrelated packages) is cataloged in docs/AUDIT_PLATFORM.md for follow-
up by package owners.

Structural fixes (eslint config):
  - eslint.config.js (root):
      • New flat-config block for **/*.cjs and **/scripts/**/*.{js,cjs}
        with Node globals (process, console, require, module, __dirname)
        and no-console disabled. CLI scripts legitimately print to
        stdout. This alone clears the 45 errors in design-tokens'
        validate-tokens.cjs.
      • Added XMLHttpRequest + ProgressEvent to browser globals so
        feedback-client compiles.
  - packages/ui/eslint.config.js:
      • Added @typescript-eslint/parser — the package-local override
        replaced (didn't merge with) the root config, so TS syntax was
        being parsed by espree and erroring on every `interface` /
        type import.
      • Added ignores for dist/** (root's ignores aren't inherited).
      • Extended the files glob to .storybook/**/*.{ts,tsx}.

Mechanical lint fixes (no behaviour change):
  - design-tokens/scripts/{validate,token-coverage}.cjs: empty catch
    binding (catch (e) → catch).
  - feedback-client/src/index.ts:
      • captureScreen(): preserve caught error via `{ cause: err }`
        on the rethrown Error (preserve-caught-error rule, real bug —
        previous chain dropped the original stack).
      • captureElement(): rename unused parity params mimeType/quality
        to _mimeType/_quality and document why they exist.
  - logger/__tests__/logger.test.ts: drop unused `LoggerConfig` import.
  - extraction-service/{lib/circuit-breaker,modules/extract/{sidecar-
    monitor,usage}}.test.ts: drop 3 unused vitest/type imports.
  - tracker-web/__tests__/tracker-proxy.test.ts: rename unused local
    `url` → `_url`.

New: docs/AUDIT_PLATFORM.md
  Tooling-backed audit summary (pnpm install / typecheck / test / lint
  results), classification of remaining lint debt by rule, and an
  ordered hand-off plan for package owners to clear the rest with
  `pnpm --filter <pkg> lint:fix` followed by an eyeball review.

Verified before commit:
  - `pnpm typecheck` → pass (all 69 packages compile)
  - `pnpm test`      → pass (~2,200 tests across 18+ suites)
  - `pnpm lint`      → 85 pre-existing errors surfaced (none introduced
    by this commit; all in unrelated packages — see AUDIT_PLATFORM.md
    section P).

Out of scope (left untouched in working tree):
  - In-progress nomgap-on-Vercel migration: docker-compose.ecosystem.yml,
    products/nomgap/product.json, services/platform-service/src/
    modules/flags/seed.ts.
  - pnpm-lock.yaml: my `pnpm install -r` regenerated it (+2.9k/-8.5k
    lines) — not part of the audit, owner should commit deliberately.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 14:21:34 -07:00
..
generated feat(design-tokens): extend generator with per-product Swift + Kotlin native themes 2026-03-28 00:25:03 -07:00
scripts chore(audit): unblock workspace lint pipeline + 13 mechanical fixes 2026-05-04 14:21:34 -07:00
src feat: add package tests (58 new) + @bytelyst/fastify-core package 2026-02-12 22:17:17 -08:00
tokens feat(design-tokens): add actiontrail, notelett, localmemgpt, localllmlab product palettes 2026-03-27 16:23:13 -07:00
bytelyst-design-tokens-0.1.0.tgz chore: update chat history archive + design-tokens tarball 2026-03-31 01:42:48 -07:00
package.json refactor(gitea): robust manifest-based publish pipeline 2026-04-13 01:47:03 -07:00
README.md docs: design system audit, onboarding guide, and AGENTS.md updates 2026-03-03 21:55:02 -08:00
tsconfig.json feat(design-tokens): add @bytelyst/design-tokens package 2026-02-12 11:22:52 -08:00

@bytelyst/design-tokens

ByteLyst cross-platform design system tokens. Single source of truth for colors, typography, spacing, and more across Web, iOS, Android/KMP, and React Native.

Quick Start

Install

# This is a workspace package - use from source
# Copy generated files to your project

Generate Tokens

# From the monorepo root
pnpm --filter @bytelyst/design-tokens generate

This regenerates all platform outputs from tokens/bytelyst.tokens.json.


Token Structure

Color Tokens

Token Path Example Value Usage
color.semantic.dark.bgCanvas #06070A Dark mode background
color.semantic.dark.accentPrimary #5A8CFF Primary brand color
color.semantic.light.surfaceCard #FFFFFF Light mode card background
color.nomgap.stageKetosis #5A8CFF Product-specific color

Typography Tokens

Token Path Value CSS Output
typography.fontFamily.display 'Space Grotesk' --ml-font-display
typography.fontSize.lg 18 --ml-fs-lg: 18px
typography.fontWeight.semibold 600

Spacing Tokens (8pt Grid)

Token Value CSS
spacing.1 4 --ml-space-1: 4px
spacing.4 16 --ml-space-4: 16px
spacing.8 32 --ml-space-8: 32px

Elevation Tokens

Token CSS Output
elevation.sm --ml-elevation-sm: 0 4px 12px rgba(0,0,0,0.12)
elevation.md --ml-elevation-md: 0 12px 28px rgba(0,0,0,0.18)

Platform Usage

Web (CSS)

/* Import the CSS file */
@import '@bytelyst/design-tokens/generated/tokens.css';

/* Use tokens */
.my-component {
  background-color: var(--ml-bg-canvas);
  color: var(--ml-text-primary);
  padding: var(--ml-space-4);
  border-radius: var(--ml-radius-md);
  box-shadow: var(--ml-elevation-sm);
  font-family: var(--ml-font-display);
  font-size: var(--ml-fs-lg);
}

With Tailwind CSS

<!-- Use arbitrary values with CSS variables -->
<div class="bg-[var(--ml-bg-canvas)] text-[var(--ml-text-primary)] p-[var(--ml-space-4)]">
  Content
</div>

Web (TypeScript)

import { tokens } from '@bytelyst/design-tokens/generated/tokens';

// Access any token programmatically
const primaryColor = tokens.color.semantic.dark.accentPrimary;
const fontSize = tokens.typography.fontSize.lg;

iOS (SwiftUI)

import SwiftUI

// Copy MindLystTheme.swift to your project
// Rename to YourProductTheme.swift

struct MyView: View {
    var body: some View {
        Text("Hello")
            .foregroundColor(ProductColors.darkTextPrimary)
            .background(ProductColors.darkBgCanvas)
            .font(.system(size: ProductSpacing.x4))
    }
}

Android/KMP (Kotlin + Compose)

import com.mindlyst.shared.theme.MindLystTokens

@Composable
fun MyComponent() {
    Box(
        modifier = Modifier
            .background(Color(MindLystTokens.Dark.BG_CANVAS))
            .padding(MindLystTokens.Spacing.X4.dp)
    ) {
        Text(
            text = "Hello",
            color = Color(MindLystTokens.Dark.TEXT_PRIMARY),
            fontSize = MindLystTokens.Typography.SIZE_LG.sp
        )
    }
}

React Native (Expo)

import { tokens } from '@bytelyst/design-tokens/generated/react-native/tokens';
import { StyleSheet } from 'react-native';

const styles = StyleSheet.create({
  container: {
    backgroundColor: tokens.colors.bgCanvas,
    padding: tokens.spacing['4'],
    borderRadius: tokens.radius.md,
  },
  text: {
    color: tokens.colors.textPrimary,
    fontSize: tokens.typography.fontSize.lg,
  },
});

Product-Specific Tokens

Each product has dedicated color tokens:

{
  "color": {
    "nomgap": {
      "stageFed": "#FF9F43",
      "stageKetosis": "#5A8CFF",
      "autophagyMeter": "#5AE68C"
    },
    "chronomind": {
      "urgencyCritical": "#FF6E6E",
      "focusMode": "#7C6BFF"
    },
    "peakpulse": {
      "activityHike": "#34D399",
      "speedZoneFast": "#FFD166"
    }
  }
}

Validation & Compliance

Check for Hardcoded Colors

# From your product repo
node ../learning_ai_common_plat/packages/design-tokens/scripts/validate-tokens.cjs src/

This scans for #RRGGBB, rgb(), rgba(), and hsl() patterns.

Get Token Coverage Report

# From your product repo
node ../learning_ai_common_plat/packages/design-tokens/scripts/token-coverage.cjs src/

Reports:

  • Percentage of files using tokens
  • Number of hardcoded colors found
  • Token adoption rate

CI Integration

GitHub Actions Example

- name: Check for hardcoded colors
  run: |
    node ../../learning_ai_common_plat/packages/design-tokens/scripts/validate-tokens.cjs src/
    if [ $? -ne 0 ]; then
      echo "❌ Hardcoded colors found. Use design tokens instead."
      exit 1
    fi    

Pre-commit Hook

# .husky/pre-commit or .git/hooks/pre-commit
node packages/design-tokens/scripts/validate-tokens.cjs src/ || true

Token Categories (v1.1.0)

Category Count Description
Color 80+ Palette, semantic (dark/light), product-specific
Typography 20+ Font families, sizes, weights, line heights
Spacing 13 8pt grid (0-64px)
Radius 6 Corner radii (xs to pill)
Elevation 4 Shadow depths
Motion 7 Durations, easings
Z-Index 9 Layer stacking
Icon 6 Icon sizes
Grid 12 12-column system
Opacity 11 Alpha values

Version History

Version Date Changes
1.1.0 2026-03-03 Added product tokens (PeakPulse, ChronoMind, NomGap, LysnrAI), z-index, icon sizes, grid, opacity
1.0.0 2026-02-12 Initial release with color, typography, spacing, radius, elevation, motion

Contributing

  1. Edit tokens/bytelyst.tokens.json (canonical source)
  2. Run pnpm generate to regenerate outputs
  3. Copy generated files to consumer repos
  4. Commit both source and generated files

Never edit generated files directly — they will be overwritten.


See Also