Skip to content

Developer Tooling

Mantle ships a full CI and convention-enforcement suite in the CLI.

Quick Start

bash
mantle generate hooks            # Husky pre-commit / pre-push
mantle generate ci-templates     # GitHub Actions workflows
mantle generate knip-config      # Dead code detection config
mantle generate agents           # AGENTS.md for AI assistants

pnpm add -D husky && npx husky   # Install hook runtime

mantle ci                        # Run full pipeline locally

Local CI

mantle ci mirrors what GitHub Actions runs.

bash
mantle ci           # lint, build, typecheck, test, conventions
mantle ci --full    # adds integration tests and extended checks

Phases: setup → build → validate → test → quality → integration. Tools that aren't installed (ShellCheck, knip, tofu) are skipped gracefully.

CI blocks on any CRITICAL or HIGH violation, test failure, build error, or dependency architecture violation.

Convention Checks

mantle check runs 20 ts-morph rules against your code.

bash
mantle check                      # all rules
mantle check --fast               # CRITICAL only (~2s)
mantle check --severity HIGH      # CRITICAL + HIGH

Severity levels:

SeverityCountExamples
CRITICAL3Handler pattern, handler export, defineLambda required
HIGH11No raw process.env, no raw AWS SDK, entity decorators, response validation
MEDIUM6Permission gaps, metrics, batch retry, mocking

Dependency Architecture

bash
mantle check deps

Enforces: no handler→handler imports, no circular deps, entity queries can't import handler code, no deep @mantleframework/* internal imports.

Git Hooks

bash
mantle generate hooks

Creates two Husky hooks:

  • pre-commit: secrets scan + dependency architecture (~2–5s)
  • pre-push: full mantle ci pipeline
bash
MANTLE_SKIP_HOOKS=1 git commit    # bypass temporarily

ESLint Rules

bash
pnpm add -D @mantleframework/eslint-rules
javascript
// eslint.config.mjs
import mantleRules from '@mantleframework/eslint-rules'
export default [mantleRules.configs.recommended]

Provides 8 rules covering handler patterns, imports, and naming.

Bundle Analysis

bash
mantle check bundles              # default 5 MB threshold
mantle check bundles --json       # JSON output for CI

Reports per-Lambda sizes, top dependencies, and tree-shaking ratio.

Dead Code Detection

bash
mantle generate knip-config
pnpm add -D knip
mantle check dead-code

MCP Server

bash
mantle mcp-server

Exposes 19 tools for AI assistants: validation, infra queries, package reference, deployment workflows, entity queries, dependency analysis, and performance estimation.

Context Generation

bash
mantle generate agents            # AGENTS.md project overview
mantle generate graph             # build/graph.json dependency graph
mantle generate repomix           # AI context packing config

Configuration

typescript
// mantle.config.ts
import { defineToolingConfig } from '@mantleframework/cli/config'

export default defineToolingConfig({
  name: 'my-api',
  database: { provider: 'aurora-dsql' },
  ci: {
    formatter: 'dprint',
    conventions: { severity: 'HIGH' },
  },
  hooks: {
    preCommit: { secretsScan: true, depArchitecture: true },
    prePush: { ci: true },
  },
})

Further Reading