/** * lib/app-code.ts — THE grammar of a scaffolder `appCode` (audit 2026-09-24, D10). * * `appCode` is the .NET project-name PREFIX of the generated solution: it builds * the emitted paths — `src/{appCode}.Api`, `src/{appCode}.Infrastructure/…`. It is * NOT the C# namespace (a separate `namespace` field carries its own grammar, * `[A-Za-z_][A-Za-z0-9_.]*`) and NOT the BA `applicationCode` (the kebab * navigation code of ONE application). Until 2026-09-24 six backend scaffolders * each carried an inline regex and disagreed: scaffold-core-seed and scaffold-seed * accepted `test-v2` (a hyphen), scaffold-entity / scaffold-business / * scaffold-controller / scaffold-screen-controller refused it — the same value * passed Phase 0 of /ba-develop and was refused in Phase 1. Now the six agree and * all refuse it (a kebab prefix is not a C# namespace root). * * Accepted set: a C# IDENTIFIER — first character a letter or `_`, then letters, * digits and `_`. Why an identifier and not a file name: every C# emitter falls * back to `spec.namespace ?? spec.appCode` as the namespace root, so a hyphen * (`test-v2`) would render `namespace test-v2.Domain…` — invalid C#. `ss init` * (`src/commands/init.ts`) only ever produces a PascalCase project name, so this * grammar is a superset of what the pipeline emits. Refused BY CONSTRUCTION: * `-`, `/`, `\`, `.` (hence `..`), whitespace, an empty string, a leading digit. * * Consumers (import — never copy): the six `types.ts` named above, and any * future scaffolder whose spec carries the project prefix. */ /** The ONE `appCode` grammar shared by every backend scaffolder. */ export const APP_CODE_RE = /^[A-Za-z_][A-Za-z0-9_]*$/ /** The ONE refusal message — the schemas hand it to `z.string().regex(APP_CODE_RE, APP_CODE_MESSAGE)`. */ export const APP_CODE_MESSAGE = 'appCode must be the .NET project name prefix that builds the emitted paths (src/{appCode}.Api) and, when namespace is omitted, the C# namespace root: a C# identifier — a letter or "_" first, then letters, digits or "_" (e.g. MyApp, My_App) — never a hyphen (test-v2 is not a C# namespace) nor a path segment ("/", "\\", ".", spaces); it is not the BA applicationCode'