Package Exports
- @dkcli/cli
- @dkcli/cli/package.json
Readme
DesignKit
DesignKit is a SvelteKit application plus a small src/lib/dk utility library for mathematical UI tooling. It ships a deterministic proof page plus fourteen focused tools that turn structured inputs into repeatable outputs across layout solving, composition scoring, palette generation, perceptual distinctness, target acquisition, typography spacing, prepared paragraph layout, modular scales, glass CSS, optical corrections, APCA contrast checks, spring easing, minimum-jerk motion, balanced line breaking, and CSS auditing.
Advanced engine, runtime-backed ML features, API endpoints, and DesignDocument schema are documented in docs/advanced-engine.md.
Runbook
pnpm devstarts the local app.pnpm dkcms:devstarts the standalonedkcmsworker.pnpm dkcms:dev:allapplies the local D1 schema, starts the worker, and starts the app together for end-to-end dev.pnpm dk --helpshows the full DesignKit CLI surface.pnpm dk <command>runs the source-owneddkCLI through the package script wrapper.pnpm build:cliemits the publishable npm package files todist/.pnpm pack:drypreviews the npm tarball contents after the CLI build.pnpm lintruns ESLint with zero-warning tolerance.pnpm check:strictrunssvelte-checkand fails on warnings.pnpm testruns the Vitest suite.pnpm test:e2ebuilds the app and runs the Playwright suite.DK_VISUAL_SNAPSHOTS=1 pnpm exec playwright test e2e/component-gallery.e2e.tsruns the opt-in, platform-specific gallery screenshot checks.pnpm test:coverageruns the suite with coverage thresholds.pnpm buildproduces the production bundle.pnpm verifyruns the full local verification sequence.
Architecture
src/routescontains one route per tool plus aperfectproof page that composes several dk modules together.workers/dkcmsis a sibling Cloudflare Worker that stores CMS state in D1, runs a Workflow-backed dk build loop, and emits generated pages.src/lib/dkcontains the pure logic and string-generation helpers behind each tool.src/lib/dk/cli.tsis the source-owned CLI layer for thedkcommand surface.bin/dk.jsis the local development wrapper used bypnpm dk.src/bin/dk.tsis the publishable CLI entrypoint compiled intodist/bin/dk.js.src/lib/styles/tokens.cssandsrc/app.cssdefine shared visual tokens and app-wide styles.
Documentation
- docs/advanced-engine.md: runtime-backed saliency/layout/compose, API endpoints,
DesignDocumentschema,app-shellbehavior, and production defaults. pnpm dk <command> --help: command-level flags and formats.src/routes/README.md: route-to-module mapping.src/lib/dk/README.md: module responsibilities and library rules.
npm Package
The repo now packages the CLI as @dkcli/cli.
- Install globally:
npm install -g @dkcli/cli - Run via package binary:
dk --helpordkcli --help - Run one-off without installing:
npx @dkcli/cli --help
Constraints
- Do not edit
.svelte-kit/ordk-current; both are generated artifacts. - Internal route code should import directly from specific
src/lib/dk/*.tsmodules. - Avoid
$effectfor local state synchronization; prefer derived state or explicit event handlers.
Deployment
Cloudflare deployment config lives in wrangler.jsonc. The current deploy script is pnpm deploy.
- Production runtime base URL is
https://dkcli.com. dkcmsis configured separately in workers/dkcms/wrangler.jsonc.- The CLI keeps saliency/layout/compose local unless
--runtime-urlorDK_RUNTIME_URLis set.mlandautowithout a runtime URL fall back to local heuristic analysis. AIis required for server-side ML importance scoring.DK_CACHEis optional. If you deploy with KV enabled, replace the placeholder namespace IDs inwrangler.jsonc.