cronus-ui 0.6.16 → 0.6.17

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/README.md CHANGED
@@ -49,7 +49,7 @@ Notes that match the commander surface:
49
49
  `packages/cli/scripts/build-registry.ts` — each item carries its source, its npm
50
50
  `dependencies`, and its `registryDependencies` (other components it imports),
51
51
  derived by parsing imports.
52
- - The default registry is pinned to the CLI package version (`v0.6.16` here), not
52
+ - The default registry is pinned to the CLI package version (`v0.6.17` here), not
53
53
  mutable `main`, so a published CLI reads the registry snapshot it was released
54
54
  with. Use `-r, --registry ./registry` when testing local registry changes before
55
55
  a release tag exists.
@@ -80,7 +80,7 @@ Notes that match the commander surface:
80
80
  "lib": "lib",
81
81
  "blocks": "components/blocks"
82
82
  },
83
- "registry": "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.6.16/registry"
83
+ "registry": "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.6.17/registry"
84
84
  }
85
85
  ```
86
86
 
@@ -20,7 +20,7 @@
20
20
  */
21
21
  import { existsSync } from "node:fs";
22
22
  import { rm } from "node:fs/promises";
23
- import { goldPatchAppShellChrome, isGoldPathTemplate } from "../compose/gold-path.js";
23
+ import { goldPatchAppShellChrome, goldPatchShellLayout, goldPatchTeamPage, isGoldPathTemplate, } from "../compose/gold-path.js";
24
24
  import { blockRefParts } from "../compose/manifest.js";
25
25
  import { buildComposePlan, ComposePlanError, } from "../compose/plan.js";
26
26
  import { baseSnapshotDir, reloadManifest } from "../compose/reload.js";
@@ -234,7 +234,14 @@ export async function addPage(options) {
234
234
  skippedFiles.push(pageRel);
235
235
  }
236
236
  else {
237
- const content = renderPage(planPage, config);
237
+ let content = renderPage(planPage, config);
238
+ // saas/admin: compose gold-patches /team (MembersPanel). Writing the
239
+ // catalog TeamBlock would undo that — re-apply the same idempotent patch.
240
+ if (isGoldPathTemplate(appName) && planPage.route === "/team" && chromeGroup === "shell") {
241
+ const patched = goldPatchTeamPage(content);
242
+ if (patched !== undefined)
243
+ content = patched;
244
+ }
238
245
  await writeFileEnsured(pageDest, content);
239
246
  generatedFiles.push(pageRel);
240
247
  await writeFileEnsured(resolveSafeDest(targetDir, baseSnapshotDir(appName), pageRel), content);
@@ -404,7 +411,15 @@ async function ensureChromeScaffold(plan, chrome, config, targetDir, appName, ge
404
411
  if (chrome.block !== undefined && plan.shellExportName !== undefined) {
405
412
  await write(chromeWrapperPath(config, "app-shell"), renderShellWrapper("AppShellNav", chrome.block, plan.shellExportName, config));
406
413
  }
407
- await write(layoutPath(chrome), renderLayout(chrome, config));
414
+ let layout = renderLayout(chrome, config);
415
+ // saas/admin: compose gold-patches the shell layout with a session gate.
416
+ // A brand-new group would otherwise ship the catalog passthrough.
417
+ if (isGoldPathTemplate(appName) && chrome.group === "shell") {
418
+ const patched = goldPatchShellLayout(layout, `${config.aliases.lib}/auth`);
419
+ if (patched !== undefined)
420
+ layout = patched;
421
+ }
422
+ await write(layoutPath(chrome), layout);
408
423
  }
409
424
  /**
410
425
  * Parse the `--blocks hero,cta` / `--blocks login=split,cta` spec into block refs.
@@ -5,7 +5,7 @@ import { tmpdir } from "node:os";
5
5
  import { join } from "node:path";
6
6
  import { createInterface } from "node:readline/promises";
7
7
  import pc from "picocolors";
8
- import { goldPatchAppShellChrome, isGoldPathTemplate } from "../compose/gold-path.js";
8
+ import { goldPatchAppShellChrome, goldPatchShellLayout, goldPatchTeamPage, isGoldPathTemplate, } from "../compose/gold-path.js";
9
9
  import { buildComposePlan } from "../compose/plan.js";
10
10
  import { baseSnapshotDest, filterManifestToComposedPages, listBaseSnapshotRels, readBaseSnapshot, reloadManifest, } from "../compose/reload.js";
11
11
  import { renderPlan } from "../compose/render.js";
@@ -422,14 +422,12 @@ function statusLabel(plan) {
422
422
  }
423
423
  }
424
424
  /**
425
- * saas/admin: upgrade 3-ways app-shell-chrome against the catalog item (Mara).
426
- * After any write (or a catalog file already on disk), re-apply the gold-path
427
- * chrome identity. Idempotent; skipped when conflict markers are present.
425
+ * saas/admin: upgrade 3-ways chrome against the catalog item (Mara) and
426
+ * layout/team against the catalog compose render. After any write (or a
427
+ * catalog file already on disk), re-apply the gold-path identity. Idempotent;
428
+ * skipped when conflict markers are present.
428
429
  */
429
- async function repatchGoldPathChrome(cwd, config, composed) {
430
- if (!Object.keys(composed).some((key) => isGoldPathTemplate(key)))
431
- return;
432
- const rel = join(config.paths.blocks, "app-shell-chrome.tsx");
430
+ async function repatchGoldPathFile(cwd, rel, patch, label) {
433
431
  let dest;
434
432
  try {
435
433
  dest = resolveSafeDest(cwd, ".", rel);
@@ -442,11 +440,42 @@ async function repatchGoldPathChrome(cwd, config, composed) {
442
440
  const current = await readFile(dest, "utf8");
443
441
  if (current.includes("<<<<<<<"))
444
442
  return;
445
- const patched = goldPatchAppShellChrome(current);
443
+ const patched = patch(current);
446
444
  if (patched === undefined || patched === current)
447
445
  return;
448
446
  await writeFileEnsured(dest, patched);
449
- log.ok(`gold-path ${rel}: re-applied WorkspaceMenu / InviteMember / SessionUser`);
447
+ log.ok(`gold-path ${rel}: re-applied ${label}`);
448
+ }
449
+ function goldPathSurfaceRels(cwd, composed) {
450
+ const rels = new Set();
451
+ for (const rec of Object.values(composed)) {
452
+ for (const file of rec.files)
453
+ rels.add(file.replaceAll("\\", "/"));
454
+ }
455
+ for (const rel of [
456
+ "app/(shell)/layout.tsx",
457
+ "src/app/(shell)/layout.tsx",
458
+ "app/(shell)/team/page.tsx",
459
+ "src/app/(shell)/team/page.tsx",
460
+ ]) {
461
+ if (existsSync(join(cwd, rel)))
462
+ rels.add(rel);
463
+ }
464
+ return [...rels];
465
+ }
466
+ async function repatchGoldPathSurfaces(cwd, config, composed) {
467
+ if (!Object.keys(composed).some((key) => isGoldPathTemplate(key)))
468
+ return;
469
+ const authImport = `${config.aliases.lib}/auth`;
470
+ await repatchGoldPathFile(cwd, join(config.paths.blocks, "app-shell-chrome.tsx"), goldPatchAppShellChrome, "WorkspaceMenu / InviteMember / SessionUser");
471
+ for (const rel of goldPathSurfaceRels(cwd, composed)) {
472
+ if (/(^|\/)\(shell\)\/layout\.tsx$/.test(rel)) {
473
+ await repatchGoldPathFile(cwd, rel, (source) => goldPatchShellLayout(source, authImport), "session gate");
474
+ }
475
+ if (/(^|\/)\(shell\)\/team\/page\.tsx$/.test(rel)) {
476
+ await repatchGoldPathFile(cwd, rel, goldPatchTeamPage, "MembersPanel");
477
+ }
478
+ }
450
479
  }
451
480
  /** Statuses that write the planned content to disk unconditionally. */
452
481
  const WRITE_STATUSES = new Set(["fast-forward", "new-file", "merged"]);
@@ -800,7 +829,7 @@ export async function upgrade(names, options) {
800
829
  const newlyInstalled = await installPendingBlocks(itemPlans, config, cwd, targetVersion);
801
830
  Object.assign(installed, newlyInstalled);
802
831
  const written = await applyPlans(itemPlans, options, confirm);
803
- await repatchGoldPathChrome(cwd, config, composed);
832
+ await repatchGoldPathSurfaces(cwd, config, composed);
804
833
  await refreshComposeSnapshots(itemPlans);
805
834
  // Manifest: record every item that now fully embodies the target release.
806
835
  // Compose items update `composed{}` (never `installed{}`) and never drop
@@ -10,6 +10,16 @@ export declare function isGoldPathTemplate(name: string): boolean;
10
10
  * Idempotent. Used by add-page --nav and upgrade so neither restores Mara.
11
11
  */
12
12
  export declare function goldPatchAppShellChrome(source: string): string | undefined;
13
+ /**
14
+ * Re-apply the session gate onto a catalog shell layout.
15
+ * Idempotent. Used by add-page (new shell group) and upgrade.
16
+ */
17
+ export declare function goldPatchShellLayout(source: string, authImport?: string): string | undefined;
18
+ /**
19
+ * Re-apply MembersPanel onto a catalog /team page.
20
+ * Idempotent. Used by add-page --overwrite /team and upgrade.
21
+ */
22
+ export declare function goldPatchTeamPage(source: string, membersImport?: string): string | undefined;
13
23
  /** Production npm specs installed with the gold path (devDeps are merged into package.json). */
14
24
  export declare const GOLD_PATH_DEPENDENCIES: readonly ["drizzle-orm@^0.45.2", "better-sqlite3@^12.0.0", "better-auth@^1.7.2"];
15
25
  export interface GoldPathLayout {
@@ -11,10 +11,12 @@ export const GOLD_PATH_TEMPLATES = new Set(["saas", "admin"]);
11
11
  export function isGoldPathTemplate(name) {
12
12
  return GOLD_PATH_TEMPLATES.has(name);
13
13
  }
14
- /** Gold-path chrome identity — same strings compose writes into app-shell-chrome. */
14
+ /** Gold-path identity — same strings compose writes into the authenticated shell. */
15
15
  const GOLD_WORKSPACE_IMPORT = "@/components/workspace-menu";
16
16
  const GOLD_INVITE_IMPORT = "@/components/invite-member";
17
17
  const GOLD_SESSION_IMPORT = "@/components/session-user";
18
+ const GOLD_AUTH_IMPORT = "@/lib/auth";
19
+ const GOLD_MEMBERS_IMPORT = "@/components/members-panel";
18
20
  /**
19
21
  * Re-apply WorkspaceMenu / InviteMember / SessionUser onto catalog app-shell-chrome.
20
22
  * Idempotent. Used by add-page --nav and upgrade so neither restores Mara.
@@ -22,6 +24,20 @@ const GOLD_SESSION_IMPORT = "@/components/session-user";
22
24
  export function goldPatchAppShellChrome(source) {
23
25
  return patchChromeSource(source, GOLD_WORKSPACE_IMPORT, GOLD_INVITE_IMPORT, GOLD_SESSION_IMPORT);
24
26
  }
27
+ /**
28
+ * Re-apply the session gate onto a catalog shell layout.
29
+ * Idempotent. Used by add-page (new shell group) and upgrade.
30
+ */
31
+ export function goldPatchShellLayout(source, authImport = GOLD_AUTH_IMPORT) {
32
+ return patchShellLayoutSource(source, authImport);
33
+ }
34
+ /**
35
+ * Re-apply MembersPanel onto a catalog /team page.
36
+ * Idempotent. Used by add-page --overwrite /team and upgrade.
37
+ */
38
+ export function goldPatchTeamPage(source, membersImport = GOLD_MEMBERS_IMPORT) {
39
+ return patchTeamPageSource(source, membersImport);
40
+ }
25
41
  /** Production npm specs installed with the gold path (devDeps are merged into package.json). */
26
42
  export const GOLD_PATH_DEPENDENCIES = [
27
43
  "drizzle-orm@^0.45.2",
package/dist/config.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export declare const CONFIG_FILE = "cronus-ui.json";
2
- export declare const CLI_VERSION = "0.6.16";
3
- export declare const DEFAULT_REGISTRY = "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.6.16/registry";
2
+ export declare const CLI_VERSION = "0.6.17";
3
+ export declare const DEFAULT_REGISTRY = "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.6.17/registry";
4
4
  /** Manifest entry `add`/`upgrade` record per installed registry item. */
5
5
  export interface InstalledRecord {
6
6
  /** Registry release the files came from (git tag without the leading "v"). */
package/dist/config.js CHANGED
@@ -2,7 +2,7 @@ import { existsSync } from "node:fs";
2
2
  import { readFile, writeFile } from "node:fs/promises";
3
3
  import { join } from "node:path";
4
4
  export const CONFIG_FILE = "cronus-ui.json";
5
- export const CLI_VERSION = "0.6.16";
5
+ export const CLI_VERSION = "0.6.17";
6
6
  export const DEFAULT_REGISTRY = `https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v${CLI_VERSION}/registry`;
7
7
  export const DEFAULT_CONFIG = {
8
8
  aliases: { ui: "@/components/ui", lib: "@/lib", blocks: "@/components/blocks" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cronus-ui",
3
- "version": "0.6.16",
3
+ "version": "0.6.17",
4
4
  "description": "cronus-ui — add Cronus UI components to your project, shadcn-style (copy-paste registry).",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -54,7 +54,7 @@
54
54
  "registry:check": "bun run scripts/check-registry.ts"
55
55
  },
56
56
  "dependencies": {
57
- "@cronus-ui/ai-kit": "0.6.16",
57
+ "@cronus-ui/ai-kit": "0.6.17",
58
58
  "commander": "^15.0.0",
59
59
  "picocolors": "^1.1.1"
60
60
  },