@getcoherent/cli 0.6.56 → 0.6.57
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-IFJK5OPI.js → chunk-BNHIEEXH.js} +1 -1
- package/dist/{chunk-NLL3SHN3.js → chunk-PVVL26FX.js} +4 -3
- package/dist/{chunk-UZGT5APM.js → chunk-XBX4WND7.js} +2 -2
- package/dist/{code-generator-IZ6XM6WG.js → code-generator-SKXX6PQG.js} +3 -3
- package/dist/{design-constraints-PFZDW2XW.js → design-constraints-PFCUSBMG.js} +1 -1
- package/dist/index.js +33 -19
- package/dist/{plan-generator-D2UBTVCN.js → plan-generator-A3YN473Q.js} +2 -2
- package/package.json +1 -1
|
@@ -1007,17 +1007,18 @@ var CONTEXTUAL_CATEGORIES = [
|
|
|
1007
1007
|
rules: RULES_SHADCN_APIS
|
|
1008
1008
|
}
|
|
1009
1009
|
];
|
|
1010
|
-
function selectContextualRules(message) {
|
|
1010
|
+
function selectContextualRules(message, pageSections) {
|
|
1011
1011
|
const matched = /* @__PURE__ */ new Set();
|
|
1012
|
+
const matchTarget = pageSections && pageSections.length > 0 ? pageSections.join(" ") : message;
|
|
1012
1013
|
for (const category of CONTEXTUAL_CATEGORIES) {
|
|
1013
|
-
if (category.keywords.test(
|
|
1014
|
+
if (category.keywords.test(matchTarget)) {
|
|
1014
1015
|
matched.add(category.rules);
|
|
1015
1016
|
}
|
|
1016
1017
|
}
|
|
1017
1018
|
if (matched.size === 0) {
|
|
1018
1019
|
return "";
|
|
1019
1020
|
}
|
|
1020
|
-
return [...matched].join("\n");
|
|
1021
|
+
return [...matched].slice(0, 3).join("\n");
|
|
1021
1022
|
}
|
|
1022
1023
|
var DESIGN_CONSTRAINTS = `${DESIGN_THINKING}
|
|
1023
1024
|
${CORE_CONSTRAINTS}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getPageGroup,
|
|
7
7
|
installPackages,
|
|
8
8
|
sanitizeMetadataStrings
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BNHIEEXH.js";
|
|
10
10
|
import {
|
|
11
11
|
toKebabCase
|
|
12
12
|
} from "./chunk-4TLYDTT3.js";
|
|
@@ -2147,7 +2147,7 @@ async function regeneratePage(pageId, config, projectRoot) {
|
|
|
2147
2147
|
const code = await generator.generate(page, appType);
|
|
2148
2148
|
const route = page.route || "/";
|
|
2149
2149
|
const isAuth = isAuthRoute(route) || isAuthRoute(page.name || page.id || "");
|
|
2150
|
-
const { loadPlan: loadPlanForPath } = await import("./plan-generator-
|
|
2150
|
+
const { loadPlan: loadPlanForPath } = await import("./plan-generator-A3YN473Q.js");
|
|
2151
2151
|
const planForPath = loadPlanForPath(projectRoot);
|
|
2152
2152
|
const filePath = routeToFsPath(projectRoot, route, planForPath || isAuth);
|
|
2153
2153
|
await mkdir3(dirname3(filePath), { recursive: true });
|
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
regeneratePage,
|
|
13
13
|
scanAndInstallSharedDeps,
|
|
14
14
|
validateAndFixGeneratedCode
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-XBX4WND7.js";
|
|
16
|
+
import "./chunk-BNHIEEXH.js";
|
|
17
17
|
import "./chunk-4TLYDTT3.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-PVVL26FX.js";
|
|
19
19
|
import "./chunk-U5SNPHVU.js";
|
|
20
20
|
import "./chunk-3RG5ZIWI.js";
|
|
21
21
|
export {
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
warnIfVolatile,
|
|
35
35
|
warnInlineDuplicates,
|
|
36
36
|
writeFile
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-XBX4WND7.js";
|
|
38
38
|
import {
|
|
39
39
|
COHERENT_REQUIRED_PACKAGES,
|
|
40
40
|
ensureUseClientIfNeeded,
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
sanitizeMetadataStrings,
|
|
53
53
|
savePlan,
|
|
54
54
|
updateArchitecturePlan
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-BNHIEEXH.js";
|
|
56
56
|
import {
|
|
57
57
|
isValidTsx,
|
|
58
58
|
safeWrite
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
getDesignQualityForType,
|
|
75
75
|
inferPageTypeFromRoute,
|
|
76
76
|
selectContextualRules
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-PVVL26FX.js";
|
|
78
78
|
import {
|
|
79
79
|
fixGlobalsCss,
|
|
80
80
|
generateV4GlobalsCss,
|
|
@@ -2143,7 +2143,8 @@ async function parseModification(message, context, provider = "auto", options) {
|
|
|
2143
2143
|
isExpandedPageRequest,
|
|
2144
2144
|
sharedComponentsSummary: options?.sharedComponentsSummary,
|
|
2145
2145
|
tieredComponentsPrompt: options?.tieredComponentsPrompt,
|
|
2146
|
-
reusePlanDirective: options?.reusePlanDirective
|
|
2146
|
+
reusePlanDirective: options?.reusePlanDirective,
|
|
2147
|
+
pageSections: options?.pageSections
|
|
2147
2148
|
});
|
|
2148
2149
|
const raw = await ai.parseModification(prompt);
|
|
2149
2150
|
const requestsArray = Array.isArray(raw) ? raw : raw?.requests ?? [];
|
|
@@ -2243,7 +2244,7 @@ For editing an existing shared component use type "modify-layout-block" with tar
|
|
|
2243
2244
|
const coreRules = CORE_CONSTRAINTS;
|
|
2244
2245
|
const designQuality = DESIGN_QUALITY;
|
|
2245
2246
|
const visualDepth = VISUAL_DEPTH;
|
|
2246
|
-
const contextualRules = selectContextualRules(message);
|
|
2247
|
+
const contextualRules = selectContextualRules(message, options?.pageSections);
|
|
2247
2248
|
const interactionPatterns = INTERACTION_PATTERNS;
|
|
2248
2249
|
const light = config2.tokens.colors.light;
|
|
2249
2250
|
const dark = config2.tokens.colors.dark;
|
|
@@ -3511,12 +3512,24 @@ function verifyReusePlan(generatedCode, plan) {
|
|
|
3511
3512
|
}
|
|
3512
3513
|
|
|
3513
3514
|
// src/commands/chat/split-generator.ts
|
|
3514
|
-
var MAX_EXISTING_PAGES_CONTEXT =
|
|
3515
|
-
function
|
|
3515
|
+
var MAX_EXISTING_PAGES_CONTEXT = 3;
|
|
3516
|
+
function filterManifestForPage(manifest, plan, route) {
|
|
3517
|
+
const plannedForPage = plan.sharedComponents.filter((c) => c.usedBy.includes(route)).map((c) => c.name.toLowerCase());
|
|
3518
|
+
if (plannedForPage.length === 0) return manifest;
|
|
3519
|
+
const filtered = manifest.shared.filter((e) => plannedForPage.includes(e.name.toLowerCase()) || e.type === "layout");
|
|
3520
|
+
if (filtered.length === 0) return manifest;
|
|
3521
|
+
return { ...manifest, shared: filtered };
|
|
3522
|
+
}
|
|
3523
|
+
function buildExistingPagesContext(config2, forPageType) {
|
|
3516
3524
|
const pages = config2.pages || [];
|
|
3517
3525
|
const analyzed = pages.filter((p) => p.pageAnalysis);
|
|
3518
3526
|
if (analyzed.length === 0) return "";
|
|
3519
|
-
|
|
3527
|
+
let relevant = analyzed;
|
|
3528
|
+
if (forPageType) {
|
|
3529
|
+
const sameType = analyzed.filter((p) => inferPageTypeFromRoute(p.route) === forPageType);
|
|
3530
|
+
relevant = sameType.length > 0 ? sameType : analyzed;
|
|
3531
|
+
}
|
|
3532
|
+
const capped = relevant.slice(0, MAX_EXISTING_PAGES_CONTEXT);
|
|
3520
3533
|
const lines = capped.map((p) => {
|
|
3521
3534
|
return summarizePageAnalysis(p.name || p.id, p.route, p.pageAnalysis);
|
|
3522
3535
|
});
|
|
@@ -3941,7 +3954,7 @@ async function splitGeneratePages(spinner, message, modCtx, provider, parseOpts)
|
|
|
3941
3954
|
if (plan && plan.sharedComponents.length > 0) {
|
|
3942
3955
|
spinner.start(`Phase 4.5/6 \u2014 Generating ${plan.sharedComponents.length} shared components from plan...`);
|
|
3943
3956
|
try {
|
|
3944
|
-
const { generateSharedComponentsFromPlan } = await import("./plan-generator-
|
|
3957
|
+
const { generateSharedComponentsFromPlan } = await import("./plan-generator-A3YN473Q.js");
|
|
3945
3958
|
const generated = await generateSharedComponentsFromPlan(
|
|
3946
3959
|
plan,
|
|
3947
3960
|
styleContext,
|
|
@@ -3994,7 +4007,6 @@ EXISTING APP PAGE (match these UI patterns for consistency):
|
|
|
3994
4007
|
${existingAppPageCode}
|
|
3995
4008
|
\`\`\`
|
|
3996
4009
|
` : "";
|
|
3997
|
-
const existingPagesContext = buildExistingPagesContext(modCtx.config);
|
|
3998
4010
|
const existingPageCode = {};
|
|
3999
4011
|
if (projectRoot) {
|
|
4000
4012
|
const appDir = resolve2(projectRoot, "app");
|
|
@@ -4021,9 +4033,11 @@ ${existingAppPageCode}
|
|
|
4021
4033
|
const pageType = plan ? getPageType(route, plan) : inferPageTypeFromRoute(route);
|
|
4022
4034
|
const designConstraints = getDesignQualityForType(pageType);
|
|
4023
4035
|
const authNote = isAuth ? 'For this auth page: the auth layout already provides centering (flex items-center justify-center min-h-svh). Do NOT add your own centering wrapper or min-h-svh. Just output a div with className="w-full max-w-md" containing the Card. Do NOT use section containers or full-width wrappers.' : void 0;
|
|
4036
|
+
const existingPagesContext = buildExistingPagesContext(modCtx.config, pageType);
|
|
4024
4037
|
const layoutForPage = getGroupLayoutForRoute(route, plan);
|
|
4025
4038
|
const layoutNote = buildLayoutNote(layoutForPage);
|
|
4026
|
-
const
|
|
4039
|
+
const filteredManifest = currentManifest && plan ? filterManifestForPage(currentManifest, plan, route) : currentManifest;
|
|
4040
|
+
const tieredNote = filteredManifest ? buildTieredComponentsPrompt(filteredManifest, pageType) : void 0;
|
|
4027
4041
|
const pageKey = route.replace(/^\//, "") || "home";
|
|
4028
4042
|
const pageSections = plan?.pageNotes?.[pageKey]?.sections || [];
|
|
4029
4043
|
let reusePlanDirective = "";
|
|
@@ -4070,7 +4084,7 @@ ${existingAppPageCode}
|
|
|
4070
4084
|
styleContext
|
|
4071
4085
|
].filter(Boolean).join("\n\n");
|
|
4072
4086
|
try {
|
|
4073
|
-
const result = await parseModification(prompt, modCtx, provider, parseOpts);
|
|
4087
|
+
const result = await parseModification(prompt, modCtx, provider, { ...parseOpts, pageSections });
|
|
4074
4088
|
phase5Done++;
|
|
4075
4089
|
spinner.text = `Phase 5/6 \u2014 ${phase5Done}/${remainingPages.length} pages generated...`;
|
|
4076
4090
|
const codePage = result.requests.find((r) => r.type === "add-page");
|
|
@@ -6339,7 +6353,7 @@ Return JSON: { "requests": [{ "type": "add-page", "changes": { "name": "${compon
|
|
|
6339
6353
|
}
|
|
6340
6354
|
try {
|
|
6341
6355
|
const { validateReuse } = await import("./reuse-validator-XR2ZEYC4.js");
|
|
6342
|
-
const { inferPageTypeFromRoute: inferPageTypeFromRoute2 } = await import("./design-constraints-
|
|
6356
|
+
const { inferPageTypeFromRoute: inferPageTypeFromRoute2 } = await import("./design-constraints-PFCUSBMG.js");
|
|
6343
6357
|
const manifest2 = await loadManifest6(projectRoot);
|
|
6344
6358
|
const reuseplan = projectRoot ? loadPlan(projectRoot) : null;
|
|
6345
6359
|
if (manifest2.shared.length > 0) {
|
|
@@ -8479,8 +8493,8 @@ async function fixCommand(opts = {}) {
|
|
|
8479
8493
|
console.log(chalk15.green(` \u2714 ${verb} syntax: ${syntaxFixed} file(s) (use client, metadata, quotes)`));
|
|
8480
8494
|
}
|
|
8481
8495
|
try {
|
|
8482
|
-
const { loadPlan: loadPlan2 } = await import("./plan-generator-
|
|
8483
|
-
const { ensurePlanGroupLayouts: ensurePlanGroupLayouts2 } = await import("./code-generator-
|
|
8496
|
+
const { loadPlan: loadPlan2 } = await import("./plan-generator-A3YN473Q.js");
|
|
8497
|
+
const { ensurePlanGroupLayouts: ensurePlanGroupLayouts2 } = await import("./code-generator-SKXX6PQG.js");
|
|
8484
8498
|
const plan = loadPlan2(projectRoot);
|
|
8485
8499
|
if (plan) {
|
|
8486
8500
|
if (!dsm) {
|
|
@@ -8544,7 +8558,7 @@ async function fixCommand(opts = {}) {
|
|
|
8544
8558
|
const publicExists = existsSync13(publicLayoutPath);
|
|
8545
8559
|
const needsPublicLayout = !publicExists || !readFileSync10(publicLayoutPath, "utf-8").includes("<Header");
|
|
8546
8560
|
if (needsPublicLayout) {
|
|
8547
|
-
const { buildPublicLayoutCodeForSidebar } = await import("./code-generator-
|
|
8561
|
+
const { buildPublicLayoutCodeForSidebar } = await import("./code-generator-SKXX6PQG.js");
|
|
8548
8562
|
mkdirSync7(resolve8(projectRoot, "app", "(public)"), { recursive: true });
|
|
8549
8563
|
const publicResult = safeWrite(publicLayoutPath, buildPublicLayoutCodeForSidebar(), projectRoot, backups);
|
|
8550
8564
|
if (publicResult.ok) {
|
|
@@ -8593,7 +8607,7 @@ async function fixCommand(opts = {}) {
|
|
|
8593
8607
|
}
|
|
8594
8608
|
const themeTogglePath = resolve8(projectRoot, "components", "shared", "theme-toggle.tsx");
|
|
8595
8609
|
if (!existsSync13(themeTogglePath)) {
|
|
8596
|
-
const { generateThemeToggleCode } = await import("./code-generator-
|
|
8610
|
+
const { generateThemeToggleCode } = await import("./code-generator-SKXX6PQG.js");
|
|
8597
8611
|
mkdirSync7(resolve8(projectRoot, "components", "shared"), { recursive: true });
|
|
8598
8612
|
const themeResult = safeWrite(themeTogglePath, generateThemeToggleCode(), projectRoot, backups);
|
|
8599
8613
|
if (themeResult.ok) {
|
|
@@ -8614,7 +8628,7 @@ async function fixCommand(opts = {}) {
|
|
|
8614
8628
|
const isMinimal = appLayoutCode.length < 500 && !appLayoutCode.includes("Header") && !appLayoutCode.includes("Footer") && !appLayoutCode.includes("Sidebar") && !appLayoutCode.includes("SidebarProvider") && !appLayoutCode.includes("SidebarTrigger") && !appLayoutCode.includes("Sheet");
|
|
8615
8629
|
const navType = dsm.getConfig().navigation?.type || "header";
|
|
8616
8630
|
if (isMinimal && navType !== "none") {
|
|
8617
|
-
const { buildAppLayoutCode, buildGroupLayoutCode } = await import("./code-generator-
|
|
8631
|
+
const { buildAppLayoutCode, buildGroupLayoutCode } = await import("./code-generator-SKXX6PQG.js");
|
|
8618
8632
|
const isSidebar = navType === "sidebar" || navType === "both";
|
|
8619
8633
|
const newLayout = isSidebar ? buildAppLayoutCode(navType, dsm.getConfig().name) : buildGroupLayoutCode("header", dsm.getConfig().pages?.map((p) => p.name) || [], dsm.getConfig().name);
|
|
8620
8634
|
if (!dryRun) {
|
|
@@ -9161,7 +9175,7 @@ async function checkCommand(opts = {}) {
|
|
|
9161
9175
|
if (!skipShared) {
|
|
9162
9176
|
try {
|
|
9163
9177
|
const { validateReuse } = await import("./reuse-validator-XR2ZEYC4.js");
|
|
9164
|
-
const { inferPageTypeFromRoute: inferPageTypeFromRoute2 } = await import("./design-constraints-
|
|
9178
|
+
const { inferPageTypeFromRoute: inferPageTypeFromRoute2 } = await import("./design-constraints-PFCUSBMG.js");
|
|
9165
9179
|
const manifest = await loadManifest9(projectRoot);
|
|
9166
9180
|
const appDir = resolve9(projectRoot, "app");
|
|
9167
9181
|
const pageFiles = existsSync14(appDir) ? findTsxFiles(appDir) : [];
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
routeToKey,
|
|
12
12
|
savePlan,
|
|
13
13
|
updateArchitecturePlan
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-BNHIEEXH.js";
|
|
15
|
+
import "./chunk-PVVL26FX.js";
|
|
16
16
|
import "./chunk-U5SNPHVU.js";
|
|
17
17
|
import "./chunk-3RG5ZIWI.js";
|
|
18
18
|
export {
|