@viberails/types 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alex Casasola
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.cjs ADDED
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ FRAMEWORK_NAMES: () => FRAMEWORK_NAMES,
24
+ LIBRARY_NAMES: () => LIBRARY_NAMES,
25
+ ROLE_DESCRIPTIONS: () => ROLE_DESCRIPTIONS,
26
+ STYLING_NAMES: () => STYLING_NAMES,
27
+ VERSION: () => VERSION,
28
+ confidenceFromConsistency: () => confidenceFromConsistency
29
+ });
30
+ module.exports = __toCommonJS(index_exports);
31
+
32
+ // src/confidence.ts
33
+ function confidenceFromConsistency(consistency) {
34
+ if (consistency >= 90) return "high";
35
+ if (consistency >= 70) return "medium";
36
+ return "low";
37
+ }
38
+
39
+ // src/display-names.ts
40
+ var FRAMEWORK_NAMES = {
41
+ nextjs: "Next.js",
42
+ remix: "Remix",
43
+ nuxt: "Nuxt",
44
+ sveltekit: "SvelteKit",
45
+ astro: "Astro",
46
+ vite: "Vite",
47
+ gatsby: "Gatsby",
48
+ express: "Express",
49
+ fastify: "Fastify",
50
+ hono: "Hono"
51
+ };
52
+ var STYLING_NAMES = {
53
+ tailwindcss: "Tailwind CSS",
54
+ "css-modules": "CSS Modules",
55
+ "styled-components": "styled-components",
56
+ emotion: "Emotion",
57
+ sass: "Sass"
58
+ };
59
+ var LIBRARY_NAMES = {
60
+ "react-query": "React Query",
61
+ "tanstack-query": "TanStack Query",
62
+ zod: "Zod",
63
+ trpc: "tRPC",
64
+ prisma: "Prisma",
65
+ drizzle: "Drizzle"
66
+ };
67
+ var ROLE_DESCRIPTIONS = {
68
+ pages: "Pages / Routes",
69
+ components: "Components",
70
+ hooks: "Hooks",
71
+ utils: "Utilities",
72
+ types: "Type definitions",
73
+ tests: "Tests",
74
+ styles: "Styles",
75
+ api: "API routes",
76
+ config: "Configuration"
77
+ };
78
+
79
+ // src/index.ts
80
+ var VERSION = "0.1.0";
81
+ // Annotate the CommonJS export names for ESM import in node:
82
+ 0 && (module.exports = {
83
+ FRAMEWORK_NAMES,
84
+ LIBRARY_NAMES,
85
+ ROLE_DESCRIPTIONS,
86
+ STYLING_NAMES,
87
+ VERSION,
88
+ confidenceFromConsistency
89
+ });
90
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/confidence.ts","../src/display-names.ts"],"sourcesContent":["export const VERSION = '0.1.0';\n\nexport type { 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 ViberailsConfig,\n WorkspaceConfig,\n} from './config.js';\nexport {\n FRAMEWORK_NAMES,\n LIBRARY_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 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 remix: 'Remix',\n nuxt: 'Nuxt',\n sveltekit: 'SvelteKit',\n astro: 'Astro',\n vite: 'Vite',\n gatsby: 'Gatsby',\n express: 'Express',\n fastify: 'Fastify',\n hono: 'Hono',\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};\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 prisma: 'Prisma',\n drizzle: 'Drizzle',\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;;;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,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,MAAM;AACR;AAGO,IAAM,gBAAwC;AAAA,EACnD,aAAa;AAAA,EACb,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,SAAS;AAAA,EACT,MAAM;AACR;AAGO,IAAM,gBAAwC;AAAA,EACnD,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,KAAK;AAAA,EACL,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS;AACX;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;;;AF5CO,IAAM,UAAU;","names":[]}
@@ -0,0 +1,402 @@
1
+ /** A boundary rule defining allowed or disallowed imports. */
2
+ interface BoundaryRule {
3
+ /** Source package or directory pattern. */
4
+ from: string;
5
+ /** Target package or directory pattern. */
6
+ to: string;
7
+ /** Whether this import direction is allowed (`true`) or disallowed (`false`). */
8
+ allow: boolean;
9
+ /** Human-readable explanation of why this boundary exists. */
10
+ reason?: string;
11
+ }
12
+ /** A boundary violation detected during checking. */
13
+ interface BoundaryViolation {
14
+ /** File containing the violating import. */
15
+ file: string;
16
+ /** Line number of the violating import. */
17
+ line: number;
18
+ /** The import specifier that violated the boundary. */
19
+ specifier: string;
20
+ /** What the specifier resolved to. */
21
+ resolvedTo: string;
22
+ /** The boundary rule that was violated. */
23
+ rule: BoundaryRule;
24
+ }
25
+
26
+ /**
27
+ * The type of rule that was violated.
28
+ */
29
+ type CheckRule = 'file-size' | 'file-naming' | 'missing-test' | 'boundary-violation';
30
+ /**
31
+ * A single rule violation detected by `viberails check`.
32
+ */
33
+ interface CheckViolation {
34
+ /** Relative path to the offending file. */
35
+ file: string;
36
+ /** Which rule was violated. */
37
+ rule: CheckRule;
38
+ /** Human-readable description of the violation. */
39
+ message: string;
40
+ /** Severity derived from config.enforcement. */
41
+ severity: 'error' | 'warn';
42
+ }
43
+ /**
44
+ * The result of running `viberails check`.
45
+ */
46
+ interface CheckResult {
47
+ /** All violations found. */
48
+ violations: CheckViolation[];
49
+ /** Number of files that were checked. */
50
+ checkedFiles: number;
51
+ /** The enforcement mode from config. */
52
+ enforcement: 'enforce' | 'warn';
53
+ }
54
+
55
+ /**
56
+ * Confidence level for a detected convention or pattern.
57
+ *
58
+ * - `'high'` — ≥90% consistency across analyzed files. Enforced by default.
59
+ * - `'medium'` — 70–89% consistency. Included in config but not enforced.
60
+ * - `'low'` — <70% consistency. Omitted from config entirely.
61
+ */
62
+ type Confidence = 'high' | 'medium' | 'low';
63
+ /**
64
+ * A convention or pattern detected by the scanner, with metadata
65
+ * about how confidently it was identified.
66
+ *
67
+ * @typeParam T - The type of the detected value. Defaults to `string`.
68
+ */
69
+ interface DetectedConvention<T = string> {
70
+ /** The detected value (e.g. a naming pattern, file extension, or path). */
71
+ value: T;
72
+ /** How confident the scanner is in this detection. */
73
+ confidence: Confidence;
74
+ /** Number of files analyzed to determine this convention. */
75
+ sampleSize: number;
76
+ /** Percentage (0–100) of files that follow this convention. */
77
+ consistency: number;
78
+ }
79
+ /**
80
+ * Derives a confidence level from a consistency percentage.
81
+ *
82
+ * @param consistency - A number from 0 to 100 representing the percentage
83
+ * of files that follow a given convention.
84
+ * @returns The corresponding confidence level:
85
+ * - `'high'` for consistency ≥ 90
86
+ * - `'medium'` for consistency ≥ 70 and < 90
87
+ * - `'low'` for consistency < 70
88
+ */
89
+ declare function confidenceFromConsistency(consistency: number): Confidence;
90
+
91
+ /**
92
+ * The top-level configuration shape for `viberails.config.json`.
93
+ * Generated from scan results and optionally edited by the user.
94
+ */
95
+ interface ViberailsConfig {
96
+ /** JSON Schema URL for editor validation. */
97
+ $schema?: string;
98
+ /** Config format version. Always `1` for V1.0. */
99
+ version: number;
100
+ /** Project name, typically from package.json. */
101
+ name: string;
102
+ /** Whether conventions are warned about or enforced as errors. */
103
+ enforcement: 'warn' | 'enforce';
104
+ /** Detected or configured technology stack. */
105
+ stack: ConfigStack;
106
+ /** Detected or configured directory structure. */
107
+ structure: ConfigStructure;
108
+ /** Detected or configured coding conventions. */
109
+ conventions: ConfigConventions;
110
+ /** Rule thresholds and toggles for enforcement. */
111
+ rules: ConfigRules;
112
+ /** Glob patterns for files and directories to ignore. */
113
+ ignore: string[];
114
+ /** Module boundary rules for import enforcement (V1.1+). */
115
+ boundaries?: BoundaryRule[];
116
+ /** Workspace configuration for monorepo support (V1.1+). */
117
+ workspace?: WorkspaceConfig;
118
+ }
119
+ /**
120
+ * Workspace configuration for monorepo projects.
121
+ */
122
+ interface WorkspaceConfig {
123
+ /** Relative paths to workspace packages (e.g. `"packages/scanner"`). */
124
+ packages: string[];
125
+ /** Whether this project is a monorepo with multiple packages. */
126
+ isMonorepo: boolean;
127
+ }
128
+ /**
129
+ * Technology stack configuration. Each field is a string identifier,
130
+ * optionally with a version suffix (e.g. `"nextjs@15"`, `"typescript"`).
131
+ */
132
+ interface ConfigStack {
133
+ /** Primary framework identifier (e.g. `"nextjs@15"`, `"remix@2"`). */
134
+ framework?: string;
135
+ /** Primary language (e.g. `"typescript"`, `"javascript"`). */
136
+ language: string;
137
+ /** Styling solution (e.g. `"tailwindcss@4"`, `"css-modules"`). */
138
+ styling?: string;
139
+ /** Backend framework (e.g. `"express@5"`, `"fastify"`). */
140
+ backend?: string;
141
+ /** Package manager (e.g. `"pnpm"`, `"npm"`, `"yarn"`). */
142
+ packageManager: string;
143
+ /** Linter (e.g. `"eslint@9"`, `"biome"`). */
144
+ linter?: string;
145
+ /** Test runner (e.g. `"vitest"`, `"jest"`). */
146
+ testRunner?: string;
147
+ }
148
+ /**
149
+ * Directory structure configuration. Each field is a path relative
150
+ * to the project root.
151
+ */
152
+ interface ConfigStructure {
153
+ /** Source directory (e.g. `"src"`), or undefined for flat structure. */
154
+ srcDir?: string;
155
+ /** Pages or routes directory (e.g. `"src/app"`, `"pages"`). */
156
+ pages?: string;
157
+ /** Components directory (e.g. `"src/components"`). */
158
+ components?: string;
159
+ /** Hooks directory (e.g. `"src/hooks"`). */
160
+ hooks?: string;
161
+ /** Utilities directory (e.g. `"src/utils"`, `"src/lib"`). */
162
+ utils?: string;
163
+ /** Type definitions directory (e.g. `"src/types"`). */
164
+ types?: string;
165
+ /** Tests directory (e.g. `"tests"`, `"__tests__"`). */
166
+ tests?: string;
167
+ /** Test file naming pattern (e.g. `"*.test.ts"`, `"*.spec.ts"`). */
168
+ testPattern?: string;
169
+ }
170
+ /**
171
+ * A convention value that may carry scanner metadata.
172
+ * When generated from a scan, includes confidence and consistency info.
173
+ * When manually set, is just a plain string.
174
+ */
175
+ type ConventionValue = string | {
176
+ /** The convention value. */
177
+ value: string;
178
+ /** Scanner confidence level. Prefixed with `_` to signal metadata. */
179
+ _confidence: Confidence;
180
+ /** Scanner consistency percentage. Prefixed with `_` to signal metadata. */
181
+ _consistency: number;
182
+ /** Set by mergeConfig when a convention is newly detected during sync. */
183
+ _detected?: boolean;
184
+ };
185
+ /**
186
+ * Coding convention configuration. Each field can be a plain string
187
+ * (confirmed by user) or an object with scanner metadata (auto-detected).
188
+ */
189
+ interface ConfigConventions {
190
+ /** File naming convention (e.g. `"kebab-case"`, `"camelCase"`). */
191
+ fileNaming?: ConventionValue;
192
+ /** Component naming convention (e.g. `"PascalCase"`). */
193
+ componentNaming?: ConventionValue;
194
+ /** Hook naming convention (e.g. `"useXxx"`). */
195
+ hookNaming?: ConventionValue;
196
+ /** Import alias pattern (e.g. `"@/*"`, `"~/*"`). */
197
+ importAlias?: ConventionValue;
198
+ }
199
+ /**
200
+ * Rule thresholds and toggles for convention enforcement.
201
+ */
202
+ interface ConfigRules {
203
+ /**
204
+ * Maximum number of lines allowed per file.
205
+ * @default 300
206
+ */
207
+ maxFileLines: number;
208
+ /**
209
+ * Maximum number of lines allowed per function.
210
+ * @default 50
211
+ */
212
+ maxFunctionLines: number;
213
+ /**
214
+ * Whether to require test files for source modules.
215
+ * @default true
216
+ */
217
+ requireTests: boolean;
218
+ /**
219
+ * Whether to enforce detected file naming conventions.
220
+ * @default true
221
+ */
222
+ enforceNaming: boolean;
223
+ /**
224
+ * Whether to enforce module boundary rules.
225
+ * @default false (V1.1+ feature)
226
+ */
227
+ enforceBoundaries: boolean;
228
+ }
229
+
230
+ /** Display names for framework identifiers. */
231
+ declare const FRAMEWORK_NAMES: Record<string, string>;
232
+ /** Display names for styling libraries. */
233
+ declare const STYLING_NAMES: Record<string, string>;
234
+ /** Display names for notable libraries. */
235
+ declare const LIBRARY_NAMES: Record<string, string>;
236
+ /** Display names for directory roles. */
237
+ declare const ROLE_DESCRIPTIONS: Record<string, string>;
238
+
239
+ /** A node in the import graph, representing one source file. */
240
+ interface ImportGraphNode {
241
+ /** Absolute path to the file. */
242
+ filePath: string;
243
+ /** Path relative to the project or package root. */
244
+ relativePath: string;
245
+ /** Workspace package this file belongs to, if any. */
246
+ packageName?: string;
247
+ }
248
+ /** A single resolved import edge. */
249
+ interface ImportEdge {
250
+ /** Absolute path of the importing file. */
251
+ source: string;
252
+ /** Absolute path or package name for externals. */
253
+ target: string;
254
+ /** Raw import specifier as written in source code. */
255
+ specifier: string;
256
+ /** Whether this is a type-only import (`import type { ... }`). */
257
+ typeOnly: boolean;
258
+ /** Whether this is a dynamic import (`await import('...')`). */
259
+ dynamic: boolean;
260
+ /** Line number of the import statement. */
261
+ line: number;
262
+ }
263
+ /** Classification of a resolved import. */
264
+ type ImportKind = 'internal' | 'workspace' | 'external' | 'builtin' | 'unresolved';
265
+ /** The complete import graph for a project. */
266
+ interface ImportGraph {
267
+ /** All source file nodes in the graph. */
268
+ nodes: ImportGraphNode[];
269
+ /** All import edges between nodes. */
270
+ edges: ImportEdge[];
271
+ /** Detected workspace packages. */
272
+ packages: WorkspacePackage[];
273
+ /** Detected import cycles, each as a list of file paths. */
274
+ cycles: string[][];
275
+ }
276
+ /** A detected workspace package. */
277
+ interface WorkspacePackage {
278
+ /** Package name from package.json. */
279
+ name: string;
280
+ /** Absolute path to the package root. */
281
+ path: string;
282
+ /** Path relative to the workspace root. */
283
+ relativePath: string;
284
+ /** Names of other workspace packages this package depends on. */
285
+ internalDeps: string[];
286
+ }
287
+
288
+ /**
289
+ * The complete output of scanning a project. Consumed by the config
290
+ * generator and context generator to produce AI context files.
291
+ */
292
+ interface ScanResult {
293
+ /** Absolute path to the project root directory. */
294
+ root: string;
295
+ /** Detected technology stack (framework, language, tooling). */
296
+ stack: DetectedStack;
297
+ /** Detected directory structure and organization. */
298
+ structure: DetectedStructure;
299
+ /** Detected coding conventions, keyed by convention name. */
300
+ conventions: Record<string, DetectedConvention>;
301
+ /** Quantitative statistics about the codebase. */
302
+ statistics: CodebaseStatistics;
303
+ /** Detected workspace information for monorepo projects (V1.1+). */
304
+ workspace?: DetectedWorkspace;
305
+ }
306
+ /**
307
+ * Workspace information detected by scanning the project root
308
+ * for pnpm-workspace.yaml or package.json workspaces field.
309
+ */
310
+ interface DetectedWorkspace {
311
+ /** Workspace glob patterns from configuration (e.g. `["packages/*"]`). */
312
+ patterns: string[];
313
+ /** Resolved workspace packages. */
314
+ packages: WorkspacePackage[];
315
+ }
316
+ /**
317
+ * The detected technology stack of a project, extracted primarily
318
+ * from package.json dependencies and configuration files.
319
+ */
320
+ interface DetectedStack {
321
+ /** Primary framework (e.g. Next.js, Remix, Astro). */
322
+ framework?: StackItem;
323
+ /** Primary language (e.g. TypeScript, JavaScript). */
324
+ language: StackItem;
325
+ /** Styling solution (e.g. Tailwind CSS, CSS Modules). */
326
+ styling?: StackItem;
327
+ /** Backend framework or runtime (e.g. Express, Fastify). */
328
+ backend?: StackItem;
329
+ /** Package manager used (e.g. pnpm, npm, yarn). */
330
+ packageManager: StackItem;
331
+ /** Linter in use (e.g. ESLint, Biome). */
332
+ linter?: StackItem;
333
+ /** Test runner in use (e.g. Vitest, Jest). */
334
+ testRunner?: StackItem;
335
+ /** Notable libraries detected (e.g. Zod, tRPC, React Query). */
336
+ libraries: StackItem[];
337
+ }
338
+ /**
339
+ * A single technology or tool detected in the project.
340
+ */
341
+ interface StackItem {
342
+ /** Identifier name of the tool or technology. */
343
+ name: string;
344
+ /** Detected version, if available. */
345
+ version?: string;
346
+ }
347
+ /**
348
+ * The detected directory structure and organization of a project.
349
+ */
350
+ interface DetectedStructure {
351
+ /** Source directory name (e.g. `'src'`), or undefined if the project uses a flat structure. */
352
+ srcDir?: string;
353
+ /** Detected meaningful directories with their roles. */
354
+ directories: DirectoryInfo[];
355
+ /** Detected test file naming pattern (e.g. `*.test.ts`, `*.spec.ts`). */
356
+ testPattern?: DetectedConvention<string>;
357
+ }
358
+ /**
359
+ * Information about a detected directory and its inferred role.
360
+ */
361
+ interface DirectoryInfo {
362
+ /** Path relative to the project root. */
363
+ path: string;
364
+ /** The inferred role of this directory. */
365
+ role: DirectoryRole;
366
+ /** Number of files in this directory (non-recursive). */
367
+ fileCount: number;
368
+ /** How confident the scanner is in the role assignment. */
369
+ confidence: Confidence;
370
+ }
371
+ /**
372
+ * The inferred role of a directory in the project structure.
373
+ */
374
+ type DirectoryRole = 'pages' | 'components' | 'hooks' | 'utils' | 'types' | 'tests' | 'styles' | 'api' | 'config' | 'unknown';
375
+ /**
376
+ * Quantitative statistics about the codebase.
377
+ */
378
+ interface CodebaseStatistics {
379
+ /** Total number of source files. */
380
+ totalFiles: number;
381
+ /** Total number of lines across all source files. */
382
+ totalLines: number;
383
+ /** Average number of lines per file. */
384
+ averageFileLines: number;
385
+ /** Top 5 largest files by line count. */
386
+ largestFiles: FileStatistic[];
387
+ /** File count grouped by extension (e.g. `{ '.ts': 42, '.tsx': 18 }`). */
388
+ filesByExtension: Record<string, number>;
389
+ }
390
+ /**
391
+ * Line count information for a single file.
392
+ */
393
+ interface FileStatistic {
394
+ /** Path relative to the project root. */
395
+ path: string;
396
+ /** Number of lines in the file. */
397
+ lines: number;
398
+ }
399
+
400
+ declare const VERSION = "0.1.0";
401
+
402
+ export { type BoundaryRule, type BoundaryViolation, 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, ROLE_DESCRIPTIONS, STYLING_NAMES, type ScanResult, type StackItem, VERSION, type ViberailsConfig, type WorkspaceConfig, type WorkspacePackage, confidenceFromConsistency };
@@ -0,0 +1,402 @@
1
+ /** A boundary rule defining allowed or disallowed imports. */
2
+ interface BoundaryRule {
3
+ /** Source package or directory pattern. */
4
+ from: string;
5
+ /** Target package or directory pattern. */
6
+ to: string;
7
+ /** Whether this import direction is allowed (`true`) or disallowed (`false`). */
8
+ allow: boolean;
9
+ /** Human-readable explanation of why this boundary exists. */
10
+ reason?: string;
11
+ }
12
+ /** A boundary violation detected during checking. */
13
+ interface BoundaryViolation {
14
+ /** File containing the violating import. */
15
+ file: string;
16
+ /** Line number of the violating import. */
17
+ line: number;
18
+ /** The import specifier that violated the boundary. */
19
+ specifier: string;
20
+ /** What the specifier resolved to. */
21
+ resolvedTo: string;
22
+ /** The boundary rule that was violated. */
23
+ rule: BoundaryRule;
24
+ }
25
+
26
+ /**
27
+ * The type of rule that was violated.
28
+ */
29
+ type CheckRule = 'file-size' | 'file-naming' | 'missing-test' | 'boundary-violation';
30
+ /**
31
+ * A single rule violation detected by `viberails check`.
32
+ */
33
+ interface CheckViolation {
34
+ /** Relative path to the offending file. */
35
+ file: string;
36
+ /** Which rule was violated. */
37
+ rule: CheckRule;
38
+ /** Human-readable description of the violation. */
39
+ message: string;
40
+ /** Severity derived from config.enforcement. */
41
+ severity: 'error' | 'warn';
42
+ }
43
+ /**
44
+ * The result of running `viberails check`.
45
+ */
46
+ interface CheckResult {
47
+ /** All violations found. */
48
+ violations: CheckViolation[];
49
+ /** Number of files that were checked. */
50
+ checkedFiles: number;
51
+ /** The enforcement mode from config. */
52
+ enforcement: 'enforce' | 'warn';
53
+ }
54
+
55
+ /**
56
+ * Confidence level for a detected convention or pattern.
57
+ *
58
+ * - `'high'` — ≥90% consistency across analyzed files. Enforced by default.
59
+ * - `'medium'` — 70–89% consistency. Included in config but not enforced.
60
+ * - `'low'` — <70% consistency. Omitted from config entirely.
61
+ */
62
+ type Confidence = 'high' | 'medium' | 'low';
63
+ /**
64
+ * A convention or pattern detected by the scanner, with metadata
65
+ * about how confidently it was identified.
66
+ *
67
+ * @typeParam T - The type of the detected value. Defaults to `string`.
68
+ */
69
+ interface DetectedConvention<T = string> {
70
+ /** The detected value (e.g. a naming pattern, file extension, or path). */
71
+ value: T;
72
+ /** How confident the scanner is in this detection. */
73
+ confidence: Confidence;
74
+ /** Number of files analyzed to determine this convention. */
75
+ sampleSize: number;
76
+ /** Percentage (0–100) of files that follow this convention. */
77
+ consistency: number;
78
+ }
79
+ /**
80
+ * Derives a confidence level from a consistency percentage.
81
+ *
82
+ * @param consistency - A number from 0 to 100 representing the percentage
83
+ * of files that follow a given convention.
84
+ * @returns The corresponding confidence level:
85
+ * - `'high'` for consistency ≥ 90
86
+ * - `'medium'` for consistency ≥ 70 and < 90
87
+ * - `'low'` for consistency < 70
88
+ */
89
+ declare function confidenceFromConsistency(consistency: number): Confidence;
90
+
91
+ /**
92
+ * The top-level configuration shape for `viberails.config.json`.
93
+ * Generated from scan results and optionally edited by the user.
94
+ */
95
+ interface ViberailsConfig {
96
+ /** JSON Schema URL for editor validation. */
97
+ $schema?: string;
98
+ /** Config format version. Always `1` for V1.0. */
99
+ version: number;
100
+ /** Project name, typically from package.json. */
101
+ name: string;
102
+ /** Whether conventions are warned about or enforced as errors. */
103
+ enforcement: 'warn' | 'enforce';
104
+ /** Detected or configured technology stack. */
105
+ stack: ConfigStack;
106
+ /** Detected or configured directory structure. */
107
+ structure: ConfigStructure;
108
+ /** Detected or configured coding conventions. */
109
+ conventions: ConfigConventions;
110
+ /** Rule thresholds and toggles for enforcement. */
111
+ rules: ConfigRules;
112
+ /** Glob patterns for files and directories to ignore. */
113
+ ignore: string[];
114
+ /** Module boundary rules for import enforcement (V1.1+). */
115
+ boundaries?: BoundaryRule[];
116
+ /** Workspace configuration for monorepo support (V1.1+). */
117
+ workspace?: WorkspaceConfig;
118
+ }
119
+ /**
120
+ * Workspace configuration for monorepo projects.
121
+ */
122
+ interface WorkspaceConfig {
123
+ /** Relative paths to workspace packages (e.g. `"packages/scanner"`). */
124
+ packages: string[];
125
+ /** Whether this project is a monorepo with multiple packages. */
126
+ isMonorepo: boolean;
127
+ }
128
+ /**
129
+ * Technology stack configuration. Each field is a string identifier,
130
+ * optionally with a version suffix (e.g. `"nextjs@15"`, `"typescript"`).
131
+ */
132
+ interface ConfigStack {
133
+ /** Primary framework identifier (e.g. `"nextjs@15"`, `"remix@2"`). */
134
+ framework?: string;
135
+ /** Primary language (e.g. `"typescript"`, `"javascript"`). */
136
+ language: string;
137
+ /** Styling solution (e.g. `"tailwindcss@4"`, `"css-modules"`). */
138
+ styling?: string;
139
+ /** Backend framework (e.g. `"express@5"`, `"fastify"`). */
140
+ backend?: string;
141
+ /** Package manager (e.g. `"pnpm"`, `"npm"`, `"yarn"`). */
142
+ packageManager: string;
143
+ /** Linter (e.g. `"eslint@9"`, `"biome"`). */
144
+ linter?: string;
145
+ /** Test runner (e.g. `"vitest"`, `"jest"`). */
146
+ testRunner?: string;
147
+ }
148
+ /**
149
+ * Directory structure configuration. Each field is a path relative
150
+ * to the project root.
151
+ */
152
+ interface ConfigStructure {
153
+ /** Source directory (e.g. `"src"`), or undefined for flat structure. */
154
+ srcDir?: string;
155
+ /** Pages or routes directory (e.g. `"src/app"`, `"pages"`). */
156
+ pages?: string;
157
+ /** Components directory (e.g. `"src/components"`). */
158
+ components?: string;
159
+ /** Hooks directory (e.g. `"src/hooks"`). */
160
+ hooks?: string;
161
+ /** Utilities directory (e.g. `"src/utils"`, `"src/lib"`). */
162
+ utils?: string;
163
+ /** Type definitions directory (e.g. `"src/types"`). */
164
+ types?: string;
165
+ /** Tests directory (e.g. `"tests"`, `"__tests__"`). */
166
+ tests?: string;
167
+ /** Test file naming pattern (e.g. `"*.test.ts"`, `"*.spec.ts"`). */
168
+ testPattern?: string;
169
+ }
170
+ /**
171
+ * A convention value that may carry scanner metadata.
172
+ * When generated from a scan, includes confidence and consistency info.
173
+ * When manually set, is just a plain string.
174
+ */
175
+ type ConventionValue = string | {
176
+ /** The convention value. */
177
+ value: string;
178
+ /** Scanner confidence level. Prefixed with `_` to signal metadata. */
179
+ _confidence: Confidence;
180
+ /** Scanner consistency percentage. Prefixed with `_` to signal metadata. */
181
+ _consistency: number;
182
+ /** Set by mergeConfig when a convention is newly detected during sync. */
183
+ _detected?: boolean;
184
+ };
185
+ /**
186
+ * Coding convention configuration. Each field can be a plain string
187
+ * (confirmed by user) or an object with scanner metadata (auto-detected).
188
+ */
189
+ interface ConfigConventions {
190
+ /** File naming convention (e.g. `"kebab-case"`, `"camelCase"`). */
191
+ fileNaming?: ConventionValue;
192
+ /** Component naming convention (e.g. `"PascalCase"`). */
193
+ componentNaming?: ConventionValue;
194
+ /** Hook naming convention (e.g. `"useXxx"`). */
195
+ hookNaming?: ConventionValue;
196
+ /** Import alias pattern (e.g. `"@/*"`, `"~/*"`). */
197
+ importAlias?: ConventionValue;
198
+ }
199
+ /**
200
+ * Rule thresholds and toggles for convention enforcement.
201
+ */
202
+ interface ConfigRules {
203
+ /**
204
+ * Maximum number of lines allowed per file.
205
+ * @default 300
206
+ */
207
+ maxFileLines: number;
208
+ /**
209
+ * Maximum number of lines allowed per function.
210
+ * @default 50
211
+ */
212
+ maxFunctionLines: number;
213
+ /**
214
+ * Whether to require test files for source modules.
215
+ * @default true
216
+ */
217
+ requireTests: boolean;
218
+ /**
219
+ * Whether to enforce detected file naming conventions.
220
+ * @default true
221
+ */
222
+ enforceNaming: boolean;
223
+ /**
224
+ * Whether to enforce module boundary rules.
225
+ * @default false (V1.1+ feature)
226
+ */
227
+ enforceBoundaries: boolean;
228
+ }
229
+
230
+ /** Display names for framework identifiers. */
231
+ declare const FRAMEWORK_NAMES: Record<string, string>;
232
+ /** Display names for styling libraries. */
233
+ declare const STYLING_NAMES: Record<string, string>;
234
+ /** Display names for notable libraries. */
235
+ declare const LIBRARY_NAMES: Record<string, string>;
236
+ /** Display names for directory roles. */
237
+ declare const ROLE_DESCRIPTIONS: Record<string, string>;
238
+
239
+ /** A node in the import graph, representing one source file. */
240
+ interface ImportGraphNode {
241
+ /** Absolute path to the file. */
242
+ filePath: string;
243
+ /** Path relative to the project or package root. */
244
+ relativePath: string;
245
+ /** Workspace package this file belongs to, if any. */
246
+ packageName?: string;
247
+ }
248
+ /** A single resolved import edge. */
249
+ interface ImportEdge {
250
+ /** Absolute path of the importing file. */
251
+ source: string;
252
+ /** Absolute path or package name for externals. */
253
+ target: string;
254
+ /** Raw import specifier as written in source code. */
255
+ specifier: string;
256
+ /** Whether this is a type-only import (`import type { ... }`). */
257
+ typeOnly: boolean;
258
+ /** Whether this is a dynamic import (`await import('...')`). */
259
+ dynamic: boolean;
260
+ /** Line number of the import statement. */
261
+ line: number;
262
+ }
263
+ /** Classification of a resolved import. */
264
+ type ImportKind = 'internal' | 'workspace' | 'external' | 'builtin' | 'unresolved';
265
+ /** The complete import graph for a project. */
266
+ interface ImportGraph {
267
+ /** All source file nodes in the graph. */
268
+ nodes: ImportGraphNode[];
269
+ /** All import edges between nodes. */
270
+ edges: ImportEdge[];
271
+ /** Detected workspace packages. */
272
+ packages: WorkspacePackage[];
273
+ /** Detected import cycles, each as a list of file paths. */
274
+ cycles: string[][];
275
+ }
276
+ /** A detected workspace package. */
277
+ interface WorkspacePackage {
278
+ /** Package name from package.json. */
279
+ name: string;
280
+ /** Absolute path to the package root. */
281
+ path: string;
282
+ /** Path relative to the workspace root. */
283
+ relativePath: string;
284
+ /** Names of other workspace packages this package depends on. */
285
+ internalDeps: string[];
286
+ }
287
+
288
+ /**
289
+ * The complete output of scanning a project. Consumed by the config
290
+ * generator and context generator to produce AI context files.
291
+ */
292
+ interface ScanResult {
293
+ /** Absolute path to the project root directory. */
294
+ root: string;
295
+ /** Detected technology stack (framework, language, tooling). */
296
+ stack: DetectedStack;
297
+ /** Detected directory structure and organization. */
298
+ structure: DetectedStructure;
299
+ /** Detected coding conventions, keyed by convention name. */
300
+ conventions: Record<string, DetectedConvention>;
301
+ /** Quantitative statistics about the codebase. */
302
+ statistics: CodebaseStatistics;
303
+ /** Detected workspace information for monorepo projects (V1.1+). */
304
+ workspace?: DetectedWorkspace;
305
+ }
306
+ /**
307
+ * Workspace information detected by scanning the project root
308
+ * for pnpm-workspace.yaml or package.json workspaces field.
309
+ */
310
+ interface DetectedWorkspace {
311
+ /** Workspace glob patterns from configuration (e.g. `["packages/*"]`). */
312
+ patterns: string[];
313
+ /** Resolved workspace packages. */
314
+ packages: WorkspacePackage[];
315
+ }
316
+ /**
317
+ * The detected technology stack of a project, extracted primarily
318
+ * from package.json dependencies and configuration files.
319
+ */
320
+ interface DetectedStack {
321
+ /** Primary framework (e.g. Next.js, Remix, Astro). */
322
+ framework?: StackItem;
323
+ /** Primary language (e.g. TypeScript, JavaScript). */
324
+ language: StackItem;
325
+ /** Styling solution (e.g. Tailwind CSS, CSS Modules). */
326
+ styling?: StackItem;
327
+ /** Backend framework or runtime (e.g. Express, Fastify). */
328
+ backend?: StackItem;
329
+ /** Package manager used (e.g. pnpm, npm, yarn). */
330
+ packageManager: StackItem;
331
+ /** Linter in use (e.g. ESLint, Biome). */
332
+ linter?: StackItem;
333
+ /** Test runner in use (e.g. Vitest, Jest). */
334
+ testRunner?: StackItem;
335
+ /** Notable libraries detected (e.g. Zod, tRPC, React Query). */
336
+ libraries: StackItem[];
337
+ }
338
+ /**
339
+ * A single technology or tool detected in the project.
340
+ */
341
+ interface StackItem {
342
+ /** Identifier name of the tool or technology. */
343
+ name: string;
344
+ /** Detected version, if available. */
345
+ version?: string;
346
+ }
347
+ /**
348
+ * The detected directory structure and organization of a project.
349
+ */
350
+ interface DetectedStructure {
351
+ /** Source directory name (e.g. `'src'`), or undefined if the project uses a flat structure. */
352
+ srcDir?: string;
353
+ /** Detected meaningful directories with their roles. */
354
+ directories: DirectoryInfo[];
355
+ /** Detected test file naming pattern (e.g. `*.test.ts`, `*.spec.ts`). */
356
+ testPattern?: DetectedConvention<string>;
357
+ }
358
+ /**
359
+ * Information about a detected directory and its inferred role.
360
+ */
361
+ interface DirectoryInfo {
362
+ /** Path relative to the project root. */
363
+ path: string;
364
+ /** The inferred role of this directory. */
365
+ role: DirectoryRole;
366
+ /** Number of files in this directory (non-recursive). */
367
+ fileCount: number;
368
+ /** How confident the scanner is in the role assignment. */
369
+ confidence: Confidence;
370
+ }
371
+ /**
372
+ * The inferred role of a directory in the project structure.
373
+ */
374
+ type DirectoryRole = 'pages' | 'components' | 'hooks' | 'utils' | 'types' | 'tests' | 'styles' | 'api' | 'config' | 'unknown';
375
+ /**
376
+ * Quantitative statistics about the codebase.
377
+ */
378
+ interface CodebaseStatistics {
379
+ /** Total number of source files. */
380
+ totalFiles: number;
381
+ /** Total number of lines across all source files. */
382
+ totalLines: number;
383
+ /** Average number of lines per file. */
384
+ averageFileLines: number;
385
+ /** Top 5 largest files by line count. */
386
+ largestFiles: FileStatistic[];
387
+ /** File count grouped by extension (e.g. `{ '.ts': 42, '.tsx': 18 }`). */
388
+ filesByExtension: Record<string, number>;
389
+ }
390
+ /**
391
+ * Line count information for a single file.
392
+ */
393
+ interface FileStatistic {
394
+ /** Path relative to the project root. */
395
+ path: string;
396
+ /** Number of lines in the file. */
397
+ lines: number;
398
+ }
399
+
400
+ declare const VERSION = "0.1.0";
401
+
402
+ export { type BoundaryRule, type BoundaryViolation, 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, ROLE_DESCRIPTIONS, STYLING_NAMES, type ScanResult, type StackItem, VERSION, type ViberailsConfig, type WorkspaceConfig, type WorkspacePackage, confidenceFromConsistency };
package/dist/index.js ADDED
@@ -0,0 +1,58 @@
1
+ // src/confidence.ts
2
+ function confidenceFromConsistency(consistency) {
3
+ if (consistency >= 90) return "high";
4
+ if (consistency >= 70) return "medium";
5
+ return "low";
6
+ }
7
+
8
+ // src/display-names.ts
9
+ var FRAMEWORK_NAMES = {
10
+ nextjs: "Next.js",
11
+ remix: "Remix",
12
+ nuxt: "Nuxt",
13
+ sveltekit: "SvelteKit",
14
+ astro: "Astro",
15
+ vite: "Vite",
16
+ gatsby: "Gatsby",
17
+ express: "Express",
18
+ fastify: "Fastify",
19
+ hono: "Hono"
20
+ };
21
+ var STYLING_NAMES = {
22
+ tailwindcss: "Tailwind CSS",
23
+ "css-modules": "CSS Modules",
24
+ "styled-components": "styled-components",
25
+ emotion: "Emotion",
26
+ sass: "Sass"
27
+ };
28
+ var LIBRARY_NAMES = {
29
+ "react-query": "React Query",
30
+ "tanstack-query": "TanStack Query",
31
+ zod: "Zod",
32
+ trpc: "tRPC",
33
+ prisma: "Prisma",
34
+ drizzle: "Drizzle"
35
+ };
36
+ var ROLE_DESCRIPTIONS = {
37
+ pages: "Pages / Routes",
38
+ components: "Components",
39
+ hooks: "Hooks",
40
+ utils: "Utilities",
41
+ types: "Type definitions",
42
+ tests: "Tests",
43
+ styles: "Styles",
44
+ api: "API routes",
45
+ config: "Configuration"
46
+ };
47
+
48
+ // src/index.ts
49
+ var VERSION = "0.1.0";
50
+ export {
51
+ FRAMEWORK_NAMES,
52
+ LIBRARY_NAMES,
53
+ ROLE_DESCRIPTIONS,
54
+ STYLING_NAMES,
55
+ VERSION,
56
+ confidenceFromConsistency
57
+ };
58
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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 remix: 'Remix',\n nuxt: 'Nuxt',\n sveltekit: 'SvelteKit',\n astro: 'Astro',\n vite: 'Vite',\n gatsby: 'Gatsby',\n express: 'Express',\n fastify: 'Fastify',\n hono: 'Hono',\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};\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 prisma: 'Prisma',\n drizzle: 'Drizzle',\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","export const VERSION = '0.1.0';\n\nexport type { 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 ViberailsConfig,\n WorkspaceConfig,\n} from './config.js';\nexport {\n FRAMEWORK_NAMES,\n LIBRARY_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 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,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,MAAM;AACR;AAGO,IAAM,gBAAwC;AAAA,EACnD,aAAa;AAAA,EACb,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,SAAS;AAAA,EACT,MAAM;AACR;AAGO,IAAM,gBAAwC;AAAA,EACnD,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,KAAK;AAAA,EACL,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS;AACX;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;;;AC5CO,IAAM,UAAU;","names":[]}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@viberails/types",
3
+ "version": "0.1.0",
4
+ "description": "Shared type definitions for viberails",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
19
+ }
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "scripts": {
28
+ "build": "tsup",
29
+ "test": "vitest run",
30
+ "lint": "biome check src/",
31
+ "clean": "rm -rf dist"
32
+ }
33
+ }