Placeholder segment behavior is inconsistent: case conversion and segments(n) split some camel-case, hyphen, and underscore boundaries, while toNthSegment splits only on hyphens, and spaces are not handled consistently. Any word boundary in a name should mean the same thing everywhere, including spaces, hyphens, underscores, and uppercase transitions in camelCase or PascalCase names.
Relevant files:
packages/konsistent/src/core/case-utils.ts
packages/konsistent/src/core/placeholder.ts
packages/konsistent/src/core/constraints/segments.ts
packages/konsistent/src/config/schema.ts
packages/konsistent/src/config/cli-placeholders.ts
Implement one canonical word-splitting function and use it for segment constraints, nth-segment transforms, and case transforms. Update placeholder value validation where necessary so supported inputs can contain every documented boundary form, with shared tests covering all boundary types.
Backward compatibility: internal helpers and documentation can be renamed or replaced without compatibility shims. If accepted placeholder values or any konsistent.json behavior changes, keep the old behavior available as deprecated where it can be selected explicitly and emit a non-failing CLI warning for deprecated usage.
Placeholder segment behavior is inconsistent: case conversion and
segments(n)split some camel-case, hyphen, and underscore boundaries, whiletoNthSegmentsplits only on hyphens, and spaces are not handled consistently. Any word boundary in a name should mean the same thing everywhere, including spaces, hyphens, underscores, and uppercase transitions in camelCase or PascalCase names.Relevant files:
packages/konsistent/src/core/case-utils.tspackages/konsistent/src/core/placeholder.tspackages/konsistent/src/core/constraints/segments.tspackages/konsistent/src/config/schema.tspackages/konsistent/src/config/cli-placeholders.tsImplement one canonical word-splitting function and use it for segment constraints, nth-segment transforms, and case transforms. Update placeholder value validation where necessary so supported inputs can contain every documented boundary form, with shared tests covering all boundary types.
Backward compatibility: internal helpers and documentation can be renamed or replaced without compatibility shims. If accepted placeholder values or any
konsistent.jsonbehavior changes, keep the old behavior available as deprecated where it can be selected explicitly and emit a non-failing CLI warning for deprecated usage.