@viberails/types 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -148,7 +148,7 @@ var ROLE_DESCRIPTIONS = {
148
148
  };
149
149
 
150
150
  // src/index.ts
151
- var VERSION = "0.4.0";
151
+ var VERSION = "0.5.1";
152
152
  // Annotate the CommonJS export names for ESM import in node:
153
153
  0 && (module.exports = {
154
154
  CONVENTION_LABELS,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/confidence.ts","../src/display-names.ts"],"sourcesContent":["declare const __PACKAGE_VERSION__: string;\nexport const VERSION: string = __PACKAGE_VERSION__;\n\nexport type { BoundaryConfig, BoundaryRule, BoundaryViolation } from './boundary.js';\nexport type { CheckResult, CheckRule, CheckViolation } from './check-result.js';\nexport type { Confidence, DetectedConvention } from './confidence.js';\nexport { confidenceFromConsistency } from './confidence.js';\nexport type {\n ConfigConventions,\n ConfigRules,\n ConfigStack,\n ConfigStructure,\n ConventionValue,\n PackageConfigOverrides,\n ViberailsConfig,\n WorkspaceConfig,\n} from './config.js';\nexport {\n CONVENTION_LABELS,\n FRAMEWORK_NAMES,\n LIBRARY_NAMES,\n ORM_NAMES,\n ROLE_DESCRIPTIONS,\n STYLING_NAMES,\n} from './display-names.js';\nexport type {\n ImportEdge,\n ImportGraph,\n ImportGraphNode,\n ImportKind,\n WorkspacePackage,\n} from './graph.js';\nexport type {\n CodebaseStatistics,\n DetectedStack,\n DetectedStructure,\n DetectedWorkspace,\n DirectoryInfo,\n DirectoryRole,\n FileStatistic,\n PackageScanResult,\n ScanResult,\n StackItem,\n} from './scan-result.js';\n","/**\n * Confidence level for a detected convention or pattern.\n *\n * - `'high'` — ≥90% consistency across analyzed files. Enforced by default.\n * - `'medium'` — 70–89% consistency. Included in config but not enforced.\n * - `'low'` — <70% consistency. Omitted from config entirely.\n */\nexport type Confidence = 'high' | 'medium' | 'low';\n\n/**\n * A convention or pattern detected by the scanner, with metadata\n * about how confidently it was identified.\n *\n * @typeParam T - The type of the detected value. Defaults to `string`.\n */\nexport interface DetectedConvention<T = string> {\n /** The detected value (e.g. a naming pattern, file extension, or path). */\n value: T;\n\n /** How confident the scanner is in this detection. */\n confidence: Confidence;\n\n /** Number of files analyzed to determine this convention. */\n sampleSize: number;\n\n /** Percentage (0–100) of files that follow this convention. */\n consistency: number;\n}\n\n/**\n * Derives a confidence level from a consistency percentage.\n *\n * @param consistency - A number from 0 to 100 representing the percentage\n * of files that follow a given convention.\n * @returns The corresponding confidence level:\n * - `'high'` for consistency ≥ 90\n * - `'medium'` for consistency ≥ 70 and < 90\n * - `'low'` for consistency < 70\n */\nexport function confidenceFromConsistency(consistency: number): Confidence {\n if (consistency >= 90) return 'high';\n if (consistency >= 70) return 'medium';\n return 'low';\n}\n","/** Display names for framework identifiers. */\nexport const FRAMEWORK_NAMES: Record<string, string> = {\n nextjs: 'Next.js',\n expo: 'Expo',\n 'react-native': 'React Native',\n angular: 'Angular',\n remix: 'Remix',\n nuxt: 'Nuxt',\n sveltekit: 'SvelteKit',\n astro: 'Astro',\n gatsby: 'Gatsby',\n solidjs: 'Solid.js',\n qwik: 'Qwik',\n electron: 'Electron',\n tauri: 'Tauri',\n nestjs: 'NestJS',\n express: 'Express',\n fastify: 'Fastify',\n koa: 'Koa',\n hono: 'Hono',\n supabase: 'Supabase',\n firebase: 'Firebase',\n convex: 'Convex',\n};\n\n/** Display names for styling libraries. */\nexport const STYLING_NAMES: Record<string, string> = {\n tailwindcss: 'Tailwind CSS',\n 'css-modules': 'CSS Modules',\n 'styled-components': 'styled-components',\n emotion: 'Emotion',\n sass: 'Sass',\n 'vanilla-extract': 'Vanilla Extract',\n unocss: 'UnoCSS',\n 'panda-css': 'Panda CSS',\n nativewind: 'NativeWind',\n};\n\n/** Display names for ORM / database clients. */\nexport const ORM_NAMES: Record<string, string> = {\n prisma: 'Prisma',\n drizzle: 'Drizzle',\n typeorm: 'TypeORM',\n sequelize: 'Sequelize',\n mongoose: 'Mongoose',\n kysely: 'Kysely',\n 'mikro-orm': 'MikroORM',\n};\n\n/** Display names for notable libraries. */\nexport const LIBRARY_NAMES: Record<string, string> = {\n 'react-query': 'React Query',\n 'tanstack-query': 'TanStack Query',\n zod: 'Zod',\n trpc: 'tRPC',\n expo: 'Expo',\n 'react-native': 'React Native',\n nextjs: 'Next.js',\n react: 'React',\n sveltekit: 'SvelteKit',\n svelte: 'Svelte',\n astro: 'Astro',\n vue: 'Vue',\n apollo: 'Apollo Client',\n urql: 'urql',\n graphql: 'GraphQL',\n 'redux-toolkit': 'Redux Toolkit',\n zustand: 'Zustand',\n jotai: 'Jotai',\n recoil: 'Recoil',\n mobx: 'MobX',\n xstate: 'XState',\n valtio: 'Valtio',\n 'react-hook-form': 'React Hook Form',\n formik: 'Formik',\n axios: 'Axios',\n 'next-auth': 'NextAuth.js',\n 'auth-js': 'Auth.js',\n clerk: 'Clerk',\n lucia: 'Lucia',\n 'date-fns': 'date-fns',\n dayjs: 'Day.js',\n luxon: 'Luxon',\n i18next: 'i18next',\n 'next-i18next': 'next-i18next',\n stripe: 'Stripe',\n 'socket.io': 'Socket.IO',\n 'testing-library': 'Testing Library',\n msw: 'MSW',\n storybook: 'Storybook',\n vite: 'Vite',\n webpack: 'webpack',\n esbuild: 'esbuild',\n rspack: 'Rspack',\n nx: 'Nx',\n lerna: 'Lerna',\n};\n\n/** Display labels for convention keys. */\nexport const CONVENTION_LABELS: Record<string, string> = {\n fileNaming: 'File naming',\n componentNaming: 'Component naming',\n hookNaming: 'Hook naming',\n importAlias: 'Import alias',\n};\n\n/** Display names for directory roles. */\nexport const ROLE_DESCRIPTIONS: Record<string, string> = {\n pages: 'Pages / Routes',\n components: 'Components',\n hooks: 'Hooks',\n utils: 'Utilities',\n types: 'Type definitions',\n tests: 'Tests',\n styles: 'Styles',\n api: 'API routes',\n config: 'Configuration',\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;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AAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,mBAAmB;AAAA,EACnB,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,aAAa;AAAA,EACb,WAAW;AAAA,EACX,OAAO;AAAA,EACP,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,OAAO;AAAA,EACP,SAAS;AAAA,EACT,gBAAgB;AAAA,EAChB,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,KAAK;AAAA,EACL,WAAW;AAAA,EACX,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,OAAO;AACT;AAGO,IAAM,oBAA4C;AAAA,EACvD,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,aAAa;AACf;AAGO,IAAM,oBAA4C;AAAA,EACvD,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,QAAQ;AACV;;;AFpHO,IAAM,UAAkB;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/confidence.ts","../src/display-names.ts"],"sourcesContent":["declare const __PACKAGE_VERSION__: string;\nexport const VERSION: string = __PACKAGE_VERSION__;\n\nexport type { BoundaryConfig, BoundaryRule, BoundaryViolation } from './boundary.js';\nexport type { CheckResult, CheckRule, CheckViolation } from './check-result.js';\nexport type { Confidence, DetectedConvention } from './confidence.js';\nexport { confidenceFromConsistency } from './confidence.js';\nexport type {\n ConfigConventions,\n ConfigCoverage,\n ConfigDefaults,\n ConfigMeta,\n ConfigRules,\n ConfigStack,\n ConfigStructure,\n ConventionMeta,\n PackageBoundary,\n PackageConfig,\n PackageMeta,\n ViberailsConfig,\n} from './config.js';\nexport {\n CONVENTION_LABELS,\n FRAMEWORK_NAMES,\n LIBRARY_NAMES,\n ORM_NAMES,\n ROLE_DESCRIPTIONS,\n STYLING_NAMES,\n} from './display-names.js';\nexport type {\n ImportEdge,\n ImportGraph,\n ImportGraphNode,\n ImportKind,\n WorkspacePackage,\n} from './graph.js';\nexport type {\n CodebaseStatistics,\n DetectedStack,\n DetectedStructure,\n DetectedWorkspace,\n DirectoryInfo,\n DirectoryRole,\n FileStatistic,\n PackageScanResult,\n ScanResult,\n StackItem,\n} from './scan-result.js';\n","/**\n * Confidence level for a detected convention or pattern.\n *\n * - `'high'` — ≥90% consistency across analyzed files. Enforced by default.\n * - `'medium'` — 70–89% consistency. Included in config but not enforced.\n * - `'low'` — <70% consistency. Omitted from config entirely.\n */\nexport type Confidence = 'high' | 'medium' | 'low';\n\n/**\n * A convention or pattern detected by the scanner, with metadata\n * about how confidently it was identified.\n *\n * @typeParam T - The type of the detected value. Defaults to `string`.\n */\nexport interface DetectedConvention<T = string> {\n /** The detected value (e.g. a naming pattern, file extension, or path). */\n value: T;\n\n /** How confident the scanner is in this detection. */\n confidence: Confidence;\n\n /** Number of files analyzed to determine this convention. */\n sampleSize: number;\n\n /** Percentage (0–100) of files that follow this convention. */\n consistency: number;\n}\n\n/**\n * Derives a confidence level from a consistency percentage.\n *\n * @param consistency - A number from 0 to 100 representing the percentage\n * of files that follow a given convention.\n * @returns The corresponding confidence level:\n * - `'high'` for consistency ≥ 90\n * - `'medium'` for consistency ≥ 70 and < 90\n * - `'low'` for consistency < 70\n */\nexport function confidenceFromConsistency(consistency: number): Confidence {\n if (consistency >= 90) return 'high';\n if (consistency >= 70) return 'medium';\n return 'low';\n}\n","/** Display names for framework identifiers. */\nexport const FRAMEWORK_NAMES: Record<string, string> = {\n nextjs: 'Next.js',\n expo: 'Expo',\n 'react-native': 'React Native',\n angular: 'Angular',\n remix: 'Remix',\n nuxt: 'Nuxt',\n sveltekit: 'SvelteKit',\n astro: 'Astro',\n gatsby: 'Gatsby',\n solidjs: 'Solid.js',\n qwik: 'Qwik',\n electron: 'Electron',\n tauri: 'Tauri',\n nestjs: 'NestJS',\n express: 'Express',\n fastify: 'Fastify',\n koa: 'Koa',\n hono: 'Hono',\n supabase: 'Supabase',\n firebase: 'Firebase',\n convex: 'Convex',\n};\n\n/** Display names for styling libraries. */\nexport const STYLING_NAMES: Record<string, string> = {\n tailwindcss: 'Tailwind CSS',\n 'css-modules': 'CSS Modules',\n 'styled-components': 'styled-components',\n emotion: 'Emotion',\n sass: 'Sass',\n 'vanilla-extract': 'Vanilla Extract',\n unocss: 'UnoCSS',\n 'panda-css': 'Panda CSS',\n nativewind: 'NativeWind',\n};\n\n/** Display names for ORM / database clients. */\nexport const ORM_NAMES: Record<string, string> = {\n prisma: 'Prisma',\n drizzle: 'Drizzle',\n typeorm: 'TypeORM',\n sequelize: 'Sequelize',\n mongoose: 'Mongoose',\n kysely: 'Kysely',\n 'mikro-orm': 'MikroORM',\n};\n\n/** Display names for notable libraries. */\nexport const LIBRARY_NAMES: Record<string, string> = {\n 'react-query': 'React Query',\n 'tanstack-query': 'TanStack Query',\n zod: 'Zod',\n trpc: 'tRPC',\n expo: 'Expo',\n 'react-native': 'React Native',\n nextjs: 'Next.js',\n react: 'React',\n sveltekit: 'SvelteKit',\n svelte: 'Svelte',\n astro: 'Astro',\n vue: 'Vue',\n apollo: 'Apollo Client',\n urql: 'urql',\n graphql: 'GraphQL',\n 'redux-toolkit': 'Redux Toolkit',\n zustand: 'Zustand',\n jotai: 'Jotai',\n recoil: 'Recoil',\n mobx: 'MobX',\n xstate: 'XState',\n valtio: 'Valtio',\n 'react-hook-form': 'React Hook Form',\n formik: 'Formik',\n axios: 'Axios',\n 'next-auth': 'NextAuth.js',\n 'auth-js': 'Auth.js',\n clerk: 'Clerk',\n lucia: 'Lucia',\n 'date-fns': 'date-fns',\n dayjs: 'Day.js',\n luxon: 'Luxon',\n i18next: 'i18next',\n 'next-i18next': 'next-i18next',\n stripe: 'Stripe',\n 'socket.io': 'Socket.IO',\n 'testing-library': 'Testing Library',\n msw: 'MSW',\n storybook: 'Storybook',\n vite: 'Vite',\n webpack: 'webpack',\n esbuild: 'esbuild',\n rspack: 'Rspack',\n nx: 'Nx',\n lerna: 'Lerna',\n};\n\n/** Display labels for convention keys. */\nexport const CONVENTION_LABELS: Record<string, string> = {\n fileNaming: 'File naming',\n componentNaming: 'Component naming',\n hookNaming: 'Hook naming',\n importAlias: 'Import alias',\n};\n\n/** Display names for directory roles. */\nexport const ROLE_DESCRIPTIONS: Record<string, string> = {\n pages: 'Pages / Routes',\n components: 'Components',\n hooks: 'Hooks',\n utils: 'Utilities',\n types: 'Type definitions',\n tests: 'Tests',\n styles: 'Styles',\n api: 'API routes',\n config: 'Configuration',\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACuCO,SAAS,0BAA0B,aAAiC;AACzE,MAAI,eAAe,GAAI,QAAO;AAC9B,MAAI,eAAe,GAAI,QAAO;AAC9B,SAAO;AACT;;;AC1CO,IAAM,kBAA0C;AAAA,EACrD,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,UAAU;AAAA,EACV,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,KAAK;AAAA,EACL,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AAAA,EACV,QAAQ;AACV;AAGO,IAAM,gBAAwC;AAAA,EACnD,aAAa;AAAA,EACb,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,SAAS;AAAA,EACT,MAAM;AAAA,EACN,mBAAmB;AAAA,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ACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,QAAQ;AACV;;;AFpHO,IAAM,UAAkB;","names":[]}
package/dist/index.d.cts CHANGED
@@ -32,7 +32,7 @@ interface BoundaryViolation {
32
32
  /**
33
33
  * The type of rule that was violated.
34
34
  */
35
- type CheckRule = 'file-size' | 'file-naming' | 'missing-test' | 'boundary-violation';
35
+ type CheckRule = 'file-size' | 'file-naming' | 'missing-test' | 'test-coverage' | 'boundary-violation';
36
36
  /**
37
37
  * A single rule violation detected by `viberails check`.
38
38
  */
@@ -43,7 +43,7 @@ interface CheckViolation {
43
43
  rule: CheckRule;
44
44
  /** Human-readable description of the violation. */
45
45
  message: string;
46
- /** Severity derived from config.enforcement. */
46
+ /** Severity derived from CLI mode (warn vs enforce). */
47
47
  severity: 'error' | 'warn';
48
48
  }
49
49
  /**
@@ -54,8 +54,6 @@ interface CheckResult {
54
54
  violations: CheckViolation[];
55
55
  /** Number of files that were checked. */
56
56
  checkedFiles: number;
57
- /** The enforcement mode from config. */
58
- enforcement: 'enforce' | 'warn';
59
57
  }
60
58
 
61
59
  /**
@@ -101,55 +99,113 @@ declare function confidenceFromConsistency(consistency: number): Confidence;
101
99
  interface ViberailsConfig {
102
100
  /** JSON Schema URL for editor validation. */
103
101
  $schema?: string;
104
- /** Config format version. Always `1` for V1.0. */
102
+ /** Config format version. Always `1`. */
105
103
  version: number;
106
104
  /** Project name, typically from package.json. */
107
105
  name: string;
108
- /** Whether conventions are warned about or enforced as errors. */
109
- enforcement: 'warn' | 'enforce';
110
- /** Detected or configured technology stack. */
111
- stack: ConfigStack;
112
- /** Detected or configured directory structure. */
113
- structure: ConfigStructure;
114
- /** Detected or configured coding conventions. */
115
- conventions: ConfigConventions;
116
106
  /** Rule thresholds and toggles for enforcement. */
117
107
  rules: ConfigRules;
118
- /** Glob patterns for files and directories to ignore. */
119
- ignore: string[];
108
+ /** Glob patterns for files and directories to ignore. Project-specific only. */
109
+ ignore?: string[];
120
110
  /** Module boundary rules for import enforcement. */
121
111
  boundaries?: BoundaryConfig;
122
- /** Workspace configuration for monorepo support (V1.1+). */
123
- workspace?: WorkspaceConfig;
124
- /** Per-package overrides for monorepo projects. Only packages that differ from global. */
125
- packages?: PackageConfigOverrides[];
112
+ /**
113
+ * Shared defaults for all packages. Packages inherit these values
114
+ * and can override any field. Only present when packages share common config.
115
+ * Written by compactConfig(), consumed by expandDefaults() on load.
116
+ */
117
+ defaults?: ConfigDefaults;
118
+ /**
119
+ * Per-package configs. Required — single projects use `path: "."`.
120
+ * After loading, each package is self-contained (expandDefaults merges defaults in).
121
+ * On disk, stack/structure/conventions may be omitted when covered by defaults.
122
+ */
123
+ packages: PackageConfig[];
124
+ /** Scanner metadata. Regenerated on every sync — not user-editable. */
125
+ _meta?: ConfigMeta;
126
126
  }
127
127
  /**
128
- * Per-package configuration overrides for monorepo projects.
129
- * Only fields that differ from the global config are included.
128
+ * Per-package configuration.
129
+ * Self-contained after loading: stack, structure, and conventions are fully populated.
130
+ * On disk, these fields are optional — expandDefaults fills them from defaults.
130
131
  */
131
- interface PackageConfigOverrides {
132
+ interface PackageConfig {
132
133
  /** Package name from package.json. */
133
134
  name: string;
134
- /** Relative path to the package (e.g. "apps/web"). */
135
+ /** Relative path to the package (e.g. "apps/web", "." for root). */
135
136
  path: string;
136
- /** Override stack fields (only differences from global). */
137
- stack?: Partial<ConfigStack>;
138
- /** Override conventions (only differences from global). */
139
- conventions?: Partial<ConfigConventions>;
140
- /** Override rules (only differences from global). */
137
+ /** Technology stack for this package. Optional on disk, filled by expandDefaults. */
138
+ stack?: ConfigStack;
139
+ /** Directory structure for this package. Optional on disk, filled by expandDefaults. */
140
+ structure?: ConfigStructure;
141
+ /** Coding conventions for this package. Optional on disk, filled by expandDefaults. */
142
+ conventions?: ConfigConventions;
143
+ /** Override rules for this package (only differences from global). */
141
144
  rules?: Partial<ConfigRules>;
145
+ /** Coverage command/path overrides for this package. */
146
+ coverage?: ConfigCoverage;
142
147
  /** Additional ignore patterns for this package (appended to global). */
143
148
  ignore?: string[];
149
+ /** Per-package boundary rules. */
150
+ boundaries?: PackageBoundary;
151
+ }
152
+ /**
153
+ * Per-package boundary declaration.
154
+ */
155
+ interface PackageBoundary {
156
+ /** Packages/modules this package must NOT import from. */
157
+ deny: string[];
158
+ /** Files exempt from boundary checks. */
159
+ ignore?: string[];
160
+ }
161
+ /**
162
+ * Shared default values for all packages. Packages inherit from these
163
+ * and override specific fields. Keeps config DRY when packages share tooling.
164
+ */
165
+ interface ConfigDefaults {
166
+ /** Default technology stack, inherited by all packages. */
167
+ stack?: Partial<ConfigStack>;
168
+ /** Default directory structure, inherited by all packages. */
169
+ structure?: Partial<ConfigStructure>;
170
+ /** Default coding conventions, inherited by all packages. */
171
+ conventions?: ConfigConventions;
172
+ /** Default coverage command/path inherited by all packages. */
173
+ coverage?: ConfigCoverage;
144
174
  }
145
175
  /**
146
- * Workspace configuration for monorepo projects.
176
+ * Coverage collection configuration.
177
+ * If omitted, viberails falls back to supported test runner defaults.
147
178
  */
148
- interface WorkspaceConfig {
149
- /** Relative paths to workspace packages (e.g. `"packages/scanner"`). */
150
- packages: string[];
151
- /** Whether this project is a monorepo with multiple packages. */
152
- isMonorepo: boolean;
179
+ interface ConfigCoverage {
180
+ /** Command used to generate coverage summary data. */
181
+ command?: string;
182
+ /** Relative path to coverage summary JSON (from package root). */
183
+ summaryPath?: string;
184
+ }
185
+ /**
186
+ * Scanner metadata, separated from user-editable config.
187
+ * Regenerated on every `sync`. Never manually edited.
188
+ */
189
+ interface ConfigMeta {
190
+ /** ISO timestamp of the last sync. */
191
+ lastSync?: string;
192
+ /** Per-package scanner metadata, keyed by package path. */
193
+ packages?: Record<string, PackageMeta>;
194
+ }
195
+ /** Scanner metadata for a single convention. */
196
+ interface ConventionMeta {
197
+ /** The value detected by the scanner (e.g. "kebab-case"). */
198
+ value: string;
199
+ /** Scanner confidence level. */
200
+ confidence: Confidence;
201
+ /** Consistency percentage (0-100). */
202
+ consistency: number;
203
+ /** Set when a convention is newly detected during sync. */
204
+ detected?: boolean;
205
+ }
206
+ /** Scanner metadata for a package. */
207
+ interface PackageMeta {
208
+ conventions?: Record<string, ConventionMeta>;
153
209
  }
154
210
  /**
155
211
  * Technology stack configuration. Each field is a string identifier,
@@ -177,7 +233,7 @@ interface ConfigStack {
177
233
  }
178
234
  /**
179
235
  * Directory structure configuration. Each field is a path relative
180
- * to the project root.
236
+ * to the package root.
181
237
  */
182
238
  interface ConfigStructure {
183
239
  /** Source directory (e.g. `"src"`), or undefined for flat structure. */
@@ -198,33 +254,18 @@ interface ConfigStructure {
198
254
  testPattern?: string;
199
255
  }
200
256
  /**
201
- * A convention value that may carry scanner metadata.
202
- * When generated from a scan, includes confidence and consistency info.
203
- * When manually set, is just a plain string.
204
- */
205
- type ConventionValue = string | {
206
- /** The convention value. */
207
- value: string;
208
- /** Scanner confidence level. Prefixed with `_` to signal metadata. */
209
- _confidence: Confidence;
210
- /** Scanner consistency percentage. Prefixed with `_` to signal metadata. */
211
- _consistency: number;
212
- /** Set by mergeConfig when a convention is newly detected during sync. */
213
- _detected?: boolean;
214
- };
215
- /**
216
- * Coding convention configuration. Each field can be a plain string
217
- * (confirmed by user) or an object with scanner metadata (auto-detected).
257
+ * Coding convention configuration. Plain strings only.
258
+ * Scanner metadata lives in `_meta.packages[path].conventions`.
218
259
  */
219
260
  interface ConfigConventions {
220
261
  /** File naming convention (e.g. `"kebab-case"`, `"camelCase"`). */
221
- fileNaming?: ConventionValue;
262
+ fileNaming?: string;
222
263
  /** Component naming convention (e.g. `"PascalCase"`). */
223
- componentNaming?: ConventionValue;
264
+ componentNaming?: string;
224
265
  /** Hook naming convention (e.g. `"useXxx"`). */
225
- hookNaming?: ConventionValue;
266
+ hookNaming?: string;
226
267
  /** Import alias pattern (e.g. `"@/*"`, `"~/*"`). */
227
- importAlias?: ConventionValue;
268
+ importAlias?: string;
228
269
  }
229
270
  /**
230
271
  * Rule thresholds and toggles for convention enforcement.
@@ -242,15 +283,11 @@ interface ConfigRules {
242
283
  */
243
284
  maxTestFileLines: number;
244
285
  /**
245
- * Maximum number of lines allowed per function.
246
- * @default 50
247
- */
248
- maxFunctionLines: number;
249
- /**
250
- * Whether to require test files for source modules.
251
- * @default true
286
+ * Minimum line coverage target percentage.
287
+ * 0 disables coverage threshold checks.
288
+ * @default 80
252
289
  */
253
- requireTests: boolean;
290
+ testCoverage: number;
254
291
  /**
255
292
  * Whether to enforce detected file naming conventions.
256
293
  * @default true
@@ -258,9 +295,14 @@ interface ConfigRules {
258
295
  enforceNaming: boolean;
259
296
  /**
260
297
  * Whether to enforce module boundary rules.
261
- * @default false (V1.1+ feature)
298
+ * @default false
262
299
  */
263
300
  enforceBoundaries: boolean;
301
+ /**
302
+ * Whether to enforce that every source file has a corresponding test file.
303
+ * @default true
304
+ */
305
+ enforceMissingTests: boolean;
264
306
  }
265
307
 
266
308
  /** Display names for framework identifiers. */
@@ -368,6 +410,8 @@ interface PackageScanResult {
368
410
  conventions: Record<string, DetectedConvention>;
369
411
  /** Quantitative statistics for this package. */
370
412
  statistics: CodebaseStatistics;
413
+ /** Whether this package appears to be types-only (no runtime dependencies). */
414
+ typesOnly?: boolean;
371
415
  }
372
416
  /**
373
417
  * Workspace information detected by scanning the project root
@@ -469,4 +513,4 @@ interface FileStatistic {
469
513
 
470
514
  declare const VERSION: string;
471
515
 
472
- export { type BoundaryConfig, type BoundaryRule, type BoundaryViolation, CONVENTION_LABELS, type CheckResult, type CheckRule, type CheckViolation, type CodebaseStatistics, type Confidence, type ConfigConventions, type ConfigRules, type ConfigStack, type ConfigStructure, type ConventionValue, type DetectedConvention, type DetectedStack, type DetectedStructure, type DetectedWorkspace, type DirectoryInfo, type DirectoryRole, FRAMEWORK_NAMES, type FileStatistic, type ImportEdge, type ImportGraph, type ImportGraphNode, type ImportKind, LIBRARY_NAMES, ORM_NAMES, type PackageConfigOverrides, type PackageScanResult, ROLE_DESCRIPTIONS, STYLING_NAMES, type ScanResult, type StackItem, VERSION, type ViberailsConfig, type WorkspaceConfig, type WorkspacePackage, confidenceFromConsistency };
516
+ export { type BoundaryConfig, type BoundaryRule, type BoundaryViolation, CONVENTION_LABELS, type CheckResult, type CheckRule, type CheckViolation, type CodebaseStatistics, type Confidence, type ConfigConventions, type ConfigCoverage, type ConfigDefaults, type ConfigMeta, type ConfigRules, type ConfigStack, type ConfigStructure, type ConventionMeta, type DetectedConvention, type DetectedStack, type DetectedStructure, type DetectedWorkspace, type DirectoryInfo, type DirectoryRole, FRAMEWORK_NAMES, type FileStatistic, type ImportEdge, type ImportGraph, type ImportGraphNode, type ImportKind, LIBRARY_NAMES, ORM_NAMES, type PackageBoundary, type PackageConfig, type PackageMeta, type PackageScanResult, ROLE_DESCRIPTIONS, STYLING_NAMES, type ScanResult, type StackItem, VERSION, type ViberailsConfig, type WorkspacePackage, confidenceFromConsistency };
package/dist/index.d.ts CHANGED
@@ -32,7 +32,7 @@ interface BoundaryViolation {
32
32
  /**
33
33
  * The type of rule that was violated.
34
34
  */
35
- type CheckRule = 'file-size' | 'file-naming' | 'missing-test' | 'boundary-violation';
35
+ type CheckRule = 'file-size' | 'file-naming' | 'missing-test' | 'test-coverage' | 'boundary-violation';
36
36
  /**
37
37
  * A single rule violation detected by `viberails check`.
38
38
  */
@@ -43,7 +43,7 @@ interface CheckViolation {
43
43
  rule: CheckRule;
44
44
  /** Human-readable description of the violation. */
45
45
  message: string;
46
- /** Severity derived from config.enforcement. */
46
+ /** Severity derived from CLI mode (warn vs enforce). */
47
47
  severity: 'error' | 'warn';
48
48
  }
49
49
  /**
@@ -54,8 +54,6 @@ interface CheckResult {
54
54
  violations: CheckViolation[];
55
55
  /** Number of files that were checked. */
56
56
  checkedFiles: number;
57
- /** The enforcement mode from config. */
58
- enforcement: 'enforce' | 'warn';
59
57
  }
60
58
 
61
59
  /**
@@ -101,55 +99,113 @@ declare function confidenceFromConsistency(consistency: number): Confidence;
101
99
  interface ViberailsConfig {
102
100
  /** JSON Schema URL for editor validation. */
103
101
  $schema?: string;
104
- /** Config format version. Always `1` for V1.0. */
102
+ /** Config format version. Always `1`. */
105
103
  version: number;
106
104
  /** Project name, typically from package.json. */
107
105
  name: string;
108
- /** Whether conventions are warned about or enforced as errors. */
109
- enforcement: 'warn' | 'enforce';
110
- /** Detected or configured technology stack. */
111
- stack: ConfigStack;
112
- /** Detected or configured directory structure. */
113
- structure: ConfigStructure;
114
- /** Detected or configured coding conventions. */
115
- conventions: ConfigConventions;
116
106
  /** Rule thresholds and toggles for enforcement. */
117
107
  rules: ConfigRules;
118
- /** Glob patterns for files and directories to ignore. */
119
- ignore: string[];
108
+ /** Glob patterns for files and directories to ignore. Project-specific only. */
109
+ ignore?: string[];
120
110
  /** Module boundary rules for import enforcement. */
121
111
  boundaries?: BoundaryConfig;
122
- /** Workspace configuration for monorepo support (V1.1+). */
123
- workspace?: WorkspaceConfig;
124
- /** Per-package overrides for monorepo projects. Only packages that differ from global. */
125
- packages?: PackageConfigOverrides[];
112
+ /**
113
+ * Shared defaults for all packages. Packages inherit these values
114
+ * and can override any field. Only present when packages share common config.
115
+ * Written by compactConfig(), consumed by expandDefaults() on load.
116
+ */
117
+ defaults?: ConfigDefaults;
118
+ /**
119
+ * Per-package configs. Required — single projects use `path: "."`.
120
+ * After loading, each package is self-contained (expandDefaults merges defaults in).
121
+ * On disk, stack/structure/conventions may be omitted when covered by defaults.
122
+ */
123
+ packages: PackageConfig[];
124
+ /** Scanner metadata. Regenerated on every sync — not user-editable. */
125
+ _meta?: ConfigMeta;
126
126
  }
127
127
  /**
128
- * Per-package configuration overrides for monorepo projects.
129
- * Only fields that differ from the global config are included.
128
+ * Per-package configuration.
129
+ * Self-contained after loading: stack, structure, and conventions are fully populated.
130
+ * On disk, these fields are optional — expandDefaults fills them from defaults.
130
131
  */
131
- interface PackageConfigOverrides {
132
+ interface PackageConfig {
132
133
  /** Package name from package.json. */
133
134
  name: string;
134
- /** Relative path to the package (e.g. "apps/web"). */
135
+ /** Relative path to the package (e.g. "apps/web", "." for root). */
135
136
  path: string;
136
- /** Override stack fields (only differences from global). */
137
- stack?: Partial<ConfigStack>;
138
- /** Override conventions (only differences from global). */
139
- conventions?: Partial<ConfigConventions>;
140
- /** Override rules (only differences from global). */
137
+ /** Technology stack for this package. Optional on disk, filled by expandDefaults. */
138
+ stack?: ConfigStack;
139
+ /** Directory structure for this package. Optional on disk, filled by expandDefaults. */
140
+ structure?: ConfigStructure;
141
+ /** Coding conventions for this package. Optional on disk, filled by expandDefaults. */
142
+ conventions?: ConfigConventions;
143
+ /** Override rules for this package (only differences from global). */
141
144
  rules?: Partial<ConfigRules>;
145
+ /** Coverage command/path overrides for this package. */
146
+ coverage?: ConfigCoverage;
142
147
  /** Additional ignore patterns for this package (appended to global). */
143
148
  ignore?: string[];
149
+ /** Per-package boundary rules. */
150
+ boundaries?: PackageBoundary;
151
+ }
152
+ /**
153
+ * Per-package boundary declaration.
154
+ */
155
+ interface PackageBoundary {
156
+ /** Packages/modules this package must NOT import from. */
157
+ deny: string[];
158
+ /** Files exempt from boundary checks. */
159
+ ignore?: string[];
160
+ }
161
+ /**
162
+ * Shared default values for all packages. Packages inherit from these
163
+ * and override specific fields. Keeps config DRY when packages share tooling.
164
+ */
165
+ interface ConfigDefaults {
166
+ /** Default technology stack, inherited by all packages. */
167
+ stack?: Partial<ConfigStack>;
168
+ /** Default directory structure, inherited by all packages. */
169
+ structure?: Partial<ConfigStructure>;
170
+ /** Default coding conventions, inherited by all packages. */
171
+ conventions?: ConfigConventions;
172
+ /** Default coverage command/path inherited by all packages. */
173
+ coverage?: ConfigCoverage;
144
174
  }
145
175
  /**
146
- * Workspace configuration for monorepo projects.
176
+ * Coverage collection configuration.
177
+ * If omitted, viberails falls back to supported test runner defaults.
147
178
  */
148
- interface WorkspaceConfig {
149
- /** Relative paths to workspace packages (e.g. `"packages/scanner"`). */
150
- packages: string[];
151
- /** Whether this project is a monorepo with multiple packages. */
152
- isMonorepo: boolean;
179
+ interface ConfigCoverage {
180
+ /** Command used to generate coverage summary data. */
181
+ command?: string;
182
+ /** Relative path to coverage summary JSON (from package root). */
183
+ summaryPath?: string;
184
+ }
185
+ /**
186
+ * Scanner metadata, separated from user-editable config.
187
+ * Regenerated on every `sync`. Never manually edited.
188
+ */
189
+ interface ConfigMeta {
190
+ /** ISO timestamp of the last sync. */
191
+ lastSync?: string;
192
+ /** Per-package scanner metadata, keyed by package path. */
193
+ packages?: Record<string, PackageMeta>;
194
+ }
195
+ /** Scanner metadata for a single convention. */
196
+ interface ConventionMeta {
197
+ /** The value detected by the scanner (e.g. "kebab-case"). */
198
+ value: string;
199
+ /** Scanner confidence level. */
200
+ confidence: Confidence;
201
+ /** Consistency percentage (0-100). */
202
+ consistency: number;
203
+ /** Set when a convention is newly detected during sync. */
204
+ detected?: boolean;
205
+ }
206
+ /** Scanner metadata for a package. */
207
+ interface PackageMeta {
208
+ conventions?: Record<string, ConventionMeta>;
153
209
  }
154
210
  /**
155
211
  * Technology stack configuration. Each field is a string identifier,
@@ -177,7 +233,7 @@ interface ConfigStack {
177
233
  }
178
234
  /**
179
235
  * Directory structure configuration. Each field is a path relative
180
- * to the project root.
236
+ * to the package root.
181
237
  */
182
238
  interface ConfigStructure {
183
239
  /** Source directory (e.g. `"src"`), or undefined for flat structure. */
@@ -198,33 +254,18 @@ interface ConfigStructure {
198
254
  testPattern?: string;
199
255
  }
200
256
  /**
201
- * A convention value that may carry scanner metadata.
202
- * When generated from a scan, includes confidence and consistency info.
203
- * When manually set, is just a plain string.
204
- */
205
- type ConventionValue = string | {
206
- /** The convention value. */
207
- value: string;
208
- /** Scanner confidence level. Prefixed with `_` to signal metadata. */
209
- _confidence: Confidence;
210
- /** Scanner consistency percentage. Prefixed with `_` to signal metadata. */
211
- _consistency: number;
212
- /** Set by mergeConfig when a convention is newly detected during sync. */
213
- _detected?: boolean;
214
- };
215
- /**
216
- * Coding convention configuration. Each field can be a plain string
217
- * (confirmed by user) or an object with scanner metadata (auto-detected).
257
+ * Coding convention configuration. Plain strings only.
258
+ * Scanner metadata lives in `_meta.packages[path].conventions`.
218
259
  */
219
260
  interface ConfigConventions {
220
261
  /** File naming convention (e.g. `"kebab-case"`, `"camelCase"`). */
221
- fileNaming?: ConventionValue;
262
+ fileNaming?: string;
222
263
  /** Component naming convention (e.g. `"PascalCase"`). */
223
- componentNaming?: ConventionValue;
264
+ componentNaming?: string;
224
265
  /** Hook naming convention (e.g. `"useXxx"`). */
225
- hookNaming?: ConventionValue;
266
+ hookNaming?: string;
226
267
  /** Import alias pattern (e.g. `"@/*"`, `"~/*"`). */
227
- importAlias?: ConventionValue;
268
+ importAlias?: string;
228
269
  }
229
270
  /**
230
271
  * Rule thresholds and toggles for convention enforcement.
@@ -242,15 +283,11 @@ interface ConfigRules {
242
283
  */
243
284
  maxTestFileLines: number;
244
285
  /**
245
- * Maximum number of lines allowed per function.
246
- * @default 50
247
- */
248
- maxFunctionLines: number;
249
- /**
250
- * Whether to require test files for source modules.
251
- * @default true
286
+ * Minimum line coverage target percentage.
287
+ * 0 disables coverage threshold checks.
288
+ * @default 80
252
289
  */
253
- requireTests: boolean;
290
+ testCoverage: number;
254
291
  /**
255
292
  * Whether to enforce detected file naming conventions.
256
293
  * @default true
@@ -258,9 +295,14 @@ interface ConfigRules {
258
295
  enforceNaming: boolean;
259
296
  /**
260
297
  * Whether to enforce module boundary rules.
261
- * @default false (V1.1+ feature)
298
+ * @default false
262
299
  */
263
300
  enforceBoundaries: boolean;
301
+ /**
302
+ * Whether to enforce that every source file has a corresponding test file.
303
+ * @default true
304
+ */
305
+ enforceMissingTests: boolean;
264
306
  }
265
307
 
266
308
  /** Display names for framework identifiers. */
@@ -368,6 +410,8 @@ interface PackageScanResult {
368
410
  conventions: Record<string, DetectedConvention>;
369
411
  /** Quantitative statistics for this package. */
370
412
  statistics: CodebaseStatistics;
413
+ /** Whether this package appears to be types-only (no runtime dependencies). */
414
+ typesOnly?: boolean;
371
415
  }
372
416
  /**
373
417
  * Workspace information detected by scanning the project root
@@ -469,4 +513,4 @@ interface FileStatistic {
469
513
 
470
514
  declare const VERSION: string;
471
515
 
472
- export { type BoundaryConfig, type BoundaryRule, type BoundaryViolation, CONVENTION_LABELS, type CheckResult, type CheckRule, type CheckViolation, type CodebaseStatistics, type Confidence, type ConfigConventions, type ConfigRules, type ConfigStack, type ConfigStructure, type ConventionValue, type DetectedConvention, type DetectedStack, type DetectedStructure, type DetectedWorkspace, type DirectoryInfo, type DirectoryRole, FRAMEWORK_NAMES, type FileStatistic, type ImportEdge, type ImportGraph, type ImportGraphNode, type ImportKind, LIBRARY_NAMES, ORM_NAMES, type PackageConfigOverrides, type PackageScanResult, ROLE_DESCRIPTIONS, STYLING_NAMES, type ScanResult, type StackItem, VERSION, type ViberailsConfig, type WorkspaceConfig, type WorkspacePackage, confidenceFromConsistency };
516
+ export { type BoundaryConfig, type BoundaryRule, type BoundaryViolation, CONVENTION_LABELS, type CheckResult, type CheckRule, type CheckViolation, type CodebaseStatistics, type Confidence, type ConfigConventions, type ConfigCoverage, type ConfigDefaults, type ConfigMeta, type ConfigRules, type ConfigStack, type ConfigStructure, type ConventionMeta, type DetectedConvention, type DetectedStack, type DetectedStructure, type DetectedWorkspace, type DirectoryInfo, type DirectoryRole, FRAMEWORK_NAMES, type FileStatistic, type ImportEdge, type ImportGraph, type ImportGraphNode, type ImportKind, LIBRARY_NAMES, ORM_NAMES, type PackageBoundary, type PackageConfig, type PackageMeta, type PackageScanResult, ROLE_DESCRIPTIONS, STYLING_NAMES, type ScanResult, type StackItem, VERSION, type ViberailsConfig, type WorkspacePackage, confidenceFromConsistency };
package/dist/index.js CHANGED
@@ -115,7 +115,7 @@ var ROLE_DESCRIPTIONS = {
115
115
  };
116
116
 
117
117
  // src/index.ts
118
- var VERSION = "0.4.0";
118
+ var VERSION = "0.5.1";
119
119
  export {
120
120
  CONVENTION_LABELS,
121
121
  FRAMEWORK_NAMES,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/confidence.ts","../src/display-names.ts","../src/index.ts"],"sourcesContent":["/**\n * Confidence level for a detected convention or pattern.\n *\n * - `'high'` — ≥90% consistency across analyzed files. Enforced by default.\n * - `'medium'` — 70–89% consistency. Included in config but not enforced.\n * - `'low'` — <70% consistency. Omitted from config entirely.\n */\nexport type Confidence = 'high' | 'medium' | 'low';\n\n/**\n * A convention or pattern detected by the scanner, with metadata\n * about how confidently it was identified.\n *\n * @typeParam T - The type of the detected value. Defaults to `string`.\n */\nexport interface DetectedConvention<T = string> {\n /** The detected value (e.g. a naming pattern, file extension, or path). */\n value: T;\n\n /** How confident the scanner is in this detection. */\n confidence: Confidence;\n\n /** Number of files analyzed to determine this convention. */\n sampleSize: number;\n\n /** Percentage (0–100) of files that follow this convention. */\n consistency: number;\n}\n\n/**\n * Derives a confidence level from a consistency percentage.\n *\n * @param consistency - A number from 0 to 100 representing the percentage\n * of files that follow a given convention.\n * @returns The corresponding confidence level:\n * - `'high'` for consistency ≥ 90\n * - `'medium'` for consistency ≥ 70 and < 90\n * - `'low'` for consistency < 70\n */\nexport function confidenceFromConsistency(consistency: number): Confidence {\n if (consistency >= 90) return 'high';\n if (consistency >= 70) return 'medium';\n return 'low';\n}\n","/** Display names for framework identifiers. */\nexport const FRAMEWORK_NAMES: Record<string, string> = {\n nextjs: 'Next.js',\n expo: 'Expo',\n 'react-native': 'React Native',\n angular: 'Angular',\n remix: 'Remix',\n nuxt: 'Nuxt',\n sveltekit: 'SvelteKit',\n astro: 'Astro',\n gatsby: 'Gatsby',\n solidjs: 'Solid.js',\n qwik: 'Qwik',\n electron: 'Electron',\n tauri: 'Tauri',\n nestjs: 'NestJS',\n express: 'Express',\n fastify: 'Fastify',\n koa: 'Koa',\n hono: 'Hono',\n supabase: 'Supabase',\n firebase: 'Firebase',\n convex: 'Convex',\n};\n\n/** Display names for styling libraries. */\nexport const STYLING_NAMES: Record<string, string> = {\n tailwindcss: 'Tailwind CSS',\n 'css-modules': 'CSS Modules',\n 'styled-components': 'styled-components',\n emotion: 'Emotion',\n sass: 'Sass',\n 'vanilla-extract': 'Vanilla Extract',\n unocss: 'UnoCSS',\n 'panda-css': 'Panda CSS',\n nativewind: 'NativeWind',\n};\n\n/** Display names for ORM / database clients. */\nexport const ORM_NAMES: Record<string, string> = {\n prisma: 'Prisma',\n drizzle: 'Drizzle',\n typeorm: 'TypeORM',\n sequelize: 'Sequelize',\n mongoose: 'Mongoose',\n kysely: 'Kysely',\n 'mikro-orm': 'MikroORM',\n};\n\n/** Display names for notable libraries. */\nexport const LIBRARY_NAMES: Record<string, string> = {\n 'react-query': 'React Query',\n 'tanstack-query': 'TanStack Query',\n zod: 'Zod',\n trpc: 'tRPC',\n expo: 'Expo',\n 'react-native': 'React Native',\n nextjs: 'Next.js',\n react: 'React',\n sveltekit: 'SvelteKit',\n svelte: 'Svelte',\n astro: 'Astro',\n vue: 'Vue',\n apollo: 'Apollo Client',\n urql: 'urql',\n graphql: 'GraphQL',\n 'redux-toolkit': 'Redux Toolkit',\n zustand: 'Zustand',\n jotai: 'Jotai',\n recoil: 'Recoil',\n mobx: 'MobX',\n xstate: 'XState',\n valtio: 'Valtio',\n 'react-hook-form': 'React Hook Form',\n formik: 'Formik',\n axios: 'Axios',\n 'next-auth': 'NextAuth.js',\n 'auth-js': 'Auth.js',\n clerk: 'Clerk',\n lucia: 'Lucia',\n 'date-fns': 'date-fns',\n dayjs: 'Day.js',\n luxon: 'Luxon',\n i18next: 'i18next',\n 'next-i18next': 'next-i18next',\n stripe: 'Stripe',\n 'socket.io': 'Socket.IO',\n 'testing-library': 'Testing Library',\n msw: 'MSW',\n storybook: 'Storybook',\n vite: 'Vite',\n webpack: 'webpack',\n esbuild: 'esbuild',\n rspack: 'Rspack',\n nx: 'Nx',\n lerna: 'Lerna',\n};\n\n/** Display labels for convention keys. */\nexport const CONVENTION_LABELS: Record<string, string> = {\n fileNaming: 'File naming',\n componentNaming: 'Component naming',\n hookNaming: 'Hook naming',\n importAlias: 'Import alias',\n};\n\n/** Display names for directory roles. */\nexport const ROLE_DESCRIPTIONS: Record<string, string> = {\n pages: 'Pages / Routes',\n components: 'Components',\n hooks: 'Hooks',\n utils: 'Utilities',\n types: 'Type definitions',\n tests: 'Tests',\n styles: 'Styles',\n api: 'API routes',\n config: 'Configuration',\n};\n","declare const __PACKAGE_VERSION__: string;\nexport const VERSION: string = __PACKAGE_VERSION__;\n\nexport type { BoundaryConfig, BoundaryRule, BoundaryViolation } from './boundary.js';\nexport type { CheckResult, CheckRule, CheckViolation } from './check-result.js';\nexport type { Confidence, DetectedConvention } from './confidence.js';\nexport { confidenceFromConsistency } from './confidence.js';\nexport type {\n ConfigConventions,\n ConfigRules,\n ConfigStack,\n ConfigStructure,\n ConventionValue,\n PackageConfigOverrides,\n ViberailsConfig,\n WorkspaceConfig,\n} from './config.js';\nexport {\n CONVENTION_LABELS,\n FRAMEWORK_NAMES,\n LIBRARY_NAMES,\n ORM_NAMES,\n ROLE_DESCRIPTIONS,\n STYLING_NAMES,\n} from './display-names.js';\nexport type {\n ImportEdge,\n ImportGraph,\n ImportGraphNode,\n ImportKind,\n WorkspacePackage,\n} from './graph.js';\nexport type {\n CodebaseStatistics,\n DetectedStack,\n DetectedStructure,\n DetectedWorkspace,\n DirectoryInfo,\n DirectoryRole,\n FileStatistic,\n PackageScanResult,\n ScanResult,\n StackItem,\n} from './scan-result.js';\n"],"mappings":";AAuCO,SAAS,0BAA0B,aAAiC;AACzE,MAAI,eAAe,GAAI,QAAO;AAC9B,MAAI,eAAe,GAAI,QAAO;AAC9B,SAAO;AACT;;;AC1CO,IAAM,kBAA0C;AAAA,EACrD,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,UAAU;AAAA,EACV,OAAO;AAAA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AAAA,EACT,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,OAAO;AACT;AAGO,IAAM,oBAA4C;AAAA,EACvD,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,aAAa;AACf;AAGO,IAAM,oBAA4C;AAAA,EACvD,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,QAAQ;AACV;;;ACpHO,IAAM,UAAkB;","names":[]}
1
+ {"version":3,"sources":["../src/confidence.ts","../src/display-names.ts","../src/index.ts"],"sourcesContent":["/**\n * Confidence level for a detected convention or pattern.\n *\n * - `'high'` — ≥90% consistency across analyzed files. Enforced by default.\n * - `'medium'` — 70–89% consistency. Included in config but not enforced.\n * - `'low'` — <70% consistency. Omitted from config entirely.\n */\nexport type Confidence = 'high' | 'medium' | 'low';\n\n/**\n * A convention or pattern detected by the scanner, with metadata\n * about how confidently it was identified.\n *\n * @typeParam T - The type of the detected value. Defaults to `string`.\n */\nexport interface DetectedConvention<T = string> {\n /** The detected value (e.g. a naming pattern, file extension, or path). */\n value: T;\n\n /** How confident the scanner is in this detection. */\n confidence: Confidence;\n\n /** Number of files analyzed to determine this convention. */\n sampleSize: number;\n\n /** Percentage (0–100) of files that follow this convention. */\n consistency: number;\n}\n\n/**\n * Derives a confidence level from a consistency percentage.\n *\n * @param consistency - A number from 0 to 100 representing the percentage\n * of files that follow a given convention.\n * @returns The corresponding confidence level:\n * - `'high'` for consistency ≥ 90\n * - `'medium'` for consistency ≥ 70 and < 90\n * - `'low'` for consistency < 70\n */\nexport function confidenceFromConsistency(consistency: number): Confidence {\n if (consistency >= 90) return 'high';\n if (consistency >= 70) return 'medium';\n return 'low';\n}\n","/** Display names for framework identifiers. */\nexport const FRAMEWORK_NAMES: Record<string, string> = {\n nextjs: 'Next.js',\n expo: 'Expo',\n 'react-native': 'React Native',\n angular: 'Angular',\n remix: 'Remix',\n nuxt: 'Nuxt',\n sveltekit: 'SvelteKit',\n astro: 'Astro',\n gatsby: 'Gatsby',\n solidjs: 'Solid.js',\n qwik: 'Qwik',\n electron: 'Electron',\n tauri: 'Tauri',\n nestjs: 'NestJS',\n express: 'Express',\n fastify: 'Fastify',\n koa: 'Koa',\n hono: 'Hono',\n supabase: 'Supabase',\n firebase: 'Firebase',\n convex: 'Convex',\n};\n\n/** Display names for styling libraries. */\nexport const STYLING_NAMES: Record<string, string> = {\n tailwindcss: 'Tailwind CSS',\n 'css-modules': 'CSS Modules',\n 'styled-components': 'styled-components',\n emotion: 'Emotion',\n sass: 'Sass',\n 'vanilla-extract': 'Vanilla Extract',\n unocss: 'UnoCSS',\n 'panda-css': 'Panda CSS',\n nativewind: 'NativeWind',\n};\n\n/** Display names for ORM / database clients. */\nexport const ORM_NAMES: Record<string, string> = {\n prisma: 'Prisma',\n drizzle: 'Drizzle',\n typeorm: 'TypeORM',\n sequelize: 'Sequelize',\n mongoose: 'Mongoose',\n kysely: 'Kysely',\n 'mikro-orm': 'MikroORM',\n};\n\n/** Display names for notable libraries. */\nexport const LIBRARY_NAMES: Record<string, string> = {\n 'react-query': 'React Query',\n 'tanstack-query': 'TanStack Query',\n zod: 'Zod',\n trpc: 'tRPC',\n expo: 'Expo',\n 'react-native': 'React Native',\n nextjs: 'Next.js',\n react: 'React',\n sveltekit: 'SvelteKit',\n svelte: 'Svelte',\n astro: 'Astro',\n vue: 'Vue',\n apollo: 'Apollo Client',\n urql: 'urql',\n graphql: 'GraphQL',\n 'redux-toolkit': 'Redux Toolkit',\n zustand: 'Zustand',\n jotai: 'Jotai',\n recoil: 'Recoil',\n mobx: 'MobX',\n xstate: 'XState',\n valtio: 'Valtio',\n 'react-hook-form': 'React Hook Form',\n formik: 'Formik',\n axios: 'Axios',\n 'next-auth': 'NextAuth.js',\n 'auth-js': 'Auth.js',\n clerk: 'Clerk',\n lucia: 'Lucia',\n 'date-fns': 'date-fns',\n dayjs: 'Day.js',\n luxon: 'Luxon',\n i18next: 'i18next',\n 'next-i18next': 'next-i18next',\n stripe: 'Stripe',\n 'socket.io': 'Socket.IO',\n 'testing-library': 'Testing Library',\n msw: 'MSW',\n storybook: 'Storybook',\n vite: 'Vite',\n webpack: 'webpack',\n esbuild: 'esbuild',\n rspack: 'Rspack',\n nx: 'Nx',\n lerna: 'Lerna',\n};\n\n/** Display labels for convention keys. */\nexport const CONVENTION_LABELS: Record<string, string> = {\n fileNaming: 'File naming',\n componentNaming: 'Component naming',\n hookNaming: 'Hook naming',\n importAlias: 'Import alias',\n};\n\n/** Display names for directory roles. */\nexport const ROLE_DESCRIPTIONS: Record<string, string> = {\n pages: 'Pages / Routes',\n components: 'Components',\n hooks: 'Hooks',\n utils: 'Utilities',\n types: 'Type definitions',\n tests: 'Tests',\n styles: 'Styles',\n api: 'API routes',\n config: 'Configuration',\n};\n","declare const __PACKAGE_VERSION__: string;\nexport const VERSION: string = __PACKAGE_VERSION__;\n\nexport type { BoundaryConfig, BoundaryRule, BoundaryViolation } from './boundary.js';\nexport type { CheckResult, CheckRule, CheckViolation } from './check-result.js';\nexport type { Confidence, DetectedConvention } from './confidence.js';\nexport { confidenceFromConsistency } from './confidence.js';\nexport type {\n ConfigConventions,\n ConfigCoverage,\n ConfigDefaults,\n ConfigMeta,\n ConfigRules,\n ConfigStack,\n ConfigStructure,\n ConventionMeta,\n PackageBoundary,\n PackageConfig,\n PackageMeta,\n ViberailsConfig,\n} from './config.js';\nexport {\n CONVENTION_LABELS,\n FRAMEWORK_NAMES,\n LIBRARY_NAMES,\n ORM_NAMES,\n ROLE_DESCRIPTIONS,\n STYLING_NAMES,\n} from './display-names.js';\nexport type {\n ImportEdge,\n ImportGraph,\n ImportGraphNode,\n ImportKind,\n WorkspacePackage,\n} from './graph.js';\nexport type {\n CodebaseStatistics,\n DetectedStack,\n DetectedStructure,\n DetectedWorkspace,\n DirectoryInfo,\n DirectoryRole,\n FileSt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O;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,mBAAmB;AAAA,EACnB,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,aAAa;AAAA,EACb,WAAW;AAAA,EACX,OAAO;AAAA,EACP,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,OAAO;AAAA,EACP,SAAS;AAAA,EACT,gBAAgB;AAAA,EAChB,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,KAAK;AAAA,EACL,WAAW;AAAA,EACX,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,OAAO;AACT;AAGO,IAAM,oBAA4C;AAAA,EACvD,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,aAAa;AACf;AAGO,IAAM,oBAA4C;AAAA,EACvD,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,QAAQ;AACV;;;ACpHO,IAAM,UAAkB;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viberails/types",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "Shared type definitions for viberails",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",