Development commands
Common commands and workflows for AlignTrue development.
Core commands
Run the web app locally
pnpm devOpens the Next.js app at http://localhost:3000 (from apps/web)
Build all packages
pnpm buildRun tests
pnpm test # All tests across all packages
pnpm test:fast # Fast reporter for quick feedbackType-check all packages
pnpm typecheckFormat
pnpm format # Format code with Prettier
pnpm format:check # Check formatting without changesValidation workflow
Run before large refactors to ensure clean baseline:
pnpm pre-refactor # Type check + lint entire workspaceClean
# Remove all node_modules and build artifacts
pnpm clean
# Remove temp files created by AI/debugging
pnpm clean-tempWorking on packages
Package build workflow
When editing workspace packages that other packages depend on (core, schema, exporters), you have two options:
Option 1: Watch mode (recommended for active development)
Run packages in watch mode for automatic rebuilds on save:
pnpm dev:packagesThis runs all packages in parallel watch mode. Keep this running in a separate terminal while developing.
Option 2: Manual builds
Build packages explicitly when needed:
# Build all packages
pnpm build:packages
# Build specific package
pnpm --filter @aligntrue/core buildWhy builds matter
Packages import from dist/ directories of their dependencies (e.g., CLI imports from packages/core/dist/). If you edit source in packages/core/src/ but don’t rebuild, other packages will see stale types and code.
The pre-commit hook automatically rebuilds packages when source files change, so you won’t commit stale builds. But during development, use watch mode for instant feedback.
Running tests locally
All tests
Run the full test suite across all packages:
pnpm testSpecific package
Test a single package:
pnpm --filter @aligntrue/cli test
pnpm --filter @aligntrue/schema test
pnpm --filter @aligntrue/core testSpecific test file
Run a specific test file:
pnpm --filter @aligntrue/cli vitest run tests/commands/sync.test.tsWatch mode
Run tests in watch mode for rapid feedback during development:
# Watch all tests in a package
pnpm --filter @aligntrue/cli vitest
# Watch specific test file
pnpm --filter @aligntrue/cli vitest tests/commands/sync.test.ts
# Watch with UI
pnpm --filter @aligntrue/cli vitest --uiWith coverage
Generate coverage reports:
pnpm --filter @aligntrue/cli vitest --coverageDeterministic test environment
Match CI environment exactly (useful for debugging CI failures):
TZ=UTC pnpm testFast feedback mode
Use the fast reporter for quicker output:
pnpm test:fastDesign system and theming
AlignTrue uses a centralized design system (@aligntrue/ui) for consistent branding across all web properties.
Key components
- AlignTrueLogo - SVG logo with theme-aware colors and orange colon (#F5A623)
- Primer-based colors - Semantic tokens that adapt to light/dark modes
Using the design system
Import components and styles in your Next.js app:
import { AlignTrueLogo } from "@aligntrue/ui";
import "@aligntrue/ui/styles/tokens.css";Color tokens
Use semantic color tokens instead of hardcoded colors:
// Good - adapts to theme
<div style={{ color: "var(--fgColor-default)" }}>Text</div>
// Bad - hardcoded, breaks in dark mode
<div style={{ color: "#171717" }}>Text</div>Available token categories:
--fgColor-*- Foreground/text colors--bgColor-*- Background colors--borderColor-*- Border colors--color-neutral-*- Neutral scale (50-950)
See workspace structure for complete documentation.
Testing themes
Test both light and dark modes during development:
- Use the theme toggle in the UI
- Check browser DevTools → Application → Local Storage for
aligntrue-theme - Toggle system preference in OS settings to test “system” mode
- Verify no FOUC (flash of unstyled content) on page load
Nextra documentation sites
For Nextra-based docs, import Nextra’s base styles and use the theme config factory:
import "nextra-theme-docs/style.css";
import { createAlignTrueNextraTheme } from "@aligntrue/ui/nextra";
const themeConfig = createAlignTrueNextraTheme({
docsRepositoryBase: "https://github.com/org/repo/tree/main/apps/docs",
logoSize: "md",
});This provides:
- Branded logo in navbar
- Consistent sidebar and TOC configuration
- Nextra’s built-in theme system for colors
Code quality
TypeScript
- All packages use strict TypeScript
- Extends
tsconfig.base.jsonfrom repo root - No
anytypes allowed - Use
unknownand narrow types
Formatting
EditorConfig is configured at the root. Use:
- 2 spaces for indentation
- LF line endings
- UTF-8 encoding
Testing
- Unit tests go in
packages/*/tests/ - Keep tests fast (<1s per test)
- Make tests deterministic (no real time, network, or randomness)
Common tasks
Add a new package
- Create directory under
packages/ - Add
package.jsonwith workspace dependencies - Create
tsconfig.jsonextending base - Add to workspace commands in root
package.json
Update dependencies
pnpm update --latest --recursiveCheck for security issues
pnpm auditVersioning with Changesets
We use Changesets for managing package versions and changelogs.
Creating a changeset
After making changes, create a changeset describing your changes:
pnpm changesetFollow the prompts to:
- Select which packages changed
- Choose version bump type (major/minor/patch)
- Write a summary of changes
The changeset file will be committed with your changes.
Versioning packages
To consume changesets and bump versions:
pnpm versionThis updates package.json versions and CHANGELOG.md files.
Publishing packages
After versioning, publish to npm:
pnpm releaseThis builds all packages and publishes them to npm.
CI/CD
CI runs on every PR:
- Lockfile sync validation
pnpm typecheck- Type checkingpnpm test- Testspnpm build- Production build- Integration tests
- Golden repository validation
All must pass before merge.
Note: Pre-push hooks mirror CI checks, so if pre-push passes, CI should pass too.
Troubleshooting
Pre-commit hook fails with formatting errors
The hook auto-formats code with Prettier. If it still fails, check the error output for issues with the lockfile update or other problems.
Pre-push hook is too slow
Pre-push runs the full validation suite (~30-60 seconds). This is intentional to catch issues before CI.
For faster iteration during development, use watch mode for tests instead of relying on hooks.
Commit message rejected
Ensure your commit message follows Conventional Commits format:
<type>: <description>Example: feat: Add new command or fix: Resolve memory leak
Next steps
- Review workspace structure
- Understand architecture concepts
- See setup guide for installation