@viberails/context 0.1.0 → 0.2.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 +126 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +126 -20
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -24,7 +24,7 @@ __export(index_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(index_exports);
|
|
26
26
|
|
|
27
|
-
// src/
|
|
27
|
+
// src/format-helpers.ts
|
|
28
28
|
var NAMING_EXAMPLES = {
|
|
29
29
|
"kebab-case": "`user-profile.ts`, not `UserProfile.ts`",
|
|
30
30
|
camelCase: "`userProfile.ts`, not `user-profile.ts`",
|
|
@@ -34,6 +34,112 @@ var NAMING_EXAMPLES = {
|
|
|
34
34
|
function conventionValue(cv) {
|
|
35
35
|
return typeof cv === "string" ? cv : cv.value;
|
|
36
36
|
}
|
|
37
|
+
function formatDevelopmentSetup(config) {
|
|
38
|
+
const { linter, formatter } = config.stack;
|
|
39
|
+
if (!linter && !formatter) return [];
|
|
40
|
+
const lines = [];
|
|
41
|
+
lines.push("## Development setup\n");
|
|
42
|
+
const toolName = (id) => {
|
|
43
|
+
const name = id.split("@")[0];
|
|
44
|
+
if (name === "biome") return "Biome";
|
|
45
|
+
if (name === "prettier") return "Prettier";
|
|
46
|
+
if (name === "eslint") return "ESLint";
|
|
47
|
+
return name;
|
|
48
|
+
};
|
|
49
|
+
if (formatter && linter) {
|
|
50
|
+
const fmt = toolName(formatter);
|
|
51
|
+
const lint = toolName(linter);
|
|
52
|
+
if (fmt === lint) {
|
|
53
|
+
lines.push(`This project uses **${fmt}** for formatting and linting.
|
|
54
|
+
`);
|
|
55
|
+
} else {
|
|
56
|
+
lines.push(`This project uses **${fmt}** for formatting and **${lint}** for linting.
|
|
57
|
+
`);
|
|
58
|
+
}
|
|
59
|
+
} else if (formatter) {
|
|
60
|
+
lines.push(`This project uses **${toolName(formatter)}** for formatting.
|
|
61
|
+
`);
|
|
62
|
+
} else if (linter) {
|
|
63
|
+
lines.push(`This project uses **${toolName(linter)}** for linting.
|
|
64
|
+
`);
|
|
65
|
+
}
|
|
66
|
+
lines.push("- Enable format-on-save in your editor to avoid lint failures on commit.");
|
|
67
|
+
if (formatter) {
|
|
68
|
+
const fmt = toolName(formatter);
|
|
69
|
+
if (fmt === "Biome") {
|
|
70
|
+
lines.push(
|
|
71
|
+
"- If using VS Code, install the [Biome extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome) and enable format-on-save."
|
|
72
|
+
);
|
|
73
|
+
} else if (fmt === "Prettier") {
|
|
74
|
+
lines.push(
|
|
75
|
+
"- If using VS Code, install the [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) and enable format-on-save."
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return lines;
|
|
80
|
+
}
|
|
81
|
+
function packageHeader(pkg) {
|
|
82
|
+
const framework = pkg.stack?.framework;
|
|
83
|
+
if (framework) {
|
|
84
|
+
const name = typeof framework === "string" ? framework.split("@")[0] : framework;
|
|
85
|
+
return `### ${pkg.path} (${name})`;
|
|
86
|
+
}
|
|
87
|
+
return `### ${pkg.path}`;
|
|
88
|
+
}
|
|
89
|
+
function formatPackageOverrides(config) {
|
|
90
|
+
if (!config.packages || config.packages.length === 0) return [];
|
|
91
|
+
const lines = [];
|
|
92
|
+
lines.push("## Per-package rules\n");
|
|
93
|
+
lines.push("The following packages have rules that differ from the global defaults:\n");
|
|
94
|
+
for (const pkg of config.packages) {
|
|
95
|
+
lines.push(packageHeader(pkg));
|
|
96
|
+
if (pkg.conventions?.fileNaming) {
|
|
97
|
+
const val = conventionValue(pkg.conventions.fileNaming);
|
|
98
|
+
const examples = NAMING_EXAMPLES[val] ?? `e.g. \`my-module.ts\``;
|
|
99
|
+
lines.push(`- Source files use **${val}**: ${examples}.`);
|
|
100
|
+
}
|
|
101
|
+
if (pkg.conventions?.componentNaming) {
|
|
102
|
+
const val = conventionValue(pkg.conventions.componentNaming);
|
|
103
|
+
lines.push(`- Components use **${val}** naming.`);
|
|
104
|
+
}
|
|
105
|
+
if (pkg.conventions?.hookNaming) {
|
|
106
|
+
const val = conventionValue(pkg.conventions.hookNaming);
|
|
107
|
+
lines.push(`- Hooks use **${val}** naming.`);
|
|
108
|
+
}
|
|
109
|
+
if (pkg.conventions?.importAlias) {
|
|
110
|
+
const val = conventionValue(pkg.conventions.importAlias);
|
|
111
|
+
lines.push(`- Import alias: \`${val}\`.`);
|
|
112
|
+
}
|
|
113
|
+
if (pkg.rules?.maxFileLines !== void 0 && pkg.rules.maxFileLines > 0) {
|
|
114
|
+
lines.push(
|
|
115
|
+
`- Files must not exceed **${pkg.rules.maxFileLines} lines**. Split into focused modules.`
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
if (pkg.rules?.maxFunctionLines !== void 0 && pkg.rules.maxFunctionLines > 0) {
|
|
119
|
+
lines.push(
|
|
120
|
+
`- Functions must not exceed **${pkg.rules.maxFunctionLines} lines**. Extract helpers for complex logic.`
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return lines;
|
|
125
|
+
}
|
|
126
|
+
function formatBoundaryRules(config) {
|
|
127
|
+
if (!config.rules.enforceBoundaries || !config.boundaries || config.boundaries.length === 0) {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
const denyRules = config.boundaries.filter((r) => !r.allow);
|
|
131
|
+
if (denyRules.length === 0) return [];
|
|
132
|
+
const lines = [];
|
|
133
|
+
lines.push("## Boundary rules\n");
|
|
134
|
+
lines.push("These import boundaries are enforced:\n");
|
|
135
|
+
for (const rule of denyRules) {
|
|
136
|
+
const reason = rule.reason ? ` (${rule.reason})` : "";
|
|
137
|
+
lines.push(`- \`${rule.from}\` must NOT import from \`${rule.to}\`${reason}`);
|
|
138
|
+
}
|
|
139
|
+
return lines;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// src/generate-context.ts
|
|
37
143
|
function formatEnforcedRules(config) {
|
|
38
144
|
const { rules, conventions, structure } = config;
|
|
39
145
|
const lines = [];
|
|
@@ -53,10 +159,15 @@ function formatEnforcedRules(config) {
|
|
|
53
159
|
lines.push(`- Source files use **${val}**: ${examples}.`);
|
|
54
160
|
}
|
|
55
161
|
if (rules.requireTests && structure.testPattern) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
162
|
+
if (structure.srcDir) {
|
|
163
|
+
lines.push(
|
|
164
|
+
`- Every source file in \`${structure.srcDir}/\` must have a corresponding \`${structure.testPattern}\` file.`
|
|
165
|
+
);
|
|
166
|
+
} else {
|
|
167
|
+
lines.push(
|
|
168
|
+
`- Every source file must have a corresponding \`${structure.testPattern}\` file.`
|
|
169
|
+
);
|
|
170
|
+
}
|
|
60
171
|
}
|
|
61
172
|
return lines;
|
|
62
173
|
}
|
|
@@ -76,30 +187,25 @@ function generateContext(config) {
|
|
|
76
187
|
} else {
|
|
77
188
|
sections.push("_(No rules configured. Edit `viberails.config.json` to add rules.)_");
|
|
78
189
|
}
|
|
190
|
+
const packageLines = formatPackageOverrides(config);
|
|
191
|
+
if (packageLines.length > 0) {
|
|
192
|
+
sections.push("");
|
|
193
|
+
sections.push(packageLines.join("\n"));
|
|
194
|
+
}
|
|
79
195
|
const boundaryLines = formatBoundaryRules(config);
|
|
80
196
|
if (boundaryLines.length > 0) {
|
|
81
197
|
sections.push("");
|
|
82
198
|
sections.push(boundaryLines.join("\n"));
|
|
83
199
|
}
|
|
200
|
+
const setupLines = formatDevelopmentSetup(config);
|
|
201
|
+
if (setupLines.length > 0) {
|
|
202
|
+
sections.push("");
|
|
203
|
+
sections.push(setupLines.join("\n"));
|
|
204
|
+
}
|
|
84
205
|
sections.push("");
|
|
85
206
|
sections.push("Run `viberails check` before committing to catch violations early.\n");
|
|
86
207
|
return sections.join("\n");
|
|
87
208
|
}
|
|
88
|
-
function formatBoundaryRules(config) {
|
|
89
|
-
if (!config.rules.enforceBoundaries || !config.boundaries || config.boundaries.length === 0) {
|
|
90
|
-
return [];
|
|
91
|
-
}
|
|
92
|
-
const denyRules = config.boundaries.filter((r) => !r.allow);
|
|
93
|
-
if (denyRules.length === 0) return [];
|
|
94
|
-
const lines = [];
|
|
95
|
-
lines.push("## Boundary rules\n");
|
|
96
|
-
lines.push("These import boundaries are enforced:\n");
|
|
97
|
-
for (const rule of denyRules) {
|
|
98
|
-
const reason = rule.reason ? ` (${rule.reason})` : "";
|
|
99
|
-
lines.push(`- \`${rule.from}\` must NOT import from \`${rule.to}\`${reason}`);
|
|
100
|
-
}
|
|
101
|
-
return lines;
|
|
102
|
-
}
|
|
103
209
|
// Annotate the CommonJS export names for ESM import in node:
|
|
104
210
|
0 && (module.exports = {
|
|
105
211
|
generateContext
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/generate-context.ts"],"sourcesContent":["export { generateContext } from './generate-context.js';\n","import type { ConventionValue, ViberailsConfig } from '@viberails/types';\n\n/** Naming convention examples for directive formatting. */\nconst NAMING_EXAMPLES: Record<string, string> = {\n 'kebab-case': '`user-profile.ts`, not `UserProfile.ts`',\n camelCase: '`userProfile.ts`, not `user-profile.ts`',\n PascalCase: '`UserProfile.ts`, not `user-profile.ts`',\n snake_case: '`user_profile.ts`, not `UserProfile.ts`',\n};\n\n/**\n * Extract the effective value from a ConventionValue (string or object).\n */\nfunction conventionValue(cv: ConventionValue): string {\n return typeof cv === 'string' ? cv : cv.value;\n}\n\n/**\n * Build the list of enforced rules as markdown bullet points.\n */\nfunction formatEnforcedRules(config: ViberailsConfig): string[] {\n const { rules, conventions, structure } = config;\n const lines: string[] = [];\n\n if (rules.maxFileLines > 0) {\n lines.push(\n `- Files must not exceed **${rules.maxFileLines} lines**. Split into focused modules.`,\n );\n }\n\n if (rules.maxFunctionLines > 0) {\n lines.push(\n `- Functions must not exceed **${rules.maxFunctionLines} lines**. Extract helpers for complex logic.`,\n );\n }\n\n if (rules.enforceNaming && conventions.fileNaming) {\n const val = conventionValue(conventions.fileNaming);\n const examples = NAMING_EXAMPLES[val] ?? `e.g. \\`my-module.ts\\``;\n lines.push(`- Source files use **${val}**: ${examples}.`);\n }\n\n if (rules.requireTests && structure.testPattern) {\n const srcDir = structure.srcDir ?? 'src';\n lines.push(\n `- Every source file in \\`${srcDir}/\\` must have a corresponding \\`${structure.testPattern}\\` file.`,\n );\n }\n\n return lines;\n}\n\n/**\n * Generate a rules-focused context document from a ViberailsConfig.\n *\n * The output tells AI agents what rules are enforced and that commits\n * will fail if they are violated. It does not describe the project's\n * stack, structure, or architecture — that is trivially discoverable.\n *\n * @param config - The viberails configuration\n * @returns Markdown string for `.viberails/context.md`\n */\nexport function generateContext(config: ViberailsConfig): string {\n const sections: string[] = [];\n\n sections.push('# viberails enforced rules\\n');\n\n if (config.enforcement === 'enforce') {\n sections.push('Commits will be rejected if these rules are violated:\\n');\n } else {\n sections.push(\n 'These rules are checked before commits. Violations will be **warned** but not blocked:\\n',\n );\n }\n\n const ruleLines = formatEnforcedRules(config);\n if (ruleLines.length > 0) {\n sections.push(ruleLines.join('\\n'));\n } else {\n sections.push('_(No rules configured. Edit `viberails.config.json` to add rules.)_');\n }\n\n const boundaryLines = formatBoundaryRules(config);\n if (boundaryLines.length > 0) {\n sections.push('');\n sections.push(boundaryLines.join('\\n'));\n }\n\n sections.push('');\n sections.push('Run `viberails check` before committing to catch violations early.\\n');\n\n return sections.join('\\n');\n}\n\n/**\n * Build the boundary rules section as markdown lines.\n * Only includes deny rules (allow: false).\n */\nfunction formatBoundaryRules(config: ViberailsConfig): string[] {\n if (!config.rules.enforceBoundaries || !config.boundaries || config.boundaries.length === 0) {\n return [];\n }\n\n const denyRules = config.boundaries.filter((r) => !r.allow);\n if (denyRules.length === 0) return [];\n\n const lines: string[] = [];\n lines.push('## Boundary rules\\n');\n lines.push('These import boundaries are enforced:\\n');\n\n for (const rule of denyRules) {\n const reason = rule.reason ? ` (${rule.reason})` : '';\n lines.push(`- \\`${rule.from}\\` must NOT import from \\`${rule.to}\\`${reason}`);\n }\n\n return lines;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,IAAM,kBAA0C;AAAA,EAC9C,cAAc;AAAA,EACd,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,YAAY;AACd;AAKA,SAAS,gBAAgB,IAA6B;AACpD,SAAO,OAAO,OAAO,WAAW,KAAK,GAAG;AAC1C;AAKA,SAAS,oBAAoB,QAAmC;AAC9D,QAAM,EAAE,OAAO,aAAa,UAAU,IAAI;AAC1C,QAAM,QAAkB,CAAC;AAEzB,MAAI,MAAM,eAAe,GAAG;AAC1B,UAAM;AAAA,MACJ,6BAA6B,MAAM,YAAY;AAAA,IACjD;AAAA,EACF;AAEA,MAAI,MAAM,mBAAmB,GAAG;AAC9B,UAAM;AAAA,MACJ,iCAAiC,MAAM,gBAAgB;AAAA,IACzD;AAAA,EACF;AAEA,MAAI,MAAM,iBAAiB,YAAY,YAAY;AACjD,UAAM,MAAM,gBAAgB,YAAY,UAAU;AAClD,UAAM,WAAW,gBAAgB,GAAG,KAAK;AACzC,UAAM,KAAK,wBAAwB,GAAG,OAAO,QAAQ,GAAG;AAAA,EAC1D;AAEA,MAAI,MAAM,gBAAgB,UAAU,aAAa;AAC/C,UAAM,SAAS,UAAU,UAAU;AACnC,UAAM;AAAA,MACJ,4BAA4B,MAAM,mCAAmC,UAAU,WAAW;AAAA,IAC5F;AAAA,EACF;AAEA,SAAO;AACT;AAYO,SAAS,gBAAgB,QAAiC;AAC/D,QAAM,WAAqB,CAAC;AAE5B,WAAS,KAAK,8BAA8B;AAE5C,MAAI,OAAO,gBAAgB,WAAW;AACpC,aAAS,KAAK,yDAAyD;AAAA,EACzE,OAAO;AACL,aAAS;AAAA,MACP;AAAA,IACF;AAAA,EACF;AAEA,QAAM,YAAY,oBAAoB,MAAM;AAC5C,MAAI,UAAU,SAAS,GAAG;AACxB,aAAS,KAAK,UAAU,KAAK,IAAI,CAAC;AAAA,EACpC,OAAO;AACL,aAAS,KAAK,qEAAqE;AAAA,EACrF;AAEA,QAAM,gBAAgB,oBAAoB,MAAM;AAChD,MAAI,cAAc,SAAS,GAAG;AAC5B,aAAS,KAAK,EAAE;AAChB,aAAS,KAAK,cAAc,KAAK,IAAI,CAAC;AAAA,EACxC;AAEA,WAAS,KAAK,EAAE;AAChB,WAAS,KAAK,sEAAsE;AAEpF,SAAO,SAAS,KAAK,IAAI;AAC3B;AAMA,SAAS,oBAAoB,QAAmC;AAC9D,MAAI,CAAC,OAAO,MAAM,qBAAqB,CAAC,OAAO,cAAc,OAAO,WAAW,WAAW,GAAG;AAC3F,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,YAAY,OAAO,WAAW,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK;AAC1D,MAAI,UAAU,WAAW,EAAG,QAAO,CAAC;AAEpC,QAAM,QAAkB,CAAC;AACzB,QAAM,KAAK,qBAAqB;AAChC,QAAM,KAAK,yCAAyC;AAEpD,aAAW,QAAQ,WAAW;AAC5B,UAAM,SAAS,KAAK,SAAS,KAAK,KAAK,MAAM,MAAM;AACnD,UAAM,KAAK,OAAO,KAAK,IAAI,6BAA6B,KAAK,EAAE,KAAK,MAAM,EAAE;AAAA,EAC9E;AAEA,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/format-helpers.ts","../src/generate-context.ts"],"sourcesContent":["export { generateContext } from './generate-context.js';\n","import type { ConventionValue, PackageConfigOverrides, ViberailsConfig } from '@viberails/types';\n\n/** Naming convention examples for directive formatting. */\nexport const NAMING_EXAMPLES: Record<string, string> = {\n 'kebab-case': '`user-profile.ts`, not `UserProfile.ts`',\n camelCase: '`userProfile.ts`, not `user-profile.ts`',\n PascalCase: '`UserProfile.ts`, not `user-profile.ts`',\n snake_case: '`user_profile.ts`, not `UserProfile.ts`',\n};\n\n/**\n * Extract the effective value from a ConventionValue (string or object).\n */\nexport function conventionValue(cv: ConventionValue): string {\n return typeof cv === 'string' ? cv : cv.value;\n}\n\n/**\n * Build the \"Development setup\" section describing the project's\n * formatter and linter, with guidance on enabling format-on-save.\n */\nexport function formatDevelopmentSetup(config: ViberailsConfig): string[] {\n const { linter, formatter } = config.stack;\n if (!linter && !formatter) return [];\n\n const lines: string[] = [];\n lines.push('## Development setup\\n');\n\n const toolName = (id: string): string => {\n const name = id.split('@')[0];\n if (name === 'biome') return 'Biome';\n if (name === 'prettier') return 'Prettier';\n if (name === 'eslint') return 'ESLint';\n return name;\n };\n\n if (formatter && linter) {\n const fmt = toolName(formatter);\n const lint = toolName(linter);\n if (fmt === lint) {\n lines.push(`This project uses **${fmt}** for formatting and linting.\\n`);\n } else {\n lines.push(`This project uses **${fmt}** for formatting and **${lint}** for linting.\\n`);\n }\n } else if (formatter) {\n lines.push(`This project uses **${toolName(formatter)}** for formatting.\\n`);\n } else if (linter) {\n lines.push(`This project uses **${toolName(linter)}** for linting.\\n`);\n }\n\n lines.push('- Enable format-on-save in your editor to avoid lint failures on commit.');\n\n if (formatter) {\n const fmt = toolName(formatter);\n if (fmt === 'Biome') {\n lines.push(\n '- If using VS Code, install the [Biome extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome) and enable format-on-save.',\n );\n } else if (fmt === 'Prettier') {\n lines.push(\n '- If using VS Code, install the [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) and enable format-on-save.',\n );\n }\n }\n\n return lines;\n}\n\n/**\n * Build the header for a package override section.\n */\nexport function packageHeader(pkg: PackageConfigOverrides): string {\n const framework = pkg.stack?.framework;\n if (framework) {\n const name = typeof framework === 'string' ? framework.split('@')[0] : framework;\n return `### ${pkg.path} (${name})`;\n }\n return `### ${pkg.path}`;\n}\n\n/**\n * Build the per-package overrides section as markdown lines.\n */\nexport function formatPackageOverrides(config: ViberailsConfig): string[] {\n if (!config.packages || config.packages.length === 0) return [];\n\n const lines: string[] = [];\n lines.push('## Per-package rules\\n');\n lines.push('The following packages have rules that differ from the global defaults:\\n');\n\n for (const pkg of config.packages) {\n lines.push(packageHeader(pkg));\n\n if (pkg.conventions?.fileNaming) {\n const val = conventionValue(pkg.conventions.fileNaming);\n const examples = NAMING_EXAMPLES[val] ?? `e.g. \\`my-module.ts\\``;\n lines.push(`- Source files use **${val}**: ${examples}.`);\n }\n\n if (pkg.conventions?.componentNaming) {\n const val = conventionValue(pkg.conventions.componentNaming);\n lines.push(`- Components use **${val}** naming.`);\n }\n\n if (pkg.conventions?.hookNaming) {\n const val = conventionValue(pkg.conventions.hookNaming);\n lines.push(`- Hooks use **${val}** naming.`);\n }\n\n if (pkg.conventions?.importAlias) {\n const val = conventionValue(pkg.conventions.importAlias);\n lines.push(`- Import alias: \\`${val}\\`.`);\n }\n\n if (pkg.rules?.maxFileLines !== undefined && pkg.rules.maxFileLines > 0) {\n lines.push(\n `- Files must not exceed **${pkg.rules.maxFileLines} lines**. Split into focused modules.`,\n );\n }\n\n if (pkg.rules?.maxFunctionLines !== undefined && pkg.rules.maxFunctionLines > 0) {\n lines.push(\n `- Functions must not exceed **${pkg.rules.maxFunctionLines} lines**. Extract helpers for complex logic.`,\n );\n }\n }\n\n return lines;\n}\n\n/**\n * Build the boundary rules section as markdown lines.\n * Only includes deny rules (allow: false).\n */\nexport function formatBoundaryRules(config: ViberailsConfig): string[] {\n if (!config.rules.enforceBoundaries || !config.boundaries || config.boundaries.length === 0) {\n return [];\n }\n\n const denyRules = config.boundaries.filter((r) => !r.allow);\n if (denyRules.length === 0) return [];\n\n const lines: string[] = [];\n lines.push('## Boundary rules\\n');\n lines.push('These import boundaries are enforced:\\n');\n\n for (const rule of denyRules) {\n const reason = rule.reason ? ` (${rule.reason})` : '';\n lines.push(`- \\`${rule.from}\\` must NOT import from \\`${rule.to}\\`${reason}`);\n }\n\n return lines;\n}\n","import type { ViberailsConfig } from '@viberails/types';\nimport {\n conventionValue,\n formatBoundaryRules,\n formatDevelopmentSetup,\n formatPackageOverrides,\n NAMING_EXAMPLES,\n} from './format-helpers.js';\n\n/**\n * Build the list of enforced rules as markdown bullet points.\n */\nfunction formatEnforcedRules(config: ViberailsConfig): string[] {\n const { rules, conventions, structure } = config;\n const lines: string[] = [];\n\n if (rules.maxFileLines > 0) {\n lines.push(\n `- Files must not exceed **${rules.maxFileLines} lines**. Split into focused modules.`,\n );\n }\n\n if (rules.maxFunctionLines > 0) {\n lines.push(\n `- Functions must not exceed **${rules.maxFunctionLines} lines**. Extract helpers for complex logic.`,\n );\n }\n\n if (rules.enforceNaming && conventions.fileNaming) {\n const val = conventionValue(conventions.fileNaming);\n const examples = NAMING_EXAMPLES[val] ?? `e.g. \\`my-module.ts\\``;\n lines.push(`- Source files use **${val}**: ${examples}.`);\n }\n\n if (rules.requireTests && structure.testPattern) {\n if (structure.srcDir) {\n lines.push(\n `- Every source file in \\`${structure.srcDir}/\\` must have a corresponding \\`${structure.testPattern}\\` file.`,\n );\n } else {\n lines.push(\n `- Every source file must have a corresponding \\`${structure.testPattern}\\` file.`,\n );\n }\n }\n\n return lines;\n}\n\n/**\n * Generate a rules-focused context document from a ViberailsConfig.\n *\n * The output tells AI agents what rules are enforced and that commits\n * will fail if they are violated. It does not describe the project's\n * stack, structure, or architecture — that is trivially discoverable.\n *\n * @param config - The viberails configuration\n * @returns Markdown string for `.viberails/context.md`\n */\nexport function generateContext(config: ViberailsConfig): string {\n const sections: string[] = [];\n\n sections.push('# viberails enforced rules\\n');\n\n if (config.enforcement === 'enforce') {\n sections.push('Commits will be rejected if these rules are violated:\\n');\n } else {\n sections.push(\n 'These rules are checked before commits. Violations will be **warned** but not blocked:\\n',\n );\n }\n\n const ruleLines = formatEnforcedRules(config);\n if (ruleLines.length > 0) {\n sections.push(ruleLines.join('\\n'));\n } else {\n sections.push('_(No rules configured. Edit `viberails.config.json` to add rules.)_');\n }\n\n const packageLines = formatPackageOverrides(config);\n if (packageLines.length > 0) {\n sections.push('');\n sections.push(packageLines.join('\\n'));\n }\n\n const boundaryLines = formatBoundaryRules(config);\n if (boundaryLines.length > 0) {\n sections.push('');\n sections.push(boundaryLines.join('\\n'));\n }\n\n const setupLines = formatDevelopmentSetup(config);\n if (setupLines.length > 0) {\n sections.push('');\n sections.push(setupLines.join('\\n'));\n }\n\n sections.push('');\n sections.push('Run `viberails check` before committing to catch violations early.\\n');\n\n return sections.join('\\n');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGO,IAAM,kBAA0C;AAAA,EACrD,cAAc;AAAA,EACd,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,YAAY;AACd;AAKO,SAAS,gBAAgB,IAA6B;AAC3D,SAAO,OAAO,OAAO,WAAW,KAAK,GAAG;AAC1C;AAMO,SAAS,uBAAuB,QAAmC;AACxE,QAAM,EAAE,QAAQ,UAAU,IAAI,OAAO;AACrC,MAAI,CAAC,UAAU,CAAC,UAAW,QAAO,CAAC;AAEnC,QAAM,QAAkB,CAAC;AACzB,QAAM,KAAK,wBAAwB;AAEnC,QAAM,WAAW,CAAC,OAAuB;AACvC,UAAM,OAAO,GAAG,MAAM,GAAG,EAAE,CAAC;AAC5B,QAAI,SAAS,QAAS,QAAO;AAC7B,QAAI,SAAS,WAAY,QAAO;AAChC,QAAI,SAAS,SAAU,QAAO;AAC9B,WAAO;AAAA,EACT;AAEA,MAAI,aAAa,QAAQ;AACvB,UAAM,MAAM,SAAS,SAAS;AAC9B,UAAM,OAAO,SAAS,MAAM;AAC5B,QAAI,QAAQ,MAAM;AAChB,YAAM,KAAK,uBAAuB,GAAG;AAAA,CAAkC;AAAA,IACzE,OAAO;AACL,YAAM,KAAK,uBAAuB,GAAG,2BAA2B,IAAI;AAAA,CAAmB;AAAA,IACzF;AAAA,EACF,WAAW,WAAW;AACpB,UAAM,KAAK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AS,KAAK,EAAE;AAChB,aAAS,KAAK,WAAW,KAAK,IAAI,CAAC;AAAA,EACrC;AAEA,WAAS,KAAK,EAAE;AAChB,WAAS,KAAK,sEAAsE;AAEpF,SAAO,SAAS,KAAK,IAAI;AAC3B;","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/format-helpers.ts
|
|
2
2
|
var NAMING_EXAMPLES = {
|
|
3
3
|
"kebab-case": "`user-profile.ts`, not `UserProfile.ts`",
|
|
4
4
|
camelCase: "`userProfile.ts`, not `user-profile.ts`",
|
|
@@ -8,6 +8,112 @@ var NAMING_EXAMPLES = {
|
|
|
8
8
|
function conventionValue(cv) {
|
|
9
9
|
return typeof cv === "string" ? cv : cv.value;
|
|
10
10
|
}
|
|
11
|
+
function formatDevelopmentSetup(config) {
|
|
12
|
+
const { linter, formatter } = config.stack;
|
|
13
|
+
if (!linter && !formatter) return [];
|
|
14
|
+
const lines = [];
|
|
15
|
+
lines.push("## Development setup\n");
|
|
16
|
+
const toolName = (id) => {
|
|
17
|
+
const name = id.split("@")[0];
|
|
18
|
+
if (name === "biome") return "Biome";
|
|
19
|
+
if (name === "prettier") return "Prettier";
|
|
20
|
+
if (name === "eslint") return "ESLint";
|
|
21
|
+
return name;
|
|
22
|
+
};
|
|
23
|
+
if (formatter && linter) {
|
|
24
|
+
const fmt = toolName(formatter);
|
|
25
|
+
const lint = toolName(linter);
|
|
26
|
+
if (fmt === lint) {
|
|
27
|
+
lines.push(`This project uses **${fmt}** for formatting and linting.
|
|
28
|
+
`);
|
|
29
|
+
} else {
|
|
30
|
+
lines.push(`This project uses **${fmt}** for formatting and **${lint}** for linting.
|
|
31
|
+
`);
|
|
32
|
+
}
|
|
33
|
+
} else if (formatter) {
|
|
34
|
+
lines.push(`This project uses **${toolName(formatter)}** for formatting.
|
|
35
|
+
`);
|
|
36
|
+
} else if (linter) {
|
|
37
|
+
lines.push(`This project uses **${toolName(linter)}** for linting.
|
|
38
|
+
`);
|
|
39
|
+
}
|
|
40
|
+
lines.push("- Enable format-on-save in your editor to avoid lint failures on commit.");
|
|
41
|
+
if (formatter) {
|
|
42
|
+
const fmt = toolName(formatter);
|
|
43
|
+
if (fmt === "Biome") {
|
|
44
|
+
lines.push(
|
|
45
|
+
"- If using VS Code, install the [Biome extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome) and enable format-on-save."
|
|
46
|
+
);
|
|
47
|
+
} else if (fmt === "Prettier") {
|
|
48
|
+
lines.push(
|
|
49
|
+
"- If using VS Code, install the [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) and enable format-on-save."
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return lines;
|
|
54
|
+
}
|
|
55
|
+
function packageHeader(pkg) {
|
|
56
|
+
const framework = pkg.stack?.framework;
|
|
57
|
+
if (framework) {
|
|
58
|
+
const name = typeof framework === "string" ? framework.split("@")[0] : framework;
|
|
59
|
+
return `### ${pkg.path} (${name})`;
|
|
60
|
+
}
|
|
61
|
+
return `### ${pkg.path}`;
|
|
62
|
+
}
|
|
63
|
+
function formatPackageOverrides(config) {
|
|
64
|
+
if (!config.packages || config.packages.length === 0) return [];
|
|
65
|
+
const lines = [];
|
|
66
|
+
lines.push("## Per-package rules\n");
|
|
67
|
+
lines.push("The following packages have rules that differ from the global defaults:\n");
|
|
68
|
+
for (const pkg of config.packages) {
|
|
69
|
+
lines.push(packageHeader(pkg));
|
|
70
|
+
if (pkg.conventions?.fileNaming) {
|
|
71
|
+
const val = conventionValue(pkg.conventions.fileNaming);
|
|
72
|
+
const examples = NAMING_EXAMPLES[val] ?? `e.g. \`my-module.ts\``;
|
|
73
|
+
lines.push(`- Source files use **${val}**: ${examples}.`);
|
|
74
|
+
}
|
|
75
|
+
if (pkg.conventions?.componentNaming) {
|
|
76
|
+
const val = conventionValue(pkg.conventions.componentNaming);
|
|
77
|
+
lines.push(`- Components use **${val}** naming.`);
|
|
78
|
+
}
|
|
79
|
+
if (pkg.conventions?.hookNaming) {
|
|
80
|
+
const val = conventionValue(pkg.conventions.hookNaming);
|
|
81
|
+
lines.push(`- Hooks use **${val}** naming.`);
|
|
82
|
+
}
|
|
83
|
+
if (pkg.conventions?.importAlias) {
|
|
84
|
+
const val = conventionValue(pkg.conventions.importAlias);
|
|
85
|
+
lines.push(`- Import alias: \`${val}\`.`);
|
|
86
|
+
}
|
|
87
|
+
if (pkg.rules?.maxFileLines !== void 0 && pkg.rules.maxFileLines > 0) {
|
|
88
|
+
lines.push(
|
|
89
|
+
`- Files must not exceed **${pkg.rules.maxFileLines} lines**. Split into focused modules.`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
if (pkg.rules?.maxFunctionLines !== void 0 && pkg.rules.maxFunctionLines > 0) {
|
|
93
|
+
lines.push(
|
|
94
|
+
`- Functions must not exceed **${pkg.rules.maxFunctionLines} lines**. Extract helpers for complex logic.`
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return lines;
|
|
99
|
+
}
|
|
100
|
+
function formatBoundaryRules(config) {
|
|
101
|
+
if (!config.rules.enforceBoundaries || !config.boundaries || config.boundaries.length === 0) {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
const denyRules = config.boundaries.filter((r) => !r.allow);
|
|
105
|
+
if (denyRules.length === 0) return [];
|
|
106
|
+
const lines = [];
|
|
107
|
+
lines.push("## Boundary rules\n");
|
|
108
|
+
lines.push("These import boundaries are enforced:\n");
|
|
109
|
+
for (const rule of denyRules) {
|
|
110
|
+
const reason = rule.reason ? ` (${rule.reason})` : "";
|
|
111
|
+
lines.push(`- \`${rule.from}\` must NOT import from \`${rule.to}\`${reason}`);
|
|
112
|
+
}
|
|
113
|
+
return lines;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// src/generate-context.ts
|
|
11
117
|
function formatEnforcedRules(config) {
|
|
12
118
|
const { rules, conventions, structure } = config;
|
|
13
119
|
const lines = [];
|
|
@@ -27,10 +133,15 @@ function formatEnforcedRules(config) {
|
|
|
27
133
|
lines.push(`- Source files use **${val}**: ${examples}.`);
|
|
28
134
|
}
|
|
29
135
|
if (rules.requireTests && structure.testPattern) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
136
|
+
if (structure.srcDir) {
|
|
137
|
+
lines.push(
|
|
138
|
+
`- Every source file in \`${structure.srcDir}/\` must have a corresponding \`${structure.testPattern}\` file.`
|
|
139
|
+
);
|
|
140
|
+
} else {
|
|
141
|
+
lines.push(
|
|
142
|
+
`- Every source file must have a corresponding \`${structure.testPattern}\` file.`
|
|
143
|
+
);
|
|
144
|
+
}
|
|
34
145
|
}
|
|
35
146
|
return lines;
|
|
36
147
|
}
|
|
@@ -50,30 +161,25 @@ function generateContext(config) {
|
|
|
50
161
|
} else {
|
|
51
162
|
sections.push("_(No rules configured. Edit `viberails.config.json` to add rules.)_");
|
|
52
163
|
}
|
|
164
|
+
const packageLines = formatPackageOverrides(config);
|
|
165
|
+
if (packageLines.length > 0) {
|
|
166
|
+
sections.push("");
|
|
167
|
+
sections.push(packageLines.join("\n"));
|
|
168
|
+
}
|
|
53
169
|
const boundaryLines = formatBoundaryRules(config);
|
|
54
170
|
if (boundaryLines.length > 0) {
|
|
55
171
|
sections.push("");
|
|
56
172
|
sections.push(boundaryLines.join("\n"));
|
|
57
173
|
}
|
|
174
|
+
const setupLines = formatDevelopmentSetup(config);
|
|
175
|
+
if (setupLines.length > 0) {
|
|
176
|
+
sections.push("");
|
|
177
|
+
sections.push(setupLines.join("\n"));
|
|
178
|
+
}
|
|
58
179
|
sections.push("");
|
|
59
180
|
sections.push("Run `viberails check` before committing to catch violations early.\n");
|
|
60
181
|
return sections.join("\n");
|
|
61
182
|
}
|
|
62
|
-
function formatBoundaryRules(config) {
|
|
63
|
-
if (!config.rules.enforceBoundaries || !config.boundaries || config.boundaries.length === 0) {
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
const denyRules = config.boundaries.filter((r) => !r.allow);
|
|
67
|
-
if (denyRules.length === 0) return [];
|
|
68
|
-
const lines = [];
|
|
69
|
-
lines.push("## Boundary rules\n");
|
|
70
|
-
lines.push("These import boundaries are enforced:\n");
|
|
71
|
-
for (const rule of denyRules) {
|
|
72
|
-
const reason = rule.reason ? ` (${rule.reason})` : "";
|
|
73
|
-
lines.push(`- \`${rule.from}\` must NOT import from \`${rule.to}\`${reason}`);
|
|
74
|
-
}
|
|
75
|
-
return lines;
|
|
76
|
-
}
|
|
77
183
|
export {
|
|
78
184
|
generateContext
|
|
79
185
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/generate-context.ts"],"sourcesContent":["import type { ConventionValue, ViberailsConfig } from '@viberails/types';\n\n/** Naming convention examples for directive formatting. */\nconst NAMING_EXAMPLES: Record<string, string> = {\n 'kebab-case': '`user-profile.ts`, not `UserProfile.ts`',\n camelCase: '`userProfile.ts`, not `user-profile.ts`',\n PascalCase: '`UserProfile.ts`, not `user-profile.ts`',\n snake_case: '`user_profile.ts`, not `UserProfile.ts`',\n};\n\n/**\n * Extract the effective value from a ConventionValue (string or object).\n */\nfunction conventionValue(cv: ConventionValue): string {\n return typeof cv === 'string' ? cv : cv.value;\n}\n\n/**\n * Build the list of enforced rules as markdown bullet points.\n */\nfunction formatEnforcedRules(config: ViberailsConfig): string[] {\n const { rules, conventions, structure } = config;\n const lines: string[] = [];\n\n if (rules.maxFileLines > 0) {\n lines.push(\n `- Files must not exceed **${rules.maxFileLines} lines**. Split into focused modules.`,\n );\n }\n\n if (rules.maxFunctionLines > 0) {\n lines.push(\n `- Functions must not exceed **${rules.maxFunctionLines} lines**. Extract helpers for complex logic.`,\n );\n }\n\n if (rules.enforceNaming && conventions.fileNaming) {\n const val = conventionValue(conventions.fileNaming);\n const examples = NAMING_EXAMPLES[val] ?? `e.g. \\`my-module.ts\\``;\n lines.push(`- Source files use **${val}**: ${examples}.`);\n }\n\n if (rules.requireTests && structure.testPattern) {\n const srcDir = structure.srcDir ?? 'src';\n lines.push(\n `- Every source file in \\`${srcDir}/\\` must have a corresponding \\`${structure.testPattern}\\` file.`,\n );\n }\n\n return lines;\n}\n\n/**\n * Generate a rules-focused context document from a ViberailsConfig.\n *\n * The output tells AI agents what rules are enforced and that commits\n * will fail if they are violated. It does not describe the project's\n * stack, structure, or architecture — that is trivially discoverable.\n *\n * @param config - The viberails configuration\n * @returns Markdown string for `.viberails/context.md`\n */\nexport function generateContext(config: ViberailsConfig): string {\n const sections: string[] = [];\n\n sections.push('# viberails enforced rules\\n');\n\n if (config.enforcement === 'enforce') {\n sections.push('Commits will be rejected if these rules are violated:\\n');\n } else {\n sections.push(\n 'These rules are checked before commits. Violations will be **warned** but not blocked:\\n',\n );\n }\n\n const ruleLines = formatEnforcedRules(config);\n if (ruleLines.length > 0) {\n sections.push(ruleLines.join('\\n'));\n } else {\n sections.push('_(No rules configured. Edit `viberails.config.json` to add rules.)_');\n }\n\n const boundaryLines = formatBoundaryRules(config);\n if (boundaryLines.length > 0) {\n sections.push('');\n sections.push(boundaryLines.join('\\n'));\n }\n\n sections.push('');\n sections.push('Run `viberails check` before committing to catch violations early.\\n');\n\n return sections.join('\\n');\n}\n\n/**\n * Build the boundary rules section as markdown lines.\n * Only includes deny rules (allow: false).\n */\nfunction formatBoundaryRules(config: ViberailsConfig): string[] {\n if (!config.rules.enforceBoundaries || !config.boundaries || config.boundaries.length === 0) {\n return [];\n }\n\n const denyRules = config.boundaries.filter((r) => !r.allow);\n if (denyRules.length === 0) return [];\n\n const lines: string[] = [];\n lines.push('## Boundary rules\\n');\n lines.push('These import boundaries are enforced:\\n');\n\n for (const rule of denyRules) {\n const reason = rule.reason ? ` (${rule.reason})` : '';\n lines.push(`- \\`${rule.from}\\` must NOT import from \\`${rule.to}\\`${reason}`);\n }\n\n return lines;\n}\n"],"mappings":";AAGA,IAA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SAAS,GAAG;AAC5B,aAAS,KAAK,EAAE;AAChB,aAAS,KAAK,cAAc,KAAK,IAAI,CAAC;AAAA,EACxC;AAEA,WAAS,KAAK,EAAE;AAChB,WAAS,KAAK,sEAAsE;AAEpF,SAAO,SAAS,KAAK,IAAI;AAC3B;AAMA,SAAS,oBAAoB,QAAmC;AAC9D,MAAI,CAAC,OAAO,MAAM,qBAAqB,CAAC,OAAO,cAAc,OAAO,WAAW,WAAW,GAAG;AAC3F,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,YAAY,OAAO,WAAW,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK;AAC1D,MAAI,UAAU,WAAW,EAAG,QAAO,CAAC;AAEpC,QAAM,QAAkB,CAAC;AACzB,QAAM,KAAK,qBAAqB;AAChC,QAAM,KAAK,yCAAyC;AAEpD,aAAW,QAAQ,WAAW;AAC5B,UAAM,SAAS,KAAK,SAAS,KAAK,KAAK,MAAM,MAAM;AACnD,UAAM,KAAK,OAAO,KAAK,IAAI,6BAA6B,KAAK,EAAE,KAAK,MAAM,EAAE;AAAA,EAC9E;AAEA,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/format-helpers.ts","../src/generate-context.ts"],"sourcesContent":["import type { ConventionValue, PackageConfigOverrides, ViberailsConfig } from '@viberails/types';\n\n/** Naming convention examples for directive formatting. */\nexport const NAMING_EXAMPLES: Record<string, string> = {\n 'kebab-case': '`user-profile.ts`, not `UserProfile.ts`',\n camelCase: '`userProfile.ts`, not `user-profile.ts`',\n PascalCase: '`UserProfile.ts`, not `user-profile.ts`',\n snake_case: '`user_profile.ts`, not `UserProfile.ts`',\n};\n\n/**\n * Extract the effective value from a ConventionValue (string or object).\n */\nexport function conventionValue(cv: ConventionValue): string {\n return typeof cv === 'string' ? cv : cv.value;\n}\n\n/**\n * Build the \"Development setup\" section describing the project's\n * formatter and linter, with guidance on enabling format-on-save.\n */\nexport function formatDevelopmentSetup(config: ViberailsConfig): string[] {\n const { linter, formatter } = config.stack;\n if (!linter && !formatter) return [];\n\n const lines: string[] = [];\n lines.push('## Development setup\\n');\n\n const toolName = (id: string): string => {\n const name = id.split('@')[0];\n if (name === 'biome') return 'Biome';\n if (name === 'prettier') return 'Prettier';\n if (name === 'eslint') return 'ESLint';\n return name;\n };\n\n if (formatter && linter) {\n const fmt = toolName(formatter);\n const lint = toolName(linter);\n if (fmt === lint) {\n lines.push(`This project uses **${fmt}** for formatting and linting.\\n`);\n } else {\n lines.push(`This project uses **${fmt}** for formatting and **${lint}** for linting.\\n`);\n }\n } else if (formatter) {\n lines.push(`This project uses **${toolName(formatter)}** for formatting.\\n`);\n } else if (linter) {\n lines.push(`This project uses **${toolName(linter)}** for linting.\\n`);\n }\n\n lines.push('- Enable format-on-save in your editor to avoid lint failures on commit.');\n\n if (formatter) {\n const fmt = toolName(formatter);\n if (fmt === 'Biome') {\n lines.push(\n '- If using VS Code, install the [Biome extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome) and enable format-on-save.',\n );\n } else if (fmt === 'Prettier') {\n lines.push(\n '- If using VS Code, install the [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) and enable format-on-save.',\n );\n }\n }\n\n return lines;\n}\n\n/**\n * Build the header for a package override section.\n */\nexport function packageHeader(pkg: PackageConfigOverrides): string {\n const framework = pkg.stack?.framework;\n if (framework) {\n const name = typeof framework === 'string' ? framework.split('@')[0] : framework;\n return `### ${pkg.path} (${name})`;\n }\n return `### ${pkg.path}`;\n}\n\n/**\n * Build the per-package overrides section as markdown lines.\n */\nexport function formatPackageOverrides(config: ViberailsConfig): string[] {\n if (!config.packages || config.packages.length === 0) return [];\n\n const lines: string[] = [];\n lines.push('## Per-package rules\\n');\n lines.push('The following packages have rules that differ from the global defaults:\\n');\n\n for (const pkg of config.packages) {\n lines.push(packageHeader(pkg));\n\n if (pkg.conventions?.fileNaming) {\n const val = conventionValue(pkg.conventions.fileNaming);\n const examples = NAMING_EXAMPLES[val] ?? `e.g. \\`my-module.ts\\``;\n lines.push(`- Source files use **${val}**: ${examples}.`);\n }\n\n if (pkg.conventions?.componentNaming) {\n const val = conventionValue(pkg.conventions.componentNaming);\n lines.push(`- Components use **${val}** naming.`);\n }\n\n if (pkg.conventions?.hookNaming) {\n const val = conventionValue(pkg.conventions.hookNaming);\n lines.push(`- Hooks use **${val}** naming.`);\n }\n\n if (pkg.conventions?.importAlias) {\n const val = conventionValue(pkg.conventions.importAlias);\n lines.push(`- Import alias: \\`${val}\\`.`);\n }\n\n if (pkg.rules?.maxFileLines !== undefined && pkg.rules.maxFileLines > 0) {\n lines.push(\n `- Files must not exceed **${pkg.rules.maxFileLines} lines**. Split into focused modules.`,\n );\n }\n\n if (pkg.rules?.maxFunctionLines !== undefined && pkg.rules.maxFunctionLines > 0) {\n lines.push(\n `- Functions must not exceed **${pkg.rules.maxFunctionLines} lines**. Extract helpers for complex logic.`,\n );\n }\n }\n\n return lines;\n}\n\n/**\n * Build the boundary rules section as markdown lines.\n * Only includes deny rules (allow: false).\n */\nexport function formatBoundaryRules(config: ViberailsConfig): string[] {\n if (!config.rules.enforceBoundaries || !config.boundaries || config.boundaries.length === 0) {\n return [];\n }\n\n const denyRules = config.boundaries.filter((r) => !r.allow);\n if (denyRules.length === 0) return [];\n\n const lines: string[] = [];\n lines.push('## Boundary rules\\n');\n lines.push('These import boundaries are enforced:\\n');\n\n for (const rule of denyRules) {\n const reason = rule.reason ? ` (${rule.reason})` : '';\n lines.push(`- \\`${rule.from}\\` must NOT import from \\`${rule.to}\\`${reason}`);\n }\n\n return lines;\n}\n","import type { ViberailsConfig } from '@viberails/types';\nimport {\n conventionValue,\n formatBoundaryRules,\n formatDevelopmentSetup,\n formatPackageOverrides,\n NAMING_EXAMPLES,\n} from './format-helpers.js';\n\n/**\n * Build the list of enforced rules as markdown bullet points.\n */\nfunction formatEnforcedRules(config: ViberailsConfig): string[] {\n const { rules, conventions, structure } = config;\n const lines: string[] = [];\n\n if (rules.maxFileLines > 0) {\n lines.push(\n `- Files must not exceed **${rules.maxFileLines} lines**. Split into focused modules.`,\n );\n }\n\n if (rules.maxFunctionLines > 0) {\n lines.push(\n `- Functions must not exceed **${rules.maxFunctionLines} lines**. Extract helpers for complex logic.`,\n );\n }\n\n if (rules.enforceNaming && conventions.fileNaming) {\n const val = conventionValue(conventions.fileNaming);\n const examples = NAMING_EXAMPLES[val] ?? `e.g. \\`my-module.ts\\``;\n lines.push(`- Source files use **${val}**: ${examples}.`);\n }\n\n if (rules.requireTests && structure.testPattern) {\n if (structure.srcDir) {\n lines.push(\n `- Every source file in \\`${structure.srcDir}/\\` must have a corresponding \\`${structure.testPattern}\\` file.`,\n );\n } else {\n lines.push(\n `- Every source file must have a corresponding \\`${structure.testPattern}\\` file.`,\n );\n }\n }\n\n return lines;\n}\n\n/**\n * Generate a rules-focused context document from a ViberailsConfig.\n *\n * The output tells AI agents what rules are enforced and that commits\n * will fail if they are violated. It does not describe the project's\n * stack, structure, or architecture — that is trivially discoverable.\n *\n * @param config - The viberails configuration\n * @returns Markdown string for `.viberails/context.md`\n */\nexport function generateContext(config: ViberailsConfig): string {\n const sections: string[] = [];\n\n sections.push('# viberails enforced rules\\n');\n\n if (config.enforcement === 'enforce') {\n sections.push('Commits will be rejected if these rules are violated:\\n');\n } else {\n sections.push(\n 'These rules are checked before commits. Violations will be **warned** but not blocked:\\n',\n );\n }\n\n const ruleLines = formatEnforcedRules(config);\n if (ruleLines.length > 0) {\n sections.push(ruleLines.join('\\n'));\n } else {\n sections.push('_(No rules configured. Edit `viberails.config.json` to add rules.)_');\n }\n\n const packageLines = formatPackageOverrides(config);\n if (packageLines.length > 0) {\n sections.push('');\n sections.push(packageLines.join('\\n'));\n }\n\n const boundaryLines = formatBoundaryRules(config);\n if (boundaryLines.length > 0) {\n sections.push('');\n sections.push(boundaryLines.join('\\n'));\n }\n\n const setupLines = formatDevelopmentSetup(config);\n if (setupLines.length > 0) {\n sections.push('');\n sections.push(setupLines.join('\\n'));\n }\n\n sections.push('');\n sections.push('Run `viberails check` before committing to catch violations early.\\n');\n\n return sections.join('\\n');\n}\n"],"mappings":";AAGO,IAAM,kBAA0C;AAAA,EACrD,cAAc;AAAA,EACd,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,YAAY;AACd;AAKO,SAAS,gBAAgB,IAA6B;AAC3D,SAAO,OAAO,OAAO,WAAW,KAAK,GAAG;AAC1C;AAMO,SAAS,uBAAuB,QAAmC;AACxE,QAAM,EAAE,QAAQ,UAAU,IAAI,OAAO;AACrC,MAAI,CAAC,UAAU,CAAC,UAAW,QAAO,CAAC;AAEnC,QAAM,QAAkB,CAAC;AACzB,QAAM,KAAK,wBAAwB;AAEnC,QAAM,WAAW,CAAC,OAAuB;AACvC,UAAM,OAAO,GAAG,MAAM,GAAG,EAAE,CAAC;AAC5B,QAAI,SAAS,QAAS,QAAO;AAC7B,QAAI,SAAS,WAAY,QAAO;AAChC,QAAI,SAAS,SAAU,QAAO;AAC9B,WAAO;AAAA,EACT;AAEA,MAAI,aAAa,QAAQ;AACvB,UAAM,MAAM,SAAS,SAAS;AAC9B,UAAM,OAAO,SAAS,MAAM;AAC5B,QAAI,QAAQ,MAAM;AAChB,YAAM,KAAK,uBAAuB,GAAG;AAAA,CAAkC;AAAA,IACzE,OAAO;AACL,YAAM,KAAK,uBAAuB,GAAG,2BAA2B,IAAI;AAAA,CAAmB;AAAA,IACzF;AAAA,EACF,WAAW,WAAW;AACpB,UAAM,KAAK,uBAAuB,SAAS,SAAS,CAAC;AAAA,CAAsB;AAAA,EAC7E,WAAW,QAAQ;AACjB,UAAM,KAAK,uBAAuB,SAAS,MAAM,CAAC;AAAA,CAAmB;AAAA,EACvE;AAEA,QAAM,KAAK,0EAA0E;AAErF,MAAI,WAAW;AACb,UAAM,MAAM,SAAS,SAAS;AAC9B,QAAI,QAAQ,SAAS;AACnB,YAAM;AAAA,QACJ;AAAA,MACF;AAAA,IACF,WAAW,QAAQ,YAAY;AAC7B,YAAM;AAAA,Q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ACpB,YAAM;AAAA,QACJ,4BAA4B,UAAU,MAAM,mCAAmC,UAAU,WAAW;AAAA,MACtG;AAAA,IACF,OAAO;AACL,YAAM;AAAA,QACJ,mDAAmD,UAAU,WAAW;AAAA,MAC1E;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAYO,SAAS,gBAAgB,QAAiC;AAC/D,QAAM,WAAqB,CAAC;AAE5B,WAAS,KAAK,8BAA8B;AAE5C,MAAI,OAAO,gBAAgB,WAAW;AACpC,aAAS,KAAK,yDAAyD;AAAA,EACzE,OAAO;AACL,aAAS;AAAA,MACP;AAAA,IACF;AAAA,EACF;AAEA,QAAM,YAAY,oBAAoB,MAAM;AAC5C,MAAI,UAAU,SAAS,GAAG;AACxB,aAAS,KAAK,UAAU,KAAK,IAAI,CAAC;AAAA,EACpC,OAAO;AACL,aAAS,KAAK,qEAAqE;AAAA,EACrF;AAEA,QAAM,eAAe,uBAAuB,MAAM;AAClD,MAAI,aAAa,SAAS,GAAG;AAC3B,aAAS,KAAK,EAAE;AAChB,aAAS,KAAK,aAAa,KAAK,IAAI,CAAC;AAAA,EACvC;AAEA,QAAM,gBAAgB,oBAAoB,MAAM;AAChD,MAAI,cAAc,SAAS,GAAG;AAC5B,aAAS,KAAK,EAAE;AAChB,aAAS,KAAK,cAAc,KAAK,IAAI,CAAC;AAAA,EACxC;AAEA,QAAM,aAAa,uBAAuB,MAAM;AAChD,MAAI,WAAW,SAAS,GAAG;AACzB,aAAS,KAAK,EAAE;AAChB,aAAS,KAAK,WAAW,KAAK,IAAI,CAAC;AAAA,EACrC;AAEA,WAAS,KAAK,EAAE;AAChB,WAAS,KAAK,sEAAsE;AAEpF,SAAO,SAAS,KAAK,IAAI;AAC3B;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viberails/context",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "AI context file generation for viberails",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@viberails/types": "0.1
|
|
29
|
-
"@viberails/config": "0.1
|
|
28
|
+
"@viberails/types": "0.2.1",
|
|
29
|
+
"@viberails/config": "0.2.1"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "tsup",
|