@getcoherent/cli 0.6.32 → 0.6.34
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/{chunk-NP2CGABX.js → chunk-4A4YYAGN.js} +5 -0
- package/dist/{chunk-NK4G2DES.js → chunk-QT5MRW4F.js} +1 -1
- package/dist/{chunk-KUCRJLLU.js → chunk-UBTRGU7W.js} +109 -25
- package/dist/{code-generator-GAUWEX3G.js → code-generator-U2N646D4.js} +7 -3
- package/dist/index.js +58 -12
- package/dist/{plan-generator-HQAAV5S4.js → plan-generator-625ZNUZF.js} +2 -2
- package/dist/{quality-validator-EC2QSVEM.js → quality-validator-ONJCQ325.js} +1 -1
- package/package.json +2 -2
|
@@ -715,6 +715,11 @@ async function autoFixCode(code, context) {
|
|
|
715
715
|
if (fixed !== beforeEntityFix) {
|
|
716
716
|
fixes.push("Fixed syntax issues");
|
|
717
717
|
}
|
|
718
|
+
const beforeTemplateFix = fixed;
|
|
719
|
+
fixed = fixed.replace(/`\)>/g, "`}>");
|
|
720
|
+
if (fixed !== beforeTemplateFix) {
|
|
721
|
+
fixes.push("Fixed syntax issues");
|
|
722
|
+
}
|
|
718
723
|
const isJsExpr = (text) => /[().;=&|!?]/.test(text);
|
|
719
724
|
const beforeLtFix = fixed;
|
|
720
725
|
fixed = fixed.replace(/>([^<{}\n]*)<(\d)/g, (m, text, d) => isJsExpr(text) ? m : `>${text}<${d}`);
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getPageGroup,
|
|
7
7
|
installPackages,
|
|
8
8
|
sanitizeMetadataStrings
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-QT5MRW4F.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/chat/code-generator.ts
|
|
12
12
|
import { resolve as resolve3 } from "path";
|
|
@@ -2149,7 +2149,7 @@ async function regeneratePage(pageId, config, projectRoot) {
|
|
|
2149
2149
|
const code = await generator.generate(page, appType);
|
|
2150
2150
|
const route = page.route || "/";
|
|
2151
2151
|
const isAuth = isAuthRoute(route) || isAuthRoute(page.name || page.id || "");
|
|
2152
|
-
const { loadPlan: loadPlanForPath } = await import("./plan-generator-
|
|
2152
|
+
const { loadPlan: loadPlanForPath } = await import("./plan-generator-625ZNUZF.js");
|
|
2153
2153
|
const planForPath = loadPlanForPath(projectRoot);
|
|
2154
2154
|
const filePath = routeToFsPath(projectRoot, route, planForPath || isAuth);
|
|
2155
2155
|
await mkdir3(dirname3(filePath), { recursive: true });
|
|
@@ -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,26 +1,30 @@
|
|
|
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-
|
|
14
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-UBTRGU7W.js";
|
|
16
|
+
import "./chunk-QT5MRW4F.js";
|
|
15
17
|
import "./chunk-5AHG4NNX.js";
|
|
16
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-4A4YYAGN.js";
|
|
17
19
|
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,
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
sanitizeMetadataStrings,
|
|
57
57
|
savePlan,
|
|
58
58
|
updateArchitecturePlan
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-QT5MRW4F.js";
|
|
60
60
|
import {
|
|
61
61
|
CORE_CONSTRAINTS,
|
|
62
62
|
DESIGN_QUALITY,
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
formatIssues,
|
|
75
75
|
validatePageQuality,
|
|
76
76
|
verifyIncrementalEdit
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-4A4YYAGN.js";
|
|
78
78
|
import {
|
|
79
79
|
__require
|
|
80
80
|
} from "./chunk-3RG5ZIWI.js";
|
|
@@ -4109,7 +4109,7 @@ async function splitGeneratePages(spinner, message, modCtx, provider, parseOpts)
|
|
|
4109
4109
|
if (plan && plan.sharedComponents.length > 0) {
|
|
4110
4110
|
spinner.start(`Phase 4.5/6 \u2014 Generating ${plan.sharedComponents.length} shared components from plan...`);
|
|
4111
4111
|
try {
|
|
4112
|
-
const { generateSharedComponentsFromPlan } = await import("./plan-generator-
|
|
4112
|
+
const { generateSharedComponentsFromPlan } = await import("./plan-generator-625ZNUZF.js");
|
|
4113
4113
|
const generated = await generateSharedComponentsFromPlan(
|
|
4114
4114
|
plan,
|
|
4115
4115
|
styleContext,
|
|
@@ -5701,9 +5701,10 @@ function getDefaultContent(pageType, pageName) {
|
|
|
5701
5701
|
}
|
|
5702
5702
|
|
|
5703
5703
|
// src/utils/nav-snapshot.ts
|
|
5704
|
-
function takeNavSnapshot(items) {
|
|
5705
|
-
|
|
5706
|
-
|
|
5704
|
+
function takeNavSnapshot(items, navType) {
|
|
5705
|
+
const prefix = navType ? `type:${navType}|` : "";
|
|
5706
|
+
if (!items || items.length === 0) return `${prefix}[]`;
|
|
5707
|
+
return `${prefix}${JSON.stringify(items.map((i) => `${i.label}:${i.href}`).sort())}`;
|
|
5707
5708
|
}
|
|
5708
5709
|
function hasNavChanged(before, after) {
|
|
5709
5710
|
return before !== after;
|
|
@@ -5967,7 +5968,7 @@ async function chatCommand(message, options) {
|
|
|
5967
5968
|
spinner.start(`Creating shared component: ${componentName}...`);
|
|
5968
5969
|
const { createAIProvider: createAIProvider2 } = await import("./ai-provider-CGSIYFZT.js");
|
|
5969
5970
|
const { generateSharedComponent: generateSharedComponent6 } = await import("@getcoherent/core");
|
|
5970
|
-
const { autoFixCode: autoFixCode2 } = await import("./quality-validator-
|
|
5971
|
+
const { autoFixCode: autoFixCode2 } = await import("./quality-validator-ONJCQ325.js");
|
|
5971
5972
|
const { extractPropsInterface, extractDependencies } = await import("./component-extractor-VYJLT5NR.js");
|
|
5972
5973
|
const aiProvider = await createAIProvider2(provider ?? "auto");
|
|
5973
5974
|
const prompt = `Generate a React component called "${componentName}". Description: ${message}.
|
|
@@ -6414,7 +6415,8 @@ Return JSON: { "requests": [{ "type": "add-page", "changes": { "name": "${compon
|
|
|
6414
6415
|
} catch {
|
|
6415
6416
|
}
|
|
6416
6417
|
const navBefore = takeNavSnapshot(
|
|
6417
|
-
config2.navigation?.items?.map((i) => ({ label: i.label, href: i.route || `/${i.label.toLowerCase()}` }))
|
|
6418
|
+
config2.navigation?.items?.map((i) => ({ label: i.label, href: i.route || `/${i.label.toLowerCase()}` })),
|
|
6419
|
+
config2.navigation?.type
|
|
6418
6420
|
);
|
|
6419
6421
|
spinner.start("Applying modifications...");
|
|
6420
6422
|
const results = [];
|
|
@@ -6649,7 +6651,8 @@ Return JSON: { "requests": [{ "type": "add-page", "changes": { "name": "${compon
|
|
|
6649
6651
|
updatedConfig.navigation?.items?.map((i) => ({
|
|
6650
6652
|
label: i.label,
|
|
6651
6653
|
href: i.route || `/${i.label.toLowerCase()}`
|
|
6652
|
-
}))
|
|
6654
|
+
})),
|
|
6655
|
+
updatedConfig.navigation?.type
|
|
6653
6656
|
);
|
|
6654
6657
|
const navChanged = hasNavChanged(navBefore, navAfter);
|
|
6655
6658
|
if (allModified.size > 0) {
|
|
@@ -8036,6 +8039,14 @@ async function stripCoherentArtifacts(outputDir) {
|
|
|
8036
8039
|
header = header.replace(/\n\s*<\/>\s*\n/, "\n");
|
|
8037
8040
|
await writeFile3(sharedHeaderPath, header, "utf-8");
|
|
8038
8041
|
}
|
|
8042
|
+
if (existsSync15(layoutPath)) {
|
|
8043
|
+
let rootLayout = await readFile3(layoutPath, "utf-8");
|
|
8044
|
+
const before = rootLayout;
|
|
8045
|
+
rootLayout = rootLayout.replace(/<Link\s[^>]*href="\/design-system"[^>]*>[\s\S]*?<\/Link>/g, "");
|
|
8046
|
+
if (rootLayout !== before) {
|
|
8047
|
+
await writeFile3(layoutPath, rootLayout, "utf-8");
|
|
8048
|
+
}
|
|
8049
|
+
}
|
|
8039
8050
|
const guardPath2 = join10(outputDir, "app", "ShowWhenNotAuthRoute.tsx");
|
|
8040
8051
|
if (existsSync15(guardPath2)) {
|
|
8041
8052
|
let guard = await readFile3(guardPath2, "utf-8");
|
|
@@ -8443,8 +8454,8 @@ async function fixCommand(opts = {}) {
|
|
|
8443
8454
|
console.log(chalk15.green(` \u2714 ${verb} syntax: ${syntaxFixed} file(s) (use client, metadata, quotes)`));
|
|
8444
8455
|
}
|
|
8445
8456
|
try {
|
|
8446
|
-
const { loadPlan: loadPlan2 } = await import("./plan-generator-
|
|
8447
|
-
const { ensurePlanGroupLayouts: ensurePlanGroupLayouts2 } = await import("./code-generator-
|
|
8457
|
+
const { loadPlan: loadPlan2 } = await import("./plan-generator-625ZNUZF.js");
|
|
8458
|
+
const { ensurePlanGroupLayouts: ensurePlanGroupLayouts2 } = await import("./code-generator-U2N646D4.js");
|
|
8448
8459
|
const plan = loadPlan2(projectRoot);
|
|
8449
8460
|
if (plan) {
|
|
8450
8461
|
await ensurePlanGroupLayouts2(projectRoot, plan);
|
|
@@ -8466,6 +8477,41 @@ async function fixCommand(opts = {}) {
|
|
|
8466
8477
|
fixes.push("Generated AppSidebar component (components/shared/sidebar.tsx)");
|
|
8467
8478
|
console.log(chalk15.green(" \u2714 Generated AppSidebar component"));
|
|
8468
8479
|
}
|
|
8480
|
+
if (hasSidebar && !dryRun) {
|
|
8481
|
+
const rootLayoutPath = resolve10(projectRoot, "app", "layout.tsx");
|
|
8482
|
+
if (existsSync16(rootLayoutPath)) {
|
|
8483
|
+
let rootCode = readFileSync12(rootLayoutPath, "utf-8");
|
|
8484
|
+
if (rootCode.includes("<Header")) {
|
|
8485
|
+
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) => {
|
|
8486
|
+
const inner = match.replace(/<\/?ShowWhenNotAuthRoute>/g, "").trim();
|
|
8487
|
+
return inner;
|
|
8488
|
+
}).replace(/\s*<Header\s*\/>\s*/g, "\n").replace(/\s*<Footer\s*\/>\s*/g, "\n");
|
|
8489
|
+
rootCode = rootCode.replace(/min-h-screen flex flex-col/g, "min-h-svh");
|
|
8490
|
+
rootCode = rootCode.replace(/"flex-1 flex flex-col"/g, '"flex-1"');
|
|
8491
|
+
writeFileSync10(rootLayoutPath, rootCode, "utf-8");
|
|
8492
|
+
fixes.push("Stripped Header/Footer from root layout (sidebar mode)");
|
|
8493
|
+
console.log(chalk15.green(" \u2714 Stripped Header/Footer from root layout (sidebar mode)"));
|
|
8494
|
+
}
|
|
8495
|
+
}
|
|
8496
|
+
const publicLayoutPath = resolve10(projectRoot, "app", "(public)", "layout.tsx");
|
|
8497
|
+
const publicExists = existsSync16(publicLayoutPath);
|
|
8498
|
+
const needsPublicLayout = !publicExists || !readFileSync12(publicLayoutPath, "utf-8").includes("<Header");
|
|
8499
|
+
if (needsPublicLayout) {
|
|
8500
|
+
const { buildPublicLayoutCodeForSidebar } = await import("./code-generator-U2N646D4.js");
|
|
8501
|
+
mkdirSync7(resolve10(projectRoot, "app", "(public)"), { recursive: true });
|
|
8502
|
+
writeFileSync10(publicLayoutPath, buildPublicLayoutCodeForSidebar(), "utf-8");
|
|
8503
|
+
fixes.push("Added Header/Footer to (public) layout");
|
|
8504
|
+
console.log(chalk15.green(" \u2714 Added Header/Footer to (public) layout"));
|
|
8505
|
+
}
|
|
8506
|
+
const themeTogglePath = resolve10(projectRoot, "components", "shared", "theme-toggle.tsx");
|
|
8507
|
+
if (!existsSync16(themeTogglePath)) {
|
|
8508
|
+
const { generateThemeToggleCode } = await import("./code-generator-U2N646D4.js");
|
|
8509
|
+
mkdirSync7(resolve10(projectRoot, "components", "shared"), { recursive: true });
|
|
8510
|
+
writeFileSync10(themeTogglePath, generateThemeToggleCode(), "utf-8");
|
|
8511
|
+
fixes.push("Generated ThemeToggle component (components/shared/theme-toggle.tsx)");
|
|
8512
|
+
console.log(chalk15.green(" \u2714 Generated ThemeToggle component"));
|
|
8513
|
+
}
|
|
8514
|
+
}
|
|
8469
8515
|
}
|
|
8470
8516
|
} catch {
|
|
8471
8517
|
}
|
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
routeToKey,
|
|
12
12
|
savePlan,
|
|
13
13
|
updateArchitecturePlan
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-QT5MRW4F.js";
|
|
15
15
|
import "./chunk-5AHG4NNX.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-4A4YYAGN.js";
|
|
17
17
|
import "./chunk-3RG5ZIWI.js";
|
|
18
18
|
export {
|
|
19
19
|
ArchitecturePlanSchema,
|
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.34",
|
|
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.34"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^20.11.0",
|