gencow 0.1.266 → 0.1.267
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.
|
@@ -150,7 +150,7 @@ const SAFE_LOCAL_ERROR_CODES = new Map([
|
|
|
150
150
|
action: (caught) => {
|
|
151
151
|
const dir = safeDisplayDir(caught);
|
|
152
152
|
const target = dir ?? "<build-output-dir>";
|
|
153
|
-
return `Retryable: yes, after the build writes an index.html with real content into ${target} — run \`ls -l ${target}/index.html\` to confirm its size is above 0 bytes and that it holds more than whitespace or HTML comments, then rerun \`gencow static ${target}\`.`;
|
|
153
|
+
return `Retryable: yes, after the build writes an index.html with real content into ${target} — run \`ls -l ${target}/index.html\` to confirm its size is above 0 bytes and that it holds more than whitespace or HTML comments, then rerun \`gencow static ${target}${safeRetryTargetFlags(caught)}\`.`;
|
|
154
154
|
},
|
|
155
155
|
},
|
|
156
156
|
],
|
|
@@ -162,7 +162,7 @@ const SAFE_LOCAL_ERROR_CODES = new Map([
|
|
|
162
162
|
action: (caught) => {
|
|
163
163
|
const dir = safeDisplayDir(caught);
|
|
164
164
|
const target = dir ?? "<build-output-dir>";
|
|
165
|
-
return `Retryable: yes, after the build writes index.html into ${target} — run \`ls ${target}/index.html\` to confirm, then rerun \`gencow static ${target}\`.`;
|
|
165
|
+
return `Retryable: yes, after the build writes index.html into ${target} — run \`ls ${target}/index.html\` to confirm, then rerun \`gencow static ${target}${safeRetryTargetFlags(caught)}\`.`;
|
|
166
166
|
},
|
|
167
167
|
},
|
|
168
168
|
],
|
|
@@ -172,6 +172,11 @@ function safeDisplayDir(caught) {
|
|
|
172
172
|
const { displayDir } = caught;
|
|
173
173
|
return typeof displayDir === "string" && SAFE_DISPLAY_DIR.test(displayDir) ? displayDir : null;
|
|
174
174
|
}
|
|
175
|
+
|
|
176
|
+
// Only the production selector is carried into retry guidance; any other value is never printed.
|
|
177
|
+
function safeRetryTargetFlags(caught) {
|
|
178
|
+
return caught.targetFlags === "--prod" ? " --prod" : "";
|
|
179
|
+
}
|
|
175
180
|
const SAFE_SOURCE_LOCATION_PATH = /^(?![/\\])(?!.*(?:^|\/)\.\.(?:\/|$))[^\u0000-\u001f\u007f]{1,240}$/u;
|
|
176
181
|
|
|
177
182
|
const SAFE_IMPORT_NAME = /^[A-Za-z_$][\w$]{0,127}$/u;
|
package/lib/deploy-runtime.mjs
CHANGED
|
@@ -402,6 +402,8 @@ export function createDeployCommand({
|
|
|
402
402
|
try {
|
|
403
403
|
staticArtifactPreflight = preflightStaticDeployArtifactImpl({
|
|
404
404
|
staticDirArg: resolvedStaticDirArg,
|
|
405
|
+
// Explicit --prod only; an --app that implies prod is resolved after this point.
|
|
406
|
+
targetFlags: parsed.envTarget === "prod" ? "--prod" : null,
|
|
405
407
|
// Display text is what the user typed or the client config says, never the resolved path.
|
|
406
408
|
staticDirDisplay: parsed.staticDirArg ?? selectedClient?.static?.dir ?? null,
|
|
407
409
|
staticDirSource: parsed.staticDirArg ? "argument" : "config",
|
|
@@ -74,6 +74,7 @@ export function buildStaticArtifactManifest({
|
|
|
74
74
|
rootDir,
|
|
75
75
|
selection,
|
|
76
76
|
displayDir = null,
|
|
77
|
+
targetFlags = null,
|
|
77
78
|
lstatSyncImpl = lstatSync,
|
|
78
79
|
readdirSyncImpl = readdirSync,
|
|
79
80
|
readFileSyncImpl = readFileSync,
|
|
@@ -99,19 +100,22 @@ export function buildStaticArtifactManifest({
|
|
|
99
100
|
: "Selected directory";
|
|
100
101
|
// displayDir is the project-relative directory the user passed or the CLI detected. It is
|
|
101
102
|
// attached as a field (not interpolated) so the public renderer decides what is safe to show.
|
|
103
|
+
// targetFlags carries only the production selector the user passed, so the retry guidance can keep
|
|
104
|
+
// it. Any other value (for example an app ID) is dropped here and never reaches the message.
|
|
105
|
+
const retryTarget = targetFlags === "--prod" ? { targetFlags } : {};
|
|
102
106
|
if (entrypoint === "empty") {
|
|
103
107
|
throw Object.assign(
|
|
104
108
|
new Error(
|
|
105
109
|
`${source} has an empty or blank index.html at its root (only whitespace or HTML comments). Refusing to replace the current frontend.`,
|
|
106
110
|
),
|
|
107
|
-
{ code: "STATIC_ARTIFACT_INDEX_EMPTY", displayDir },
|
|
111
|
+
{ code: "STATIC_ARTIFACT_INDEX_EMPTY", displayDir, ...retryTarget },
|
|
108
112
|
);
|
|
109
113
|
}
|
|
110
114
|
throw Object.assign(
|
|
111
115
|
new Error(
|
|
112
116
|
`${source} does not contain index.html at its root. Refusing to replace the current frontend.`,
|
|
113
117
|
),
|
|
114
|
-
{ code: "STATIC_ARTIFACT_INDEX_MISSING", displayDir },
|
|
118
|
+
{ code: "STATIC_ARTIFACT_INDEX_MISSING", displayDir, ...retryTarget },
|
|
115
119
|
);
|
|
116
120
|
}
|
|
117
121
|
return {
|
package/lib/static-command.mjs
CHANGED
|
@@ -263,12 +263,24 @@ export function createStaticCommand(options = {}) {
|
|
|
263
263
|
|
|
264
264
|
// The display value is what the user typed or the client config says, never the resolved absolute path.
|
|
265
265
|
const staticDirDisplay = parsed.staticDir || selectedClient?.static?.dir || null;
|
|
266
|
+
// The production selector the user asked for (--prod, or --app naming the prod app) is passed to the
|
|
267
|
+
// artifact error so its Retry line keeps it. The app ID itself is never passed.
|
|
268
|
+
const requestedTargetFlags =
|
|
269
|
+
resolveImplicitProdEnvironment({
|
|
270
|
+
explicitApp: Boolean(parsed.appId),
|
|
271
|
+
envTarget: parsed.isProd ? "prod" : "dev",
|
|
272
|
+
appId: parsed.appId,
|
|
273
|
+
prodApp: prodAppId,
|
|
274
|
+
}) === "prod"
|
|
275
|
+
? "--prod"
|
|
276
|
+
: null;
|
|
266
277
|
let artifactPreflight;
|
|
267
278
|
try {
|
|
268
279
|
artifactPreflight = preflightStaticDeployArtifactImpl({
|
|
269
280
|
staticDirArg: configuredStaticDir,
|
|
270
281
|
staticDirDisplay,
|
|
271
282
|
staticDirSource: parsed.staticDir ? "argument" : "config",
|
|
283
|
+
targetFlags: requestedTargetFlags,
|
|
272
284
|
cwd: selectedClient ? frontendRoot : cwdImpl(),
|
|
273
285
|
});
|
|
274
286
|
} catch (manifestError) {
|
|
@@ -52,6 +52,7 @@ export function preflightStaticDeployArtifact({
|
|
|
52
52
|
staticDirArg,
|
|
53
53
|
staticDirDisplay = null,
|
|
54
54
|
staticDirSource = "argument",
|
|
55
|
+
targetFlags = null,
|
|
55
56
|
cwd = process.cwd(),
|
|
56
57
|
autoDetectDirs,
|
|
57
58
|
existsSyncImpl = existsSync,
|
|
@@ -78,6 +79,7 @@ export function preflightStaticDeployArtifact({
|
|
|
78
79
|
rootDir: resolvePathImpl(cwd, targetDir),
|
|
79
80
|
selection: staticDirArg ? "explicit" : `auto:${targetDir}`,
|
|
80
81
|
displayDir: targetDir,
|
|
82
|
+
targetFlags,
|
|
81
83
|
lstatSyncImpl,
|
|
82
84
|
readdirSyncImpl,
|
|
83
85
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gencow",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.267",
|
|
4
4
|
"description": "Gencow — AI Backend Engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"postgres": "^3.4.9",
|
|
43
43
|
"@gencow/client": "0.2.8",
|
|
44
44
|
"@gencow/react": "0.2.8",
|
|
45
|
-
"@gencow/server": "0.1.3",
|
|
46
45
|
"@gencow/core": "0.1.47",
|
|
46
|
+
"@gencow/server": "0.1.3",
|
|
47
47
|
"@gencow/shared": "0.0.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|