@viberails/context 0.2.1 → 0.2.3
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 +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
VERSION: () => VERSION,
|
|
23
24
|
generateContext: () => generateContext
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -148,11 +149,6 @@ function formatEnforcedRules(config) {
|
|
|
148
149
|
`- Files must not exceed **${rules.maxFileLines} lines**. Split into focused modules.`
|
|
149
150
|
);
|
|
150
151
|
}
|
|
151
|
-
if (rules.maxFunctionLines > 0) {
|
|
152
|
-
lines.push(
|
|
153
|
-
`- Functions must not exceed **${rules.maxFunctionLines} lines**. Extract helpers for complex logic.`
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
152
|
if (rules.enforceNaming && conventions.fileNaming) {
|
|
157
153
|
const val = conventionValue(conventions.fileNaming);
|
|
158
154
|
const examples = NAMING_EXAMPLES[val] ?? `e.g. \`my-module.ts\``;
|
|
@@ -206,8 +202,12 @@ function generateContext(config) {
|
|
|
206
202
|
sections.push("Run `viberails check` before committing to catch violations early.\n");
|
|
207
203
|
return sections.join("\n");
|
|
208
204
|
}
|
|
205
|
+
|
|
206
|
+
// src/index.ts
|
|
207
|
+
var VERSION = "0.2.3";
|
|
209
208
|
// Annotate the CommonJS export names for ESM import in node:
|
|
210
209
|
0 && (module.exports = {
|
|
210
|
+
VERSION,
|
|
211
211
|
generateContext
|
|
212
212
|
});
|
|
213
213
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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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rF;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":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/format-helpers.ts","../src/generate-context.ts"],"sourcesContent":["declare const __PACKAGE_VERSION__: string;\nexport const VERSION: string = __PACKAGE_VERSION__;\n\nexport { 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.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;AAAA;;;ACGO,IAAM,kBAA0C;AAAA,EACrD,cAAc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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;;;AF9FO,IAAM,UAAkB;","names":[]}
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -122,11 +122,6 @@ function formatEnforcedRules(config) {
|
|
|
122
122
|
`- Files must not exceed **${rules.maxFileLines} lines**. Split into focused modules.`
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
|
-
if (rules.maxFunctionLines > 0) {
|
|
126
|
-
lines.push(
|
|
127
|
-
`- Functions must not exceed **${rules.maxFunctionLines} lines**. Extract helpers for complex logic.`
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
125
|
if (rules.enforceNaming && conventions.fileNaming) {
|
|
131
126
|
const val = conventionValue(conventions.fileNaming);
|
|
132
127
|
const examples = NAMING_EXAMPLES[val] ?? `e.g. \`my-module.ts\``;
|
|
@@ -180,7 +175,11 @@ function generateContext(config) {
|
|
|
180
175
|
sections.push("Run `viberails check` before committing to catch violations early.\n");
|
|
181
176
|
return sections.join("\n");
|
|
182
177
|
}
|
|
178
|
+
|
|
179
|
+
// src/index.ts
|
|
180
|
+
var VERSION = "0.2.3";
|
|
183
181
|
export {
|
|
182
|
+
VERSION,
|
|
184
183
|
generateContext
|
|
185
184
|
};
|
|
186
185
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,S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,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":[]}
|
|
1
|
+
{"version":3,"sources":["../src/format-helpers.ts","../src/generate-context.ts","../src/index.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.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","declare const __PACKAGE_VERSION__: string;\nexport const VERSION: string = __PACKAGE_VERSION__;\n\nexport { generateContext } from './generate-context.js';\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;A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.3",
|
|
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.2.
|
|
29
|
-
"@viberails/config": "0.2.
|
|
28
|
+
"@viberails/types": "0.2.3",
|
|
29
|
+
"@viberails/config": "0.2.3"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "tsup",
|