@titan-design/style-profile 0.2.0 → 0.4.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/README.md +19 -3
- package/dist/index.d.ts +17 -6
- package/dist/index.js +51 -44
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,9 +50,24 @@ for (const file of exportProfile(profile, "ruff")) {
|
|
|
50
50
|
| `editorconfig` | `.editorconfig` |
|
|
51
51
|
| `markdown` | `style-guide.md` |
|
|
52
52
|
| `claude-rules` | `.claude/rules/typescript.md` (none when no rule clears `info`) |
|
|
53
|
-
| `hooks` | `.claude/settings.json` |
|
|
53
|
+
| `hooks` | `.claude/codewatch-hooks.json` (a fragment to merge into `.claude/settings.json`) |
|
|
54
54
|
| `skill` | `skill.md`, `references/naming.md`, `references/patterns.md`, `references/per-language/<lang>.md` |
|
|
55
55
|
|
|
56
|
+
`exportProfile(profile, "hooks")` returns one file, `.claude/codewatch-hooks.json`. It is a
|
|
57
|
+
fragment in Claude Code's event-keyed hooks shape, not a whole settings file, so writing it
|
|
58
|
+
never replaces an existing `.claude/settings.json`. Append its `PostToolUse` entry to your
|
|
59
|
+
settings:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
jq -s '.[0].hooks.PostToolUse += .[1].hooks.PostToolUse | .[0]' \
|
|
63
|
+
.claude/settings.json .claude/codewatch-hooks.json > settings.tmp \
|
|
64
|
+
&& mv settings.tmp .claude/settings.json
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The hook fires after every `Write` or `Edit`. Claude Code passes the tool call as JSON on
|
|
68
|
+
stdin; the command reads `tool_input.file_path` from it with `jq` and runs
|
|
69
|
+
`codewatch check --fix <file>`, so both `jq` and `codewatch` must be on `PATH`.
|
|
70
|
+
|
|
56
71
|
Each format also has its own generator (`generateEslintExport`, `generateRuffExport`, and so
|
|
57
72
|
on). The rule builders in `eslint-rules` (`buildNamingConventionRule`,
|
|
58
73
|
`buildFunctionLengthRule`, `buildFileNamingRule`, `buildJsdocRules`, `buildImportOrderRule`)
|
|
@@ -64,8 +79,9 @@ out of the rule and reported there with a reason instead of making ESLint reject
|
|
|
64
79
|
|
|
65
80
|
## Provenance
|
|
66
81
|
|
|
67
|
-
Ported
|
|
68
|
-
|
|
82
|
+
Ported from codewatch's `@codewatch/profile`. Generated headers and the hooks command
|
|
83
|
+
still name `codewatch`. Every artifact except the hooks fragment is byte-identical to the
|
|
84
|
+
original's; the hooks export was rewritten to match Claude Code's settings schema.
|
|
69
85
|
|
|
70
86
|
The worked example and the gotchas live in the site's reference page,
|
|
71
87
|
`site/reference/style-profile.md`.
|
package/dist/index.d.ts
CHANGED
|
@@ -355,6 +355,11 @@ declare const PROFILE_CATEGORIES: readonly ["naming", "structure", "documentatio
|
|
|
355
355
|
type ProfileCategory = (typeof PROFILE_CATEGORIES)[number];
|
|
356
356
|
type Severity = "error" | "warn" | "info" | "off";
|
|
357
357
|
|
|
358
|
+
type EslintSeverity = "error" | "warn" | "off";
|
|
359
|
+
/** The one confidence ladder: a rule's profile tier, "off" below the info threshold. */
|
|
360
|
+
declare function severityForConfidence(confidence: number, thresholds?: SeverityThresholds): Severity;
|
|
361
|
+
declare function toEslintLevel(severity: Severity): EslintSeverity;
|
|
362
|
+
|
|
358
363
|
declare function readProfile(filePath: string): Promise<Profile>;
|
|
359
364
|
declare function writeProfile(filePath: string, profile: unknown): Promise<void>;
|
|
360
365
|
declare function validateProfile(data: unknown): zod.ZodSafeParseResult<{
|
|
@@ -563,19 +568,25 @@ declare function generateSkillFiles(profile: Profile): GeneratedFile[];
|
|
|
563
568
|
|
|
564
569
|
declare function generateClaudeRules(profile: Profile): GeneratedFile[];
|
|
565
570
|
|
|
566
|
-
interface
|
|
567
|
-
|
|
568
|
-
matcher: string;
|
|
571
|
+
interface ClaudeCommandHook {
|
|
572
|
+
type: "command";
|
|
569
573
|
command: string;
|
|
570
574
|
}
|
|
575
|
+
interface ClaudeHookMatcher {
|
|
576
|
+
matcher: string;
|
|
577
|
+
hooks: ClaudeCommandHook[];
|
|
578
|
+
}
|
|
571
579
|
interface ClaudeSettingsHooks {
|
|
572
|
-
hooks:
|
|
580
|
+
hooks: {
|
|
581
|
+
PostToolUse: ClaudeHookMatcher[];
|
|
582
|
+
};
|
|
573
583
|
}
|
|
574
584
|
declare function generateHooksConfig(_profile: Profile): ClaudeSettingsHooks;
|
|
575
585
|
|
|
576
586
|
declare function generateEslintExport(profile: Profile): GeneratedFile;
|
|
577
587
|
|
|
578
|
-
|
|
588
|
+
type EmittedEslintSeverity = "error" | "warn";
|
|
589
|
+
declare function toEslintSeverity(confidence: number, thresholds: SeverityThresholds): EmittedEslintSeverity | null;
|
|
579
590
|
declare function severityRank(s: Severity): number;
|
|
580
591
|
/** Same shape as style-checker's SkippedRule, so a consumer can forward it unchanged. */
|
|
581
592
|
interface EslintSkippedRule {
|
|
@@ -627,4 +638,4 @@ declare function getRulesForCategory(profile: Profile, category: string): RuleEn
|
|
|
627
638
|
declare function getRulesByCategory(profile: Profile): Map<string, RuleEntry[]>;
|
|
628
639
|
declare function detectLanguages(profile: Profile): string[];
|
|
629
640
|
|
|
630
|
-
export { DEFAULT_SEVERITY_THRESHOLDS, type EslintSkippedRule, ExampleSchema, type ExportFormat, type ExtractedRule, type Fixability, FixabilitySchema, type GeneratedFile, type NamingConventionResult, PROFILE_CATEGORIES, type Profile, type ProfileCategory, ProfileSchema, type RuleEntry, SCHEMA_VERSION, SUPPORTED_FORMATS, type Severity, type SeverityThresholds, type Stability, StabilitySchema, type StyleRule, StyleRuleSchema, buildFileNamingRule, buildFunctionLengthRule, buildImportOrderRule, buildJsdocRules, buildNamingConvention, buildNamingConventionRule, detectLanguages, exportProfile, extractAllRules, generateClaudeRules, generateEditorConfigExport, generateEslintExport, generateHooksConfig, generateMarkdownExport, generateRuffExport, generateSkillFiles, getRulesByCategory, getRulesForCategory, getTopRules, migrateProfile, readProfile, registerMigration, severityRank, toEslintSeverity, toTsEslintFormat, validateProfile, writeProfile };
|
|
641
|
+
export { DEFAULT_SEVERITY_THRESHOLDS, type EslintSeverity, type EslintSkippedRule, ExampleSchema, type ExportFormat, type ExtractedRule, type Fixability, FixabilitySchema, type GeneratedFile, type NamingConventionResult, PROFILE_CATEGORIES, type Profile, type ProfileCategory, ProfileSchema, type RuleEntry, SCHEMA_VERSION, SUPPORTED_FORMATS, type Severity, type SeverityThresholds, type Stability, StabilitySchema, type StyleRule, StyleRuleSchema, buildFileNamingRule, buildFunctionLengthRule, buildImportOrderRule, buildJsdocRules, buildNamingConvention, buildNamingConventionRule, detectLanguages, exportProfile, extractAllRules, generateClaudeRules, generateEditorConfigExport, generateEslintExport, generateHooksConfig, generateMarkdownExport, generateRuffExport, generateSkillFiles, getRulesByCategory, getRulesForCategory, getTopRules, migrateProfile, readProfile, registerMigration, severityForConfidence, severityRank, toEslintLevel, toEslintSeverity, toTsEslintFormat, validateProfile, writeProfile };
|
package/dist/index.js
CHANGED
|
@@ -92,6 +92,17 @@ var PROFILE_CATEGORIES = [
|
|
|
92
92
|
"patterns"
|
|
93
93
|
];
|
|
94
94
|
|
|
95
|
+
// src/schema/severity.ts
|
|
96
|
+
function severityForConfidence(confidence, thresholds = DEFAULT_SEVERITY_THRESHOLDS) {
|
|
97
|
+
if (confidence >= thresholds.error) return "error";
|
|
98
|
+
if (confidence >= thresholds.warn) return "warn";
|
|
99
|
+
if (confidence >= thresholds.info) return "info";
|
|
100
|
+
return "off";
|
|
101
|
+
}
|
|
102
|
+
function toEslintLevel(severity) {
|
|
103
|
+
return severity === "info" ? "warn" : severity;
|
|
104
|
+
}
|
|
105
|
+
|
|
95
106
|
// src/io.ts
|
|
96
107
|
import * as fs from "fs/promises";
|
|
97
108
|
async function readProfile(filePath) {
|
|
@@ -162,9 +173,11 @@ function extractAllRules(profile) {
|
|
|
162
173
|
}
|
|
163
174
|
return rules;
|
|
164
175
|
}
|
|
176
|
+
function tierOf(profile, rule) {
|
|
177
|
+
return severityForConfidence(rule.confidence, profile.severityThresholds);
|
|
178
|
+
}
|
|
165
179
|
function getTopRules(profile, count = 8) {
|
|
166
|
-
|
|
167
|
-
return extractAllRules(profile).filter((r) => r.confidence >= errorThreshold).sort((a, b) => b.confidence - a.confidence).slice(0, count);
|
|
180
|
+
return extractAllRules(profile).filter((r) => tierOf(profile, r) === "error").sort((a, b) => b.confidence - a.confidence).slice(0, count);
|
|
168
181
|
}
|
|
169
182
|
function getRulesForCategory(profile, category) {
|
|
170
183
|
return extractAllRules(profile).filter((r) => r.category === category);
|
|
@@ -180,21 +193,16 @@ function getRulesByCategory(profile) {
|
|
|
180
193
|
}
|
|
181
194
|
var byConfidence = (a, b) => b.confidence - a.confidence;
|
|
182
195
|
function getRulesByTier(profile) {
|
|
183
|
-
const allRules = extractAllRules(profile);
|
|
184
|
-
const errorThreshold = profile.severityThresholds?.error ?? 0.85;
|
|
185
|
-
const warnThreshold = profile.severityThresholds?.warn ?? 0.6;
|
|
186
|
-
const infoThreshold = profile.severityThresholds?.info ?? 0.4;
|
|
187
196
|
const critical = [];
|
|
188
197
|
const strong = [];
|
|
189
198
|
const preferred = [];
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
199
|
+
const buckets = {
|
|
200
|
+
error: critical,
|
|
201
|
+
warn: strong,
|
|
202
|
+
info: preferred
|
|
203
|
+
};
|
|
204
|
+
for (const rule of extractAllRules(profile)) {
|
|
205
|
+
buckets[tierOf(profile, rule)]?.push(rule);
|
|
198
206
|
}
|
|
199
207
|
critical.sort(byConfidence);
|
|
200
208
|
strong.sort(byConfidence);
|
|
@@ -377,10 +385,7 @@ function formatBody(author, rules) {
|
|
|
377
385
|
function generateClaudeRules(profile) {
|
|
378
386
|
const files = [];
|
|
379
387
|
const allRules = extractAllRules(profile);
|
|
380
|
-
const
|
|
381
|
-
const eligibleRules = allRules.filter(
|
|
382
|
-
(r) => r.confidence >= infoThreshold
|
|
383
|
-
);
|
|
388
|
+
const eligibleRules = allRules.filter((r) => tierOf(profile, r) !== "off");
|
|
384
389
|
if (eligibleRules.length > 0) {
|
|
385
390
|
const frontmatter = formatFrontmatter(
|
|
386
391
|
["**/*.ts", "**/*.tsx"],
|
|
@@ -395,29 +400,24 @@ function generateClaudeRules(profile) {
|
|
|
395
400
|
}
|
|
396
401
|
|
|
397
402
|
// src/exporters/hooks.ts
|
|
403
|
+
var CHECK_EDITED_FILE = `f=$(jq -r '.tool_input.file_path // empty'); [ -z "$f" ] || codewatch check --fix "$f"`;
|
|
398
404
|
function generateHooksConfig(_profile) {
|
|
399
405
|
return {
|
|
400
|
-
hooks:
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
matcher: "Edit",
|
|
409
|
-
command: "codewatch diff --fix $TOOL_INPUT_FILE_PATH"
|
|
410
|
-
}
|
|
411
|
-
]
|
|
406
|
+
hooks: {
|
|
407
|
+
PostToolUse: [
|
|
408
|
+
{
|
|
409
|
+
matcher: "Write|Edit",
|
|
410
|
+
hooks: [{ type: "command", command: CHECK_EDITED_FILE }]
|
|
411
|
+
}
|
|
412
|
+
]
|
|
413
|
+
}
|
|
412
414
|
};
|
|
413
415
|
}
|
|
414
416
|
|
|
415
417
|
// src/exporters/eslint-rules.ts
|
|
416
418
|
function toEslintSeverity(confidence, thresholds) {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
if (confidence >= thresholds.info) return "info";
|
|
420
|
-
return null;
|
|
419
|
+
const level = toEslintLevel(severityForConfidence(confidence, thresholds));
|
|
420
|
+
return level === "off" ? null : level;
|
|
421
421
|
}
|
|
422
422
|
function severityRank(s) {
|
|
423
423
|
return s === "error" ? 3 : s === "warn" ? 2 : 1;
|
|
@@ -428,6 +428,9 @@ var NAMING_SELECTORS = {
|
|
|
428
428
|
types: "typeLike",
|
|
429
429
|
constants: "variable"
|
|
430
430
|
};
|
|
431
|
+
var NAMING_MODIFIERS = {
|
|
432
|
+
constants: ["const", "global"]
|
|
433
|
+
};
|
|
431
434
|
function eslintExtensionOptions(rule) {
|
|
432
435
|
const eslintExt = rule.extensions?.eslint;
|
|
433
436
|
return eslintExt && typeof eslintExt === "object" && "options" in eslintExt && Array.isArray(eslintExt.options) ? eslintExt.options : void 0;
|
|
@@ -459,18 +462,22 @@ function namingSelectors(key, rule, selectorName, skipped) {
|
|
|
459
462
|
const eslintOptions = eslintExtensionOptions(rule);
|
|
460
463
|
if (eslintOptions) return eslintOptions;
|
|
461
464
|
const format = typeof rule.convention === "string" ? toTsEslintFormat(rule.convention) : null;
|
|
462
|
-
if (format)
|
|
463
|
-
|
|
464
|
-
|
|
465
|
+
if (!format) {
|
|
466
|
+
skipped.push(skippedNaming(key, rule.convention));
|
|
467
|
+
return [];
|
|
468
|
+
}
|
|
469
|
+
const modifiers = NAMING_MODIFIERS[key];
|
|
470
|
+
return [{ selector: selectorName, format: [format], ...modifiers ? { modifiers } : {} }];
|
|
465
471
|
}
|
|
466
472
|
function buildNamingConvention(profile) {
|
|
467
473
|
const thresholds = profile.severityThresholds;
|
|
468
474
|
const selectors = [];
|
|
469
475
|
const skippedRules = [];
|
|
470
476
|
let maxSeverity = null;
|
|
471
|
-
for (const
|
|
477
|
+
for (const key of Object.keys(NAMING_SELECTORS)) {
|
|
478
|
+
const rule = profile.naming?.[key];
|
|
479
|
+
if (!rule) continue;
|
|
472
480
|
const selectorName = NAMING_SELECTORS[key];
|
|
473
|
-
if (!selectorName) continue;
|
|
474
481
|
const severity = toEslintSeverity(rule.confidence, thresholds);
|
|
475
482
|
if (!severity) continue;
|
|
476
483
|
const ruleSelectors = namingSelectors(key, rule, selectorName, skippedRules);
|
|
@@ -552,7 +559,7 @@ function extensionEntry(rule, thresholds) {
|
|
|
552
559
|
return {
|
|
553
560
|
plugin,
|
|
554
561
|
rule: ext.rule,
|
|
555
|
-
severity: sev
|
|
562
|
+
severity: sev,
|
|
556
563
|
options: ext.options
|
|
557
564
|
};
|
|
558
565
|
}
|
|
@@ -573,12 +580,10 @@ function addImportOrderRule(profile, entries) {
|
|
|
573
580
|
if (!result) return;
|
|
574
581
|
const [ruleName, ruleConfig] = result;
|
|
575
582
|
const configArray = ruleConfig;
|
|
576
|
-
const severity = configArray[0];
|
|
577
|
-
if (severity === "info") return;
|
|
578
583
|
entries.push({
|
|
579
584
|
plugin: "perfectionist",
|
|
580
585
|
rule: ruleName,
|
|
581
|
-
severity,
|
|
586
|
+
severity: configArray[0],
|
|
582
587
|
options: [configArray[1]]
|
|
583
588
|
});
|
|
584
589
|
}
|
|
@@ -932,7 +937,7 @@ function hooksFiles(profile) {
|
|
|
932
937
|
const config = generateHooksConfig(profile);
|
|
933
938
|
return [
|
|
934
939
|
{
|
|
935
|
-
path: ".claude/
|
|
940
|
+
path: ".claude/codewatch-hooks.json",
|
|
936
941
|
content: JSON.stringify(config, null, 2)
|
|
937
942
|
}
|
|
938
943
|
];
|
|
@@ -991,7 +996,9 @@ export {
|
|
|
991
996
|
migrateProfile,
|
|
992
997
|
readProfile,
|
|
993
998
|
registerMigration,
|
|
999
|
+
severityForConfidence,
|
|
994
1000
|
severityRank,
|
|
1001
|
+
toEslintLevel,
|
|
995
1002
|
toEslintSeverity,
|
|
996
1003
|
toTsEslintFormat,
|
|
997
1004
|
validateProfile,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schema/style-rule.ts","../src/schema/profile.ts","../src/io.ts","../src/migrations/registry.ts","../src/migrations/migrate-profile.ts","../src/exporters/template-helpers.ts","../src/exporters/templates.ts","../src/exporters/skill.ts","../src/exporters/claude-rules.ts","../src/exporters/hooks.ts","../src/exporters/eslint-rules.ts","../src/exporters/eslint.ts","../src/exporters/ruff.ts","../src/exporters/markdown.ts","../src/exporters/editorconfig.ts","../src/exporters/export-index.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const ExampleSchema = z.object({\n good: z.string().optional(),\n bad: z.string().optional(),\n source: z.string().optional(),\n});\n\nexport const StabilitySchema = z.enum([\"high\", \"medium\", \"low\"]);\n\nexport const FixabilitySchema = z.enum([\n \"safe\",\n \"maybe-incorrect\",\n \"requires-input\",\n \"not-fixable\",\n]);\n\nexport const StyleRuleSchema = z.object({\n convention: z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.array(z.string()),\n ]),\n confidence: z.number().min(0).max(1),\n stability: StabilitySchema.optional(),\n fixability: FixabilitySchema.optional(),\n description: z.string().optional(),\n examples: z.array(ExampleSchema).optional(),\n extensions: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport type StyleRule = z.infer<typeof StyleRuleSchema>;\nexport type Stability = z.infer<typeof StabilitySchema>;\nexport type Fixability = z.infer<typeof FixabilitySchema>;\n","import { z } from \"zod\";\nimport { StyleRuleSchema } from \"./style-rule.js\";\n\nexport const SCHEMA_VERSION = \"1.0.0\";\n\nconst CategorySchema = z.record(z.string(), StyleRuleSchema);\n\nconst IdiomSchema = z.object({\n name: z.string(),\n description: z.string(),\n frequency: z.number(),\n confidence: z.number().min(0).max(1),\n example: z.string().optional(),\n});\n\nconst AntiPatternSchema = z.object({\n pattern: z.string(),\n reason: z.string(),\n deprecated: z.boolean().optional(),\n});\n\nconst OverrideSchema = z.object({\n files: z.array(z.string()),\n naming: CategorySchema.optional(),\n structure: CategorySchema.optional(),\n documentation: CategorySchema.optional(),\n errorHandling: CategorySchema.optional(),\n formatting: CategorySchema.optional(),\n patterns: CategorySchema.optional(),\n});\n\nconst SeverityThresholdsSchema = z.object({\n error: z.number().min(0).max(1),\n warn: z.number().min(0).max(1),\n info: z.number().min(0).max(1),\n});\n\nexport const DEFAULT_SEVERITY_THRESHOLDS = {\n error: 0.85,\n warn: 0.60,\n info: 0.40,\n} as const;\n\nexport const ProfileSchema = z.object({\n $schema: z.string().optional(),\n schemaVersion: z.string(),\n author: z.string(),\n generated: z.string(),\n sources: z.array(z.string()),\n\n naming: CategorySchema,\n structure: CategorySchema,\n documentation: CategorySchema,\n errorHandling: CategorySchema,\n formatting: CategorySchema,\n patterns: CategorySchema,\n\n idioms: z.object({\n detected: z.array(IdiomSchema),\n }),\n\n antiPatterns: z.object({\n acknowledged: z.array(AntiPatternSchema),\n }),\n\n overrides: z.array(OverrideSchema),\n\n severityThresholds: SeverityThresholdsSchema.default(DEFAULT_SEVERITY_THRESHOLDS),\n});\n\nexport type Profile = z.infer<typeof ProfileSchema>;\nexport type SeverityThresholds = z.infer<typeof SeverityThresholdsSchema>;\n\nexport const PROFILE_CATEGORIES = [\n \"naming\",\n \"structure\",\n \"documentation\",\n \"errorHandling\",\n \"formatting\",\n \"patterns\",\n] as const;\n\nexport type ProfileCategory = (typeof PROFILE_CATEGORIES)[number];\n\nexport type Severity = \"error\" | \"warn\" | \"info\" | \"off\";\n","import * as fs from \"node:fs/promises\";\nimport { ProfileSchema, type Profile } from \"./schema/profile.js\";\n\nexport async function readProfile(filePath: string): Promise<Profile> {\n const raw = await fs.readFile(filePath, \"utf-8\");\n const json: unknown = JSON.parse(raw);\n return ProfileSchema.parse(json);\n}\n\nexport async function writeProfile(\n filePath: string,\n profile: unknown,\n): Promise<void> {\n const validated = ProfileSchema.parse(profile);\n await fs.writeFile(filePath, JSON.stringify(validated, null, 2) + \"\\n\");\n}\n\nexport function validateProfile(data: unknown) {\n return ProfileSchema.safeParse(data);\n}\n","export interface Migration {\n from: string;\n to: string;\n migrate: (profile: Record<string, unknown>) => Record<string, unknown>;\n}\n\nconst migrations: Migration[] = [];\n\nexport function registerMigration(migration: Migration): void {\n migrations.push(migration);\n migrations.sort((a, b) => a.from.localeCompare(b.from));\n}\n\nexport function getMigrations(): ReadonlyArray<Migration> {\n return migrations;\n}\n\nexport function clearMigrations(): void {\n migrations.length = 0;\n}\n","import { SCHEMA_VERSION } from \"../schema/profile.js\";\nimport { getMigrations, registerMigration, clearMigrations } from \"./registry.js\";\n\nexport { registerMigration, clearMigrations };\n\nexport function migrateProfile(\n profile: Record<string, unknown>,\n): Record<string, unknown> {\n let current = { ...profile };\n const version = current.schemaVersion as string;\n\n if (version === SCHEMA_VERSION) {\n return current;\n }\n\n const migrations = getMigrations();\n let currentVersion = version;\n\n for (const migration of migrations) {\n if (migration.from === currentVersion) {\n current = migration.migrate(current);\n currentVersion = migration.to;\n }\n }\n\n if (currentVersion !== SCHEMA_VERSION) {\n throw new Error(\n `No migration path from version ${version} to ${SCHEMA_VERSION}`,\n );\n }\n\n return current;\n}\n","import { PROFILE_CATEGORIES, type Profile } from \"../schema/profile.js\";\n\nexport interface RuleEntry {\n category: string;\n name: string;\n convention: unknown;\n confidence: number;\n stability?: string;\n description?: string;\n examples?: Array<{ good?: string; bad?: string; source?: string }>;\n extensions?: Record<string, unknown>;\n}\n\nexport type ExtractedRule = RuleEntry;\n\nexport function extractAllRules(profile: Profile): RuleEntry[] {\n const rules: RuleEntry[] = [];\n\n for (const category of PROFILE_CATEGORIES) {\n const section = profile[category];\n if (!section || typeof section !== \"object\") continue;\n\n for (const [name, rule] of Object.entries(section)) {\n if (!rule || typeof rule !== \"object\") continue;\n rules.push({\n category,\n name,\n convention: rule.convention,\n confidence: rule.confidence,\n stability: rule.stability,\n description: rule.description,\n examples: rule.examples,\n extensions: rule.extensions,\n });\n }\n }\n\n return rules;\n}\n\nexport function getTopRules(\n profile: Profile,\n count: number = 8,\n): RuleEntry[] {\n const errorThreshold = profile.severityThresholds?.error ?? 0.85;\n return extractAllRules(profile)\n .filter((r) => r.confidence >= errorThreshold)\n .sort((a, b) => b.confidence - a.confidence)\n .slice(0, count);\n}\n\nexport function getRulesForCategory(\n profile: Profile,\n category: string,\n): RuleEntry[] {\n return extractAllRules(profile).filter((r) => r.category === category);\n}\n\nexport function getRulesByCategory(\n profile: Profile,\n): Map<string, RuleEntry[]> {\n const grouped = new Map<string, RuleEntry[]>();\n for (const rule of extractAllRules(profile)) {\n const existing = grouped.get(rule.category) ?? [];\n existing.push(rule);\n grouped.set(rule.category, existing);\n }\n return grouped;\n}\n\nconst byConfidence = (a: RuleEntry, b: RuleEntry) =>\n b.confidence - a.confidence;\n\nexport function getRulesByTier(profile: Profile): {\n critical: RuleEntry[];\n strong: RuleEntry[];\n preferred: RuleEntry[];\n} {\n const allRules = extractAllRules(profile);\n const errorThreshold = profile.severityThresholds?.error ?? 0.85;\n const warnThreshold = profile.severityThresholds?.warn ?? 0.60;\n const infoThreshold = profile.severityThresholds?.info ?? 0.40;\n\n const critical: RuleEntry[] = [];\n const strong: RuleEntry[] = [];\n const preferred: RuleEntry[] = [];\n\n for (const rule of allRules) {\n if (rule.confidence >= errorThreshold) {\n critical.push(rule);\n } else if (rule.confidence >= warnThreshold) {\n strong.push(rule);\n } else if (rule.confidence >= infoThreshold) {\n preferred.push(rule);\n }\n }\n\n critical.sort(byConfidence);\n strong.sort(byConfidence);\n preferred.sort(byConfidence);\n\n return { critical, strong, preferred };\n}\n\nexport function readableConvention(rule: RuleEntry): string {\n if (\n typeof rule.convention === \"boolean\" ||\n typeof rule.convention === \"number\"\n ) {\n return rule.description ?? JSON.stringify(rule.convention);\n }\n if (Array.isArray(rule.convention)) {\n return rule.convention.join(\" → \");\n }\n return String(rule.convention);\n}\n\nexport function detectLanguages(profile: Profile): string[] {\n const langs: string[] = [];\n const hasTypescriptSignals =\n Object.keys(profile.naming).length > 0 ||\n Object.keys(profile.structure).length > 0;\n if (hasTypescriptSignals) langs.push(\"typescript\");\n return langs.length > 0 ? langs : [\"typescript\"];\n}\n","import Handlebars from \"handlebars\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n// tsup bundles into dist/index.js while tests load src/exporters, so the package root sits at different depths.\nfunction findPackageRoot(start: string): string {\n let dir = start;\n while (!existsSync(join(dir, \"package.json\"))) {\n const parent = dirname(dir);\n if (parent === dir) throw new Error(`style-profile package root not found above ${start}`);\n dir = parent;\n }\n return dir;\n}\n\nexport function loadTemplate(name: string): Handlebars.TemplateDelegate {\n const root = findPackageRoot(dirname(fileURLToPath(import.meta.url)));\n const source = readFileSync(join(root, \"templates\", name), \"utf-8\");\n return Handlebars.compile(source);\n}\n","import type { Profile } from \"../schema/profile.js\";\nimport type { GeneratedFile } from \"./types.js\";\nimport {\n getRulesByTier,\n readableConvention,\n detectLanguages,\n} from \"./template-helpers.js\";\nimport type { RuleEntry } from \"./template-helpers.js\";\nimport { loadTemplate } from \"./templates.js\";\n\nfunction buildTieredRulesContext(profile: Profile) {\n const tiers = getRulesByTier(profile);\n\n const mapRule = (r: RuleEntry) => ({\n name: `${r.category}.${r.name}`,\n readableConvention: readableConvention(r),\n confidencePercent: (r.confidence * 100).toFixed(0),\n });\n\n return {\n criticalRules: tiers.critical.map(mapRule),\n strongRules: tiers.strong.map(mapRule),\n preferredRules: tiers.preferred.map(mapRule),\n };\n}\n\nfunction buildNamingContext(profile: Profile) {\n const section = profile.naming;\n return Object.entries(section).map(([name, rule]) => ({\n label: name.charAt(0).toUpperCase() + name.slice(1),\n convention:\n typeof rule.convention === \"string\"\n ? rule.convention\n : JSON.stringify(rule.convention),\n confidencePercent: (rule.confidence * 100).toFixed(0),\n stability: rule.stability,\n fixability: rule.fixability,\n description: rule.description,\n examples: rule.examples,\n }));\n}\n\nfunction buildPatternsContext(profile: Profile) {\n const section = profile.patterns;\n const patternRules = Object.entries(section).map(([name, rule]) => ({\n name,\n strength:\n typeof rule.convention === \"string\" ? rule.convention : \"detected\",\n confidencePercent: (rule.confidence * 100).toFixed(0),\n description: rule.description,\n fixability: rule.fixability,\n examples: rule.examples,\n }));\n\n const preferredPatterns = profile.structure?.preferredPatterns;\n let preferredList: string[] | undefined;\n if (preferredPatterns && Array.isArray(preferredPatterns.convention)) {\n preferredList = preferredPatterns.convention as string[];\n }\n\n return { patterns: patternRules, preferredPatterns: preferredList };\n}\n\nfunction buildIdiomsContext(profile: Profile) {\n return profile.idioms.detected.map((idiom) => ({\n name: idiom.name,\n description: idiom.description,\n example: idiom.example,\n }));\n}\n\nfunction buildAntiPatternsContext(profile: Profile) {\n return profile.antiPatterns.acknowledged.map((ap) => ({\n pattern: ap.pattern,\n reason: ap.reason,\n }));\n}\n\nfunction buildLanguageContext(profile: Profile, lang: string) {\n const tiers = getRulesByTier(profile);\n const mapRule = (r: RuleEntry) => ({\n category: r.category,\n name: r.name,\n convention:\n typeof r.convention === \"string\"\n ? r.convention\n : JSON.stringify(r.convention),\n confidencePercent: (r.confidence * 100).toFixed(0),\n readableConvention: readableConvention(r),\n description: r.description,\n });\n\n return {\n language: lang.charAt(0).toUpperCase() + lang.slice(1),\n criticalRules: tiers.critical.map(mapRule),\n strongRules: tiers.strong.map(mapRule),\n preferredRules: tiers.preferred.map(mapRule),\n };\n}\n\nfunction renderSkillFile(profile: Profile, languages: string[]): GeneratedFile {\n const skillTemplate = loadTemplate(\"skill.md.hbs\");\n const idioms = buildIdiomsContext(profile);\n const antiPatterns = buildAntiPatternsContext(profile);\n return {\n path: \"skill.md\",\n content: skillTemplate({\n author: profile.author,\n ...buildTieredRulesContext(profile),\n languages,\n idioms: idioms.length > 0 ? idioms : undefined,\n antiPatterns: antiPatterns.length > 0 ? antiPatterns : undefined,\n }),\n };\n}\n\nexport function generateSkillFiles(profile: Profile): GeneratedFile[] {\n const files: GeneratedFile[] = [];\n const languages = detectLanguages(profile);\n\n files.push(renderSkillFile(profile, languages));\n\n const namingTemplate = loadTemplate(\"naming.md.hbs\");\n files.push({\n path: \"references/naming.md\",\n content: namingTemplate({ rules: buildNamingContext(profile) }),\n });\n\n const patternsTemplate = loadTemplate(\"patterns.md.hbs\");\n files.push({\n path: \"references/patterns.md\",\n content: patternsTemplate(buildPatternsContext(profile)),\n });\n\n const langTemplate = loadTemplate(\"per-language.md.hbs\");\n for (const lang of languages) {\n files.push({\n path: `references/per-language/${lang}.md`,\n content: langTemplate(buildLanguageContext(profile, lang)),\n });\n }\n\n return files;\n}\n","import type { Profile } from \"../schema/profile.js\";\nimport { extractAllRules, type RuleEntry } from \"./template-helpers.js\";\nimport type { GeneratedFile } from \"./types.js\";\n\nfunction formatFrontmatter(globs: string[], description: string): string {\n return [\n \"---\",\n `description: \"${description}\"`,\n `globs: \"${globs.join(\", \")}\"`,\n \"alwaysApply: false\",\n \"---\",\n \"\",\n ].join(\"\\n\");\n}\n\nfunction formatRuleLine(\n category: string,\n name: string,\n convention: unknown,\n description?: string,\n): string {\n const value =\n typeof convention === \"string\"\n ? convention\n : JSON.stringify(convention);\n const desc = description ? ` -- ${description}` : \"\";\n return `- **${category}.${name}**: \\`${value}\\`${desc}`;\n}\n\nfunction formatBody(author: string, rules: RuleEntry[]): string {\n return [\n `# ${author}'s TypeScript Style`,\n \"\",\n ...rules\n .sort((a, b) => b.confidence - a.confidence)\n .map((r) =>\n formatRuleLine(r.category, r.name, r.convention, r.description),\n ),\n ].join(\"\\n\");\n}\n\nexport function generateClaudeRules(profile: Profile): GeneratedFile[] {\n const files: GeneratedFile[] = [];\n const allRules = extractAllRules(profile);\n const infoThreshold = profile.severityThresholds?.info ?? 0.40;\n\n const eligibleRules = allRules.filter(\n (r) => r.confidence >= infoThreshold,\n );\n\n if (eligibleRules.length > 0) {\n const frontmatter = formatFrontmatter(\n [\"**/*.ts\", \"**/*.tsx\"],\n `${profile.author}'s TypeScript coding style preferences`,\n );\n\n files.push({\n path: \".claude/rules/typescript.md\",\n content: frontmatter + formatBody(profile.author, eligibleRules) + \"\\n\",\n });\n }\n\n return files;\n}\n","import type { Profile } from \"../schema/profile.js\";\n\ninterface ClaudeHook {\n event: \"PreToolUse\" | \"PostToolUse\";\n matcher: string;\n command: string;\n}\n\ninterface ClaudeSettingsHooks {\n hooks: ClaudeHook[];\n}\n\nexport function generateHooksConfig(\n _profile: Profile,\n): ClaudeSettingsHooks {\n return {\n hooks: [\n {\n event: \"PostToolUse\",\n matcher: \"Write\",\n command: \"codewatch diff --fix $TOOL_INPUT_FILE_PATH\",\n },\n {\n event: \"PostToolUse\",\n matcher: \"Edit\",\n command: \"codewatch diff --fix $TOOL_INPUT_FILE_PATH\",\n },\n ],\n };\n}\n","import type { Profile, SeverityThresholds, Severity } from \"../schema/profile.js\";\nimport type { StyleRule } from \"../schema/style-rule.js\";\n\nexport function toEslintSeverity(\n confidence: number,\n thresholds: SeverityThresholds,\n): Severity | null {\n if (confidence >= thresholds.error) return \"error\";\n if (confidence >= thresholds.warn) return \"warn\";\n if (confidence >= thresholds.info) return \"info\";\n return null;\n}\n\nexport function severityRank(s: Severity): number {\n return s === \"error\" ? 3 : s === \"warn\" ? 2 : 1;\n}\n\nconst NAMING_SELECTORS: Record<string, string> = {\n variables: \"variable\",\n functions: \"function\",\n types: \"typeLike\",\n constants: \"variable\",\n};\n\nfunction eslintExtensionOptions(rule: StyleRule): unknown[] | undefined {\n const eslintExt = rule.extensions?.eslint;\n return eslintExt &&\n typeof eslintExt === \"object\" &&\n \"options\" in eslintExt &&\n Array.isArray((eslintExt as Record<string, unknown>).options)\n ? ((eslintExt as Record<string, unknown>).options as unknown[])\n : undefined;\n}\n\nconst NAMING_RULE = \"@typescript-eslint/naming-convention\";\n\n// Keys are profile vocabulary (style-analyzer emits SCREAMING_SNAKE); values are typescript-eslint's format enum.\nconst TS_ESLINT_FORMATS: Record<string, string> = {\n camelCase: \"camelCase\",\n strictCamelCase: \"strictCamelCase\",\n PascalCase: \"PascalCase\",\n StrictPascalCase: \"StrictPascalCase\",\n snake_case: \"snake_case\",\n UPPER_CASE: \"UPPER_CASE\",\n UPPER_SNAKE_CASE: \"UPPER_CASE\",\n SCREAMING_SNAKE: \"UPPER_CASE\",\n SCREAMING_SNAKE_CASE: \"UPPER_CASE\",\n};\n\n/** Same shape as style-checker's SkippedRule, so a consumer can forward it unchanged. */\nexport interface EslintSkippedRule {\n tool: \"eslint\";\n rule: string;\n plugin: string;\n reason: string;\n}\n\nexport interface NamingConventionResult {\n rule: [string, unknown] | null;\n skippedRules: EslintSkippedRule[];\n}\n\nexport function toTsEslintFormat(convention: string): string | null {\n return TS_ESLINT_FORMATS[convention] ?? null;\n}\n\nfunction skippedNaming(key: string, convention: unknown): EslintSkippedRule {\n return {\n tool: \"eslint\",\n rule: NAMING_RULE,\n plugin: \"@typescript-eslint\",\n reason: `naming.${key} convention ${JSON.stringify(convention)} has no typescript-eslint naming-convention format`,\n };\n}\n\nfunction namingSelectors(\n key: string,\n rule: StyleRule,\n selectorName: string,\n skipped: EslintSkippedRule[],\n): unknown[] {\n const eslintOptions = eslintExtensionOptions(rule);\n if (eslintOptions) return eslintOptions;\n const format = typeof rule.convention === \"string\" ? toTsEslintFormat(rule.convention) : null;\n if (format) return [{ selector: selectorName, format: [format] }];\n skipped.push(skippedNaming(key, rule.convention));\n return [];\n}\n\nexport function buildNamingConvention(profile: Profile): NamingConventionResult {\n const thresholds = profile.severityThresholds;\n const selectors: unknown[] = [];\n const skippedRules: EslintSkippedRule[] = [];\n let maxSeverity: Severity | null = null;\n\n for (const [key, rule] of Object.entries(profile.naming ?? {})) {\n const selectorName = NAMING_SELECTORS[key];\n if (!selectorName) continue;\n const severity = toEslintSeverity(rule.confidence, thresholds);\n if (!severity) continue;\n\n const ruleSelectors = namingSelectors(key, rule, selectorName, skippedRules);\n if (ruleSelectors.length === 0) continue;\n selectors.push(...ruleSelectors);\n if (!maxSeverity || severityRank(severity) > severityRank(maxSeverity)) maxSeverity = severity;\n }\n\n if (selectors.length === 0 || !maxSeverity) return { rule: null, skippedRules };\n return { rule: [NAMING_RULE, [maxSeverity, ...selectors]], skippedRules };\n}\n\nexport function buildNamingConventionRule(\n profile: Profile,\n): [string, unknown] | null {\n return buildNamingConvention(profile).rule;\n}\n\nexport function buildImportOrderRule(\n profile: Profile,\n): [string, unknown] | null {\n const importOrder = profile.structure?.importOrder;\n if (!importOrder) return null;\n const severity = toEslintSeverity(importOrder.confidence, profile.severityThresholds);\n if (!severity) return null;\n\n const convention = Array.isArray(importOrder.convention)\n ? importOrder.convention\n : [\"builtin\", \"external\", \"internal\", \"relative\"];\n\n return [\n \"perfectionist/sort-imports\",\n [\n severity,\n {\n type: \"natural\",\n groups: convention,\n },\n ],\n ];\n}\n\nexport function buildFunctionLengthRule(\n profile: Profile,\n): [string, unknown] | null {\n const maxLines = profile.structure?.functionMaxLines;\n if (!maxLines) return null;\n const severity = toEslintSeverity(maxLines.confidence, profile.severityThresholds);\n if (!severity) return null;\n if (typeof maxLines.convention !== \"number\") return null;\n\n return [\"max-lines-per-function\", [severity, { max: maxLines.convention }]];\n}\n\nexport function buildFileNamingRule(\n profile: Profile,\n): [string, unknown] | null {\n const files = profile.naming?.files;\n if (!files) return null;\n const severity = toEslintSeverity(files.confidence, profile.severityThresholds);\n if (!severity) return null;\n if (typeof files.convention !== \"string\") return null;\n\n const caseMap: Record<string, string> = {\n \"kebab-case\": \"kebabCase\",\n camelCase: \"camelCase\",\n PascalCase: \"pascalCase\",\n snake_case: \"snakeCase\",\n };\n\n return [\n \"unicorn/filename-case\",\n [severity, { case: { [caseMap[files.convention] ?? \"kebabCase\"]: true } }],\n ];\n}\n\nexport function buildJsdocRules(\n profile: Profile,\n): Array<[string, unknown]> {\n const rules: Array<[string, unknown]> = [];\n const docs = profile.documentation;\n if (!docs) return rules;\n\n const functionDocs = docs.functionDocs;\n if (!functionDocs) return rules;\n\n const severity = toEslintSeverity(functionDocs.confidence, profile.severityThresholds);\n if (!severity) return rules;\n\n if (functionDocs.convention === \"jsdoc-selective\") {\n rules.push([\"jsdoc/require-jsdoc\", [severity, { publicOnly: true }]]);\n } else if (functionDocs.convention === \"jsdoc-all\") {\n rules.push([\"jsdoc/require-jsdoc\", [severity]]);\n }\n\n return rules;\n}\n","import {\n PROFILE_CATEGORIES,\n type Profile,\n type SeverityThresholds,\n} from \"../schema/profile.js\";\nimport type { StyleRule } from \"../schema/style-rule.js\";\nimport type { GeneratedFile } from \"./types.js\";\nimport {\n toEslintSeverity,\n buildImportOrderRule,\n} from \"./eslint-rules.js\";\n\ninterface EslintRuleEntry {\n plugin: string;\n rule: string;\n severity: \"error\" | \"warn\" | \"off\";\n options?: unknown[];\n}\n\nfunction extensionEntry(\n rule: StyleRule,\n thresholds: SeverityThresholds,\n): EslintRuleEntry | null {\n const ext = rule.extensions?.eslint as\n | { rule: string; options?: unknown[] }\n | undefined;\n if (!ext) return null;\n\n const sev = toEslintSeverity(rule.confidence, thresholds);\n if (sev === null) return null;\n\n const plugin = ext.rule.includes(\"/\")\n ? ext.rule.split(\"/\").slice(0, -1).join(\"/\")\n : \"\";\n\n return {\n plugin,\n rule: ext.rule,\n severity: sev === \"info\" ? \"warn\" : sev,\n options: ext.options,\n };\n}\n\nfunction collectEslintExtensions(profile: Profile): EslintRuleEntry[] {\n const entries: EslintRuleEntry[] = [];\n\n for (const category of PROFILE_CATEGORIES) {\n const section = profile[category];\n if (!section) continue;\n\n for (const [, rule] of Object.entries(section)) {\n const entry = extensionEntry(rule, profile.severityThresholds);\n if (entry) entries.push(entry);\n }\n }\n\n return entries;\n}\n\nfunction addImportOrderRule(profile: Profile, entries: EslintRuleEntry[]): void {\n const result = buildImportOrderRule(profile);\n if (!result) return;\n\n const [ruleName, ruleConfig] = result;\n const configArray = ruleConfig as unknown[];\n const severity = configArray[0] as string;\n if (severity === \"info\") return;\n\n entries.push({\n plugin: \"perfectionist\",\n rule: ruleName,\n severity: severity as \"error\" | \"warn\",\n options: [configArray[1]],\n });\n}\n\nfunction detectRequiredPlugins(entries: EslintRuleEntry[]): Set<string> {\n const plugins = new Set<string>();\n for (const entry of entries) {\n if (entry.plugin.includes(\"@typescript-eslint\")) {\n plugins.add(\"@typescript-eslint\");\n }\n if (entry.plugin === \"perfectionist\") {\n plugins.add(\"perfectionist\");\n }\n if (entry.plugin.includes(\"unicorn\")) {\n plugins.add(\"unicorn\");\n }\n if (entry.plugin.includes(\"jsdoc\")) {\n plugins.add(\"jsdoc\");\n }\n }\n return plugins;\n}\n\nfunction generateImportStatements(plugins: Set<string>): string[] {\n const imports: string[] = [];\n if (plugins.has(\"@typescript-eslint\")) {\n imports.push(`import tseslint from \"@typescript-eslint/eslint-plugin\";`);\n imports.push(`import tsparser from \"@typescript-eslint/parser\";`);\n }\n if (plugins.has(\"perfectionist\")) {\n imports.push(`import perfectionist from \"eslint-plugin-perfectionist\";`);\n }\n if (plugins.has(\"unicorn\")) {\n imports.push(`import unicorn from \"eslint-plugin-unicorn\";`);\n }\n if (plugins.has(\"jsdoc\")) {\n imports.push(`import jsdoc from \"eslint-plugin-jsdoc\";`);\n }\n return imports;\n}\n\nfunction buildRulesObject(\n entries: EslintRuleEntry[],\n): Record<string, unknown> {\n const rules: Record<string, unknown> = {};\n for (const entry of entries) {\n if (entry.options && entry.options.length > 0) {\n rules[entry.rule] = [entry.severity, ...entry.options];\n } else {\n rules[entry.rule] = entry.severity;\n }\n }\n return rules;\n}\n\nexport function generateEslintExport(profile: Profile): GeneratedFile {\n const entries = collectEslintExtensions(profile);\n addImportOrderRule(profile, entries);\n\n const plugins = detectRequiredPlugins(entries);\n const imports = generateImportStatements(plugins);\n const rules = buildRulesObject(entries);\n\n const header = [\n `// Generated by codewatch for ${profile.author}`,\n `// Date: ${profile.generated}`,\n `// Do not edit manually - regenerate with: codewatch export --format eslint`,\n \"\",\n ].join(\"\\n\");\n\n const content = [\n header,\n ...imports,\n \"\",\n `export default ${JSON.stringify({ rules }, null, 2)};`,\n \"\",\n ].join(\"\\n\");\n\n return { path: \"eslint.config.js\", content };\n}\n","import type { Profile } from \"../schema/profile.js\";\nimport type { StyleRule } from \"../schema/style-rule.js\";\nimport type { GeneratedFile } from \"./types.js\";\n\ninterface RuffLintSubsections {\n mccabe?: { maxComplexity: number };\n pydocstyle?: { convention: string };\n isort?: { sectionOrder: string[] };\n}\n\ninterface RuffLint extends RuffLintSubsections {\n select: string[];\n ignore: string[];\n fixable: string[];\n}\n\ninterface RuffConfig {\n lineLength?: number;\n lint: RuffLint;\n}\n\ninterface RuffAccumulator extends RuffLintSubsections {\n select: Set<string>;\n}\n\nconst CATEGORY_KEYS = [\n \"naming\",\n \"structure\",\n \"documentation\",\n \"errorHandling\",\n \"formatting\",\n \"patterns\",\n] as const;\n\nfunction addExtensionCodes(rule: StyleRule, select: Set<string>): void {\n if (!rule.extensions?.ruff) return;\n const ext = rule.extensions.ruff as { codes?: string[] };\n if (!ext.codes) return;\n for (const code of ext.codes) {\n select.add(code.replace(/\\d+$/, \"\"));\n }\n}\n\nfunction applyFunctionMaxLines(\n category: string,\n name: string,\n rule: StyleRule,\n acc: RuffAccumulator,\n): void {\n if (category !== \"structure\" || name !== \"functionMaxLines\") return;\n acc.select.add(\"C90\");\n if (typeof rule.convention === \"number\") {\n acc.mccabe = { maxComplexity: rule.convention };\n }\n}\n\nfunction applyRule(\n category: string,\n name: string,\n rule: StyleRule,\n acc: RuffAccumulator,\n): void {\n addExtensionCodes(rule, acc.select);\n\n if (category === \"naming\") {\n acc.select.add(\"N\");\n }\n\n if (category === \"structure\" && name === \"importOrder\") {\n acc.select.add(\"I\");\n if (Array.isArray(rule.convention)) {\n acc.isort = { sectionOrder: rule.convention as string[] };\n }\n }\n\n if (category === \"documentation\" && name === \"functionDocs\") {\n acc.select.add(\"D\");\n if (typeof rule.convention === \"string\") {\n acc.pydocstyle = { convention: rule.convention };\n }\n }\n\n applyFunctionMaxLines(category, name, rule, acc);\n}\n\nfunction lineLengthOf(profile: Profile): number | undefined {\n const lineLengthRule = profile.formatting?.lineLength;\n if (lineLengthRule && typeof lineLengthRule.convention === \"number\") {\n return lineLengthRule.convention;\n }\n return undefined;\n}\n\nfunction buildRuffConfig(profile: Profile): RuffConfig {\n const thresholds = profile.severityThresholds;\n const acc: RuffAccumulator = { select: new Set<string>() };\n const fixable = new Set<string>([\"ALL\"]);\n\n for (const category of CATEGORY_KEYS) {\n const section = profile[category];\n if (!section) continue;\n\n for (const [name, rule] of Object.entries(\n section as Record<string, StyleRule>,\n )) {\n if (rule.confidence < thresholds.info) continue;\n applyRule(category, name, rule, acc);\n }\n }\n\n return {\n lineLength: lineLengthOf(profile),\n lint: {\n select: [...acc.select].sort(),\n ignore: [],\n fixable: [...fixable],\n mccabe: acc.mccabe,\n pydocstyle: acc.pydocstyle,\n isort: acc.isort,\n },\n };\n}\n\nfunction toTomlArray(items: string[]): string {\n return `[${items.map((s) => `\"${s}\"`).join(\", \")}]`;\n}\n\nfunction serializeLintTable(lint: RuffLint): string[] {\n const lines: string[] = [\"[lint]\"];\n if (lint.select.length > 0) {\n lines.push(`select = ${toTomlArray(lint.select)}`);\n }\n if (lint.ignore.length > 0) {\n lines.push(`ignore = ${toTomlArray(lint.ignore)}`);\n }\n if (lint.fixable.length > 0) {\n lines.push(`fixable = ${toTomlArray(lint.fixable)}`);\n }\n lines.push(\"\");\n return lines;\n}\n\nfunction serializeLintSubtables(lint: RuffLintSubsections): string[] {\n const lines: string[] = [];\n\n if (lint.mccabe) {\n lines.push(\"[lint.mccabe]\");\n lines.push(`max-complexity = ${lint.mccabe.maxComplexity}`);\n lines.push(\"\");\n }\n\n if (lint.pydocstyle) {\n lines.push(\"[lint.pydocstyle]\");\n lines.push(`convention = \"${lint.pydocstyle.convention}\"`);\n lines.push(\"\");\n }\n\n if (lint.isort) {\n lines.push(\"[lint.isort]\");\n lines.push(`section-order = ${toTomlArray(lint.isort.sectionOrder)}`);\n lines.push(\"\");\n }\n\n return lines;\n}\n\nfunction serializeToToml(config: RuffConfig): string {\n const lines: string[] = [];\n\n if (config.lineLength !== undefined) {\n lines.push(`line-length = ${config.lineLength}`);\n lines.push(\"\");\n }\n\n lines.push(...serializeLintTable(config.lint));\n lines.push(...serializeLintSubtables(config.lint));\n\n return lines.join(\"\\n\");\n}\n\nexport function generateRuffExport(profile: Profile): GeneratedFile {\n const config = buildRuffConfig(profile);\n\n const header = [\n `# Generated by codewatch for ${profile.author}`,\n `# Date: ${profile.generated}`,\n `# Do not edit manually - regenerate with: codewatch export --format ruff`,\n \"\",\n ].join(\"\\n\");\n\n return {\n path: \"ruff.toml\",\n content: header + serializeToToml(config),\n };\n}\n","import type { Profile } from \"../schema/profile.js\";\nimport type { GeneratedFile } from \"./types.js\";\nimport {\n extractAllRules,\n type RuleEntry,\n} from \"./template-helpers.js\";\n\nfunction capitalize(str: string): string {\n const spaced = str.replace(/([A-Z])/g, \" $1\");\n return spaced.charAt(0).toUpperCase() + spaced.slice(1);\n}\n\nfunction formatConvention(convention: unknown): string {\n if (typeof convention === \"string\") return convention;\n if (typeof convention === \"number\") return String(convention);\n if (typeof convention === \"boolean\") return String(convention);\n return JSON.stringify(convention);\n}\n\nfunction groupByCategory(rules: RuleEntry[]): Map<string, RuleEntry[]> {\n const byCategory = new Map<string, RuleEntry[]>();\n for (const rule of rules) {\n const existing = byCategory.get(rule.category) ?? [];\n existing.push(rule);\n byCategory.set(rule.category, existing);\n }\n return byCategory;\n}\n\nfunction exampleLines(examples: NonNullable<RuleEntry[\"examples\"]>): string[] {\n const lines: string[] = [];\n for (const example of examples) {\n if (example.good) {\n lines.push(\"```typescript\");\n lines.push(\"// Preferred\");\n lines.push(example.good);\n lines.push(\"```\");\n lines.push(\"\");\n }\n if (example.bad) {\n lines.push(\"```typescript\");\n lines.push(\"// Avoid\");\n lines.push(example.bad);\n lines.push(\"```\");\n lines.push(\"\");\n }\n }\n return lines;\n}\n\nfunction ruleLines(rule: RuleEntry): string[] {\n const lines: string[] = [];\n const confPct = (rule.confidence * 100).toFixed(0);\n const value = formatConvention(rule.convention);\n\n lines.push(`### ${capitalize(rule.name)}`);\n lines.push(\"\");\n lines.push(\n `**Convention**: \\`${value}\\` | **Confidence**: ${confPct}%${rule.stability ? ` | **Stability**: ${rule.stability}` : \"\"}`,\n );\n lines.push(\"\");\n\n if (rule.description) {\n lines.push(rule.description);\n lines.push(\"\");\n }\n\n if (rule.examples && rule.examples.length > 0) {\n lines.push(...exampleLines(rule.examples));\n }\n\n return lines;\n}\n\nexport function generateMarkdownExport(profile: Profile): GeneratedFile {\n const allRules = extractAllRules(profile);\n const byCategory = groupByCategory(allRules);\n const lines: string[] = [];\n\n lines.push(`# ${profile.author}'s Code Style Guide`);\n lines.push(\"\");\n lines.push(`> Generated by codewatch on ${profile.generated}`);\n lines.push(\n `> Sources: ${profile.sources.length > 0 ? profile.sources.join(\", \") : \"N/A\"}`,\n );\n lines.push(\"\");\n\n for (const [category, rules] of byCategory) {\n lines.push(`## ${capitalize(category)}`);\n lines.push(\"\");\n\n const sorted = [...rules].sort((a, b) => b.confidence - a.confidence);\n for (const rule of sorted) {\n lines.push(...ruleLines(rule));\n }\n }\n\n return {\n path: \"style-guide.md\",\n content: lines.join(\"\\n\"),\n };\n}\n","import type { Profile } from \"../schema/profile.js\";\nimport type { StyleRule } from \"../schema/style-rule.js\";\nimport type { GeneratedFile } from \"./types.js\";\n\nfunction getConvention<T>(\n section: Record<string, StyleRule>,\n key: string,\n): T | undefined {\n const rule = section[key];\n if (!rule) return undefined;\n return rule.convention as T;\n}\n\nfunction indentAndNewlineLines(formatting: Record<string, StyleRule>): string[] {\n const lines: string[] = [];\n\n const indentStyle = getConvention<string>(formatting, \"indentStyle\");\n if (indentStyle) {\n const value =\n indentStyle === \"spaces\"\n ? \"space\"\n : indentStyle === \"tabs\"\n ? \"tab\"\n : indentStyle;\n lines.push(`indent_style = ${value}`);\n }\n\n const indentSize = getConvention<number>(formatting, \"indentSize\");\n if (indentSize !== undefined) {\n lines.push(`indent_size = ${indentSize}`);\n }\n\n const trailingNewline = getConvention<boolean>(\n formatting,\n \"trailingNewline\",\n );\n if (trailingNewline !== undefined) {\n lines.push(`insert_final_newline = ${trailingNewline}`);\n }\n\n return lines;\n}\n\nexport function generateEditorConfigExport(\n profile: Profile,\n): GeneratedFile {\n const formatting = profile.formatting;\n const lines: string[] = [];\n\n lines.push(\"# Generated by codewatch\");\n lines.push(\"root = true\");\n lines.push(\"\");\n lines.push(\"[*]\");\n lines.push(...indentAndNewlineLines(formatting));\n\n lines.push(\"end_of_line = lf\");\n lines.push(\"charset = utf-8\");\n lines.push(\"trim_trailing_whitespace = true\");\n\n const lineLength = getConvention<number>(formatting, \"lineLength\");\n if (lineLength !== undefined) {\n lines.push(`max_line_length = ${lineLength}`);\n }\n\n lines.push(\"\");\n\n return {\n path: \".editorconfig\",\n content: lines.join(\"\\n\"),\n };\n}\n","import type { Profile } from \"../schema/profile.js\";\nimport type { GeneratedFile } from \"./types.js\";\nimport { generateSkillFiles } from \"./skill.js\";\nimport { generateClaudeRules } from \"./claude-rules.js\";\nimport { generateHooksConfig } from \"./hooks.js\";\nimport { generateEslintExport } from \"./eslint.js\";\nimport { generateRuffExport } from \"./ruff.js\";\nimport { generateMarkdownExport } from \"./markdown.js\";\nimport { generateEditorConfigExport } from \"./editorconfig.js\";\n\nexport type ExportFormat =\n | \"skill\"\n | \"claude-rules\"\n | \"hooks\"\n | \"eslint\"\n | \"ruff\"\n | \"markdown\"\n | \"editorconfig\";\n\nexport const SUPPORTED_FORMATS: ExportFormat[] = [\n \"skill\",\n \"claude-rules\",\n \"hooks\",\n \"eslint\",\n \"ruff\",\n \"markdown\",\n \"editorconfig\",\n];\n\nfunction hooksFiles(profile: Profile): GeneratedFile[] {\n const config = generateHooksConfig(profile);\n return [\n {\n path: \".claude/settings.json\",\n content: JSON.stringify(config, null, 2),\n },\n ];\n}\n\nexport function exportProfile(\n profile: Profile,\n format: ExportFormat,\n): GeneratedFile[] {\n switch (format) {\n case \"skill\":\n return generateSkillFiles(profile);\n case \"claude-rules\":\n return generateClaudeRules(profile);\n case \"hooks\":\n return hooksFiles(profile);\n case \"eslint\":\n return [generateEslintExport(profile)];\n case \"ruff\":\n return [generateRuffExport(profile)];\n case \"markdown\":\n return [generateMarkdownExport(profile)];\n case \"editorconfig\":\n return [generateEditorConfigExport(profile)];\n default:\n throw new Error(\n `Unsupported export format: \"${format as string}\". Supported formats: ${SUPPORTED_FORMATS.join(\", \")}`,\n );\n }\n}\n"],"mappings":";AAAA,SAAS,SAAS;AAEX,IAAM,gBAAgB,EAAE,OAAO;AAAA,EACpC,MAAM,EAAE,OAAO,EAAE,SAAS;AA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jB,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO,mBAAmB,OAAO;AAAA,IACnC,KAAK;AACH,aAAO,oBAAoB,OAAO;AAAA,IACpC,KAAK;AACH,aAAO,WAAW,OAAO;AAAA,IAC3B,KAAK;AACH,aAAO,CAAC,qBAAqB,OAAO,CAAC;AAAA,IACvC,KAAK;AACH,aAAO,CAAC,mBAAmB,OAAO,CAAC;AAAA,IACrC,KAAK;AACH,aAAO,CAAC,uBAAuB,OAAO,CAAC;AAAA,IACzC,KAAK;AACH,aAAO,CAAC,2BAA2B,OAAO,CAAC;AAAA,IAC7C;AACE,YAAM,IAAI;AAAA,QACR,+BAA+B,MAAgB,yBAAyB,kBAAkB,KAAK,IAAI,CAAC;AAAA,MACtG;AAAA,EACJ;AACF;","names":["z","z","migrations"]}
|
|
1
|
+
{"version":3,"sources":["../src/schema/style-rule.ts","../src/schema/profile.ts","../src/schema/severity.ts","../src/io.ts","../src/migrations/registry.ts","../src/migrations/migrate-profile.ts","../src/exporters/template-helpers.ts","../src/exporters/templates.ts","../src/exporters/skill.ts","../src/exporters/claude-rules.ts","../src/exporters/hooks.ts","../src/exporters/eslint-rules.ts","../src/exporters/eslint.ts","../src/exporters/ruff.ts","../src/exporters/markdown.ts","../src/exporters/editorconfig.ts","../src/exporters/export-index.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const ExampleSchema = z.object({\n good: z.string().optional(),\n bad: z.string().optional(),\n source: z.string().optional(),\n});\n\nexport const StabilitySchema = z.enum([\"high\", \"medium\", \"low\"]);\n\nexport const FixabilitySchema = z.enum([\n \"safe\",\n \"maybe-incorrect\",\n \"requires-input\",\n \"not-fixable\",\n]);\n\nexport const StyleRuleSchema = z.object({\n convention: z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.array(z.string()),\n ]),\n confidence: z.number().min(0).max(1),\n stability: StabilitySchema.optional(),\n fixability: FixabilitySchema.optional(),\n description: z.string().optional(),\n examples: z.array(ExampleSchema).optional(),\n extensions: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport type StyleRule = z.infer<typeof StyleRuleSchema>;\nexport type Stability = z.infer<typeof StabilitySchema>;\nexport type Fixability = z.infer<typeof FixabilitySchema>;\n","import { z } from \"zod\";\nimport { StyleRuleSchema } from \"./style-rule.js\";\n\nexport const SCHEMA_VERSION = \"1.0.0\";\n\nconst CategorySchema = z.record(z.string(), StyleRuleSchema);\n\nconst IdiomSchema = z.object({\n name: z.string(),\n description: z.string(),\n frequency: z.number(),\n confidence: z.number().min(0).max(1),\n example: z.string().optional(),\n});\n\nconst AntiPatternSchema = z.object({\n pattern: z.string(),\n reason: z.string(),\n deprecated: z.boolean().optional(),\n});\n\nconst OverrideSchema = z.object({\n files: z.array(z.string()),\n naming: CategorySchema.optional(),\n structure: CategorySchema.optional(),\n documentation: CategorySchema.optional(),\n errorHandling: CategorySchema.optional(),\n formatting: CategorySchema.optional(),\n patterns: CategorySchema.optional(),\n});\n\nconst SeverityThresholdsSchema = z.object({\n error: z.number().min(0).max(1),\n warn: z.number().min(0).max(1),\n info: z.number().min(0).max(1),\n});\n\nexport const DEFAULT_SEVERITY_THRESHOLDS = {\n error: 0.85,\n warn: 0.60,\n info: 0.40,\n} as const;\n\nexport const ProfileSchema = z.object({\n $schema: z.string().optional(),\n schemaVersion: z.string(),\n author: z.string(),\n generated: z.string(),\n sources: z.array(z.string()),\n\n naming: CategorySchema,\n structure: CategorySchema,\n documentation: CategorySchema,\n errorHandling: CategorySchema,\n formatting: CategorySchema,\n patterns: CategorySchema,\n\n idioms: z.object({\n detected: z.array(IdiomSchema),\n }),\n\n antiPatterns: z.object({\n acknowledged: z.array(AntiPatternSchema),\n }),\n\n overrides: z.array(OverrideSchema),\n\n severityThresholds: SeverityThresholdsSchema.default(DEFAULT_SEVERITY_THRESHOLDS),\n});\n\nexport type Profile = z.infer<typeof ProfileSchema>;\nexport type SeverityThresholds = z.infer<typeof SeverityThresholdsSchema>;\n\nexport const PROFILE_CATEGORIES = [\n \"naming\",\n \"structure\",\n \"documentation\",\n \"errorHandling\",\n \"formatting\",\n \"patterns\",\n] as const;\n\nexport type ProfileCategory = (typeof PROFILE_CATEGORIES)[number];\n\nexport type Severity = \"error\" | \"warn\" | \"info\" | \"off\";\n","import {\n DEFAULT_SEVERITY_THRESHOLDS,\n type Severity,\n type SeverityThresholds,\n} from \"./profile.js\";\n\nexport type EslintSeverity = \"error\" | \"warn\" | \"off\";\n\n/** The one confidence ladder: a rule's profile tier, \"off\" below the info threshold. */\nexport function severityForConfidence(\n confidence: number,\n thresholds: SeverityThresholds = DEFAULT_SEVERITY_THRESHOLDS,\n): Severity {\n if (confidence >= thresholds.error) return \"error\";\n if (confidence >= thresholds.warn) return \"warn\";\n if (confidence >= thresholds.info) return \"info\";\n return \"off\";\n}\n\n// ESLint rejects \"info\" as a rule level, so the profile's info tier still lints, as a warning.\nexport function toEslintLevel(severity: Severity): EslintSeverity {\n return severity === \"info\" ? \"warn\" : severity;\n}\n","import * as fs from \"node:fs/promises\";\nimport { ProfileSchema, type Profile } from \"./schema/profile.js\";\n\nexport async function readProfile(filePath: string): Promise<Profile> {\n const raw = await fs.readFile(filePath, \"utf-8\");\n const json: unknown = JSON.parse(raw);\n return ProfileSchema.parse(json);\n}\n\nexport async function writeProfile(\n filePath: string,\n profile: unknown,\n): Promise<void> {\n const validated = ProfileSchema.parse(profile);\n await fs.writeFile(filePath, JSON.stringify(validated, null, 2) + \"\\n\");\n}\n\nexport function validateProfile(data: unknown) {\n return ProfileSchema.safeParse(data);\n}\n","export interface Migration {\n from: string;\n to: string;\n migrate: (profile: Record<string, unknown>) => Record<string, unknown>;\n}\n\nconst migrations: Migration[] = [];\n\nexport function registerMigration(migration: Migration): void {\n migrations.push(migration);\n migrations.sort((a, b) => a.from.localeCompare(b.from));\n}\n\nexport function getMigrations(): ReadonlyArray<Migration> {\n return migrations;\n}\n\nexport function clearMigrations(): void {\n migrations.length = 0;\n}\n","import { SCHEMA_VERSION } from \"../schema/profile.js\";\nimport { getMigrations, registerMigration, clearMigrations } from \"./registry.js\";\n\nexport { registerMigration, clearMigrations };\n\nexport function migrateProfile(\n profile: Record<string, unknown>,\n): Record<string, unknown> {\n let current = { ...profile };\n const version = current.schemaVersion as string;\n\n if (version === SCHEMA_VERSION) {\n return current;\n }\n\n const migrations = getMigrations();\n let currentVersion = version;\n\n for (const migration of migrations) {\n if (migration.from === currentVersion) {\n current = migration.migrate(current);\n currentVersion = migration.to;\n }\n }\n\n if (currentVersion !== SCHEMA_VERSION) {\n throw new Error(\n `No migration path from version ${version} to ${SCHEMA_VERSION}`,\n );\n }\n\n return current;\n}\n","import { PROFILE_CATEGORIES, type Profile, type Severity } from \"../schema/profile.js\";\nimport { severityForConfidence } from \"../schema/severity.js\";\n\nexport interface RuleEntry {\n category: string;\n name: string;\n convention: unknown;\n confidence: number;\n stability?: string;\n description?: string;\n examples?: Array<{ good?: string; bad?: string; source?: string }>;\n extensions?: Record<string, unknown>;\n}\n\nexport type ExtractedRule = RuleEntry;\n\nexport function extractAllRules(profile: Profile): RuleEntry[] {\n const rules: RuleEntry[] = [];\n\n for (const category of PROFILE_CATEGORIES) {\n const section = profile[category];\n if (!section || typeof section !== \"object\") continue;\n\n for (const [name, rule] of Object.entries(section)) {\n if (!rule || typeof rule !== \"object\") continue;\n rules.push({\n category,\n name,\n convention: rule.convention,\n confidence: rule.confidence,\n stability: rule.stability,\n description: rule.description,\n examples: rule.examples,\n extensions: rule.extensions,\n });\n }\n }\n\n return rules;\n}\n\nexport function tierOf(profile: Profile, rule: RuleEntry): Severity {\n return severityForConfidence(rule.confidence, profile.severityThresholds);\n}\n\nexport function getTopRules(\n profile: Profile,\n count: number = 8,\n): RuleEntry[] {\n return extractAllRules(profile)\n .filter((r) => tierOf(profile, r) === \"error\")\n .sort((a, b) => b.confidence - a.confidence)\n .slice(0, count);\n}\n\nexport function getRulesForCategory(\n profile: Profile,\n category: string,\n): RuleEntry[] {\n return extractAllRules(profile).filter((r) => r.category === category);\n}\n\nexport function getRulesByCategory(\n profile: Profile,\n): Map<string, RuleEntry[]> {\n const grouped = new Map<string, RuleEntry[]>();\n for (const rule of extractAllRules(profile)) {\n const existing = grouped.get(rule.category) ?? [];\n existing.push(rule);\n grouped.set(rule.category, existing);\n }\n return grouped;\n}\n\nconst byConfidence = (a: RuleEntry, b: RuleEntry) =>\n b.confidence - a.confidence;\n\nexport function getRulesByTier(profile: Profile): {\n critical: RuleEntry[];\n strong: RuleEntry[];\n preferred: RuleEntry[];\n} {\n const critical: RuleEntry[] = [];\n const strong: RuleEntry[] = [];\n const preferred: RuleEntry[] = [];\n const buckets: Partial<Record<Severity, RuleEntry[]>> = {\n error: critical,\n warn: strong,\n info: preferred,\n };\n\n for (const rule of extractAllRules(profile)) {\n buckets[tierOf(profile, rule)]?.push(rule);\n }\n\n critical.sort(byConfidence);\n strong.sort(byConfidence);\n preferred.sort(byConfidence);\n\n return { critical, strong, preferred };\n}\n\nexport function readableConvention(rule: RuleEntry): string {\n if (\n typeof rule.convention === \"boolean\" ||\n typeof rule.convention === \"number\"\n ) {\n return rule.description ?? JSON.stringify(rule.convention);\n }\n if (Array.isArray(rule.convention)) {\n return rule.convention.join(\" → \");\n }\n return String(rule.convention);\n}\n\nexport function detectLanguages(profile: Profile): string[] {\n const langs: string[] = [];\n const hasTypescriptSignals =\n Object.keys(profile.naming).length > 0 ||\n Object.keys(profile.structure).length > 0;\n if (hasTypescriptSignals) langs.push(\"typescript\");\n return langs.length > 0 ? langs : [\"typescript\"];\n}\n","import Handlebars from \"handlebars\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n// tsup bundles into dist/index.js while tests load src/exporters, so the package root sits at different depths.\nfunction findPackageRoot(start: string): string {\n let dir = start;\n while (!existsSync(join(dir, \"package.json\"))) {\n const parent = dirname(dir);\n if (parent === dir) throw new Error(`style-profile package root not found above ${start}`);\n dir = parent;\n }\n return dir;\n}\n\nexport function loadTemplate(name: string): Handlebars.TemplateDelegate {\n const root = findPackageRoot(dirname(fileURLToPath(import.meta.url)));\n const source = readFileSync(join(root, \"templates\", name), \"utf-8\");\n return Handlebars.compile(source);\n}\n","import type { Profile } from \"../schema/profile.js\";\nimport type { GeneratedFile } from \"./types.js\";\nimport {\n getRulesByTier,\n readableConvention,\n detectLanguages,\n} from \"./template-helpers.js\";\nimport type { RuleEntry } from \"./template-helpers.js\";\nimport { loadTemplate } from \"./templates.js\";\n\nfunction buildTieredRulesContext(profile: Profile) {\n const tiers = getRulesByTier(profile);\n\n const mapRule = (r: RuleEntry) => ({\n name: `${r.category}.${r.name}`,\n readableConvention: readableConvention(r),\n confidencePercent: (r.confidence * 100).toFixed(0),\n });\n\n return {\n criticalRules: tiers.critical.map(mapRule),\n strongRules: tiers.strong.map(mapRule),\n preferredRules: tiers.preferred.map(mapRule),\n };\n}\n\nfunction buildNamingContext(profile: Profile) {\n const section = profile.naming;\n return Object.entries(section).map(([name, rule]) => ({\n label: name.charAt(0).toUpperCase() + name.slice(1),\n convention:\n typeof rule.convention === \"string\"\n ? rule.convention\n : JSON.stringify(rule.convention),\n confidencePercent: (rule.confidence * 100).toFixed(0),\n stability: rule.stability,\n fixability: rule.fixability,\n description: rule.description,\n examples: rule.examples,\n }));\n}\n\nfunction buildPatternsContext(profile: Profile) {\n const section = profile.patterns;\n const patternRules = Object.entries(section).map(([name, rule]) => ({\n name,\n strength:\n typeof rule.convention === \"string\" ? rule.convention : \"detected\",\n confidencePercent: (rule.confidence * 100).toFixed(0),\n description: rule.description,\n fixability: rule.fixability,\n examples: rule.examples,\n }));\n\n const preferredPatterns = profile.structure?.preferredPatterns;\n let preferredList: string[] | undefined;\n if (preferredPatterns && Array.isArray(preferredPatterns.convention)) {\n preferredList = preferredPatterns.convention as string[];\n }\n\n return { patterns: patternRules, preferredPatterns: preferredList };\n}\n\nfunction buildIdiomsContext(profile: Profile) {\n return profile.idioms.detected.map((idiom) => ({\n name: idiom.name,\n description: idiom.description,\n example: idiom.example,\n }));\n}\n\nfunction buildAntiPatternsContext(profile: Profile) {\n return profile.antiPatterns.acknowledged.map((ap) => ({\n pattern: ap.pattern,\n reason: ap.reason,\n }));\n}\n\nfunction buildLanguageContext(profile: Profile, lang: string) {\n const tiers = getRulesByTier(profile);\n const mapRule = (r: RuleEntry) => ({\n category: r.category,\n name: r.name,\n convention:\n typeof r.convention === \"string\"\n ? r.convention\n : JSON.stringify(r.convention),\n confidencePercent: (r.confidence * 100).toFixed(0),\n readableConvention: readableConvention(r),\n description: r.description,\n });\n\n return {\n language: lang.charAt(0).toUpperCase() + lang.slice(1),\n criticalRules: tiers.critical.map(mapRule),\n strongRules: tiers.strong.map(mapRule),\n preferredRules: tiers.preferred.map(mapRule),\n };\n}\n\nfunction renderSkillFile(profile: Profile, languages: string[]): GeneratedFile {\n const skillTemplate = loadTemplate(\"skill.md.hbs\");\n const idioms = buildIdiomsContext(profile);\n const antiPatterns = buildAntiPatternsContext(profile);\n return {\n path: \"skill.md\",\n content: skillTemplate({\n author: profile.author,\n ...buildTieredRulesContext(profile),\n languages,\n idioms: idioms.length > 0 ? idioms : undefined,\n antiPatterns: antiPatterns.length > 0 ? antiPatterns : undefined,\n }),\n };\n}\n\nexport function generateSkillFiles(profile: Profile): GeneratedFile[] {\n const files: GeneratedFile[] = [];\n const languages = detectLanguages(profile);\n\n files.push(renderSkillFile(profile, languages));\n\n const namingTemplate = loadTemplate(\"naming.md.hbs\");\n files.push({\n path: \"references/naming.md\",\n content: namingTemplate({ rules: buildNamingContext(profile) }),\n });\n\n const patternsTemplate = loadTemplate(\"patterns.md.hbs\");\n files.push({\n path: \"references/patterns.md\",\n content: patternsTemplate(buildPatternsContext(profile)),\n });\n\n const langTemplate = loadTemplate(\"per-language.md.hbs\");\n for (const lang of languages) {\n files.push({\n path: `references/per-language/${lang}.md`,\n content: langTemplate(buildLanguageContext(profile, lang)),\n });\n }\n\n return files;\n}\n","import type { Profile } from \"../schema/profile.js\";\nimport { extractAllRules, tierOf, type RuleEntry } from \"./template-helpers.js\";\nimport type { GeneratedFile } from \"./types.js\";\n\nfunction formatFrontmatter(globs: string[], description: string): string {\n return [\n \"---\",\n `description: \"${description}\"`,\n `globs: \"${globs.join(\", \")}\"`,\n \"alwaysApply: false\",\n \"---\",\n \"\",\n ].join(\"\\n\");\n}\n\nfunction formatRuleLine(\n category: string,\n name: string,\n convention: unknown,\n description?: string,\n): string {\n const value =\n typeof convention === \"string\"\n ? convention\n : JSON.stringify(convention);\n const desc = description ? ` -- ${description}` : \"\";\n return `- **${category}.${name}**: \\`${value}\\`${desc}`;\n}\n\nfunction formatBody(author: string, rules: RuleEntry[]): string {\n return [\n `# ${author}'s TypeScript Style`,\n \"\",\n ...rules\n .sort((a, b) => b.confidence - a.confidence)\n .map((r) =>\n formatRuleLine(r.category, r.name, r.convention, r.description),\n ),\n ].join(\"\\n\");\n}\n\nexport function generateClaudeRules(profile: Profile): GeneratedFile[] {\n const files: GeneratedFile[] = [];\n const allRules = extractAllRules(profile);\n const eligibleRules = allRules.filter((r) => tierOf(profile, r) !== \"off\");\n\n if (eligibleRules.length > 0) {\n const frontmatter = formatFrontmatter(\n [\"**/*.ts\", \"**/*.tsx\"],\n `${profile.author}'s TypeScript coding style preferences`,\n );\n\n files.push({\n path: \".claude/rules/typescript.md\",\n content: frontmatter + formatBody(profile.author, eligibleRules) + \"\\n\",\n });\n }\n\n return files;\n}\n","import type { Profile } from \"../schema/profile.js\";\n\ninterface ClaudeCommandHook {\n type: \"command\";\n command: string;\n}\n\ninterface ClaudeHookMatcher {\n matcher: string;\n hooks: ClaudeCommandHook[];\n}\n\ninterface ClaudeSettingsHooks {\n hooks: {\n PostToolUse: ClaudeHookMatcher[];\n };\n}\n\n// Claude Code passes the tool call as JSON on stdin; there is no file-path env variable.\nconst CHECK_EDITED_FILE =\n \"f=$(jq -r '.tool_input.file_path // empty'); [ -z \\\"$f\\\" ] || codewatch check --fix \\\"$f\\\"\";\n\nexport function generateHooksConfig(\n _profile: Profile,\n): ClaudeSettingsHooks {\n return {\n hooks: {\n PostToolUse: [\n {\n matcher: \"Write|Edit\",\n hooks: [{ type: \"command\", command: CHECK_EDITED_FILE }],\n },\n ],\n },\n };\n}\n","import type { Profile, SeverityThresholds, Severity } from \"../schema/profile.js\";\nimport { severityForConfidence, toEslintLevel } from \"../schema/severity.js\";\nimport type { StyleRule } from \"../schema/style-rule.js\";\n\ntype EmittedEslintSeverity = \"error\" | \"warn\";\n\nexport function toEslintSeverity(\n confidence: number,\n thresholds: SeverityThresholds,\n): EmittedEslintSeverity | null {\n const level = toEslintLevel(severityForConfidence(confidence, thresholds));\n return level === \"off\" ? null : level;\n}\n\nexport function severityRank(s: Severity): number {\n return s === \"error\" ? 3 : s === \"warn\" ? 2 : 1;\n}\n\n// Key order is significant: typescript-eslint's last-matching-selector-wins rule needs \"variables\" before \"constants\".\nconst NAMING_SELECTORS: Record<string, string> = {\n variables: \"variable\",\n functions: \"function\",\n types: \"typeLike\",\n constants: \"variable\",\n};\n\n// Scopes \"constants\" to top-level const declarations, so it doesn't shadow the \"variables\" rule for every const.\nconst NAMING_MODIFIERS: Partial<Record<string, string[]>> = {\n constants: [\"const\", \"global\"],\n};\n\nfunction eslintExtensionOptions(rule: StyleRule): unknown[] | undefined {\n const eslintExt = rule.extensions?.eslint;\n return eslintExt &&\n typeof eslintExt === \"object\" &&\n \"options\" in eslintExt &&\n Array.isArray((eslintExt as Record<string, unknown>).options)\n ? ((eslintExt as Record<string, unknown>).options as unknown[])\n : undefined;\n}\n\nconst NAMING_RULE = \"@typescript-eslint/naming-convention\";\n\n// Keys are profile vocabulary (style-analyzer emits SCREAMING_SNAKE); values are typescript-eslint's format enum.\nconst TS_ESLINT_FORMATS: Record<string, string> = {\n camelCase: \"camelCase\",\n strictCamelCase: \"strictCamelCase\",\n PascalCase: \"PascalCase\",\n StrictPascalCase: \"StrictPascalCase\",\n snake_case: \"snake_case\",\n UPPER_CASE: \"UPPER_CASE\",\n UPPER_SNAKE_CASE: \"UPPER_CASE\",\n SCREAMING_SNAKE: \"UPPER_CASE\",\n SCREAMING_SNAKE_CASE: \"UPPER_CASE\",\n};\n\n/** Same shape as style-checker's SkippedRule, so a consumer can forward it unchanged. */\nexport interface EslintSkippedRule {\n tool: \"eslint\";\n rule: string;\n plugin: string;\n reason: string;\n}\n\nexport interface NamingConventionResult {\n rule: [string, unknown] | null;\n skippedRules: EslintSkippedRule[];\n}\n\nexport function toTsEslintFormat(convention: string): string | null {\n return TS_ESLINT_FORMATS[convention] ?? null;\n}\n\nfunction skippedNaming(key: string, convention: unknown): EslintSkippedRule {\n return {\n tool: \"eslint\",\n rule: NAMING_RULE,\n plugin: \"@typescript-eslint\",\n reason: `naming.${key} convention ${JSON.stringify(convention)} has no typescript-eslint naming-convention format`,\n };\n}\n\nfunction namingSelectors(\n key: string,\n rule: StyleRule,\n selectorName: string,\n skipped: EslintSkippedRule[],\n): unknown[] {\n const eslintOptions = eslintExtensionOptions(rule);\n if (eslintOptions) return eslintOptions;\n const format = typeof rule.convention === \"string\" ? toTsEslintFormat(rule.convention) : null;\n if (!format) {\n skipped.push(skippedNaming(key, rule.convention));\n return [];\n }\n const modifiers = NAMING_MODIFIERS[key];\n return [{ selector: selectorName, format: [format], ...(modifiers ? { modifiers } : {}) }];\n}\n\nexport function buildNamingConvention(profile: Profile): NamingConventionResult {\n const thresholds = profile.severityThresholds;\n const selectors: unknown[] = [];\n const skippedRules: EslintSkippedRule[] = [];\n let maxSeverity: EmittedEslintSeverity | null = null;\n\n for (const key of Object.keys(NAMING_SELECTORS)) {\n const rule = profile.naming?.[key];\n if (!rule) continue;\n const selectorName = NAMING_SELECTORS[key]!;\n const severity = toEslintSeverity(rule.confidence, thresholds);\n if (!severity) continue;\n\n const ruleSelectors = namingSelectors(key, rule, selectorName, skippedRules);\n if (ruleSelectors.length === 0) continue;\n selectors.push(...ruleSelectors);\n if (!maxSeverity || severityRank(severity) > severityRank(maxSeverity)) maxSeverity = severity;\n }\n\n if (selectors.length === 0 || !maxSeverity) return { rule: null, skippedRules };\n return { rule: [NAMING_RULE, [maxSeverity, ...selectors]], skippedRules };\n}\n\nexport function buildNamingConventionRule(\n profile: Profile,\n): [string, unknown] | null {\n return buildNamingConvention(profile).rule;\n}\n\nexport function buildImportOrderRule(\n profile: Profile,\n): [string, unknown] | null {\n const importOrder = profile.structure?.importOrder;\n if (!importOrder) return null;\n const severity = toEslintSeverity(importOrder.confidence, profile.severityThresholds);\n if (!severity) return null;\n\n const convention = Array.isArray(importOrder.convention)\n ? importOrder.convention\n : [\"builtin\", \"external\", \"internal\", \"relative\"];\n\n return [\n \"perfectionist/sort-imports\",\n [\n severity,\n {\n type: \"natural\",\n groups: convention,\n },\n ],\n ];\n}\n\nexport function buildFunctionLengthRule(\n profile: Profile,\n): [string, unknown] | null {\n const maxLines = profile.structure?.functionMaxLines;\n if (!maxLines) return null;\n const severity = toEslintSeverity(maxLines.confidence, profile.severityThresholds);\n if (!severity) return null;\n if (typeof maxLines.convention !== \"number\") return null;\n\n return [\"max-lines-per-function\", [severity, { max: maxLines.convention }]];\n}\n\nexport function buildFileNamingRule(\n profile: Profile,\n): [string, unknown] | null {\n const files = profile.naming?.files;\n if (!files) return null;\n const severity = toEslintSeverity(files.confidence, profile.severityThresholds);\n if (!severity) return null;\n if (typeof files.convention !== \"string\") return null;\n\n const caseMap: Record<string, string> = {\n \"kebab-case\": \"kebabCase\",\n camelCase: \"camelCase\",\n PascalCase: \"pascalCase\",\n snake_case: \"snakeCase\",\n };\n\n return [\n \"unicorn/filename-case\",\n [severity, { case: { [caseMap[files.convention] ?? \"kebabCase\"]: true } }],\n ];\n}\n\nexport function buildJsdocRules(\n profile: Profile,\n): Array<[string, unknown]> {\n const rules: Array<[string, unknown]> = [];\n const docs = profile.documentation;\n if (!docs) return rules;\n\n const functionDocs = docs.functionDocs;\n if (!functionDocs) return rules;\n\n const severity = toEslintSeverity(functionDocs.confidence, profile.severityThresholds);\n if (!severity) return rules;\n\n if (functionDocs.convention === \"jsdoc-selective\") {\n rules.push([\"jsdoc/require-jsdoc\", [severity, { publicOnly: true }]]);\n } else if (functionDocs.convention === \"jsdoc-all\") {\n rules.push([\"jsdoc/require-jsdoc\", [severity]]);\n }\n\n return rules;\n}\n","import {\n PROFILE_CATEGORIES,\n type Profile,\n type SeverityThresholds,\n} from \"../schema/profile.js\";\nimport type { StyleRule } from \"../schema/style-rule.js\";\nimport type { GeneratedFile } from \"./types.js\";\nimport {\n toEslintSeverity,\n buildImportOrderRule,\n} from \"./eslint-rules.js\";\n\ninterface EslintRuleEntry {\n plugin: string;\n rule: string;\n severity: \"error\" | \"warn\" | \"off\";\n options?: unknown[];\n}\n\nfunction extensionEntry(\n rule: StyleRule,\n thresholds: SeverityThresholds,\n): EslintRuleEntry | null {\n const ext = rule.extensions?.eslint as\n | { rule: string; options?: unknown[] }\n | undefined;\n if (!ext) return null;\n\n const sev = toEslintSeverity(rule.confidence, thresholds);\n if (sev === null) return null;\n\n const plugin = ext.rule.includes(\"/\")\n ? ext.rule.split(\"/\").slice(0, -1).join(\"/\")\n : \"\";\n\n return {\n plugin,\n rule: ext.rule,\n severity: sev,\n options: ext.options,\n };\n}\n\nfunction collectEslintExtensions(profile: Profile): EslintRuleEntry[] {\n const entries: EslintRuleEntry[] = [];\n\n for (const category of PROFILE_CATEGORIES) {\n const section = profile[category];\n if (!section) continue;\n\n for (const [, rule] of Object.entries(section)) {\n const entry = extensionEntry(rule, profile.severityThresholds);\n if (entry) entries.push(entry);\n }\n }\n\n return entries;\n}\n\nfunction addImportOrderRule(profile: Profile, entries: EslintRuleEntry[]): void {\n const result = buildImportOrderRule(profile);\n if (!result) return;\n\n const [ruleName, ruleConfig] = result;\n const configArray = ruleConfig as unknown[];\n\n entries.push({\n plugin: \"perfectionist\",\n rule: ruleName,\n severity: configArray[0] as EslintRuleEntry[\"severity\"],\n options: [configArray[1]],\n });\n}\n\nfunction detectRequiredPlugins(entries: EslintRuleEntry[]): Set<string> {\n const plugins = new Set<string>();\n for (const entry of entries) {\n if (entry.plugin.includes(\"@typescript-eslint\")) {\n plugins.add(\"@typescript-eslint\");\n }\n if (entry.plugin === \"perfectionist\") {\n plugins.add(\"perfectionist\");\n }\n if (entry.plugin.includes(\"unicorn\")) {\n plugins.add(\"unicorn\");\n }\n if (entry.plugin.includes(\"jsdoc\")) {\n plugins.add(\"jsdoc\");\n }\n }\n return plugins;\n}\n\nfunction generateImportStatements(plugins: Set<string>): string[] {\n const imports: string[] = [];\n if (plugins.has(\"@typescript-eslint\")) {\n imports.push(`import tseslint from \"@typescript-eslint/eslint-plugin\";`);\n imports.push(`import tsparser from \"@typescript-eslint/parser\";`);\n }\n if (plugins.has(\"perfectionist\")) {\n imports.push(`import perfectionist from \"eslint-plugin-perfectionist\";`);\n }\n if (plugins.has(\"unicorn\")) {\n imports.push(`import unicorn from \"eslint-plugin-unicorn\";`);\n }\n if (plugins.has(\"jsdoc\")) {\n imports.push(`import jsdoc from \"eslint-plugin-jsdoc\";`);\n }\n return imports;\n}\n\nfunction buildRulesObject(\n entries: EslintRuleEntry[],\n): Record<string, unknown> {\n const rules: Record<string, unknown> = {};\n for (const entry of entries) {\n if (entry.options && entry.options.length > 0) {\n rules[entry.rule] = [entry.severity, ...entry.options];\n } else {\n rules[entry.rule] = entry.severity;\n }\n }\n return rules;\n}\n\nexport function generateEslintExport(profile: Profile): GeneratedFile {\n const entries = collectEslintExtensions(profile);\n addImportOrderRule(profile, entries);\n\n const plugins = detectRequiredPlugins(entries);\n const imports = generateImportStatements(plugins);\n const rules = buildRulesObject(entries);\n\n const header = [\n `// Generated by codewatch for ${profile.author}`,\n `// Date: ${profile.generated}`,\n `// Do not edit manually - regenerate with: codewatch export --format eslint`,\n \"\",\n ].join(\"\\n\");\n\n const content = [\n header,\n ...imports,\n \"\",\n `export default ${JSON.stringify({ rules }, null, 2)};`,\n \"\",\n ].join(\"\\n\");\n\n return { path: \"eslint.config.js\", content };\n}\n","import type { Profile } from \"../schema/profile.js\";\nimport type { StyleRule } from \"../schema/style-rule.js\";\nimport type { GeneratedFile } from \"./types.js\";\n\ninterface RuffLintSubsections {\n mccabe?: { maxComplexity: number };\n pydocstyle?: { convention: string };\n isort?: { sectionOrder: string[] };\n}\n\ninterface RuffLint extends RuffLintSubsections {\n select: string[];\n ignore: string[];\n fixable: string[];\n}\n\ninterface RuffConfig {\n lineLength?: number;\n lint: RuffLint;\n}\n\ninterface RuffAccumulator extends RuffLintSubsections {\n select: Set<string>;\n}\n\nconst CATEGORY_KEYS = [\n \"naming\",\n \"structure\",\n \"documentation\",\n \"errorHandling\",\n \"formatting\",\n \"patterns\",\n] as const;\n\nfunction addExtensionCodes(rule: StyleRule, select: Set<string>): void {\n if (!rule.extensions?.ruff) return;\n const ext = rule.extensions.ruff as { codes?: string[] };\n if (!ext.codes) return;\n for (const code of ext.codes) {\n select.add(code.replace(/\\d+$/, \"\"));\n }\n}\n\nfunction applyFunctionMaxLines(\n category: string,\n name: string,\n rule: StyleRule,\n acc: RuffAccumulator,\n): void {\n if (category !== \"structure\" || name !== \"functionMaxLines\") return;\n acc.select.add(\"C90\");\n if (typeof rule.convention === \"number\") {\n acc.mccabe = { maxComplexity: rule.convention };\n }\n}\n\nfunction applyRule(\n category: string,\n name: string,\n rule: StyleRule,\n acc: RuffAccumulator,\n): void {\n addExtensionCodes(rule, acc.select);\n\n if (category === \"naming\") {\n acc.select.add(\"N\");\n }\n\n if (category === \"structure\" && name === \"importOrder\") {\n acc.select.add(\"I\");\n if (Array.isArray(rule.convention)) {\n acc.isort = { sectionOrder: rule.convention as string[] };\n }\n }\n\n if (category === \"documentation\" && name === \"functionDocs\") {\n acc.select.add(\"D\");\n if (typeof rule.convention === \"string\") {\n acc.pydocstyle = { convention: rule.convention };\n }\n }\n\n applyFunctionMaxLines(category, name, rule, acc);\n}\n\nfunction lineLengthOf(profile: Profile): number | undefined {\n const lineLengthRule = profile.formatting?.lineLength;\n if (lineLengthRule && typeof lineLengthRule.convention === \"number\") {\n return lineLengthRule.convention;\n }\n return undefined;\n}\n\nfunction buildRuffConfig(profile: Profile): RuffConfig {\n const thresholds = profile.severityThresholds;\n const acc: RuffAccumulator = { select: new Set<string>() };\n const fixable = new Set<string>([\"ALL\"]);\n\n for (const category of CATEGORY_KEYS) {\n const section = profile[category];\n if (!section) continue;\n\n for (const [name, rule] of Object.entries(\n section as Record<string, StyleRule>,\n )) {\n if (rule.confidence < thresholds.info) continue;\n applyRule(category, name, rule, acc);\n }\n }\n\n return {\n lineLength: lineLengthOf(profile),\n lint: {\n select: [...acc.select].sort(),\n ignore: [],\n fixable: [...fixable],\n mccabe: acc.mccabe,\n pydocstyle: acc.pydocstyle,\n isort: acc.isort,\n },\n };\n}\n\nfunction toTomlArray(items: string[]): string {\n return `[${items.map((s) => `\"${s}\"`).join(\", \")}]`;\n}\n\nfunction serializeLintTable(lint: RuffLint): string[] {\n const lines: string[] = [\"[lint]\"];\n if (lint.select.length > 0) {\n lines.push(`select = ${toTomlArray(lint.select)}`);\n }\n if (lint.ignore.length > 0) {\n lines.push(`ignore = ${toTomlArray(lint.ignore)}`);\n }\n if (lint.fixable.length > 0) {\n lines.push(`fixable = ${toTomlArray(lint.fixable)}`);\n }\n lines.push(\"\");\n return lines;\n}\n\nfunction serializeLintSubtables(lint: RuffLintSubsections): string[] {\n const lines: string[] = [];\n\n if (lint.mccabe) {\n lines.push(\"[lint.mccabe]\");\n lines.push(`max-complexity = ${lint.mccabe.maxComplexity}`);\n lines.push(\"\");\n }\n\n if (lint.pydocstyle) {\n lines.push(\"[lint.pydocstyle]\");\n lines.push(`convention = \"${lint.pydocstyle.convention}\"`);\n lines.push(\"\");\n }\n\n if (lint.isort) {\n lines.push(\"[lint.isort]\");\n lines.push(`section-order = ${toTomlArray(lint.isort.sectionOrder)}`);\n lines.push(\"\");\n }\n\n return lines;\n}\n\nfunction serializeToToml(config: RuffConfig): string {\n const lines: string[] = [];\n\n if (config.lineLength !== undefined) {\n lines.push(`line-length = ${config.lineLength}`);\n lines.push(\"\");\n }\n\n lines.push(...serializeLintTable(config.lint));\n lines.push(...serializeLintSubtables(config.lint));\n\n return lines.join(\"\\n\");\n}\n\nexport function generateRuffExport(profile: Profile): GeneratedFile {\n const config = buildRuffConfig(profile);\n\n const header = [\n `# Generated by codewatch for ${profile.author}`,\n `# Date: ${profile.generated}`,\n `# Do not edit manually - regenerate with: codewatch export --format ruff`,\n \"\",\n ].join(\"\\n\");\n\n return {\n path: \"ruff.toml\",\n content: header + serializeToToml(config),\n };\n}\n","import type { Profile } from \"../schema/profile.js\";\nimport type { GeneratedFile } from \"./types.js\";\nimport {\n extractAllRules,\n type RuleEntry,\n} from \"./template-helpers.js\";\n\nfunction capitalize(str: string): string {\n const spaced = str.replace(/([A-Z])/g, \" $1\");\n return spaced.charAt(0).toUpperCase() + spaced.slice(1);\n}\n\nfunction formatConvention(convention: unknown): string {\n if (typeof convention === \"string\") return convention;\n if (typeof convention === \"number\") return String(convention);\n if (typeof convention === \"boolean\") return String(convention);\n return JSON.stringify(convention);\n}\n\nfunction groupByCategory(rules: RuleEntry[]): Map<string, RuleEntry[]> {\n const byCategory = new Map<string, RuleEntry[]>();\n for (const rule of rules) {\n const existing = byCategory.get(rule.category) ?? [];\n existing.push(rule);\n byCategory.set(rule.category, existing);\n }\n return byCategory;\n}\n\nfunction exampleLines(examples: NonNullable<RuleEntry[\"examples\"]>): string[] {\n const lines: string[] = [];\n for (const example of examples) {\n if (example.good) {\n lines.push(\"```typescript\");\n lines.push(\"// Preferred\");\n lines.push(example.good);\n lines.push(\"```\");\n lines.push(\"\");\n }\n if (example.bad) {\n lines.push(\"```typescript\");\n lines.push(\"// Avoid\");\n lines.push(example.bad);\n lines.push(\"```\");\n lines.push(\"\");\n }\n }\n return lines;\n}\n\nfunction ruleLines(rule: RuleEntry): string[] {\n const lines: string[] = [];\n const confPct = (rule.confidence * 100).toFixed(0);\n const value = formatConvention(rule.convention);\n\n lines.push(`### ${capitalize(rule.name)}`);\n lines.push(\"\");\n lines.push(\n `**Convention**: \\`${value}\\` | **Confidence**: ${confPct}%${rule.stability ? ` | **Stability**: ${rule.stability}` : \"\"}`,\n );\n lines.push(\"\");\n\n if (rule.description) {\n lines.push(rule.description);\n lines.push(\"\");\n }\n\n if (rule.examples && rule.examples.length > 0) {\n lines.push(...exampleLines(rule.examples));\n }\n\n return lines;\n}\n\nexport function generateMarkdownExport(profile: Profile): GeneratedFile {\n const allRules = extractAllRules(profile);\n const byCategory = groupByCategory(allRules);\n const lines: string[] = [];\n\n lines.push(`# ${profile.author}'s Code Style Guide`);\n lines.push(\"\");\n lines.push(`> Generated by codewatch on ${profile.generated}`);\n lines.push(\n `> Sources: ${profile.sources.length > 0 ? profile.sources.join(\", \") : \"N/A\"}`,\n );\n lines.push(\"\");\n\n for (const [category, rules] of byCategory) {\n lines.push(`## ${capitalize(category)}`);\n lines.push(\"\");\n\n const sorted = [...rules].sort((a, b) => b.confidence - a.confidence);\n for (const rule of sorted) {\n lines.push(...ruleLines(rule));\n }\n }\n\n return {\n path: \"style-guide.md\",\n content: lines.join(\"\\n\"),\n };\n}\n","import type { Profile } from \"../schema/profile.js\";\nimport type { StyleRule } from \"../schema/style-rule.js\";\nimport type { GeneratedFile } from \"./types.js\";\n\nfunction getConvention<T>(\n section: Record<string, StyleRule>,\n key: string,\n): T | undefined {\n const rule = section[key];\n if (!rule) return undefined;\n return rule.convention as T;\n}\n\nfunction indentAndNewlineLines(formatting: Record<string, StyleRule>): string[] {\n const lines: string[] = [];\n\n const indentStyle = getConvention<string>(formatting, \"indentStyle\");\n if (indentStyle) {\n const value =\n indentStyle === \"spaces\"\n ? \"space\"\n : indentStyle === \"tabs\"\n ? \"tab\"\n : indentStyle;\n lines.push(`indent_style = ${value}`);\n }\n\n const indentSize = getConvention<number>(formatting, \"indentSize\");\n if (indentSize !== undefined) {\n lines.push(`indent_size = ${indentSize}`);\n }\n\n const trailingNewline = getConvention<boolean>(\n formatting,\n \"trailingNewline\",\n );\n if (trailingNewline !== undefined) {\n lines.push(`insert_final_newline = ${trailingNewline}`);\n }\n\n return lines;\n}\n\nexport function generateEditorConfigExport(\n profile: Profile,\n): GeneratedFile {\n const formatting = profile.formatting;\n const lines: string[] = [];\n\n lines.push(\"# Generated by codewatch\");\n lines.push(\"root = true\");\n lines.push(\"\");\n lines.push(\"[*]\");\n lines.push(...indentAndNewlineLines(formatting));\n\n lines.push(\"end_of_line = lf\");\n lines.push(\"charset = utf-8\");\n lines.push(\"trim_trailing_whitespace = true\");\n\n const lineLength = getConvention<number>(formatting, \"lineLength\");\n if (lineLength !== undefined) {\n lines.push(`max_line_length = ${lineLength}`);\n }\n\n lines.push(\"\");\n\n return {\n path: \".editorconfig\",\n content: lines.join(\"\\n\"),\n };\n}\n","import type { Profile } from \"../schema/profile.js\";\nimport type { GeneratedFile } from \"./types.js\";\nimport { generateSkillFiles } from \"./skill.js\";\nimport { generateClaudeRules } from \"./claude-rules.js\";\nimport { generateHooksConfig } from \"./hooks.js\";\nimport { generateEslintExport } from \"./eslint.js\";\nimport { generateRuffExport } from \"./ruff.js\";\nimport { generateMarkdownExport } from \"./markdown.js\";\nimport { generateEditorConfigExport } from \"./editorconfig.js\";\n\nexport type ExportFormat =\n | \"skill\"\n | \"claude-rules\"\n | \"hooks\"\n | \"eslint\"\n | \"ruff\"\n | \"markdown\"\n | \"editorconfig\";\n\nexport const SUPPORTED_FORMATS: ExportFormat[] = [\n \"skill\",\n \"claude-rules\",\n \"hooks\",\n \"eslint\",\n \"ruff\",\n \"markdown\",\n \"editorconfig\",\n];\n\nfunction hooksFiles(profile: Profile): GeneratedFile[] {\n const config = generateHooksConfig(profile);\n return [\n {\n path: \".claude/codewatch-hooks.json\",\n content: JSON.stringify(config, null, 2),\n },\n ];\n}\n\nexport function exportProfile(\n profile: Profile,\n format: ExportFormat,\n): GeneratedFile[] {\n switch (format) {\n case \"skill\":\n return generateSkillFiles(profile);\n case \"claude-rules\":\n return generateClaudeRules(profile);\n case \"hooks\":\n return hooksFiles(profile);\n case \"eslint\":\n return [generateEslintExport(profile)];\n case \"ruff\":\n return [generateRuffExport(profile)];\n case \"markdown\":\n return [generateMarkdownExport(profile)];\n case \"editorconfig\":\n return [generateEditorConfigExport(profile)];\n default:\n throw new Error(\n `Unsupported export format: \"${format as string}\". Supported formats: ${SUPPORTED_FORMATS.join(\", \")}`,\n );\n }\n}\n"],"mappings":";AAAA,SAAS,SAAS;AAEX,IAAM,gBAAgB,EAAE,OAAO;AAAA,EACpC,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,KAAK,EAAE,OAAO,EAAE,SAAS;AAAA,EACzB,QAAQ,EAAE,OAAO,EAAE,SAAS;AAC9B,CAAC;AAEM,IAAM,kBAAkB,EAAE,KAAK,CAAC,QAAQ,UAAU,KAAK,CAAC;AAExD,IAAM,mBAAmB,EAAE,KAAK;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,kBAAkB,EAAE,OAAO;AAAA,EACtC,YAAY,EAAE,MAAM;AAAA,IAClB,EAAE,OAAO;AAAA,IACT,EAAE,OAAO;AAAA,IACT,EAAE,QAAQ;AAAA,IACV,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,EACpB,CAAC;AAAA,EACD,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC;AAAA,EACnC,WAAW,gBAAgB,SAAS;AAAA,EACpC,YAAY,iBAAiB,SAAS;AAAA,EACtC,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,UAAU,EAAE,MAAM,aAAa,EAAE,SAAS;AAAA,EAC1C,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,EAAE,SAAS;AACzD,CAAC;;;AC9BD,SAAS,KAAAA,UAAS;AAGX,IAAM,iBAAiB;AAE9B,IAAM,iBAAiBC,GAAE,OAAOA,GAAE,OAAO,GAAG,eAAe;AAE3D,IAAM,cAAcA,GAAE,OA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BAAqB,UAAU,EAAE;AAAA,EAC9C;AAEA,QAAM,KAAK,EAAE;AAEb,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS,MAAM,KAAK,IAAI;AAAA,EAC1B;AACF;;;ACnDO,IAAM,oBAAoC;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAAS,WAAW,SAAmC;AACrD,QAAM,SAAS,oBAAoB,OAAO;AAC1C,SAAO;AAAA,IACL;AAAA,MACE,MAAM;AAAA,MACN,SAAS,KAAK,UAAU,QAAQ,MAAM,CAAC;AAAA,IACzC;AAAA,EACF;AACF;AAEO,SAAS,cACd,SACA,QACiB;AACjB,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO,mBAAmB,OAAO;AAAA,IACnC,KAAK;AACH,aAAO,oBAAoB,OAAO;AAAA,IACpC,KAAK;AACH,aAAO,WAAW,OAAO;AAAA,IAC3B,KAAK;AACH,aAAO,CAAC,qBAAqB,OAAO,CAAC;AAAA,IACvC,KAAK;AACH,aAAO,CAAC,mBAAmB,OAAO,CAAC;AAAA,IACrC,KAAK;AACH,aAAO,CAAC,uBAAuB,OAAO,CAAC;AAAA,IACzC,KAAK;AACH,aAAO,CAAC,2BAA2B,OAAO,CAAC;AAAA,IAC7C;AACE,YAAM,IAAI;AAAA,QACR,+BAA+B,MAAgB,yBAAyB,kBAAkB,KAAK,IAAI,CAAC;AAAA,MACtG;AAAA,EACJ;AACF;","names":["z","z","migrations"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@titan-design/style-profile",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Declare one code-style profile and export it as enforcement artifacts: ESLint and ruff configs, EditorConfig, Claude rules, hooks, a skill, and markdown",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|