Developer Tooling
Mantle ships a full CI and convention-enforcement suite in the CLI.
Quick Start
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 locallyLocal CI
mantle ci mirrors what GitHub Actions runs.
mantle ci # lint, build, typecheck, test, conventions
mantle ci --full # adds integration tests and extended checksPhases: 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.
mantle check # all rules
mantle check --fast # CRITICAL only (~2s)
mantle check --severity HIGH # CRITICAL + HIGHSeverity levels:
| Severity | Count | Examples |
|---|---|---|
| CRITICAL | 3 | Handler pattern, handler export, defineLambda required |
| HIGH | 11 | No raw process.env, no raw AWS SDK, entity decorators, response validation |
| MEDIUM | 6 | Permission gaps, metrics, batch retry, mocking |
Dependency Architecture
mantle check depsEnforces: no handler→handler imports, no circular deps, entity queries can't import handler code, no deep @mantleframework/* internal imports.
Git Hooks
mantle generate hooksCreates two Husky hooks:
- pre-commit: secrets scan + dependency architecture (~2–5s)
- pre-push: full
mantle cipipeline
MANTLE_SKIP_HOOKS=1 git commit # bypass temporarilyESLint Rules
pnpm add -D @mantleframework/eslint-rules// 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
mantle check bundles # default 5 MB threshold
mantle check bundles --json # JSON output for CIReports per-Lambda sizes, top dependencies, and tree-shaking ratio.
Dead Code Detection
mantle generate knip-config
pnpm add -D knip
mantle check dead-codeMCP Server
mantle mcp-serverExposes 19 tools for AI assistants: validation, infra queries, package reference, deployment workflows, entity queries, dependency analysis, and performance estimation.
Context Generation
mantle generate agents # AGENTS.md project overview
mantle generate graph # build/graph.json dependency graph
mantle generate repomix # AI context packing configConfiguration
// 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 },
},
})