openclaw/scripts/lib/protocol-codegen-names.mts
Peter Steinberger d6e4bd48c3
build(apps): generate native protocol models at build time (#162251)
* build(apps): generate native protocol models at build time

* test(apps): include native preparation in CI build contract

* fix(apps): share cached protocol generation across Apple destinations

* fix(build): type native protocol naming helpers

* fix(build): preserve native protocol tooling consumers

* fix(tooling): scope native protocol build audit roots

* fix(build): prepare native protocol in runtime-only builds

* fix(build): preserve native preparation package and workflow contracts
2026-10-01 11:43:36 -07:00

15 lines
522 B
TypeScript

export function upperCamel(value: string): string {
const parts = value.match(/[A-Z]+(?=[A-Z][a-z]|\d|$)|[A-Z]?[a-z]+|\d+/g);
if (!parts?.length) {
throw new Error(`Cannot create Kotlin identifier from ${JSON.stringify(value)}`);
}
return parts
.map((part) => part.toLowerCase())
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
.join("");
}
export function lowerCamel(value: string): string {
const name = upperCamel(value);
return name.charAt(0).toLowerCase() + name.slice(1);
}