Files
agentic-dev/turbo/generators/templates/feature/src/feature.manifest.ts.hbs
Danijel Martinek 0ee0355f5e feat(core-shared): add analyticsEvents field to UseCaseManifest
Add optional `analyticsEvents?: readonly string[]` to `UseCaseManifest`
in `define-feature.ts` so manifests can declare which analytics events a
use case emits. Field defaults to absent (treated as []) — all existing
manifests remain valid without changes.

Update the feature generator template to emit `analyticsEvents: []` so
newly scaffolded features are analytics-declaration-ready from day one.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 11:57:49 +00:00

46 lines
1.7 KiB
Handlebars

import { defineFeature } from "@repo/core-shared/conformance";
/**
* The {{camelCase name}} feature's conformance manifest. Drives binding-slot
* types in `di/bind-production.ts` and is read by ESLint, the boot
* assertion, and the CI drift gate.
*
* Conventions:
* - `mutates: true` for any use case that creates, updates, or deletes state
* - `audits` lists every audit event the use case emits (must match calls
* to `auditLog.record(...)` in the factory body — ESLint enforces this)
* - `publishes` / `consumes` cover cross-feature events through `IEventBus`
*/
export const {{camelCase name}}Manifest = defineFeature({
name: "{{kebabCase name}}",
requiredCores: [],
useCases: {
get{{pascalCase entity}}: {
mutates: false,
audits: [],
publishes: [],
consumes: [],
analyticsEvents: [],
},
},
realtimeChannels: [],
jobs: [],
// <gen:coverage>
// Coverage bands — single source of truth (ADR-020). Read by:
// - vitest.config.ts (test-time thresholds, L0)
// - assertFeatureConformance (boot-time, fails dev/prod on drift)
// - pnpm coverage:diff (cover-the-diff gate, L1)
// Edit here; the helper in vitest.config picks up the new numbers.
coverage: {
bands: {
baseline: { statements: 80, branches: 75, functions: 80, lines: 80 },
entities: { statements: 100, branches: 100, functions: 100, lines: 100 },
"use-cases": { statements: 100, branches: 95, functions: 100, lines: 100 },
controllers: { statements: 100, branches: 95, functions: 100, lines: 100 },
},
mutationTargets: ["entities", "use-cases"],
},
} as const);
export type {{pascalCase name}}Manifest = typeof {{camelCase name}}Manifest;