@rebasepro/cli 0.34.0 → 0.34.2
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/dist/{agent-setup-CGeAuP0Q.js → agent-setup-kjdKozkF.js} +3 -3
- package/dist/{agent-setup-CGeAuP0Q.js.map → agent-setup-kjdKozkF.js.map} +1 -1
- package/dist/{api-zx1wSK5a.js → api-CQh_qTyQ.js} +2 -2
- package/dist/{api-zx1wSK5a.js.map → api-CQh_qTyQ.js.map} +1 -1
- package/dist/{api-keys-DaWN8dyI.js → api-keys-CG2IpknI.js} +5 -5
- package/dist/{api-keys-DaWN8dyI.js.map → api-keys-CG2IpknI.js.map} +1 -1
- package/dist/{apps-D6vtDrkJ.js → apps-DaaWvv3o.js} +6 -6
- package/dist/{apps-D6vtDrkJ.js.map → apps-DaaWvv3o.js.map} +1 -1
- package/dist/{atlas-dev-database-D6h65f2x.js → atlas-dev-database-BiDMUr9W.js} +2 -2
- package/dist/{atlas-dev-database-D6h65f2x.js.map → atlas-dev-database-BiDMUr9W.js.map} +1 -1
- package/dist/{auth-DY7kU0z-.js → auth-bi8x2YX1.js} +12 -12
- package/dist/{auth-DY7kU0z-.js.map → auth-bi8x2YX1.js.map} +1 -1
- package/dist/{auth-session-DCG96UGH.js → auth-session-BVoxE5tp.js} +4 -4
- package/dist/{auth-session-DCG96UGH.js.map → auth-session-BVoxE5tp.js.map} +1 -1
- package/dist/{backend-guard-Cf8eMK_f.js → backend-guard--SW3MTSh.js} +2 -2
- package/dist/{backend-guard-Cf8eMK_f.js.map → backend-guard--SW3MTSh.js.map} +1 -1
- package/dist/{branch-pointer-BJOF2Ubv.js → branch-pointer-BjKUoENm.js} +1 -1
- package/dist/{build-D0egCUfU.js → build-D-0VCmbU.js} +11 -11
- package/dist/build-D-0VCmbU.js.map +1 -0
- package/dist/{bundle-DhdhtD8K.js → bundle-BDTVS9XE.js} +6 -6
- package/dist/{bundle-DhdhtD8K.js.map → bundle-BDTVS9XE.js.map} +1 -1
- package/dist/{cloud-DOR7bxDw.js → cloud-CR6Hps3B.js} +12 -12
- package/dist/{cloud-DOR7bxDw.js.map → cloud-CR6Hps3B.js.map} +1 -1
- package/dist/{cms-directories-BaV-Is9a.js → cms-directories-AGHvFwH7.js} +2 -2
- package/dist/{cms-directories-BaV-Is9a.js.map → cms-directories-AGHvFwH7.js.map} +1 -1
- package/dist/{command-BzSP5gBh.js → command-nWgittn1.js} +3 -3
- package/dist/{command-BzSP5gBh.js.map → command-nWgittn1.js.map} +1 -1
- package/dist/commands/build.d.ts +2 -1
- package/dist/{consent-UV6ObCME.js → consent-C8_Ik_GK.js} +3 -3
- package/dist/{consent-UV6ObCME.js.map → consent-C8_Ik_GK.js.map} +1 -1
- package/dist/{console-BVoYOLAO.js → console-BBGRHOFg.js} +5 -5
- package/dist/{console-BVoYOLAO.js.map → console-BBGRHOFg.js.map} +1 -1
- package/dist/{context-xt20FMFA.js → context-C9lz1vTS.js} +2 -2
- package/dist/{context-xt20FMFA.js.map → context-C9lz1vTS.js.map} +1 -1
- package/dist/{cron-CJ6Xk42E.js → cron-BzzNxkBH.js} +3 -3
- package/dist/{cron-CJ6Xk42E.js.map → cron-BzzNxkBH.js.map} +1 -1
- package/dist/{cron-BGkXIB1N.js → cron-DuZ3Svjq.js} +4 -4
- package/dist/{cron-BGkXIB1N.js.map → cron-DuZ3Svjq.js.map} +1 -1
- package/dist/{daemon-D5gdG7gx.js → daemon-BCBMn8hE.js} +2 -2
- package/dist/{daemon-D5gdG7gx.js.map → daemon-BCBMn8hE.js.map} +1 -1
- package/dist/{data-BpkvtCUe.js → data-1eipHbxJ.js} +3 -3
- package/dist/{data-BpkvtCUe.js.map → data-1eipHbxJ.js.map} +1 -1
- package/dist/{db-D_iF4E-v.js → db-DAotpOxs.js} +28 -28
- package/dist/{db-D_iF4E-v.js.map → db-DAotpOxs.js.map} +1 -1
- package/dist/{debug-C7Ss34XB.js → debug-CkiOcfsU.js} +2 -2
- package/dist/{debug-C7Ss34XB.js.map → debug-CkiOcfsU.js.map} +1 -1
- package/dist/{derive-ChP6vgfi.js → derive-BU5kvcOP.js} +2 -2
- package/dist/{derive-ChP6vgfi.js.map → derive-BU5kvcOP.js.map} +1 -1
- package/dist/{dev-C7n36E6f.js → dev-Ce9PVQS8.js} +13 -13
- package/dist/{dev-C7n36E6f.js.map → dev-Ce9PVQS8.js.map} +1 -1
- package/dist/{dev-preflight-BMOf2N6r.js → dev-preflight-DROlafgr.js} +2 -2
- package/dist/{dev-preflight-BMOf2N6r.js.map → dev-preflight-DROlafgr.js.map} +1 -1
- package/dist/{dev-server-2XHSHM_q.js → dev-server-dsabI0UT.js} +2 -2
- package/dist/{dev-server-2XHSHM_q.js.map → dev-server-dsabI0UT.js.map} +1 -1
- package/dist/{doctor-D0o54XSQ.js → doctor-Cdu3Llrw.js} +7 -7
- package/dist/{doctor-D0o54XSQ.js.map → doctor-Cdu3Llrw.js.map} +1 -1
- package/dist/{eject-DK_M9kor.js → eject-Dy-qRYhW.js} +3 -3
- package/dist/{eject-DK_M9kor.js.map → eject-Dy-qRYhW.js.map} +1 -1
- package/dist/{fold-static-DTpaqbB0.js → fold-static-DzV3EJZm.js} +4 -4
- package/dist/{fold-static-DTpaqbB0.js.map → fold-static-DzV3EJZm.js.map} +1 -1
- package/dist/{functions-DLuuldt2.js → functions-BCEJnISw.js} +4 -4
- package/dist/{functions-DLuuldt2.js.map → functions-BCEJnISw.js.map} +1 -1
- package/dist/{generate-view-BMaLQm8H.js → generate-view-CZ0SmsJc.js} +4 -4
- package/dist/{generate-view-BMaLQm8H.js.map → generate-view-CZ0SmsJc.js.map} +1 -1
- package/dist/{generate_sdk-UT1lwwRT.js → generate_sdk-MAbUUZoK.js} +6 -6
- package/dist/{generate_sdk-UT1lwwRT.js.map → generate_sdk-MAbUUZoK.js.map} +1 -1
- package/dist/index.es.js +54 -54
- package/dist/{init-u5Xmr1Ct.js → init-BctfWO3w.js} +44 -24
- package/dist/init-BctfWO3w.js.map +1 -0
- package/dist/last-dev-database-w-r9T5Xm.js +2 -0
- package/dist/{legacy-layout-DI2VeQSV.js → legacy-layout-CiXWalS6.js} +2 -2
- package/dist/{legacy-layout-DI2VeQSV.js.map → legacy-layout-CiXWalS6.js.map} +1 -1
- package/dist/{logs-DBYRSs6W.js → logs-B_mS4gCn.js} +4 -4
- package/dist/{logs-DBYRSs6W.js.map → logs-B_mS4gCn.js.map} +1 -1
- package/dist/{manifest-RjqxfCpb.js → manifest-D6B4LA8x.js} +3 -3
- package/dist/{manifest-RjqxfCpb.js.map → manifest-D6B4LA8x.js.map} +1 -1
- package/dist/{migrate-Cw1FkvUK.js → migrate-DdcgLMyL.js} +3 -3
- package/dist/{migrate-Cw1FkvUK.js.map → migrate-DdcgLMyL.js.map} +1 -1
- package/dist/{normalize-imports-E4yA1HfW.js → normalize-imports-CVjOssZ2.js} +2 -2
- package/dist/{normalize-imports-E4yA1HfW.js.map → normalize-imports-CVjOssZ2.js.map} +1 -1
- package/dist/{package-manager-DSEOwTqM.js → package-manager-DTNNGHyK.js} +29 -12
- package/dist/package-manager-DTNNGHyK.js.map +1 -0
- package/dist/{path-flags-ekLdkbra.js → path-flags-B7Ydt5nv.js} +2 -2
- package/dist/{path-flags-ekLdkbra.js.map → path-flags-B7Ydt5nv.js.map} +1 -1
- package/dist/{prepare-BaJe0Zik.js → prepare-CFpYl1Nt.js} +4 -4
- package/dist/{prepare-BaJe0Zik.js.map → prepare-CFpYl1Nt.js.map} +1 -1
- package/dist/{project-DALmhb5R.js → project-CQ5nKddJ.js} +2 -2
- package/dist/{project-DALmhb5R.js.map → project-CQ5nKddJ.js.map} +1 -1
- package/dist/{project-command-7EGMemEy.js → project-command-5wM_bJQt.js} +7 -7
- package/dist/{project-command-7EGMemEy.js.map → project-command-5wM_bJQt.js.map} +1 -1
- package/dist/resolve-GDRel2ne.js +2 -0
- package/dist/{resources-CE6BeL94.js → resources-ecA0MEjy.js} +4 -4
- package/dist/{resources-CE6BeL94.js.map → resources-ecA0MEjy.js.map} +1 -1
- package/dist/{rls-BxWLfEKl.js → rls-B4zGbTKY.js} +3 -3
- package/dist/{rls-BxWLfEKl.js.map → rls-B4zGbTKY.js.map} +1 -1
- package/dist/{schema-D8xFSBbN.js → schema-CWzzn0cY.js} +11 -11
- package/dist/{schema-D8xFSBbN.js.map → schema-CWzzn0cY.js.map} +1 -1
- package/dist/{schema-dir-ChcYfWjP.js → schema-dir-Dd1Pzqq5.js} +2 -2
- package/dist/{schema-dir-ChcYfWjP.js.map → schema-dir-Dd1Pzqq5.js.map} +1 -1
- package/dist/schema-reconcile-DGEMmYJI.js +2 -0
- package/dist/{schema-show-C7bY7SgE.js → schema-show-DwYtOp4S.js} +5 -5
- package/dist/{schema-show-C7bY7SgE.js.map → schema-show-DwYtOp4S.js.map} +1 -1
- package/dist/{skills-C8WdRTFg.js → skills-CWmBTCRW.js} +5 -5
- package/dist/{skills-C8WdRTFg.js.map → skills-CWmBTCRW.js.map} +1 -1
- package/dist/{start-CN_9C205.js → start-4uhCu_md.js} +6 -6
- package/dist/{start-CN_9C205.js.map → start-4uhCu_md.js.map} +1 -1
- package/dist/{status-HWlZbY1E.js → status-CVEzoSwX.js} +7 -7
- package/dist/{status-HWlZbY1E.js.map → status-CVEzoSwX.js.map} +1 -1
- package/dist/{storage-DBE8lgH-.js → storage-Dqf5tyhs.js} +9 -9
- package/dist/{storage-DBE8lgH-.js.map → storage-Dqf5tyhs.js.map} +1 -1
- package/dist/{storage-objects-ljDmtuH7.js → storage-objects-DbFsemMV.js} +3 -3
- package/dist/{storage-objects-ljDmtuH7.js.map → storage-objects-DbFsemMV.js.map} +1 -1
- package/dist/{telemetry-DZU2-NCm.js → telemetry-B5RSeQIc.js} +3 -3
- package/dist/{telemetry-DZU2-NCm.js.map → telemetry-B5RSeQIc.js.map} +1 -1
- package/dist/{telemetry-EVtASbKb.js → telemetry-CJbrRuG3.js} +2 -2
- package/dist/{telemetry-EVtASbKb.js.map → telemetry-CJbrRuG3.js.map} +1 -1
- package/dist/{upgrade-ZASvgxWM.js → upgrade-CepjhRrz.js} +6 -6
- package/dist/{upgrade-ZASvgxWM.js.map → upgrade-CepjhRrz.js.map} +1 -1
- package/dist/{users-DrJEtL9k.js → users-Cx5HuaTn.js} +3 -3
- package/dist/{users-DrJEtL9k.js.map → users-Cx5HuaTn.js.map} +1 -1
- package/dist/utils/package-manager.d.ts +12 -13
- package/dist/{verify-BdeqNb-V.js → verify-D-1y5HQS.js} +8 -8
- package/dist/{verify-BdeqNb-V.js.map → verify-D-1y5HQS.js.map} +1 -1
- package/package.json +10 -10
- package/templates/template/npmrc +5 -7
- package/dist/build-D0egCUfU.js.map +0 -1
- package/dist/init-u5Xmr1Ct.js.map +0 -1
- package/dist/last-dev-database-CBVkEUEl.js +0 -2
- package/dist/package-manager-DSEOwTqM.js.map +0 -1
- package/dist/resolve-C36px9tR.js +0 -2
- package/dist/schema-reconcile-D_wvZY91.js +0 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as unknownCommand } from "./unknown-command-DnZ2uhGs.js";
|
|
2
2
|
import { a as wantsHelp, n as parseCommandArgs, t as UsageError } from "./args-DHyrshtI.js";
|
|
3
|
-
import { a as projectTarget, c as requestJson, d as PROJECT_TARGET_FLAGS, i as printProjectHelp, l as startProjectCommand, n as isRecord, o as recordsOf, r as parsedLine, u as stringOf } from "./project-command-
|
|
4
|
-
import { M as note, m as emit } from "./context-
|
|
5
|
-
import { buildApiPlan, sendApiPlan } from "./api-
|
|
3
|
+
import { a as projectTarget, c as requestJson, d as PROJECT_TARGET_FLAGS, i as printProjectHelp, l as startProjectCommand, n as isRecord, o as recordsOf, r as parsedLine, u as stringOf } from "./project-command-5wM_bJQt.js";
|
|
4
|
+
import { M as note, m as emit } from "./context-C9lz1vTS.js";
|
|
5
|
+
import { buildApiPlan, sendApiPlan } from "./api-CQh_qTyQ.js";
|
|
6
6
|
import chalk from "chalk";
|
|
7
7
|
//#region src/commands/functions.ts
|
|
8
8
|
/** Everything the switch below dispatches, for the did-you-mean. */
|
|
@@ -117,4 +117,4 @@ function printFunctionsHelp() {
|
|
|
117
117
|
//#endregion
|
|
118
118
|
export { FUNCTIONS_SUBCOMMANDS, functionsCommand };
|
|
119
119
|
|
|
120
|
-
//# sourceMappingURL=functions-
|
|
120
|
+
//# sourceMappingURL=functions-BCEJnISw.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions-
|
|
1
|
+
{"version":3,"file":"functions-BCEJnISw.js","names":[],"sources":["../src/commands/functions.ts"],"sourcesContent":["/**\n * CLI command: rebase functions <action>\n *\n * A running app's own routes — one per file in `backend/functions/`, served at\n * `/api/functions/<name>/*` — listed, or called with the project's credential.\n * `invoke` is `rebase api` aimed at one function: the same fields, body and\n * headers, and the answer printed as it came.\n *\n * Functions are public by default and decide their own access\n * (`requireAuth`, `requireRole`, `requireScope`), so the credential matters:\n * the service key is admin, `--token` tests a narrower one, `--session` a\n * person, and `--anon` what a visitor gets.\n */\nimport type arg from \"arg\";\nimport chalk from \"chalk\";\n\nimport { parseCommandArgs, UsageError, wantsHelp } from \"../utils/args\";\nimport { unknownCommand } from \"../utils/unknown-command\";\nimport { PROJECT_TARGET_FLAGS } from \"../utils/project-target\";\nimport {\n emit,\n isRecord,\n parsedLine,\n printProjectHelp,\n projectTarget,\n recordsOf,\n requestJson,\n startProjectCommand,\n stringOf,\n type HelpAction\n} from \"../utils/project-command\";\nimport { note } from \"./cloud/context\";\nimport { buildApiPlan, sendApiPlan } from \"./api\";\n\n/** Everything the switch below dispatches, for the did-you-mean. */\nexport const FUNCTIONS_SUBCOMMANDS = [\"list\", \"invoke\"] as const;\n\nexport async function functionsCommand(subcommand: string | undefined, rawArgs: string[]): Promise<void> {\n startProjectCommand(rawArgs);\n if (subcommand === \"--help\" || wantsHelp(rawArgs)) {\n printFunctionsHelp();\n return;\n }\n switch (subcommand ?? \"list\") {\n case \"list\":\n await listFunctions(rawArgs);\n break;\n case \"invoke\":\n await invokeFunction(rawArgs);\n break;\n default:\n unknownCommand(subcommand, FUNCTIONS_SUBCOMMANDS, \"functions\");\n }\n}\n\nexport const FUNCTIONS_LIST_FLAGS = { ...PROJECT_TARGET_FLAGS } satisfies arg.Spec;\n\nasync function listFunctions(rawArgs: string[]): Promise<void> {\n const { flags } = parsedLine(() => parseCommandArgs({\n spec: FUNCTIONS_LIST_FLAGS,\n rawArgs,\n commandWords: 2,\n command: \"functions list\",\n maxPositionals: 0\n }));\n const target = await projectTarget(flags, { command: \"functions list\" });\n const body = await requestJson(target, \"/api/functions\", \"Failed to list functions\");\n const list = recordsOf(isRecord(body) ? body.functions ?? body.data : body);\n emit(() => {\n if (list.length === 0) return note(`${target.label} serves no functions (backend/functions/ is empty, or no file loaded).`);\n for (const fn of list) {\n const name = stringOf(fn.name) ?? \"?\";\n console.log(` ${chalk.bold(name)} ${chalk.gray(stringOf(fn.path) ?? `/api/functions/${name}`)}`);\n }\n if (isRecord(body) && typeof body.skipped === \"number\" && body.skipped > 0) {\n note(chalk.yellow(`${body.skipped} file(s) did not load; the server log says why.`));\n }\n }, body);\n}\n\nexport const FUNCTIONS_INVOKE_FLAGS = {\n ...PROJECT_TARGET_FLAGS,\n \"--method\": String,\n \"-X\": \"--method\",\n \"--field\": [String],\n \"-f\": \"--field\",\n \"--raw-field\": [String],\n \"-F\": \"--raw-field\",\n \"--input\": String,\n \"--header\": [String],\n \"-H\": \"--header\",\n \"--include\": Boolean,\n \"-i\": \"--include\"\n} satisfies arg.Spec;\n\nasync function invokeFunction(rawArgs: string[]): Promise<void> {\n const { flags, plan } = parsedLine(() => {\n const parsed = parseCommandArgs({\n spec: FUNCTIONS_INVOKE_FLAGS,\n rawArgs,\n commandWords: 2,\n command: \"functions invoke\",\n maxPositionals: 2\n });\n const [name, rest] = parsed.positionals;\n if (!name) throw new UsageError(\"rebase functions invoke needs a function name: rebase functions invoke <name> [path].\");\n if (name.includes(\"/\")) throw new UsageError(`\"${name}\" is not a function name: the path after it is the second argument.`);\n const sub = rest ? `/${rest.replace(/^\\/+/, \"\")}` : \"\";\n return {\n flags: parsed.flags,\n plan: buildApiPlan({\n method: parsed.flags[\"--method\"],\n path: `/api/functions/${encodeURIComponent(name)}${sub}`,\n fields: parsed.flags[\"--field\"],\n rawFields: parsed.flags[\"--raw-field\"],\n input: parsed.flags[\"--input\"],\n headers: parsed.flags[\"--header\"]\n })\n };\n });\n const target = await projectTarget(flags, { command: \"functions invoke\" });\n await sendApiPlan(target, plan, { include: flags[\"--include\"] === true });\n}\n\nconst FUNCTIONS_ACTIONS: HelpAction[] = [\n { action: \"list\", description: \"The functions the server loaded (the default)\" },\n {\n action: \"invoke\",\n args: \"<name> [path]\",\n description: \"Call one: /api/functions/<name>/<path>, the answer printed as it came\",\n flags: [\n [\"--method, -X <method>\", \"The HTTP method (else GET; POST with --input — a field alone never writes)\"],\n [\"--field, -f <key=value>\", \"A string field: query string on GET/HEAD/DELETE, JSON body otherwise\"],\n [\"--raw-field, -F <key=value>\", \"A typed field: true/false/null, numbers, JSON, @file\"],\n [\"--input <file|->\", \"The whole request body\"],\n [\"--header, -H <\\\"Name: value\\\">\", \"An extra request header\"],\n [\"--include, -i\", \"Print the status line and response headers first\"]\n ]\n }\n];\n\nfunction printFunctionsHelp(): void {\n printProjectHelp({\n command: \"functions\",\n title: \"A running app's own routes (backend/functions): list them, call one\",\n actions: FUNCTIONS_ACTIONS,\n notes: [\n \"Examples:\",\n \" rebase functions invoke hello --anon\",\n \" rebase functions invoke billing webhook -X POST --input event.json\",\n \"A non-2xx answer is printed and exits 1. Functions decide their own access, so the credential matters: --anon shows what a visitor gets.\"\n ]\n });\n}\n"],"mappings":";;;;;;;;AAmCA,IAAa,wBAAwB,CAAC,QAAQ,QAAQ;AAEtD,eAAsB,iBAAiB,YAAgC,SAAkC;CACrG,oBAAoB,OAAO;CAC3B,IAAI,eAAe,YAAY,UAAU,OAAO,GAAG;EAC/C,mBAAmB;EACnB;CACJ;CACA,QA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MAAM;GACN;GACA,cAAc;GACd,SAAS;GACT,gBAAgB;EACpB,CAAC;EACD,MAAM,CAAC,MAAM,QAAQ,OAAO;EAC5B,IAAI,CAAC,MAAM,MAAM,IAAI,WAAW,uFAAuF;EACvH,IAAI,KAAK,SAAS,GAAG,GAAG,MAAM,IAAI,WAAW,IAAI,KAAK,oEAAoE;EAC1H,MAAM,MAAM,OAAO,IAAI,KAAK,QAAQ,QAAQ,EAAE,MAAM;EACpD,OAAO;GACH,OAAO,OAAO;GACd,MAAM,aAAa;IACf,QAAQ,OAAO,MAAM;IACrB,MAAM,kBAAkB,mBAAmB,IAAI,IAAI;IACnD,QAAQ,OAAO,MAAM;IACrB,WAAW,OAAO,MAAM;IACxB,OAAO,OAAO,MAAM;IACpB,SAAS,OAAO,MAAM;GAC1B,CAAC;EACL;CACJ,CAAC;CAED,MAAM,YAAY,MADG,cAAc,OAAO,EAAE,SAAS,mBAAmB,CAAC,GAC/C,MAAM,EAAE,SAAS,MAAM,iBAAiB,KAAK,CAAC;AAC5E;AAEA,IAAM,oBAAkC,CACpC;CAAE,QAAQ;CAAQ,aAAa;AAAgD,GAC/E;CACI,QAAQ;CACR,MAAM;CACN,aAAa;CACb,OAAO;EACH,CAAC,yBAAyB,4EAA4E;EACtG,CAAC,2BAA2B,sEAAsE;EAClG,CAAC,+BAA+B,sDAAsD;EACtF,CAAC,oBAAoB,wBAAwB;EAC7C,CAAC,kCAAkC,yBAAyB;EAC5D,CAAC,iBAAiB,kDAAkD;CACxE;AACJ,CACJ;AAEA,SAAS,qBAA2B;CAChC,iBAAiB;EACb,SAAS;EACT,OAAO;EACP,SAAS;EACT,OAAO;GACH;GACA;GACA;GACA;EACJ;CACJ,CAAC;AACL"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as wantsHelp, n as parseCommandArgs, t as UsageError } from "./args-DHyrshtI.js";
|
|
2
|
-
import { p as requireProjectRoot } from "./project-
|
|
3
|
-
import { b as loadManifest, h as cmsMountOf } from "./manifest-
|
|
4
|
-
import { n as resolveSchemaDir } from "./schema-dir-
|
|
2
|
+
import { p as requireProjectRoot } from "./project-CQ5nKddJ.js";
|
|
3
|
+
import { b as loadManifest, h as cmsMountOf } from "./manifest-D6B4LA8x.js";
|
|
4
|
+
import { n as resolveSchemaDir } from "./schema-dir-Dd1Pzqq5.js";
|
|
5
5
|
import { t as declaredTables } from "./schema-text-CpNrsuMe.js";
|
|
6
6
|
import chalk from "chalk";
|
|
7
7
|
import fs from "fs";
|
|
@@ -730,4 +730,4 @@ async function generateViewCommand(rawArgs) {
|
|
|
730
730
|
//#endregion
|
|
731
731
|
export { GENERATE_SUBCOMMANDS, generateCommand };
|
|
732
732
|
|
|
733
|
-
//# sourceMappingURL=generate-view-
|
|
733
|
+
//# sourceMappingURL=generate-view-CZ0SmsJc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-view-BMaLQm8H.js","names":[],"sources":["../src/commands/generate-view.ts"],"sourcesContent":["/**\n * `rebase generate view <slug>` — scaffold a custom admin screen and register it.\n *\n * Most back-office screens are a table, a form or a board, and the admin draws\n * those from the table. The rest — a dispatch board, a reconciliation\n * screen, a record's audit trail — are a hundred lines of React. Written inside\n * the admin they inherit the sign-in, the security rules, the sidebar, the UI\n * kit and the data layer; written as a separate app they have to rebuild every\n * one of those. This command writes the first version of that file where the\n * admin will find it, so the screen starts native and registered.\n *\n * Two places, one file each:\n *\n * - **A screen** (default): `<frontend>/src/views/<Name>View.tsx`, listed in\n * `<frontend>/src/views/index.ts` as an `AppView`, which `App.tsx` hands to\n * `<RebaseCMS views>`. The first run wires `App.tsx`; later runs only append\n * to the list.\n * - **A record tab** (`--collection <slug>`, the slug of a table in\n * `backend/schema`): the same file location, with a component that takes\n * `EntityCustomViewParams`, added to the `entityViews` of that table's\n * `customizeTable(…)` in `<frontend>/src/cms/` — imported directly, because\n * that directory is the admin's own code and the backend never reads it. A\n * table with no customization yet gets one, `<frontend>/src/cms/<slug>.tsx`,\n * listed in `cms/index.ts`'s `tableCustomizations` when there is one.\n *\n * The frontend is where `rebase.json` says the CMS is (the static app with a\n * `cms` mount), which is `frontend/` in everything `rebase init` writes. A\n * project with no admin panel (`rebase init --headless`) is refused: there is\n * nowhere for a view to render.\n *\n * Edits to existing files are textual and conservative. When `App.tsx` already\n * passes its own `views`, or a customization's shape is not one this can read, the\n * view file is still written and the command prints the one line to add by\n * hand instead of guessing.\n */\nimport fs from \"fs\";\nimport path from \"path\";\nimport { fileURLToPath } from \"url\";\nimport chalk from \"chalk\";\n\nimport { tableIdentifier } from \"@rebasepro/common\";\nimport { cmsMountOf, loadManifest } from \"../manifest\";\nimport { resolveSchemaDir } from \"../utils/schema-dir\";\nimport { declaredTables } from \"../utils/schema-text\";\nimport { requireProjectRoot } from \"../utils/project\";\nimport { parseCommandArgs, UsageError, wantsHelp } from \"../utils/args\";\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\n/** What `rebase generate` dispatches. Read by `cli.ts` to name the subcommand. */\nexport const GENERATE_SUBCOMMANDS = [\"view\"] as const;\n\nconst VIEW_FLAGS = {\n \"--collection\": String,\n \"--name\": String,\n \"--icon\": String,\n \"--dry-run\": Boolean,\n \"--force\": Boolean\n} as const;\n\n/** A slug is a URL segment and an entity view key: kebab-case, starting with a letter. */\nconst SLUG_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;\n\n/**\n * Top-level paths the admin's own routes answer (`RebaseRouteDefs` in\n * `@rebasepro/cms`): `/c/*` the collections, `/s` Studio, `/settings`. They are\n * declared before custom views, so a screen at one of them was listed in the\n * sidebar and opened the built-in page instead.\n */\nconst RESERVED_SCREEN_SLUGS: readonly string[] = [\"c\", \"s\", \"settings\"];\n\nexport interface GenerateViewOptions {\n projectRoot: string;\n slug: string;\n /** Register as a tab on this table's records (its slug) instead of as a screen. */\n collection?: string;\n /** The label in the sidebar or on the tab. Defaults to the slug in sentence case. */\n name?: string;\n /** A Lucide icon name for the sidebar. Screens only. */\n icon?: string;\n /** Replace an existing view file. Registration is never duplicated. */\n force?: boolean;\n}\n\nexport interface PlannedFile {\n /** Absolute path. */\n path: string;\n contents: string;\n action: \"create\" | \"update\" | \"replace\";\n}\n\nexport interface GenerateViewPlan {\n kind: \"app\" | \"entity\";\n componentName: string;\n viewFile: string;\n files: PlannedFile[];\n /** Steps the command could not take itself, as sentences to print. */\n manualSteps: string[];\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Names\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** `orders-board` → `OrdersBoardView`; `sales-view` → `SalesView`, not `SalesViewView`. */\nexport function viewComponentName(slug: string): string {\n const pascal = slug.split(\"-\").map(part => part.charAt(0).toUpperCase() + part.slice(1)).join(\"\");\n return pascal.endsWith(\"View\") ? pascal : `${pascal}View`;\n}\n\n/** `orders-board` → `Orders board`: labels are sentence case in the admin. */\nexport function viewLabel(slug: string): string {\n const words = slug.split(\"-\").join(\" \");\n return words.charAt(0).toUpperCase() + words.slice(1);\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Reading source without a parser\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * The source with every string, template literal, regular expression and\n * comment blanked out, character for character, so brackets and keys can be\n * found by position without being fooled by a `{` inside a string. String\n * contents become `_` (they are still \"something\"), comments become spaces.\n *\n * Exported for its tests.\n */\nexport function maskCode(source: string): string {\n const out = source.split(\"\");\n let i = 0;\n const blank = (from: number, to: number, fill: string) => {\n for (let k = from; k < to; k++) if (out[k] !== \"\\n\") out[k] = fill;\n };\n const previousSignificant = (at: number): string => {\n for (let k = at - 1; k >= 0; k--) {\n const ch = out[k];\n if (ch !== \" \" && ch !== \"\\t\" && ch !== \"\\n\" && ch !== \"\\r\") return ch;\n }\n return \"\";\n };\n while (i < source.length) {\n const ch = source[i];\n const next = source[i + 1];\n if (ch === \"/\" && next === \"/\") {\n const end = source.indexOf(\"\\n\", i);\n const stop = end === -1 ? source.length : end;\n blank(i, stop, \" \");\n i = stop;\n } else if (ch === \"/\" && next === \"*\") {\n const end = source.indexOf(\"*/\", i + 2);\n const stop = end === -1 ? source.length : end + 2;\n blank(i, stop, \" \");\n i = stop;\n } else if (ch === \"\\\"\" || ch === \"'\" || ch === \"`\") {\n let k = i + 1;\n while (k < source.length && source[k] !== ch) {\n if (source[k] === \"\\\\\") k++;\n k++;\n }\n blank(i + 1, k, \"_\");\n i = k + 1;\n } else if (ch === \"/\" && (previousSignificant(i) === \"\" || \"(,=:[!&|?{;\".includes(previousSignificant(i)))) {\n // A regular expression literal: `/` where a value is expected. Not\n // after `}`, which in a .tsx file is far more often `{value}/>`.\n let k = i + 1;\n let inClass = false;\n while (k < source.length && source[k] !== \"\\n\") {\n if (source[k] === \"\\\\\") k++;\n else if (source[k] === \"[\") inClass = true;\n else if (source[k] === \"]\") inClass = false;\n else if (source[k] === \"/\" && !inClass) break;\n k++;\n }\n blank(i + 1, k, \"_\");\n i = k + 1;\n } else {\n i++;\n }\n }\n return out.join(\"\");\n}\n\nconst CLOSERS: Record<string, string> = { \"{\": \"}\", \"[\": \"]\", \"(\": \")\" };\n\n/** The index of the bracket closing the one at `open`, in masked source. */\nfunction matchClose(masked: string, open: number): number {\n const stack: string[] = [];\n for (let i = open; i < masked.length; i++) {\n const ch = masked[i];\n if (ch in CLOSERS) stack.push(CLOSERS[ch]);\n else if (ch === \"}\" || ch === \"]\" || ch === \")\") {\n if (stack.pop() !== ch) return -1;\n if (stack.length === 0) return i;\n }\n }\n return -1;\n}\n\n/** The index of the innermost `{` still open at `at`, in masked source. */\nfunction enclosingBrace(masked: string, at: number): number {\n const stack: number[] = [];\n for (let i = 0; i < at; i++) {\n const ch = masked[i];\n if (ch === \"{\" || ch === \"[\" || ch === \"(\") stack.push(i);\n else if (ch === \"}\" || ch === \"]\" || ch === \")\") stack.pop();\n }\n for (let k = stack.length - 1; k >= 0; k--) {\n if (masked[stack[k]] === \"{\") return stack[k];\n }\n return -1;\n}\n\n/**\n * The position of `key:` as a direct property of the object whose `{` is at\n * `open`, followed by `opener` (`{` or `[`) — or -1.\n */\nfunction directProperty(masked: string, open: number, key: string, opener: \"{\" | \"[\"): { keyAt: number; valueOpen: number } | undefined {\n const close = matchClose(masked, open);\n if (close === -1) return undefined;\n const pattern = new RegExp(`(^|[\\\\s,{])${key}\\\\s*:\\\\s*\\\\${opener}`, \"g\");\n const body = masked.slice(open + 1, close);\n for (const match of body.matchAll(pattern)) {\n const keyAt = open + 1 + (match.index ?? 0) + match[1].length;\n if (enclosingBrace(masked, keyAt) !== open) continue;\n return { keyAt, valueOpen: open + 1 + (match.index ?? 0) + match[0].length - 1 };\n }\n return undefined;\n}\n\nfunction lineStart(source: string, at: number): number {\n return source.lastIndexOf(\"\\n\", at - 1) + 1;\n}\n\nfunction indentAt(source: string, at: number): string {\n const start = lineStart(source, at);\n return /^[ \\t]*/.exec(source.slice(start))?.[0] ?? \"\";\n}\n\n/**\n * The indentation step a file uses: the smallest non-zero leading run of\n * spaces, not counting the ` * ` lines of a block comment.\n */\nfunction indentUnit(source: string): string {\n if (/^\\t/m.test(source)) return \"\\t\";\n let unit = Infinity;\n for (const match of source.matchAll(/^( +)[^\\s*]/gm)) unit = Math.min(unit, match[1].length);\n return \" \".repeat(Number.isFinite(unit) ? unit : 4);\n}\n\nfunction reindent(block: string, indent: string): string {\n return block.split(\"\\n\").map(line => (line ? indent + line : line)).join(\"\\n\");\n}\n\n/**\n * Insert `element` (already indented one level past `indent`) as the last item\n * of the array whose `[` is at `open`.\n */\nfunction appendToArray(source: string, masked: string, open: number, element: string): string {\n const close = matchClose(masked, open);\n const inner = masked.slice(open + 1, close);\n const indent = indentAt(source, open);\n if (inner.trim() === \"\") {\n return `${source.slice(0, open + 1)}\\n${element}\\n${indent}${source.slice(close)}`;\n }\n // After the last non-blank character of the content, keeping any comment\n // after it where it was.\n let last = close - 1;\n while (last > open && /\\s/.test(masked[last])) last--;\n const hasTrailingComma = masked[last] === \",\";\n const insertAt = last + 1;\n return `${source.slice(0, insertAt)}${hasTrailingComma ? \"\" : \",\"}\\n${element}${source.slice(insertAt)}`;\n}\n\n/** Add an import line after the file's last import statement. */\nfunction addImport(source: string, line: string): string {\n const masked = maskCode(source);\n let end = 0;\n for (const match of masked.matchAll(/^import\\b[\\s\\S]*?[\"'][^\"'\\n]*[\"'];?[ \\t]*$/gm)) {\n end = (match.index ?? 0) + match[0].length;\n }\n if (end === 0) return `${line}\\n${source}`;\n return `${source.slice(0, end)}\\n${line}${source.slice(end)}`;\n}\n\n/** A path import from `fromDir` to `toFile`, without extension, always starting with `.`. */\nfunction relativeImport(fromDir: string, toFile: string): string {\n const relative = path.relative(fromDir, toFile).split(path.sep).join(\"/\").replace(/\\.tsx?$/, \"\");\n return relative.startsWith(\".\") ? relative : `./${relative}`;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Where things are\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** The admin's frontend directory: the static app that mounts the CMS, or `frontend/`. */\nexport function resolveFrontendDir(projectRoot: string): string | undefined {\n try {\n const cms = cmsMountOf(loadManifest(projectRoot).manifest);\n if (cms) return path.join(projectRoot, cms.app.root);\n } catch {\n // A malformed rebase.json is reported by the commands that own it.\n }\n const fallback = path.join(projectRoot, \"frontend\");\n return fs.existsSync(path.join(fallback, \"src\")) ? fallback : undefined;\n}\n\n/** The tables directory, as the backend app declares it — one resolver for every command. */\nexport { resolveSchemaDir };\n\n/** Every source file under the admin's `src/cms`, sorted: where table customizations live. */\nfunction customizationFiles(dir: string): string[] {\n if (!fs.existsSync(dir)) return [];\n const out: string[] = [];\n const entries = fs.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));\n for (const entry of entries) {\n const full = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n if (entry.name !== \"node_modules\") out.push(...customizationFiles(full));\n } else if (/\\.tsx?$/.test(entry.name) && !/\\.(test|spec|d)\\.tsx?$/.test(entry.name)) {\n out.push(full);\n }\n }\n return out;\n}\n\n/**\n * Every `customizeTable(\"<slug>\", {` of a table, in code (not in a comment or\n * a string): the file, and where the options object opens. Empty when no file\n * under `cmsDir` customizes the table.\n */\nfunction findCustomization(cmsDir: string, slug: string): { file: string; optionsOpen: number }[] {\n const found: { file: string; optionsOpen: number }[] = [];\n const call = /\\bcustomizeTable\\s*(?:<[^>]*>)?\\(\\s*([\"'`])([^\"'`\\n]+)\\1\\s*,\\s*\\{/g;\n for (const file of customizationFiles(cmsDir)) {\n const source = fs.readFileSync(file, \"utf8\");\n const masked = maskCode(source);\n for (const match of source.matchAll(call)) {\n const at = match.index ?? 0;\n if (match[2] !== slug || masked[at] !== \"c\") continue;\n found.push({ file, optionsOpen: at + match[0].length - 1 });\n }\n }\n return found;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// The files\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * The scaffolds live in `templates/views/` rather than in template literals\n * here: they import React and the admin packages, and this package's sources\n * must not name those, even inside a string (`pnpm check:types-headless`).\n */\nfunction viewTemplate(name: string): string {\n const cliRoot = findCliRoot(__dirname);\n if (!cliRoot) throw new Error(`The CLI's templates/views folder is missing from ${__dirname}.`);\n return fs.readFileSync(path.join(cliRoot, \"templates\", \"views\", name), \"utf8\");\n}\n\n/** Walk up to the package root, which holds `templates/views`. */\nfunction findCliRoot(from: string): string | null {\n const root = path.parse(from).root;\n let dir = from;\n while (dir && dir !== root) {\n if (fs.existsSync(path.join(dir, \"templates\", \"views\"))) return dir;\n dir = path.dirname(dir);\n }\n return null;\n}\n\ntype ViewTemplateOptions = { slug: string; componentName: string; label: string; collection: string };\n\n/** The `{ key, name, Builder }` an entity view is registered as, with `unit` indentation inside. */\nfunction entityViewEntry(view: { key: string; name: string; componentName: string }, unit: string): string {\n return [\n \"{\",\n `${unit}key: ${JSON.stringify(view.key)},`,\n `${unit}name: ${JSON.stringify(view.name)},`,\n `${unit}Builder: ${view.componentName}`,\n \"}\"\n ].join(\"\\n\");\n}\n\n/**\n * A label as JSX text: written as is when it is plain, as a string expression\n * when it holds a character JSX reads — `{`, `}`, `<`, `>`, `&`. Pasted raw,\n * `--name \"KPIs {beta}\"` wrote `<Typography>KPIs {beta}</Typography>`, and the\n * view did not compile (\"Cannot find name 'beta'\").\n */\nfunction jsxText(text: string): string {\n return /[{}<>&]/.test(text) ? `{${JSON.stringify(text)}}` : text;\n}\n\n/** A label inside the leading `/** … *\\/` comment: one line, and no `*\\/` to close it early. */\nfunction commentText(text: string): string {\n return text.replace(/[\\r\\n]+/g, \" \").replaceAll(\"*/\", \"*\\\\/\");\n}\n\nfunction fillViewTemplate(template: string, options: ViewTemplateOptions): string {\n const { slug, componentName, label, collection } = options;\n return template\n .replaceAll(\"\\\"__COLLECTION__\\\"\", JSON.stringify(collection))\n .replaceAll(\"__COLLECTION__\", collection)\n .replaceAll(\"__COMPONENT__\", componentName)\n .replaceAll(\"__label_jsx__\", jsxText(label.toLowerCase()))\n .replaceAll(\"__LABEL_JSX__\", jsxText(label))\n .replaceAll(\"__label__\", commentText(label.toLowerCase()))\n .replaceAll(\"__LABEL__\", commentText(label))\n .replaceAll(\"__SLUG__\", slug);\n}\n\nexport function appViewSource(options: ViewTemplateOptions): string {\n return fillViewTemplate(viewTemplate(\"AppView.tsx.tmpl\"), options);\n}\n\nexport function entityViewSource(options: ViewTemplateOptions): string {\n return fillViewTemplate(viewTemplate(\"EntityView.tsx.tmpl\"), options);\n}\n\nfunction viewsIndexHeader(): string {\n return viewTemplate(\"index.ts.tmpl\");\n}\n\nfunction appViewEntry(options: { slug: string; label: string; icon: string; componentName: string }, unit: string): string {\n return [\n \"{\",\n `${unit}slug: ${JSON.stringify(options.slug)},`,\n `${unit}name: ${JSON.stringify(options.label)},`,\n `${unit}icon: ${JSON.stringify(options.icon)},`,\n `${unit}view: ${options.componentName}`,\n \"}\"\n ].join(\"\\n\");\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Planning\n// ─────────────────────────────────────────────────────────────────────────────\n\nfunction readIfExists(file: string): string | undefined {\n return fs.existsSync(file) ? fs.readFileSync(file, \"utf8\") : undefined;\n}\n\n/**\n * The frontend's package.json gains `@rebasepro/cms-types` when it lacks it.\n *\n * The view files import their prop types from it, and under pnpm a package the\n * frontend does not declare does not resolve from the frontend — the frontend's\n * `tsc` would fail on the first generated view. The version is the one the\n * frontend already uses for `@rebasepro/cms`, so the two cannot drift.\n */\nfunction planCmsTypesDependency(frontendDir: string, files: PlannedFile[], manualSteps: string[]): void {\n const manifestFile = path.join(frontendDir, \"package.json\");\n const raw = readIfExists(manifestFile);\n if (raw === undefined) return;\n let manifest: { dependencies?: Record<string, string>; devDependencies?: Record<string, string> };\n try {\n manifest = JSON.parse(raw);\n } catch {\n return;\n }\n const declared = { ...manifest.devDependencies, ...manifest.dependencies };\n if (declared[\"@rebasepro/cms-types\"]) return;\n const version = declared[\"@rebasepro/cms\"] ?? declared[\"@rebasepro/app\"];\n if (!version) return;\n const dependencies = { ...manifest.dependencies, \"@rebasepro/cms-types\": version };\n const sorted = Object.fromEntries(Object.entries(dependencies).sort(([a], [b]) => a.localeCompare(b)));\n const indent = /^(\\s+)\"/m.exec(raw)?.[1] ?? \" \";\n files.push({\n path: manifestFile,\n contents: `${JSON.stringify({ ...manifest, dependencies: sorted }, null, indent)}\\n`,\n action: \"update\"\n });\n manualSteps.push(`Run your package manager's install: ${path.basename(frontendDir)}/package.json now depends on @rebasepro/cms-types, which the view imports its types from.`);\n}\n\nfunction defaultCollectionFor(projectRoot: string): string {\n const slugs = declaredTables(resolveSchemaDir(projectRoot)).map(entry => entry.slug);\n return slugs.find(slug => slug !== \"users\") ?? slugs[0] ?? \"users\";\n}\n\n/**\n * Everything `rebase generate view` would write, without writing it.\n *\n * @throws UsageError when the slug is not a slug, there is no admin panel, the\n * view already exists (without `force`), or `--collection` names nothing.\n */\nexport function planGenerateView(options: GenerateViewOptions): GenerateViewPlan {\n const { projectRoot, slug } = options;\n if (!SLUG_PATTERN.test(slug)) {\n throw new UsageError(\n `\"${slug}\" is not a view slug: use lowercase letters, digits and dashes, starting with a letter (e.g. orders-board).`\n );\n }\n if (!options.collection && RESERVED_SCREEN_SLUGS.includes(slug)) {\n throw new UsageError(\n `\"${slug}\" is reserved: the admin's own routes answer /${slug}, so a screen there would never show. ` +\n `Pick another slug (e.g. ${slug === \"settings\" ? \"app-settings\" : `${slug}-view`}).`\n );\n }\n const frontendDir = resolveFrontendDir(projectRoot);\n if (!frontendDir) {\n throw new UsageError(\n \"This project has no admin panel to add a view to: rebase.json declares no app with a `cms` mount, and there is no frontend/src. \" +\n \"A project created with `rebase init --headless` has no admin.\"\n );\n }\n\n const componentName = viewComponentName(slug);\n const label = options.name?.trim() || viewLabel(slug);\n const viewsDir = path.join(frontendDir, \"src\", \"views\");\n const viewFile = path.join(viewsDir, `${componentName}.tsx`);\n const files: PlannedFile[] = [];\n const manualSteps: string[] = [];\n\n const viewExists = fs.existsSync(viewFile);\n if (viewExists && !options.force) {\n throw new UsageError(\n `${path.relative(projectRoot, viewFile)} already exists. Pass --force to replace it; its registration is kept.`\n );\n }\n const viewAction: PlannedFile[\"action\"] = viewExists ? \"replace\" : \"create\";\n\n if (options.collection) {\n const kind = \"entity\" as const;\n const table = options.collection;\n const schemaDir = resolveSchemaDir(projectRoot);\n const declared = declaredTables(schemaDir);\n if (!declared.some(entry => entry.slug === table)) {\n const known = [...new Set(declared.map(entry => entry.slug))].sort();\n throw new UsageError(\n `No table with slug \"${table}\" under ${path.relative(projectRoot, schemaDir) || \".\"}.` +\n (known.length ? ` Declared: ${known.join(\", \")}.` : \"\")\n );\n }\n const cmsDir = path.join(frontendDir, \"src\", \"cms\");\n const customizations = findCustomization(cmsDir, table);\n if (customizations.length > 1) {\n throw new UsageError(\n `More than one customizeTable(\"${table}\", …) under ${path.relative(projectRoot, cmsDir)}: ` +\n `${[...new Set(customizations.map(entry => path.relative(projectRoot, entry.file)))].join(\", \")}.`\n );\n }\n\n files.push({\n path: viewFile,\n contents: entityViewSource({ slug, componentName, label, collection: table }),\n action: viewAction\n });\n\n const view = { key: slug, name: label, componentName };\n if (customizations.length === 1) {\n const [{ file, optionsOpen }] = customizations;\n const importLine = `import { ${componentName} } from \"${relativeImport(path.dirname(file), viewFile)}\";`;\n const source = fs.readFileSync(file, \"utf8\");\n const updated = registerEntityView(source, optionsOpen, view);\n const where = path.relative(projectRoot, file);\n if (updated === \"already\") {\n // Registered on an earlier run: --force replaced the file only.\n } else if (updated === undefined) {\n manualSteps.push(\n `Add this to the entityViews of customizeTable(\"${table}\", …) in ${where}: ` +\n `{ key: ${JSON.stringify(slug)}, name: ${JSON.stringify(label)}, Builder: ${componentName} }, and ${importLine}`\n );\n } else {\n files.push({ path: file, contents: addImport(updated, importLine), action: \"update\" });\n }\n } else {\n const identifier = `${tableIdentifier(table)}Cms`;\n const file = path.join(cmsDir, `${table}.tsx`);\n if (fs.existsSync(file)) {\n throw new UsageError(\n `${path.relative(projectRoot, file)} exists but holds no customizeTable(\"${table}\", …): ` +\n \"add the record tab to the table's customization by hand, or move that file aside.\"\n );\n }\n const unit = \" \";\n files.push({\n path: file,\n contents: [\n \"import { customizeTable } from \\\"@rebasepro/cms\\\";\",\n `import { ${componentName} } from \"${relativeImport(cmsDir, viewFile)}\";`,\n \"\",\n `export const ${identifier} = customizeTable(\"${table}\", {`,\n `${unit}entityViews: [`,\n reindent(entityViewEntry(view, unit), unit + unit),\n `${unit}]`,\n \"});\",\n \"\"\n ].join(\"\\n\"),\n action: \"create\"\n });\n // Handed to the admin where the project lists its customizations:\n // a `tableCustomizations` list exported by `cms/index.ts`, else\n // the one `App.tsx` passes to `<RebaseCMS>`.\n const indexFile = path.join(cmsDir, \"index.ts\");\n const appFile = path.join(frontendDir, \"src\", \"App.tsx\");\n const index = readIfExists(indexFile);\n const app = readIfExists(appFile);\n const listedInIndex = index === undefined ? undefined : listCustomization(index, identifier, `./${table}`);\n const listedInApp = listedInIndex === undefined && app !== undefined\n ? listCustomization(app, identifier, `./cms/${table}`)\n : undefined;\n if (listedInIndex !== undefined) {\n if (listedInIndex !== \"already\") files.push({ path: indexFile, contents: listedInIndex, action: \"update\" });\n } else if (listedInApp !== undefined) {\n if (listedInApp !== \"already\") files.push({ path: appFile, contents: listedInApp, action: \"update\" });\n } else {\n manualSteps.push(\n `Hand the customization to the admin: import { ${identifier} } from \"./cms/${table}\" and add it to ` +\n `<RebaseCMS tableCustomizations={[…]}> in ${path.relative(projectRoot, appFile)}.`\n );\n }\n }\n planCmsTypesDependency(frontendDir, files, manualSteps);\n return { kind, componentName, viewFile, files, manualSteps };\n }\n\n files.push({\n path: viewFile,\n contents: appViewSource({ slug, componentName, label, collection: defaultCollectionFor(projectRoot) }),\n action: viewAction\n });\n\n // The list of screens.\n const indexFile = path.join(viewsDir, \"index.ts\");\n const existingIndex = readIfExists(indexFile);\n const icon = options.icon ?? \"LayoutDashboard\";\n if (existingIndex === undefined) {\n const unit = \" \";\n files.push({\n path: indexFile,\n contents: `${viewsIndexHeader()}import { ${componentName} } from \"./${componentName}\";\\n\\n` +\n `export const views: AppView[] = [\\n${reindent(appViewEntry({ slug, label, icon, componentName }, unit), unit)}\\n];\\n`,\n action: \"create\"\n });\n } else {\n const updated = registerAppView(existingIndex, { slug, label, icon, componentName });\n if (updated === undefined) {\n manualSteps.push(\n `Add { slug: ${JSON.stringify(slug)}, name: ${JSON.stringify(label)}, view: ${componentName} } to the views in ${path.relative(projectRoot, indexFile)}.`\n );\n } else if (updated !== \"already\") {\n files.push({ path: indexFile, contents: updated, action: \"update\" });\n }\n }\n\n // App.tsx hands the list to <RebaseCMS>, once.\n const appFile = path.join(frontendDir, \"src\", \"App.tsx\");\n const app = readIfExists(appFile);\n const wired = app === undefined ? undefined : wireViewsIntoApp(app);\n if (wired === undefined) {\n manualSteps.push(\n `Pass the screens to the admin: import { views } from \"./views\" and add views={views} to <RebaseCMS> in ${path.relative(projectRoot, appFile)}` +\n \" (or spread ...views into the views it already passes).\"\n );\n } else if (wired !== \"already\") {\n files.push({ path: appFile, contents: wired, action: \"update\" });\n }\n\n planCmsTypesDependency(frontendDir, files, manualSteps);\n return { kind: \"app\", componentName, viewFile, files, manualSteps };\n}\n\n/**\n * `views/index.ts` with one more entry, `\"already\"` when the slug is listed, or\n * `undefined` when the file has no `export const views … = [`.\n *\n * Exported for its tests.\n */\nexport function registerAppView(\n source: string,\n options: { slug: string; label: string; icon: string; componentName: string }\n): string | \"already\" | undefined {\n const masked = maskCode(source);\n const declaration = /export\\s+const\\s+views\\b[^=]*=\\s*\\[/.exec(masked);\n if (!declaration) return undefined;\n const open = declaration.index + declaration[0].length - 1;\n if (matchClose(masked, open) === -1) return undefined;\n const close = matchClose(masked, open);\n const listed = source.slice(open, close);\n if (new RegExp(`slug\\\\s*:\\\\s*[\"']${options.slug}[\"']`).test(listed)) return \"already\";\n\n const unit = indentUnit(source);\n const indent = indentAt(source, open) + unit;\n const element = reindent(appViewEntry(options, unit), indent);\n const appended = appendToArray(source, masked, open, element);\n return addImport(appended, `import { ${options.componentName} } from \"./${options.componentName}\";`);\n}\n\n/**\n * `App.tsx` with `views={views}` on `<RebaseCMS>` and its import, `\"already\"`\n * when it passes exactly that, or `undefined` when it cannot be done safely:\n * no `<RebaseCMS`, a `views` prop of its own, or a `views` name already in scope.\n *\n * Exported for its tests.\n */\nexport function wireViewsIntoApp(source: string): string | \"already\" | undefined {\n const masked = maskCode(source);\n const tag = /<RebaseCMS\\b/.exec(masked);\n if (!tag) return undefined;\n const tagEnd = masked.indexOf(\">\", tag.index);\n if (tagEnd === -1) return undefined;\n const attributes = masked.slice(tag.index, tagEnd);\n const importsViews = /import\\s*\\{\\s*views\\s*\\}\\s*from\\s*[\"']\\.\\/views(?:\\/index)?[\"']/.test(source);\n if (/\\sviews\\s*=/.test(attributes)) {\n return importsViews && /\\sviews\\s*=\\s*\\{\\s*views\\s*\\}/.test(attributes) ? \"already\" : undefined;\n }\n if (/\\bviews\\b/.test(masked)) return undefined;\n\n const insertAt = tag.index + \"<RebaseCMS\".length;\n const afterTag = source.slice(insertAt);\n const nextLine = /^[ \\t]*\\r?\\n([ \\t]*)\\S/.exec(afterTag);\n const attribute = nextLine ? `\\n${nextLine[1]}views={views}` : \" views={views}\";\n const withProp = source.slice(0, insertAt) + attribute + source.slice(insertAt);\n return addImport(withProp, \"import { views } from \\\"./views\\\";\");\n}\n\n/**\n * The customization file with a `{ key, name, Builder }` entry in the\n * `entityViews` of the `customizeTable(…)` options object whose `{` is at\n * `optionsOpen`; `\"already\"` when that key is there; `undefined` when the\n * shape cannot be read. The component's import is the caller's to add.\n *\n * Exported for its tests.\n */\nexport function registerEntityView(\n source: string,\n optionsOpen: number,\n view: { key: string; name: string; componentName: string }\n): string | \"already\" | undefined {\n const masked = maskCode(source);\n const close = matchClose(masked, optionsOpen);\n if (close === -1) return undefined;\n const unit = indentUnit(source);\n const entry = entityViewEntry(view, unit);\n\n const entityViews = directProperty(masked, optionsOpen, \"entityViews\", \"[\");\n if (entityViews) {\n const listClose = matchClose(masked, entityViews.valueOpen);\n if (listClose === -1) return undefined;\n const listed = source.slice(entityViews.valueOpen, listClose);\n if (new RegExp(`key\\\\s*:\\\\s*[\"']${view.key}[\"']|[\"']${view.key}[\"']`).test(listed)) return \"already\";\n const indent = indentAt(source, entityViews.keyAt) + unit;\n return appendToArray(source, masked, entityViews.valueOpen, reindent(entry, indent));\n }\n\n // `entityViews` as the first property of the options.\n const indent = indentAt(source, optionsOpen) + unit;\n const block = `${indent}entityViews: [\\n${reindent(entry, indent + unit)}\\n${indent}]`;\n const empty = masked.slice(optionsOpen + 1, close).trim() === \"\";\n const insertAt = optionsOpen + 1;\n return empty\n ? `${source.slice(0, insertAt)}\\n${block}\\n${indentAt(source, optionsOpen)}${source.slice(close)}`\n : `${source.slice(0, insertAt)}\\n${block},${source.slice(insertAt)}`;\n}\n\n/**\n * A source with `identifier` imported from `importPath` and appended to its\n * list of table customizations — `export const tableCustomizations = [ … ]`\n * (`cms/index.ts`) or `tableCustomizations={[ … ]}` on `<RebaseCMS>`\n * (`App.tsx`); `\"already\"` when it is listed; `undefined` when the source has\n * no such list.\n *\n * Exported for its tests.\n */\nexport function listCustomization(source: string, identifier: string, importPath: string): string | \"already\" | undefined {\n const masked = maskCode(source);\n const declaration = /export\\s+const\\s+tableCustomizations\\b[^=]*=\\s*\\[/.exec(masked)\n ?? /\\btableCustomizations\\s*=\\s*\\{\\s*\\[/.exec(masked);\n if (!declaration) return undefined;\n const open = declaration.index + declaration[0].length - 1;\n const close = matchClose(masked, open);\n if (close === -1) return undefined;\n if (new RegExp(`\\\\b${identifier}\\\\b`).test(masked.slice(open, close))) return \"already\";\n const inner = masked.slice(open + 1, close);\n let appended: string;\n if (inner.trim() !== \"\" && !inner.includes(\"\\n\")) {\n // A list written on one line stays on one line.\n let last = close - 1;\n while (last > open && /\\s/.test(masked[last])) last--;\n const comma = masked[last] === \",\" ? \" \" : \", \";\n appended = `${source.slice(0, last + 1)}${comma}${identifier}${source.slice(last + 1)}`;\n } else {\n const unit = indentUnit(source);\n appended = appendToArray(source, masked, open, `${indentAt(source, open)}${unit}${identifier}`);\n }\n return addImport(appended, `import { ${identifier} } from \"${importPath}\";`);\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// The command\n// ─────────────────────────────────────────────────────────────────────────────\n\nfunction printHelp(): void {\n console.log(`\n${chalk.bold(\"rebase generate\")} — scaffold code into this project\n\n${chalk.bold(\"Usage\")}\n rebase generate view <slug> A screen of the admin, in the sidebar\n rebase generate view <slug> --collection <slug> A tab on every record of a table\n\n${chalk.bold(\"What it writes\")}\n <frontend>/src/views/<Name>View.tsx The component, drawn with @rebasepro/ui\n <frontend>/src/views/index.ts The screens list (AppView[]), wired into\n <RebaseCMS views> in App.tsx on first run\n With --collection, the table's customizeTable(…) in <frontend>/src/cms gains\n an entityViews entry with the component (a new <slug>.tsx when it has none).\n\n${chalk.bold(\"Options\")}\n --collection <slug> Register as a record tab of the table with this slug\n --name <label> Sidebar or tab label ${chalk.gray(\"(default: the slug in sentence case)\")}\n --icon <Lucide name> Sidebar icon for a screen ${chalk.gray(\"(default: LayoutDashboard)\")}\n --dry-run List what would change, and change nothing\n --force Replace an existing view file\n -h, --help Show this help\n`.trim());\n}\n\nexport async function generateCommand(subcommand: string | undefined, rawArgs: string[] = []): Promise<void> {\n if (subcommand === undefined || subcommand === \"--help\" || (subcommand !== \"view\" && wantsHelp(rawArgs))) {\n printHelp();\n return;\n }\n switch (subcommand) {\n case \"view\":\n await generateViewCommand(rawArgs);\n return;\n default:\n throw new UsageError(`Unknown generate command \"${subcommand}\". Available: ${GENERATE_SUBCOMMANDS.join(\", \")}. See \\`rebase generate --help\\`.`);\n }\n}\n\nasync function generateViewCommand(rawArgs: string[]): Promise<void> {\n if (wantsHelp(rawArgs)) {\n printHelp();\n return;\n }\n const { flags, positionals } = parseCommandArgs({\n spec: VIEW_FLAGS,\n rawArgs,\n commandWords: 2,\n command: \"generate view\",\n maxPositionals: 1\n });\n const slug = positionals[0];\n if (!slug) {\n throw new UsageError(\"Name the view: `rebase generate view <slug>`, e.g. `rebase generate view orders-board`.\");\n }\n if (flags[\"--icon\"] && flags[\"--collection\"]) {\n throw new UsageError(\"--icon is for a screen in the sidebar; a record tab (--collection) has no icon here.\");\n }\n\n const projectRoot = requireProjectRoot();\n const plan = planGenerateView({\n projectRoot,\n slug,\n collection: flags[\"--collection\"],\n name: flags[\"--name\"],\n icon: flags[\"--icon\"],\n force: Boolean(flags[\"--force\"])\n });\n const dryRun = Boolean(flags[\"--dry-run\"]);\n\n for (const file of plan.files) {\n if (!dryRun) {\n fs.mkdirSync(path.dirname(file.path), { recursive: true });\n fs.writeFileSync(file.path, file.contents);\n }\n const verb = file.action === \"create\" ? \"created\" : file.action === \"replace\" ? \"replaced\" : \"updated\";\n console.log(`${chalk.green(\"✓\")} ${dryRun ? `would be ${verb}` : verb} ${path.relative(projectRoot, file.path)}`);\n }\n for (const step of plan.manualSteps) {\n console.log(`${chalk.yellow(\"!\")} ${step}`);\n }\n const where = plan.kind === \"app\" ? `/${slug} in the admin` : `a \"${flags[\"--name\"]?.trim() || viewLabel(slug)}\" tab on each ${flags[\"--collection\"]} record`;\n console.log(chalk.gray(` ${plan.componentName} renders at ${where}. Edit ${path.relative(projectRoot, plan.viewFile)} to build the screen.`));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAM,YAAY,KAAK,QAAQ,cAAc,OAAO,KAAK,GAAG,CAAC;;AAG7D,IAAa,uBAAuB,CAAC,MAAM;AAE3C,IAAM,aAAa;CACf,gBAAgB;CAChB,UAAU;CACV,UAAU;CACV,aAAa;CACb,WAAW;AACf;;AAGA,IAAM,eAAe;;;;;;;AAQrB,IAAM,wBAA2C;CAAC;CAAK;CAAK;AAAU;;AAoCtE,SAAgB,kBAAkB,MAAsB;CACpD,MAAM,SAAS,KAAK,MAAM,GAAG,CAAC,CAAC,KAAI,SAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE;CAChG,OAAO,OAAO,SAAS,MAAM,IAAI,SAAS,GAAG,OAAO;AACxD;;AAGA,SAAgB,UAAU,MAAsB;CAC5C,MAAM,QAAQ,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG;CACtC,OAAO,MAAM,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,MAAM,MAAM,CAAC;AACxD;;;;;;;;;AAcA,SAAgB,SAAS,QAAwB;CAC7C,MAAM,MAAM,OAAO,MAAM,EAAE;CAC3B,IAAI,IAAI;CACR,MAAM,SAAS,MAAc,IAAY,SAAiB;EACtD,KAAK,IAAI,IAAI,MAAM,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,MAAM,IAAI,KAAK;CAClE;CACA,MAAM,uBAAuB,OAAuB;EAChD,KAAK,IAAI,IAAI,KAAK,GAAG,KAAK,GAAG,KAAK;GAC9B,MAAM,KAAK,IAAI;GACf,IAAI,OAA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old a custom admin screen and register it.\n *\n * Most back-office screens are a table, a form or a board, and the admin draws\n * those from the table. The rest — a dispatch board, a reconciliation\n * screen, a record's audit trail — are a hundred lines of React. Written inside\n * the admin they inherit the sign-in, the security rules, the sidebar, the UI\n * kit and the data layer; written as a separate app they have to rebuild every\n * one of those. This command writes the first version of that file where the\n * admin will find it, so the screen starts native and registered.\n *\n * Two places, one file each:\n *\n * - **A screen** (default): `<frontend>/src/views/<Name>View.tsx`, listed in\n * `<frontend>/src/views/index.ts` as an `AppView`, which `App.tsx` hands to\n * `<RebaseCMS views>`. The first run wires `App.tsx`; later runs only append\n * to the list.\n * - **A record tab** (`--collection <slug>`, the slug of a table in\n * `backend/schema`): the same file location, with a component that takes\n * `EntityCustomViewParams`, added to the `entityViews` of that table's\n * `customizeTable(…)` in `<frontend>/src/cms/` — imported directly, because\n * that directory is the admin's own code and the backend never reads it. A\n * table with no customization yet gets one, `<frontend>/src/cms/<slug>.tsx`,\n * listed in `cms/index.ts`'s `tableCustomizations` when there is one.\n *\n * The frontend is where `rebase.json` says the CMS is (the static app with a\n * `cms` mount), which is `frontend/` in everything `rebase init` writes. A\n * project with no admin panel (`rebase init --headless`) is refused: there is\n * nowhere for a view to render.\n *\n * Edits to existing files are textual and conservative. When `App.tsx` already\n * passes its own `views`, or a customization's shape is not one this can read, the\n * view file is still written and the command prints the one line to add by\n * hand instead of guessing.\n */\nimport fs from \"fs\";\nimport path from \"path\";\nimport { fileURLToPath } from \"url\";\nimport chalk from \"chalk\";\n\nimport { tableIdentifier } from \"@rebasepro/common\";\nimport { cmsMountOf, loadManifest } from \"../manifest\";\nimport { resolveSchemaDir } from \"../utils/schema-dir\";\nimport { declaredTables } from \"../utils/schema-text\";\nimport { requireProjectRoot } from \"../utils/project\";\nimport { parseCommandArgs, UsageError, wantsHelp } from \"../utils/args\";\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\n/** What `rebase generate` dispatches. Read by `cli.ts` to name the subcommand. */\nexport const GENERATE_SUBCOMMANDS = [\"view\"] as const;\n\nconst VIEW_FLAGS = {\n \"--collection\": String,\n \"--name\": String,\n \"--icon\": String,\n \"--dry-run\": Boolean,\n \"--force\": Boolean\n} as const;\n\n/** A slug is a URL segment and an entity view key: kebab-case, starting with a letter. */\nconst SLUG_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;\n\n/**\n * Top-level paths the admin's own routes answer (`RebaseRouteDefs` in\n * `@rebasepro/cms`): `/c/*` the collections, `/s` Studio, `/settings`. They are\n * declared before custom views, so a screen at one of them was listed in the\n * sidebar and opened the built-in page instead.\n */\nconst RESERVED_SCREEN_SLUGS: readonly string[] = [\"c\", \"s\", \"settings\"];\n\nexport interface GenerateViewOptions {\n projectRoot: string;\n slug: string;\n /** Register as a tab on this table's records (its slug) instead of as a screen. */\n collection?: string;\n /** The label in the sidebar or on the tab. Defaults to the slug in sentence case. */\n name?: string;\n /** A Lucide icon name for the sidebar. Screens only. */\n icon?: string;\n /** Replace an existing view file. Registration is never duplicated. */\n force?: boolean;\n}\n\nexport interface PlannedFile {\n /** Absolute path. */\n path: string;\n contents: string;\n action: \"create\" | \"update\" | \"replace\";\n}\n\nexport interface GenerateViewPlan {\n kind: \"app\" | \"entity\";\n componentName: string;\n viewFile: string;\n files: PlannedFile[];\n /** Steps the command could not take itself, as sentences to print. */\n manualSteps: string[];\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Names\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** `orders-board` → `OrdersBoardView`; `sales-view` → `SalesView`, not `SalesViewView`. */\nexport function viewComponentName(slug: string): string {\n const pascal = slug.split(\"-\").map(part => part.charAt(0).toUpperCase() + part.slice(1)).join(\"\");\n return pascal.endsWith(\"View\") ? pascal : `${pascal}View`;\n}\n\n/** `orders-board` → `Orders board`: labels are sentence case in the admin. */\nexport function viewLabel(slug: string): string {\n const words = slug.split(\"-\").join(\" \");\n return words.charAt(0).toUpperCase() + words.slice(1);\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Reading source without a parser\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * The source with every string, template literal, regular expression and\n * comment blanked out, character for character, so brackets and keys can be\n * found by position without being fooled by a `{` inside a string. String\n * contents become `_` (they are still \"something\"), comments become spaces.\n *\n * Exported for its tests.\n */\nexport function maskCode(source: string): string {\n const out = source.split(\"\");\n let i = 0;\n const blank = (from: number, to: number, fill: string) => {\n for (let k = from; k < to; k++) if (out[k] !== \"\\n\") out[k] = fill;\n };\n const previousSignificant = (at: number): string => {\n for (let k = at - 1; k >= 0; k--) {\n const ch = out[k];\n if (ch !== \" \" && ch !== \"\\t\" && ch !== \"\\n\" && ch !== \"\\r\") return ch;\n }\n return \"\";\n };\n while (i < source.length) {\n const ch = source[i];\n const next = source[i + 1];\n if (ch === \"/\" && next === \"/\") {\n const end = source.indexOf(\"\\n\", i);\n const stop = end === -1 ? source.length : end;\n blank(i, stop, \" \");\n i = stop;\n } else if (ch === \"/\" && next === \"*\") {\n const end = source.indexOf(\"*/\", i + 2);\n const stop = end === -1 ? source.length : end + 2;\n blank(i, stop, \" \");\n i = stop;\n } else if (ch === \"\\\"\" || ch === \"'\" || ch === \"`\") {\n let k = i + 1;\n while (k < source.length && source[k] !== ch) {\n if (source[k] === \"\\\\\") k++;\n k++;\n }\n blank(i + 1, k, \"_\");\n i = k + 1;\n } else if (ch === \"/\" && (previousSignificant(i) === \"\" || \"(,=:[!&|?{;\".includes(previousSignificant(i)))) {\n // A regular expression literal: `/` where a value is expected. Not\n // after `}`, which in a .tsx file is far more often `{value}/>`.\n let k = i + 1;\n let inClass = false;\n while (k < source.length && source[k] !== \"\\n\") {\n if (source[k] === \"\\\\\") k++;\n else if (source[k] === \"[\") inClass = true;\n else if (source[k] === \"]\") inClass = false;\n else if (source[k] === \"/\" && !inClass) break;\n k++;\n }\n blank(i + 1, k, \"_\");\n i = k + 1;\n } else {\n i++;\n }\n }\n return out.join(\"\");\n}\n\nconst CLOSERS: Record<string, string> = { \"{\": \"}\", \"[\": \"]\", \"(\": \")\" };\n\n/** The index of the bracket closing the one at `open`, in masked source. */\nfunction matchClose(masked: string, open: number): number {\n const stack: string[] = [];\n for (let i = open; i < masked.length; i++) {\n const ch = masked[i];\n if (ch in CLOSERS) stack.push(CLOSERS[ch]);\n else if (ch === \"}\" || ch === \"]\" || ch === \")\") {\n if (stack.pop() !== ch) return -1;\n if (stack.length === 0) return i;\n }\n }\n return -1;\n}\n\n/** The index of the innermost `{` still open at `at`, in masked source. */\nfunction enclosingBrace(masked: string, at: number): number {\n const stack: number[] = [];\n for (let i = 0; i < at; i++) {\n const ch = masked[i];\n if (ch === \"{\" || ch === \"[\" || ch === \"(\") stack.push(i);\n else if (ch === \"}\" || ch === \"]\" || ch === \")\") stack.pop();\n }\n for (let k = stack.length - 1; k >= 0; k--) {\n if (masked[stack[k]] === \"{\") return stack[k];\n }\n return -1;\n}\n\n/**\n * The position of `key:` as a direct property of the object whose `{` is at\n * `open`, followed by `opener` (`{` or `[`) — or -1.\n */\nfunction directProperty(masked: string, open: number, key: string, opener: \"{\" | \"[\"): { keyAt: number; valueOpen: number } | undefined {\n const close = matchClose(masked, open);\n if (close === -1) return undefined;\n const pattern = new RegExp(`(^|[\\\\s,{])${key}\\\\s*:\\\\s*\\\\${opener}`, \"g\");\n const body = masked.slice(open + 1, close);\n for (const match of body.matchAll(pattern)) {\n const keyAt = open + 1 + (match.index ?? 0) + match[1].length;\n if (enclosingBrace(masked, keyAt) !== open) continue;\n return { keyAt, valueOpen: open + 1 + (match.index ?? 0) + match[0].length - 1 };\n }\n return undefined;\n}\n\nfunction lineStart(source: string, at: number): number {\n return source.lastIndexOf(\"\\n\", at - 1) + 1;\n}\n\nfunction indentAt(source: string, at: number): string {\n const start = lineStart(source, at);\n return /^[ \\t]*/.exec(source.slice(start))?.[0] ?? \"\";\n}\n\n/**\n * The indentation step a file uses: the smallest non-zero leading run of\n * spaces, not counting the ` * ` lines of a block comment.\n */\nfunction indentUnit(source: string): string {\n if (/^\\t/m.test(source)) return \"\\t\";\n let unit = Infinity;\n for (const match of source.matchAll(/^( +)[^\\s*]/gm)) unit = Math.min(unit, match[1].length);\n return \" \".repeat(Number.isFinite(unit) ? unit : 4);\n}\n\nfunction reindent(block: string, indent: string): string {\n return block.split(\"\\n\").map(line => (line ? indent + line : line)).join(\"\\n\");\n}\n\n/**\n * Insert `element` (already indented one level past `indent`) as the last item\n * of the array whose `[` is at `open`.\n */\nfunction appendToArray(source: string, masked: string, open: number, element: string): string {\n const close = matchClose(masked, open);\n const inner = masked.slice(open + 1, close);\n const indent = indentAt(source, open);\n if (inner.trim() === \"\") {\n return `${source.slice(0, open + 1)}\\n${element}\\n${indent}${source.slice(close)}`;\n }\n // After the last non-blank character of the content, keeping any comment\n // after it where it was.\n let last = close - 1;\n while (last > open && /\\s/.test(masked[last])) last--;\n const hasTrailingComma = masked[last] === \",\";\n const insertAt = last + 1;\n return `${source.slice(0, insertAt)}${hasTrailingComma ? \"\" : \",\"}\\n${element}${source.slice(insertAt)}`;\n}\n\n/** Add an import line after the file's last import statement. */\nfunction addImport(source: string, line: string): string {\n const masked = maskCode(source);\n let end = 0;\n for (const match of masked.matchAll(/^import\\b[\\s\\S]*?[\"'][^\"'\\n]*[\"'];?[ \\t]*$/gm)) {\n end = (match.index ?? 0) + match[0].length;\n }\n if (end === 0) return `${line}\\n${source}`;\n return `${source.slice(0, end)}\\n${line}${source.slice(end)}`;\n}\n\n/** A path import from `fromDir` to `toFile`, without extension, always starting with `.`. */\nfunction relativeImport(fromDir: string, toFile: string): string {\n const relative = path.relative(fromDir, toFile).split(path.sep).join(\"/\").replace(/\\.tsx?$/, \"\");\n return relative.startsWith(\".\") ? relative : `./${relative}`;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Where things are\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** The admin's frontend directory: the static app that mounts the CMS, or `frontend/`. */\nexport function resolveFrontendDir(projectRoot: string): string | undefined {\n try {\n const cms = cmsMountOf(loadManifest(projectRoot).manifest);\n if (cms) return path.join(projectRoot, cms.app.root);\n } catch {\n // A malformed rebase.json is reported by the commands that own it.\n }\n const fallback = path.join(projectRoot, \"frontend\");\n return fs.existsSync(path.join(fallback, \"src\")) ? fallback : undefined;\n}\n\n/** The tables directory, as the backend app declares it — one resolver for every command. */\nexport { resolveSchemaDir };\n\n/** Every source file under the admin's `src/cms`, sorted: where table customizations live. */\nfunction customizationFiles(dir: string): string[] {\n if (!fs.existsSync(dir)) return [];\n const out: string[] = [];\n const entries = fs.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));\n for (const entry of entries) {\n const full = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n if (entry.name !== \"node_modules\") out.push(...customizationFiles(full));\n } else if (/\\.tsx?$/.test(entry.name) && !/\\.(test|spec|d)\\.tsx?$/.test(entry.name)) {\n out.push(full);\n }\n }\n return out;\n}\n\n/**\n * Every `customizeTable(\"<slug>\", {` of a table, in code (not in a comment or\n * a string): the file, and where the options object opens. Empty when no file\n * under `cmsDir` customizes the table.\n */\nfunction findCustomization(cmsDir: string, slug: string): { file: string; optionsOpen: number }[] {\n const found: { file: string; optionsOpen: number }[] = [];\n const call = /\\bcustomizeTable\\s*(?:<[^>]*>)?\\(\\s*([\"'`])([^\"'`\\n]+)\\1\\s*,\\s*\\{/g;\n for (const file of customizationFiles(cmsDir)) {\n const source = fs.readFileSync(file, \"utf8\");\n const masked = maskCode(source);\n for (const match of source.matchAll(call)) {\n const at = match.index ?? 0;\n if (match[2] !== slug || masked[at] !== \"c\") continue;\n found.push({ file, optionsOpen: at + match[0].length - 1 });\n }\n }\n return found;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// The files\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * The scaffolds live in `templates/views/` rather than in template literals\n * here: they import React and the admin packages, and this package's sources\n * must not name those, even inside a string (`pnpm check:types-headless`).\n */\nfunction viewTemplate(name: string): string {\n const cliRoot = findCliRoot(__dirname);\n if (!cliRoot) throw new Error(`The CLI's templates/views folder is missing from ${__dirname}.`);\n return fs.readFileSync(path.join(cliRoot, \"templates\", \"views\", name), \"utf8\");\n}\n\n/** Walk up to the package root, which holds `templates/views`. */\nfunction findCliRoot(from: string): string | null {\n const root = path.parse(from).root;\n let dir = from;\n while (dir && dir !== root) {\n if (fs.existsSync(path.join(dir, \"templates\", \"views\"))) return dir;\n dir = path.dirname(dir);\n }\n return null;\n}\n\ntype ViewTemplateOptions = { slug: string; componentName: string; label: string; collection: string };\n\n/** The `{ key, name, Builder }` an entity view is registered as, with `unit` indentation inside. */\nfunction entityViewEntry(view: { key: string; name: string; componentName: string }, unit: string): string {\n return [\n \"{\",\n `${unit}key: ${JSON.stringify(view.key)},`,\n `${unit}name: ${JSON.stringify(view.name)},`,\n `${unit}Builder: ${view.componentName}`,\n \"}\"\n ].join(\"\\n\");\n}\n\n/**\n * A label as JSX text: written as is when it is plain, as a string expression\n * when it holds a character JSX reads — `{`, `}`, `<`, `>`, `&`. Pasted raw,\n * `--name \"KPIs {beta}\"` wrote `<Typography>KPIs {beta}</Typography>`, and the\n * view did not compile (\"Cannot find name 'beta'\").\n */\nfunction jsxText(text: string): string {\n return /[{}<>&]/.test(text) ? `{${JSON.stringify(text)}}` : text;\n}\n\n/** A label inside the leading `/** … *\\/` comment: one line, and no `*\\/` to close it early. */\nfunction commentText(text: string): string {\n return text.replace(/[\\r\\n]+/g, \" \").replaceAll(\"*/\", \"*\\\\/\");\n}\n\nfunction fillViewTemplate(template: string, options: ViewTemplateOptions): string {\n const { slug, componentName, label, collection } = options;\n return template\n .replaceAll(\"\\\"__COLLECTION__\\\"\", JSON.stringify(collection))\n .replaceAll(\"__COLLECTION__\", collection)\n .replaceAll(\"__COMPONENT__\", componentName)\n .replaceAll(\"__label_jsx__\", jsxText(label.toLowerCase()))\n .replaceAll(\"__LABEL_JSX__\", jsxText(label))\n .replaceAll(\"__label__\", commentText(label.toLowerCase()))\n .replaceAll(\"__LABEL__\", commentText(label))\n .replaceAll(\"__SLUG__\", slug);\n}\n\nexport function appViewSource(options: ViewTemplateOptions): string {\n return fillViewTemplate(viewTemplate(\"AppView.tsx.tmpl\"), options);\n}\n\nexport function entityViewSource(options: ViewTemplateOptions): string {\n return fillViewTemplate(viewTemplate(\"EntityView.tsx.tmpl\"), options);\n}\n\nfunction viewsIndexHeader(): string {\n return viewTemplate(\"index.ts.tmpl\");\n}\n\nfunction appViewEntry(options: { slug: string; label: string; icon: string; componentName: string }, unit: string): string {\n return [\n \"{\",\n `${unit}slug: ${JSON.stringify(options.slug)},`,\n `${unit}name: ${JSON.stringify(options.label)},`,\n `${unit}icon: ${JSON.stringify(options.icon)},`,\n `${unit}view: ${options.componentName}`,\n \"}\"\n ].join(\"\\n\");\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Planning\n// ─────────────────────────────────────────────────────────────────────────────\n\nfunction readIfExists(file: string): string | undefined {\n return fs.existsSync(file) ? fs.readFileSync(file, \"utf8\") : undefined;\n}\n\n/**\n * The frontend's package.json gains `@rebasepro/cms-types` when it lacks it.\n *\n * The view files import their prop types from it, and under pnpm a package the\n * frontend does not declare does not resolve from the frontend — the frontend's\n * `tsc` would fail on the first generated view. The version is the one the\n * frontend already uses for `@rebasepro/cms`, so the two cannot drift.\n */\nfunction planCmsTypesDependency(frontendDir: string, files: PlannedFile[], manualSteps: string[]): void {\n const manifestFile = path.join(frontendDir, \"package.json\");\n const raw = readIfExists(manifestFile);\n if (raw === undefined) return;\n let manifest: { dependencies?: Record<string, string>; devDependencies?: Record<string, string> };\n try {\n manifest = JSON.parse(raw);\n } catch {\n return;\n }\n const declared = { ...manifest.devDependencies, ...manifest.dependencies };\n if (declared[\"@rebasepro/cms-types\"]) return;\n const version = declared[\"@rebasepro/cms\"] ?? declared[\"@rebasepro/app\"];\n if (!version) return;\n const dependencies = { ...manifest.dependencies, \"@rebasepro/cms-types\": version };\n const sorted = Object.fromEntries(Object.entries(dependencies).sort(([a], [b]) => a.localeCompare(b)));\n const indent = /^(\\s+)\"/m.exec(raw)?.[1] ?? \" \";\n files.push({\n path: manifestFile,\n contents: `${JSON.stringify({ ...manifest, dependencies: sorted }, null, indent)}\\n`,\n action: \"update\"\n });\n manualSteps.push(`Run your package manager's install: ${path.basename(frontendDir)}/package.json now depends on @rebasepro/cms-types, which the view imports its types from.`);\n}\n\nfunction defaultCollectionFor(projectRoot: string): string {\n const slugs = declaredTables(resolveSchemaDir(projectRoot)).map(entry => entry.slug);\n return slugs.find(slug => slug !== \"users\") ?? slugs[0] ?? \"users\";\n}\n\n/**\n * Everything `rebase generate view` would write, without writing it.\n *\n * @throws UsageError when the slug is not a slug, there is no admin panel, the\n * view already exists (without `force`), or `--collection` names nothing.\n */\nexport function planGenerateView(options: GenerateViewOptions): GenerateViewPlan {\n const { projectRoot, slug } = options;\n if (!SLUG_PATTERN.test(slug)) {\n throw new UsageError(\n `\"${slug}\" is not a view slug: use lowercase letters, digits and dashes, starting with a letter (e.g. orders-board).`\n );\n }\n if (!options.collection && RESERVED_SCREEN_SLUGS.includes(slug)) {\n throw new UsageError(\n `\"${slug}\" is reserved: the admin's own routes answer /${slug}, so a screen there would never show. ` +\n `Pick another slug (e.g. ${slug === \"settings\" ? \"app-settings\" : `${slug}-view`}).`\n );\n }\n const frontendDir = resolveFrontendDir(projectRoot);\n if (!frontendDir) {\n throw new UsageError(\n \"This project has no admin panel to add a view to: rebase.json declares no app with a `cms` mount, and there is no frontend/src. \" +\n \"A project created with `rebase init --headless` has no admin.\"\n );\n }\n\n const componentName = viewComponentName(slug);\n const label = options.name?.trim() || viewLabel(slug);\n const viewsDir = path.join(frontendDir, \"src\", \"views\");\n const viewFile = path.join(viewsDir, `${componentName}.tsx`);\n const files: PlannedFile[] = [];\n const manualSteps: string[] = [];\n\n const viewExists = fs.existsSync(viewFile);\n if (viewExists && !options.force) {\n throw new UsageError(\n `${path.relative(projectRoot, viewFile)} already exists. Pass --force to replace it; its registration is kept.`\n );\n }\n const viewAction: PlannedFile[\"action\"] = viewExists ? \"replace\" : \"create\";\n\n if (options.collection) {\n const kind = \"entity\" as const;\n const table = options.collection;\n const schemaDir = resolveSchemaDir(projectRoot);\n const declared = declaredTables(schemaDir);\n if (!declared.some(entry => entry.slug === table)) {\n const known = [...new Set(declared.map(entry => entry.slug))].sort();\n throw new UsageError(\n `No table with slug \"${table}\" under ${path.relative(projectRoot, schemaDir) || \".\"}.` +\n (known.length ? ` Declared: ${known.join(\", \")}.` : \"\")\n );\n }\n const cmsDir = path.join(frontendDir, \"src\", \"cms\");\n const customizations = findCustomization(cmsDir, table);\n if (customizations.length > 1) {\n throw new UsageError(\n `More than one customizeTable(\"${table}\", …) under ${path.relative(projectRoot, cmsDir)}: ` +\n `${[...new Set(customizations.map(entry => path.relative(projectRoot, entry.file)))].join(\", \")}.`\n );\n }\n\n files.push({\n path: viewFile,\n contents: entityViewSource({ slug, componentName, label, collection: table }),\n action: viewAction\n });\n\n const view = { key: slug, name: label, componentName };\n if (customizations.length === 1) {\n const [{ file, optionsOpen }] = customizations;\n const importLine = `import { ${componentName} } from \"${relativeImport(path.dirname(file), viewFile)}\";`;\n const source = fs.readFileSync(file, \"utf8\");\n const updated = registerEntityView(source, optionsOpen, view);\n const where = path.relative(projectRoot, file);\n if (updated === \"already\") {\n // Registered on an earlier run: --force replaced the file only.\n } else if (updated === undefined) {\n manualSteps.push(\n `Add this to the entityViews of customizeTable(\"${table}\", …) in ${where}: ` +\n `{ key: ${JSON.stringify(slug)}, name: ${JSON.stringify(label)}, Builder: ${componentName} }, and ${importLine}`\n );\n } else {\n files.push({ path: file, contents: addImport(updated, importLine), action: \"update\" });\n }\n } else {\n const identifier = `${tableIdentifier(table)}Cms`;\n const file = path.join(cmsDir, `${table}.tsx`);\n if (fs.existsSync(file)) {\n throw new UsageError(\n `${path.relative(projectRoot, file)} exists but holds no customizeTable(\"${table}\", …): ` +\n \"add the record tab to the table's customization by hand, or move that file aside.\"\n );\n }\n const unit = \" \";\n files.push({\n path: file,\n contents: [\n \"import { customizeTable } from \\\"@rebasepro/cms\\\";\",\n `import { ${componentName} } from \"${relativeImport(cmsDir, viewFile)}\";`,\n \"\",\n `export const ${identifier} = customizeTable(\"${table}\", {`,\n `${unit}entityViews: [`,\n reindent(entityViewEntry(view, unit), unit + unit),\n `${unit}]`,\n \"});\",\n \"\"\n ].join(\"\\n\"),\n action: \"create\"\n });\n // Handed to the admin where the project lists its customizations:\n // a `tableCustomizations` list exported by `cms/index.ts`, else\n // the one `App.tsx` passes to `<RebaseCMS>`.\n const indexFile = path.join(cmsDir, \"index.ts\");\n const appFile = path.join(frontendDir, \"src\", \"App.tsx\");\n const index = readIfExists(indexFile);\n const app = readIfExists(appFile);\n const listedInIndex = index === undefined ? undefined : listCustomization(index, identifier, `./${table}`);\n const listedInApp = listedInIndex === undefined && app !== undefined\n ? listCustomization(app, identifier, `./cms/${table}`)\n : undefined;\n if (listedInIndex !== undefined) {\n if (listedInIndex !== \"already\") files.push({ path: indexFile, contents: listedInIndex, action: \"update\" });\n } else if (listedInApp !== undefined) {\n if (listedInApp !== \"already\") files.push({ path: appFile, contents: listedInApp, action: \"update\" });\n } else {\n manualSteps.push(\n `Hand the customization to the admin: import { ${identifier} } from \"./cms/${table}\" and add it to ` +\n `<RebaseCMS tableCustomizations={[…]}> in ${path.relative(projectRoot, appFile)}.`\n );\n }\n }\n planCmsTypesDependency(frontendDir, files, manualSteps);\n return { kind, componentName, viewFile, files, manualSteps };\n }\n\n files.push({\n path: viewFile,\n contents: appViewSource({ slug, componentName, label, collection: defaultCollectionFor(projectRoot) }),\n action: viewAction\n });\n\n // The list of screens.\n const indexFile = path.join(viewsDir, \"index.ts\");\n const existingIndex = readIfExists(indexFile);\n const icon = options.icon ?? \"LayoutDashboard\";\n if (existingIndex === undefined) {\n const unit = \" \";\n files.push({\n path: indexFile,\n contents: `${viewsIndexHeader()}import { ${componentName} } from \"./${componentName}\";\\n\\n` +\n `export const views: AppView[] = [\\n${reindent(appViewEntry({ slug, label, icon, componentName }, unit), unit)}\\n];\\n`,\n action: \"create\"\n });\n } else {\n const updated = registerAppView(existingIndex, { slug, label, icon, componentName });\n if (updated === undefined) {\n manualSteps.push(\n `Add { slug: ${JSON.stringify(slug)}, name: ${JSON.stringify(label)}, view: ${componentName} } to the views in ${path.relative(projectRoot, indexFile)}.`\n );\n } else if (updated !== \"already\") {\n files.push({ path: indexFile, contents: updated, action: \"update\" });\n }\n }\n\n // App.tsx hands the list to <RebaseCMS>, once.\n const appFile = path.join(frontendDir, \"src\", \"App.tsx\");\n const app = readIfExists(appFile);\n const wired = app === undefined ? undefined : wireViewsIntoApp(app);\n if (wired === undefined) {\n manualSteps.push(\n `Pass the screens to the admin: import { views } from \"./views\" and add views={views} to <RebaseCMS> in ${path.relative(projectRoot, appFile)}` +\n \" (or spread ...views into the views it already passes).\"\n );\n } else if (wired !== \"already\") {\n files.push({ path: appFile, contents: wired, action: \"update\" });\n }\n\n planCmsTypesDependency(frontendDir, files, manualSteps);\n return { kind: \"app\", componentName, viewFile, files, manualSteps };\n}\n\n/**\n * `views/index.ts` with one more entry, `\"already\"` when the slug is listed, or\n * `undefined` when the file has no `export const views … = [`.\n *\n * Exported for its tests.\n */\nexport function registerAppView(\n source: string,\n options: { slug: string; label: string; icon: string; componentName: string }\n): string | \"already\" | undefined {\n const masked = maskCode(source);\n const declaration = /export\\s+const\\s+views\\b[^=]*=\\s*\\[/.exec(masked);\n if (!declaration) return undefined;\n const open = declaration.index + declaration[0].length - 1;\n if (matchClose(masked, open) === -1) return undefined;\n const close = matchClose(masked, open);\n const listed = source.slice(open, close);\n if (new RegExp(`slug\\\\s*:\\\\s*[\"']${options.slug}[\"']`).test(listed)) return \"already\";\n\n const unit = indentUnit(source);\n const indent = indentAt(source, open) + unit;\n const element = reindent(appViewEntry(options, unit), indent);\n const appended = appendToArray(source, masked, open, element);\n return addImport(appended, `import { ${options.componentName} } from \"./${options.componentName}\";`);\n}\n\n/**\n * `App.tsx` with `views={views}` on `<RebaseCMS>` and its import, `\"already\"`\n * when it passes exactly that, or `undefined` when it cannot be done safely:\n * no `<RebaseCMS`, a `views` prop of its own, or a `views` name already in scope.\n *\n * Exported for its tests.\n */\nexport function wireViewsIntoApp(source: string): string | \"already\" | undefined {\n const masked = maskCode(source);\n const tag = /<RebaseCMS\\b/.exec(masked);\n if (!tag) return undefined;\n const tagEnd = masked.indexOf(\">\", tag.index);\n if (tagEnd === -1) return undefined;\n const attributes = masked.slice(tag.index, tagEnd);\n const importsViews = /import\\s*\\{\\s*views\\s*\\}\\s*from\\s*[\"']\\.\\/views(?:\\/index)?[\"']/.test(source);\n if (/\\sviews\\s*=/.test(attributes)) {\n return importsViews && /\\sviews\\s*=\\s*\\{\\s*views\\s*\\}/.test(attributes) ? \"already\" : undefined;\n }\n if (/\\bviews\\b/.test(masked)) return undefined;\n\n const insertAt = tag.index + \"<RebaseCMS\".length;\n const afterTag = source.slice(insertAt);\n const nextLine = /^[ \\t]*\\r?\\n([ \\t]*)\\S/.exec(afterTag);\n const attribute = nextLine ? `\\n${nextLine[1]}views={views}` : \" views={views}\";\n const withProp = source.slice(0, insertAt) + attribute + source.slice(insertAt);\n return addImport(withProp, \"import { views } from \\\"./views\\\";\");\n}\n\n/**\n * The customization file with a `{ key, name, Builder }` entry in the\n * `entityViews` of the `customizeTable(…)` options object whose `{` is at\n * `optionsOpen`; `\"already\"` when that key is there; `undefined` when the\n * shape cannot be read. The component's import is the caller's to add.\n *\n * Exported for its tests.\n */\nexport function registerEntityView(\n source: string,\n optionsOpen: number,\n view: { key: string; name: string; componentName: string }\n): string | \"already\" | undefined {\n const masked = maskCode(source);\n const close = matchClose(masked, optionsOpen);\n if (close === -1) return undefined;\n const unit = indentUnit(source);\n const entry = entityViewEntry(view, unit);\n\n const entityViews = directProperty(masked, optionsOpen, \"entityViews\", \"[\");\n if (entityViews) {\n const listClose = matchClose(masked, entityViews.valueOpen);\n if (listClose === -1) return undefined;\n const listed = source.slice(entityViews.valueOpen, listClose);\n if (new RegExp(`key\\\\s*:\\\\s*[\"']${view.key}[\"']|[\"']${view.key}[\"']`).test(listed)) return \"already\";\n const indent = indentAt(source, entityViews.keyAt) + unit;\n return appendToArray(source, masked, entityViews.valueOpen, reindent(entry, indent));\n }\n\n // `entityViews` as the first property of the options.\n const indent = indentAt(source, optionsOpen) + unit;\n const block = `${indent}entityViews: [\\n${reindent(entry, indent + unit)}\\n${indent}]`;\n const empty = masked.slice(optionsOpen + 1, close).trim() === \"\";\n const insertAt = optionsOpen + 1;\n return empty\n ? `${source.slice(0, insertAt)}\\n${block}\\n${indentAt(source, optionsOpen)}${source.slice(close)}`\n : `${source.slice(0, insertAt)}\\n${block},${source.slice(insertAt)}`;\n}\n\n/**\n * A source with `identifier` imported from `importPath` and appended to its\n * list of table customizations — `export const tableCustomizations = [ … ]`\n * (`cms/index.ts`) or `tableCustomizations={[ … ]}` on `<RebaseCMS>`\n * (`App.tsx`); `\"already\"` when it is listed; `undefined` when the source has\n * no such list.\n *\n * Exported for its tests.\n */\nexport function listCustomization(source: string, identifier: string, importPath: string): string | \"already\" | undefined {\n const masked = maskCode(source);\n const declaration = /export\\s+const\\s+tableCustomizations\\b[^=]*=\\s*\\[/.exec(masked)\n ?? /\\btableCustomizations\\s*=\\s*\\{\\s*\\[/.exec(masked);\n if (!declaration) return undefined;\n const open = declaration.index + declaration[0].length - 1;\n const close = matchClose(masked, open);\n if (close === -1) return undefined;\n if (new RegExp(`\\\\b${identifier}\\\\b`).test(masked.slice(open, close))) return \"already\";\n const inner = masked.slice(open + 1, close);\n let appended: string;\n if (inner.trim() !== \"\" && !inner.includes(\"\\n\")) {\n // A list written on one line stays on one line.\n let last = close - 1;\n while (last > open && /\\s/.test(masked[last])) last--;\n const comma = masked[last] === \",\" ? \" \" : \", \";\n appended = `${source.slice(0, last + 1)}${comma}${identifier}${source.slice(last + 1)}`;\n } else {\n const unit = indentUnit(source);\n appended = appendToArray(source, masked, open, `${indentAt(source, open)}${unit}${identifier}`);\n }\n return addImport(appended, `import { ${identifier} } from \"${importPath}\";`);\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// The command\n// ─────────────────────────────────────────────────────────────────────────────\n\nfunction printHelp(): void {\n console.log(`\n${chalk.bold(\"rebase generate\")} — scaffold code into this project\n\n${chalk.bold(\"Usage\")}\n rebase generate view <slug> A screen of the admin, in the sidebar\n rebase generate view <slug> --collection <slug> A tab on every record of a table\n\n${chalk.bold(\"What it writes\")}\n <frontend>/src/views/<Name>View.tsx The component, drawn with @rebasepro/ui\n <frontend>/src/views/index.ts The screens list (AppView[]), wired into\n <RebaseCMS views> in App.tsx on first run\n With --collection, the table's customizeTable(…) in <frontend>/src/cms gains\n an entityViews entry with the component (a new <slug>.tsx when it has none).\n\n${chalk.bold(\"Options\")}\n --collection <slug> Register as a record tab of the table with this slug\n --name <label> Sidebar or tab label ${chalk.gray(\"(default: the slug in sentence case)\")}\n --icon <Lucide name> Sidebar icon for a screen ${chalk.gray(\"(default: LayoutDashboard)\")}\n --dry-run List what would change, and change nothing\n --force Replace an existing view file\n -h, --help Show this help\n`.trim());\n}\n\nexport async function generateCommand(subcommand: string | undefined, rawArgs: string[] = []): Promise<void> {\n if (subcommand === undefined || subcommand === \"--help\" || (subcommand !== \"view\" && wantsHelp(rawArgs))) {\n printHelp();\n return;\n }\n switch (subcommand) {\n case \"view\":\n await generateViewCommand(rawArgs);\n return;\n default:\n throw new UsageError(`Unknown generate command \"${subcommand}\". Available: ${GENERATE_SUBCOMMANDS.join(\", \")}. See \\`rebase generate --help\\`.`);\n }\n}\n\nasync function generateViewCommand(rawArgs: string[]): Promise<void> {\n if (wantsHelp(rawArgs)) {\n printHelp();\n return;\n }\n const { flags, positionals } = parseCommandArgs({\n spec: VIEW_FLAGS,\n rawArgs,\n commandWords: 2,\n command: \"generate view\",\n maxPositionals: 1\n });\n const slug = positionals[0];\n if (!slug) {\n throw new UsageError(\"Name the view: `rebase generate view <slug>`, e.g. `rebase generate view orders-board`.\");\n }\n if (flags[\"--icon\"] && flags[\"--collection\"]) {\n throw new UsageError(\"--icon is for a screen in the sidebar; a record tab (--collection) has no icon here.\");\n }\n\n const projectRoot = requireProjectRoot();\n const plan = planGenerateView({\n projectRoot,\n slug,\n collection: flags[\"--collection\"],\n name: flags[\"--name\"],\n icon: flags[\"--icon\"],\n force: Boolean(flags[\"--force\"])\n });\n const dryRun = Boolean(flags[\"--dry-run\"]);\n\n for (const file of plan.files) {\n if (!dryRun) {\n fs.mkdirSync(path.dirname(file.path), { recursive: true });\n fs.writeFileSync(file.path, file.contents);\n }\n const verb = file.action === \"create\" ? \"created\" : file.action === \"replace\" ? \"replaced\" : \"updated\";\n console.log(`${chalk.green(\"✓\")} ${dryRun ? `would be ${verb}` : verb} ${path.relative(projectRoot, file.path)}`);\n }\n for (const step of plan.manualSteps) {\n console.log(`${chalk.yellow(\"!\")} ${step}`);\n }\n const where = plan.kind === \"app\" ? `/${slug} in the admin` : `a \"${flags[\"--name\"]?.trim() || viewLabel(slug)}\" tab on each ${flags[\"--collection\"]} record`;\n console.log(chalk.gray(` ${plan.componentName} renders at ${where}. Edit ${path.relative(projectRoot, plan.viewFile)} to build the screen.`));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAM,YAAY,KAAK,QAAQ,cAAc,OAAO,KAAK,GAAG,CAAC;;AAG7D,IAAa,uBAAuB,CAAC,MAAM;AAE3C,IAAM,aAAa;CACf,gBAAgB;CAChB,UAAU;CACV,UAAU;CACV,aAAa;CACb,WAAW;AACf;;AAGA,IAAM,eAAe;;;;;;;AAQrB,IAAM,wBAA2C;CAAC;CAAK;CAAK;AAAU;;AAoCtE,SAAgB,kBAAkB,MAAsB;CACpD,MAAM,SAAS,KAAK,MAAM,GAAG,CAAC,CAAC,KAAI,SAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC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AQ,IAAI,GAAG,MAAM,MAAM,GAAG,EAAE,GAAG,SAAS,YAAY,SAAS,KAAK,IAAI,KAAK,SAAS,aAAa,KAAK,IAAI,GAAG;CACrH;CACA,KAAK,MAAM,QAAQ,KAAK,aACpB,QAAQ,IAAI,GAAG,MAAM,OAAO,GAAG,EAAE,GAAG,MAAM;CAE9C,MAAM,QAAQ,KAAK,SAAS,QAAQ,IAAI,KAAK,iBAAiB,MAAM,MAAM,SAAS,EAAE,KAAK,KAAK,UAAU,IAAI,EAAE,gBAAgB,MAAM,gBAAgB;CACrJ,QAAQ,IAAI,MAAM,KAAK,KAAK,KAAK,cAAc,cAAc,MAAM,SAAS,KAAK,SAAS,aAAa,KAAK,QAAQ,EAAE,sBAAsB,CAAC;AACjJ"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c as findProjectRoot, d as readEnvFile } from "./project-
|
|
2
|
-
import { O as writeManifest, _ as findBackendApp, b as loadManifest, o as GENERATED_DIR, x as manifestExists } from "./manifest-
|
|
3
|
-
import { n as SCHEMA_DIR_FLAG_HELP, t as PATH_RESOLUTION_RULE } from "./path-flags-
|
|
1
|
+
import { c as findProjectRoot, d as readEnvFile } from "./project-CQ5nKddJ.js";
|
|
2
|
+
import { O as writeManifest, _ as findBackendApp, b as loadManifest, o as GENERATED_DIR, x as manifestExists } from "./manifest-D6B4LA8x.js";
|
|
3
|
+
import { n as SCHEMA_DIR_FLAG_HELP, t as PATH_RESOLUTION_RULE } from "./path-flags-B7Ydt5nv.js";
|
|
4
4
|
import { t as loadProjectSchema } from "./project-schema-Dm6Jk0Y_.js";
|
|
5
|
-
import { t as DEV_BACKEND_URL_ENV } from "./dev-server-
|
|
6
|
-
import { H as readLink } from "./context-
|
|
5
|
+
import { t as DEV_BACKEND_URL_ENV } from "./dev-server-dsabI0UT.js";
|
|
6
|
+
import { H as readLink } from "./context-C9lz1vTS.js";
|
|
7
7
|
import { t as Refusal } from "./refusal-ReeeGP8a.js";
|
|
8
8
|
import chalk from "chalk";
|
|
9
9
|
import fs from "fs";
|
|
@@ -505,4 +505,4 @@ export const SCHEMA_VERSION = ${JSON.stringify(schemaVersion)};
|
|
|
505
505
|
//#endregion
|
|
506
506
|
export { generateSdkCommand, writeRegistrationForBuild };
|
|
507
507
|
|
|
508
|
-
//# sourceMappingURL=generate_sdk-
|
|
508
|
+
//# sourceMappingURL=generate_sdk-MAbUUZoK.js.map
|