vercel-labs / vercel-labs/konsistent
Use one word-boundary algorithm for placeholder segments
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 176
- Forks
- 6
- Avg merge
- 20h 26m
- Merged PRs (30d)
- 11
Description
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.tspackages/konsistent/src/core/placeholder.tspackages/konsistent/src/core/constraints/segments.tspackages/konsistent/src/config/schema.tspackages/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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the existing boundary handling across packages/konsistent/src/core/case-utils.ts, placeholder.ts, and constraints/segments.ts, then inspect validation and CLI behavior in config/schema.ts and config/cli-placeholders.ts. Add shared tests for spaces, hyphens, underscores, camelCase, and PascalCase, and verify deprecated behavior remains selectable with a non-failing warning where required.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli, tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100