@getcoherent/cli 0.6.33 → 0.6.35
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.
|
@@ -2217,14 +2217,41 @@ async function regenerateLayout(config, projectRoot, options = {
|
|
|
2217
2217
|
}
|
|
2218
2218
|
}
|
|
2219
2219
|
}
|
|
2220
|
+
const effectiveNavType = config.navigation?.type || "header";
|
|
2221
|
+
const isSidebar = effectiveNavType === "sidebar" || effectiveNavType === "both";
|
|
2220
2222
|
try {
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
+
if (!isSidebar) {
|
|
2224
|
+
await integrateSharedLayoutIntoRootLayout(projectRoot);
|
|
2225
|
+
await ensureAuthRouteGroup(projectRoot);
|
|
2226
|
+
} else {
|
|
2227
|
+
const { mkdir: mkdirAsync, writeFile: writeFileAsync } = await import("fs/promises");
|
|
2228
|
+
const publicLayoutPath = resolve3(projectRoot, "app", "(public)", "layout.tsx");
|
|
2229
|
+
if (!existsSync5(publicLayoutPath) || options.navChanged) {
|
|
2230
|
+
await mkdirAsync(resolve3(projectRoot, "app", "(public)"), { recursive: true });
|
|
2231
|
+
await writeFileAsync(publicLayoutPath, buildPublicLayoutCodeForSidebar(), "utf-8");
|
|
2232
|
+
}
|
|
2233
|
+
const themeTogglePath = resolve3(projectRoot, "components", "shared", "theme-toggle.tsx");
|
|
2234
|
+
if (!existsSync5(themeTogglePath)) {
|
|
2235
|
+
await mkdirAsync(resolve3(projectRoot, "components", "shared"), { recursive: true });
|
|
2236
|
+
await writeFileAsync(themeTogglePath, generateThemeToggleCode(), "utf-8");
|
|
2237
|
+
}
|
|
2238
|
+
const provider = getComponentProvider();
|
|
2239
|
+
for (const cid of ["separator", "sidebar"]) {
|
|
2240
|
+
const uiPath = resolve3(projectRoot, "components", "ui", `${cid}.tsx`);
|
|
2241
|
+
if (!existsSync5(uiPath) && provider.has(cid)) {
|
|
2242
|
+
try {
|
|
2243
|
+
await provider.installComponent(cid, projectRoot);
|
|
2244
|
+
} catch {
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2248
|
+
}
|
|
2223
2249
|
await ensureAppRouteGroupLayout(
|
|
2224
2250
|
projectRoot,
|
|
2225
2251
|
config.navigation?.type,
|
|
2226
2252
|
options.navChanged,
|
|
2227
|
-
options.groupLayouts ?? config.groupLayouts
|
|
2253
|
+
options.groupLayouts ?? config.groupLayouts,
|
|
2254
|
+
config.name
|
|
2228
2255
|
);
|
|
2229
2256
|
} catch (err) {
|
|
2230
2257
|
if (process.env.COHERENT_DEBUG === "1") {
|
|
@@ -2254,33 +2281,59 @@ async function scanAndInstallSharedDeps(projectRoot) {
|
|
|
2254
2281
|
}
|
|
2255
2282
|
return [...new Set(installed)];
|
|
2256
2283
|
}
|
|
2257
|
-
async function ensureAppRouteGroupLayout(projectRoot, navType, forceUpdate = false, groupLayouts) {
|
|
2284
|
+
async function ensureAppRouteGroupLayout(projectRoot, navType, forceUpdate = false, groupLayouts, appName) {
|
|
2258
2285
|
const effectiveNavType = groupLayouts?.["app"] || navType;
|
|
2259
2286
|
const layoutPath = resolve3(projectRoot, "app", "(app)", "layout.tsx");
|
|
2260
2287
|
if (existsSync5(layoutPath) && !forceUpdate) return;
|
|
2261
2288
|
const { mkdir: mkdirAsync } = await import("fs/promises");
|
|
2262
2289
|
await mkdirAsync(resolve3(projectRoot, "app", "(app)"), { recursive: true });
|
|
2263
|
-
const code = buildAppLayoutCode(effectiveNavType);
|
|
2290
|
+
const code = buildAppLayoutCode(effectiveNavType, appName);
|
|
2264
2291
|
await writeFile2(layoutPath, code);
|
|
2265
2292
|
}
|
|
2266
|
-
function buildAppLayoutCode(navType) {
|
|
2293
|
+
function buildAppLayoutCode(navType, appName) {
|
|
2267
2294
|
const hasSidebar = navType === "sidebar" || navType === "both";
|
|
2295
|
+
const name = appName || "My App";
|
|
2296
|
+
const year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
2268
2297
|
if (hasSidebar) {
|
|
2269
|
-
return `
|
|
2270
|
-
|
|
2298
|
+
return `'use client'
|
|
2299
|
+
|
|
2300
|
+
import { AppSidebar } from '@/components/shared/sidebar'
|
|
2301
|
+
import { SidebarProvider, SidebarInset, SidebarTrigger } from '@/components/ui/sidebar'
|
|
2302
|
+
import { Separator } from '@/components/ui/separator'
|
|
2303
|
+
import { usePathname } from 'next/navigation'
|
|
2304
|
+
import { ThemeToggle } from '@/components/shared/theme-toggle'
|
|
2305
|
+
|
|
2306
|
+
function getBreadcrumb(pathname: string): string {
|
|
2307
|
+
const segments = pathname.replace(/^\\//, '').split('/')
|
|
2308
|
+
const page = segments[0] || 'dashboard'
|
|
2309
|
+
return page.charAt(0).toUpperCase() + page.slice(1)
|
|
2310
|
+
}
|
|
2271
2311
|
|
|
2272
2312
|
export default function AppLayout({
|
|
2273
2313
|
children,
|
|
2274
2314
|
}: {
|
|
2275
2315
|
children: React.ReactNode
|
|
2276
2316
|
}) {
|
|
2317
|
+
const pathname = usePathname()
|
|
2318
|
+
|
|
2277
2319
|
return (
|
|
2278
2320
|
<SidebarProvider>
|
|
2279
2321
|
<AppSidebar />
|
|
2280
2322
|
<SidebarInset>
|
|
2281
|
-
<
|
|
2323
|
+
<header className="flex h-14 shrink-0 items-center justify-between border-b px-4">
|
|
2324
|
+
<div className="flex items-center gap-2">
|
|
2325
|
+
<SidebarTrigger className="-ml-1" />
|
|
2326
|
+
<Separator orientation="vertical" className="mr-2 h-4" />
|
|
2327
|
+
<span className="text-sm text-muted-foreground">{getBreadcrumb(pathname)}</span>
|
|
2328
|
+
</div>
|
|
2329
|
+
<ThemeToggle />
|
|
2330
|
+
</header>
|
|
2331
|
+
<main className="flex-1 px-4 py-6 lg:px-6">
|
|
2282
2332
|
{children}
|
|
2283
2333
|
</main>
|
|
2334
|
+
<footer className="border-t px-4 py-3 text-xs text-muted-foreground">
|
|
2335
|
+
\\u00A9 ${year} ${name}
|
|
2336
|
+
</footer>
|
|
2284
2337
|
</SidebarInset>
|
|
2285
2338
|
</SidebarProvider>
|
|
2286
2339
|
)
|
|
@@ -2300,28 +2353,55 @@ export default function AppLayout({
|
|
|
2300
2353
|
}
|
|
2301
2354
|
`;
|
|
2302
2355
|
}
|
|
2303
|
-
function
|
|
2304
|
-
|
|
2305
|
-
return `import { AppSidebar } from '@/components/shared/sidebar'
|
|
2306
|
-
import { SidebarProvider, SidebarInset } from '@/components/ui/sidebar'
|
|
2356
|
+
function generateThemeToggleCode() {
|
|
2357
|
+
return `'use client'
|
|
2307
2358
|
|
|
2308
|
-
|
|
2359
|
+
import { Moon, Sun } from 'lucide-react'
|
|
2360
|
+
import { Button } from '@/components/ui/button'
|
|
2361
|
+
|
|
2362
|
+
export function ThemeToggle() {
|
|
2363
|
+
const toggle = () => {
|
|
2364
|
+
document.documentElement.classList.toggle('dark')
|
|
2365
|
+
}
|
|
2366
|
+
return (
|
|
2367
|
+
<Button
|
|
2368
|
+
variant="ghost"
|
|
2369
|
+
size="icon"
|
|
2370
|
+
onClick={toggle}
|
|
2371
|
+
aria-label="Toggle theme"
|
|
2372
|
+
className="relative"
|
|
2373
|
+
>
|
|
2374
|
+
<Sun className="h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
|
|
2375
|
+
<Moon className="absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
|
|
2376
|
+
</Button>
|
|
2377
|
+
)
|
|
2378
|
+
}
|
|
2379
|
+
`;
|
|
2380
|
+
}
|
|
2381
|
+
function buildPublicLayoutCodeForSidebar() {
|
|
2382
|
+
return `import { Header } from '@/components/shared/header'
|
|
2383
|
+
import { Footer } from '@/components/shared/footer'
|
|
2384
|
+
|
|
2385
|
+
export default function PublicLayout({
|
|
2309
2386
|
children,
|
|
2310
2387
|
}: {
|
|
2311
2388
|
children: React.ReactNode
|
|
2312
2389
|
}) {
|
|
2313
2390
|
return (
|
|
2314
|
-
|
|
2315
|
-
<
|
|
2316
|
-
<
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
</SidebarProvider>
|
|
2391
|
+
<>
|
|
2392
|
+
<Header />
|
|
2393
|
+
<main className="mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8 py-6">
|
|
2394
|
+
{children}
|
|
2395
|
+
</main>
|
|
2396
|
+
<Footer />
|
|
2397
|
+
</>
|
|
2322
2398
|
)
|
|
2323
2399
|
}
|
|
2324
2400
|
`;
|
|
2401
|
+
}
|
|
2402
|
+
function buildGroupLayoutCode(layout, _pages, appName) {
|
|
2403
|
+
if (layout === "sidebar" || layout === "both") {
|
|
2404
|
+
return buildAppLayoutCode("sidebar", appName);
|
|
2325
2405
|
}
|
|
2326
2406
|
if (layout === "none") {
|
|
2327
2407
|
return `export default function GroupLayout({
|
|
@@ -2366,7 +2446,9 @@ async function ensurePlanGroupLayouts(projectRoot, plan, storedHashes = {}, conf
|
|
|
2366
2446
|
continue;
|
|
2367
2447
|
}
|
|
2368
2448
|
}
|
|
2369
|
-
const
|
|
2449
|
+
const planHasSidebar = plan.groups.some((g) => g.layout === "sidebar" || g.layout === "both");
|
|
2450
|
+
const isPublicWithSidebar = planHasSidebar && group.id === "public" && (group.layout === "header" || !group.layout);
|
|
2451
|
+
const code = isPublicWithSidebar ? buildPublicLayoutCodeForSidebar() : buildGroupLayoutCode(group.layout, group.pages, config?.name);
|
|
2370
2452
|
await writeFile2(layoutPath, code);
|
|
2371
2453
|
}
|
|
2372
2454
|
if (config) {
|
|
@@ -2458,6 +2540,8 @@ export {
|
|
|
2458
2540
|
scanAndInstallSharedDeps,
|
|
2459
2541
|
ensureAppRouteGroupLayout,
|
|
2460
2542
|
buildAppLayoutCode,
|
|
2543
|
+
generateThemeToggleCode,
|
|
2544
|
+
buildPublicLayoutCodeForSidebar,
|
|
2461
2545
|
buildGroupLayoutCode,
|
|
2462
2546
|
ensurePlanGroupLayouts,
|
|
2463
2547
|
regenerateFiles
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildAppLayoutCode,
|
|
3
3
|
buildGroupLayoutCode,
|
|
4
|
+
buildPublicLayoutCodeForSidebar,
|
|
4
5
|
ensureAppRouteGroupLayout,
|
|
5
6
|
ensureComponentsInstalled,
|
|
6
7
|
ensurePlanGroupLayouts,
|
|
8
|
+
generateThemeToggleCode,
|
|
7
9
|
regenerateComponent,
|
|
8
10
|
regenerateFiles,
|
|
9
11
|
regenerateLayout,
|
|
10
12
|
regeneratePage,
|
|
11
13
|
scanAndInstallSharedDeps,
|
|
12
14
|
validateAndFixGeneratedCode
|
|
13
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-UBTRGU7W.js";
|
|
14
16
|
import "./chunk-QT5MRW4F.js";
|
|
15
17
|
import "./chunk-5AHG4NNX.js";
|
|
16
18
|
import "./chunk-4A4YYAGN.js";
|
|
@@ -18,9 +20,11 @@ import "./chunk-3RG5ZIWI.js";
|
|
|
18
20
|
export {
|
|
19
21
|
buildAppLayoutCode,
|
|
20
22
|
buildGroupLayoutCode,
|
|
23
|
+
buildPublicLayoutCodeForSidebar,
|
|
21
24
|
ensureAppRouteGroupLayout,
|
|
22
25
|
ensureComponentsInstalled,
|
|
23
26
|
ensurePlanGroupLayouts,
|
|
27
|
+
generateThemeToggleCode,
|
|
24
28
|
regenerateComponent,
|
|
25
29
|
regenerateFiles,
|
|
26
30
|
regenerateLayout,
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
warnIfVolatile,
|
|
39
39
|
warnInlineDuplicates,
|
|
40
40
|
writeFile
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-UBTRGU7W.js";
|
|
42
42
|
import {
|
|
43
43
|
COHERENT_REQUIRED_PACKAGES,
|
|
44
44
|
ensureUseClientIfNeeded,
|
|
@@ -2366,6 +2366,8 @@ For editing an existing shared component use type "modify-layout-block" with tar
|
|
|
2366
2366
|
const visualDepth = VISUAL_DEPTH;
|
|
2367
2367
|
const contextualRules = selectContextualRules(message);
|
|
2368
2368
|
const interactionPatterns = INTERACTION_PATTERNS;
|
|
2369
|
+
const light = config2.tokens.colors.light;
|
|
2370
|
+
const dark = config2.tokens.colors.dark;
|
|
2369
2371
|
return `You are a design-forward UI architect. Your goal is to create interfaces that are not just functional, but visually distinctive and memorable \u2014 while staying within shadcn/ui and Tailwind CSS.
|
|
2370
2372
|
|
|
2371
2373
|
Parse the user's natural language request into structured modification requests.
|
|
@@ -2383,6 +2385,16 @@ Current Design System:
|
|
|
2383
2385
|
- Pages: ${config2.pages.map((p) => `${p.name} (${p.route})`).join(", ")}
|
|
2384
2386
|
- Components: ${config2.components.length} components
|
|
2385
2387
|
|
|
2388
|
+
Current color tokens (#RRGGBB hex):
|
|
2389
|
+
Light theme:
|
|
2390
|
+
Brand: primary=${light.primary}, secondary=${light.secondary}, accent=${light.accent || "none"}
|
|
2391
|
+
Status: success=${light.success}, warning=${light.warning}, error=${light.error}, info=${light.info}
|
|
2392
|
+
Surface: background=${light.background}, foreground=${light.foreground}, muted=${light.muted}, border=${light.border}
|
|
2393
|
+
Dark theme:
|
|
2394
|
+
Brand: primary=${dark.primary}, secondary=${dark.secondary}, accent=${dark.accent || "none"}
|
|
2395
|
+
Status: success=${dark.success}, warning=${dark.warning}, error=${dark.error}, info=${dark.info}
|
|
2396
|
+
Surface: background=${dark.background}, foreground=${dark.foreground}, muted=${dark.muted}, border=${dark.border}
|
|
2397
|
+
|
|
2386
2398
|
EXISTING ROUTES IN THIS PROJECT:
|
|
2387
2399
|
${config2.pages.map((p) => p.route).join(", ") || "(no pages yet)"}
|
|
2388
2400
|
|
|
@@ -2414,7 +2426,7 @@ Parse this into one or more ModificationRequest objects. Each request should be:
|
|
|
2414
2426
|
5. For add-component with source "shadcn": include id, name, category, source: "shadcn", shadcnComponent, baseClassName (or omit for default), variants: [], sizes: [], usedInPages: [], createdAt, updatedAt
|
|
2415
2427
|
|
|
2416
2428
|
Available modification types:
|
|
2417
|
-
- "update-token": Change design token (e.g
|
|
2429
|
+
- "update-token": Change design token. target: dot-path (e.g. "colors.light.primary"). changes: { "value": "#RRGGBB" }. Color values MUST be 6-digit hex with # prefix (e.g. #4F46E5 for indigo, #DC2626 for red). When changing a color, ALWAYS update BOTH light and dark themes for consistency.
|
|
2418
2430
|
- "add-component": Add new component (check registry first for reuse!)
|
|
2419
2431
|
- "modify-component": Update existing component
|
|
2420
2432
|
- "modify-layout-block": Edit a shared layout component by ID or name (target: "CID-001" or "Header"). changes: { "instruction": "user instruction e.g. add a search button" }. Use when user says "in CID-001 add...", "update the header...", "change the footer...".
|
|
@@ -2986,6 +2998,7 @@ function fixGlobalsCss(projectRoot, config2) {
|
|
|
2986
2998
|
}
|
|
2987
2999
|
|
|
2988
3000
|
// src/commands/chat/request-parser.ts
|
|
3001
|
+
import { colorToHex } from "@getcoherent/core";
|
|
2989
3002
|
var AUTH_FLOW_PATTERNS = {
|
|
2990
3003
|
"/login": ["/signup", "/forgot-password"],
|
|
2991
3004
|
"/signin": ["/signup", "/forgot-password"],
|
|
@@ -3289,6 +3302,18 @@ function normalizeRequest(request, config2) {
|
|
|
3289
3302
|
}
|
|
3290
3303
|
break;
|
|
3291
3304
|
}
|
|
3305
|
+
case "update-token": {
|
|
3306
|
+
if (changes?.value && typeof changes.value === "string") {
|
|
3307
|
+
const isColorPath = request.target.includes("colors.");
|
|
3308
|
+
if (isColorPath) {
|
|
3309
|
+
const hex = colorToHex(changes.value);
|
|
3310
|
+
if (hex && hex !== changes.value) {
|
|
3311
|
+
return { ...request, changes: { ...changes, value: hex } };
|
|
3312
|
+
}
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
break;
|
|
3316
|
+
}
|
|
3292
3317
|
}
|
|
3293
3318
|
return request;
|
|
3294
3319
|
}
|
|
@@ -5701,9 +5726,10 @@ function getDefaultContent(pageType, pageName) {
|
|
|
5701
5726
|
}
|
|
5702
5727
|
|
|
5703
5728
|
// src/utils/nav-snapshot.ts
|
|
5704
|
-
function takeNavSnapshot(items) {
|
|
5705
|
-
|
|
5706
|
-
|
|
5729
|
+
function takeNavSnapshot(items, navType) {
|
|
5730
|
+
const prefix = navType ? `type:${navType}|` : "";
|
|
5731
|
+
if (!items || items.length === 0) return `${prefix}[]`;
|
|
5732
|
+
return `${prefix}${JSON.stringify(items.map((i) => `${i.label}:${i.href}`).sort())}`;
|
|
5707
5733
|
}
|
|
5708
5734
|
function hasNavChanged(before, after) {
|
|
5709
5735
|
return before !== after;
|
|
@@ -6414,7 +6440,8 @@ Return JSON: { "requests": [{ "type": "add-page", "changes": { "name": "${compon
|
|
|
6414
6440
|
} catch {
|
|
6415
6441
|
}
|
|
6416
6442
|
const navBefore = takeNavSnapshot(
|
|
6417
|
-
config2.navigation?.items?.map((i) => ({ label: i.label, href: i.route || `/${i.label.toLowerCase()}` }))
|
|
6443
|
+
config2.navigation?.items?.map((i) => ({ label: i.label, href: i.route || `/${i.label.toLowerCase()}` })),
|
|
6444
|
+
config2.navigation?.type
|
|
6418
6445
|
);
|
|
6419
6446
|
spinner.start("Applying modifications...");
|
|
6420
6447
|
const results = [];
|
|
@@ -6649,7 +6676,8 @@ Return JSON: { "requests": [{ "type": "add-page", "changes": { "name": "${compon
|
|
|
6649
6676
|
updatedConfig.navigation?.items?.map((i) => ({
|
|
6650
6677
|
label: i.label,
|
|
6651
6678
|
href: i.route || `/${i.label.toLowerCase()}`
|
|
6652
|
-
}))
|
|
6679
|
+
})),
|
|
6680
|
+
updatedConfig.navigation?.type
|
|
6653
6681
|
);
|
|
6654
6682
|
const navChanged = hasNavChanged(navBefore, navAfter);
|
|
6655
6683
|
if (allModified.size > 0) {
|
|
@@ -8036,6 +8064,14 @@ async function stripCoherentArtifacts(outputDir) {
|
|
|
8036
8064
|
header = header.replace(/\n\s*<\/>\s*\n/, "\n");
|
|
8037
8065
|
await writeFile3(sharedHeaderPath, header, "utf-8");
|
|
8038
8066
|
}
|
|
8067
|
+
if (existsSync15(layoutPath)) {
|
|
8068
|
+
let rootLayout = await readFile3(layoutPath, "utf-8");
|
|
8069
|
+
const before = rootLayout;
|
|
8070
|
+
rootLayout = rootLayout.replace(/<Link\s[^>]*href="\/design-system"[^>]*>[\s\S]*?<\/Link>/g, "");
|
|
8071
|
+
if (rootLayout !== before) {
|
|
8072
|
+
await writeFile3(layoutPath, rootLayout, "utf-8");
|
|
8073
|
+
}
|
|
8074
|
+
}
|
|
8039
8075
|
const guardPath2 = join10(outputDir, "app", "ShowWhenNotAuthRoute.tsx");
|
|
8040
8076
|
if (existsSync15(guardPath2)) {
|
|
8041
8077
|
let guard = await readFile3(guardPath2, "utf-8");
|
|
@@ -8444,10 +8480,14 @@ async function fixCommand(opts = {}) {
|
|
|
8444
8480
|
}
|
|
8445
8481
|
try {
|
|
8446
8482
|
const { loadPlan: loadPlan2 } = await import("./plan-generator-625ZNUZF.js");
|
|
8447
|
-
const { ensurePlanGroupLayouts: ensurePlanGroupLayouts2 } = await import("./code-generator-
|
|
8483
|
+
const { ensurePlanGroupLayouts: ensurePlanGroupLayouts2 } = await import("./code-generator-U2N646D4.js");
|
|
8448
8484
|
const plan = loadPlan2(projectRoot);
|
|
8449
8485
|
if (plan) {
|
|
8450
|
-
|
|
8486
|
+
if (!dsm) {
|
|
8487
|
+
dsm = new DesignSystemManager9(project.configPath);
|
|
8488
|
+
await dsm.load();
|
|
8489
|
+
}
|
|
8490
|
+
await ensurePlanGroupLayouts2(projectRoot, plan, {}, dsm.getConfig());
|
|
8451
8491
|
const layoutTypes = plan.groups.map((g) => `${g.id}:${g.layout}`).join(", ");
|
|
8452
8492
|
fixes.push(`Verified group layouts (${layoutTypes})`);
|
|
8453
8493
|
console.log(chalk15.green(` \u2714 Verified group layouts: ${layoutTypes}`));
|
|
@@ -8466,6 +8506,41 @@ async function fixCommand(opts = {}) {
|
|
|
8466
8506
|
fixes.push("Generated AppSidebar component (components/shared/sidebar.tsx)");
|
|
8467
8507
|
console.log(chalk15.green(" \u2714 Generated AppSidebar component"));
|
|
8468
8508
|
}
|
|
8509
|
+
if (hasSidebar && !dryRun) {
|
|
8510
|
+
const rootLayoutPath = resolve10(projectRoot, "app", "layout.tsx");
|
|
8511
|
+
if (existsSync16(rootLayoutPath)) {
|
|
8512
|
+
let rootCode = readFileSync12(rootLayoutPath, "utf-8");
|
|
8513
|
+
if (rootCode.includes("<Header")) {
|
|
8514
|
+
rootCode = rootCode.replace(/import\s*\{[^}]*Header[^}]*\}[^;\n]*[;\n]?\s*/g, "").replace(/import\s*\{[^}]*Footer[^}]*\}[^;\n]*[;\n]?\s*/g, "").replace(/import\s+ShowWhenNotAuthRoute[^;\n]*[;\n]?\s*/g, "").replace(/<ShowWhenNotAuthRoute>[\s\S]*?<\/ShowWhenNotAuthRoute>/g, (match) => {
|
|
8515
|
+
const inner = match.replace(/<\/?ShowWhenNotAuthRoute>/g, "").trim();
|
|
8516
|
+
return inner;
|
|
8517
|
+
}).replace(/\s*<Header\s*\/>\s*/g, "\n").replace(/\s*<Footer\s*\/>\s*/g, "\n");
|
|
8518
|
+
rootCode = rootCode.replace(/min-h-screen flex flex-col/g, "min-h-svh");
|
|
8519
|
+
rootCode = rootCode.replace(/"flex-1 flex flex-col"/g, '"flex-1"');
|
|
8520
|
+
writeFileSync10(rootLayoutPath, rootCode, "utf-8");
|
|
8521
|
+
fixes.push("Stripped Header/Footer from root layout (sidebar mode)");
|
|
8522
|
+
console.log(chalk15.green(" \u2714 Stripped Header/Footer from root layout (sidebar mode)"));
|
|
8523
|
+
}
|
|
8524
|
+
}
|
|
8525
|
+
const publicLayoutPath = resolve10(projectRoot, "app", "(public)", "layout.tsx");
|
|
8526
|
+
const publicExists = existsSync16(publicLayoutPath);
|
|
8527
|
+
const needsPublicLayout = !publicExists || !readFileSync12(publicLayoutPath, "utf-8").includes("<Header");
|
|
8528
|
+
if (needsPublicLayout) {
|
|
8529
|
+
const { buildPublicLayoutCodeForSidebar } = await import("./code-generator-U2N646D4.js");
|
|
8530
|
+
mkdirSync7(resolve10(projectRoot, "app", "(public)"), { recursive: true });
|
|
8531
|
+
writeFileSync10(publicLayoutPath, buildPublicLayoutCodeForSidebar(), "utf-8");
|
|
8532
|
+
fixes.push("Added Header/Footer to (public) layout");
|
|
8533
|
+
console.log(chalk15.green(" \u2714 Added Header/Footer to (public) layout"));
|
|
8534
|
+
}
|
|
8535
|
+
const themeTogglePath = resolve10(projectRoot, "components", "shared", "theme-toggle.tsx");
|
|
8536
|
+
if (!existsSync16(themeTogglePath)) {
|
|
8537
|
+
const { generateThemeToggleCode } = await import("./code-generator-U2N646D4.js");
|
|
8538
|
+
mkdirSync7(resolve10(projectRoot, "components", "shared"), { recursive: true });
|
|
8539
|
+
writeFileSync10(themeTogglePath, generateThemeToggleCode(), "utf-8");
|
|
8540
|
+
fixes.push("Generated ThemeToggle component (components/shared/theme-toggle.tsx)");
|
|
8541
|
+
console.log(chalk15.green(" \u2714 Generated ThemeToggle component"));
|
|
8542
|
+
}
|
|
8543
|
+
}
|
|
8469
8544
|
}
|
|
8470
8545
|
} catch {
|
|
8471
8546
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.6.
|
|
6
|
+
"version": "0.6.35",
|
|
7
7
|
"description": "CLI interface for Coherent Design Method",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "./dist/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"ora": "^7.0.1",
|
|
44
44
|
"prompts": "^2.4.2",
|
|
45
45
|
"zod": "^3.22.4",
|
|
46
|
-
"@getcoherent/core": "0.6.
|
|
46
|
+
"@getcoherent/core": "0.6.35"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^20.11.0",
|