gencow 0.1.265 → 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.
- package/lib/cli-command-runner.mjs +7 -2
- package/lib/deploy-runtime.mjs +2 -0
- package/lib/deploy-static-fullstack-runtime.mjs +1 -0
- package/lib/env-command.mjs +23 -7
- package/lib/static-artifact-manifest.mjs +6 -2
- package/lib/static-command.mjs +12 -0
- package/lib/static-deploy-artifact-preflight.mjs +2 -0
- package/package.json +4 -4
|
@@ -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",
|
package/lib/env-command.mjs
CHANGED
|
@@ -57,6 +57,15 @@ function envTargetFlags(appId, envTarget) {
|
|
|
57
57
|
return envTarget === "prod" ? "--prod" : `--app ${appId}`;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
// The Platform's pending hint names the operation but not the target, so a bare
|
|
61
|
+
// hint would query the dev target. Only that exact shape gets the target flags;
|
|
62
|
+
// any other server-provided next action is passed through unchanged.
|
|
63
|
+
const BARE_OPERATION_STATUS_HINT = /^gencow env status --operation \S+$/u;
|
|
64
|
+
function targetedNextAction(nextAction, appId, envTarget) {
|
|
65
|
+
if (!BARE_OPERATION_STATUS_HINT.test(nextAction)) return nextAction;
|
|
66
|
+
return `${nextAction} ${envTargetFlags(appId, envTarget)}`;
|
|
67
|
+
}
|
|
68
|
+
|
|
60
69
|
function envListCommand(appId, envTarget) {
|
|
61
70
|
return `gencow env list ${envTargetFlags(appId, envTarget)}`;
|
|
62
71
|
}
|
|
@@ -174,8 +183,11 @@ export function createEnvCommand(deps = {}) {
|
|
|
174
183
|
return current;
|
|
175
184
|
}
|
|
176
185
|
|
|
177
|
-
function renderProjectionResult(result) {
|
|
186
|
+
function renderProjectionResult(result, appId, envTarget) {
|
|
178
187
|
if (!result?.operationId) return 0;
|
|
188
|
+
const nextAction = result.nextAction
|
|
189
|
+
? targetedNextAction(result.nextAction, appId, envTarget)
|
|
190
|
+
: `gencow env status --operation ${result.operationId} ${envTargetFlags(appId, envTarget)}`;
|
|
179
191
|
const details = [
|
|
180
192
|
result.code ? `Code: ${result.code}` : null,
|
|
181
193
|
result.stage ? `Stage: ${result.stage}` : null,
|
|
@@ -190,7 +202,7 @@ export function createEnvCommand(deps = {}) {
|
|
|
190
202
|
result.failureCode ? `Failure class: ${result.failureCode}` : null,
|
|
191
203
|
result.correlationId ? `Correlation: ${result.correlationId}` : null,
|
|
192
204
|
result.retryPrecondition ? `Retry precondition: ${result.retryPrecondition}` : null,
|
|
193
|
-
|
|
205
|
+
`Next action: ${nextAction}`,
|
|
194
206
|
].filter(Boolean);
|
|
195
207
|
if (result.runtimeState === "applied") {
|
|
196
208
|
success(
|
|
@@ -206,7 +218,6 @@ export function createEnvCommand(deps = {}) {
|
|
|
206
218
|
warn(`Stored; runtime projection is still pending ${DIM}(operation ${result.operationId})${RESET}`);
|
|
207
219
|
}
|
|
208
220
|
for (const detail of details) info(detail);
|
|
209
|
-
if (!result.nextAction) info(`Next action: gencow env status --operation ${result.operationId}`);
|
|
210
221
|
return result.runtimeState === "failed" || result.statusQueryFailed === true ? 1 : 0;
|
|
211
222
|
}
|
|
212
223
|
|
|
@@ -270,7 +281,11 @@ export function createEnvCommand(deps = {}) {
|
|
|
270
281
|
return;
|
|
271
282
|
}
|
|
272
283
|
try {
|
|
273
|
-
return renderProjectionResult(
|
|
284
|
+
return renderProjectionResult(
|
|
285
|
+
await loadProjectionStatus(creds, appId, operationId, envTarget),
|
|
286
|
+
appId,
|
|
287
|
+
envTarget,
|
|
288
|
+
);
|
|
274
289
|
} catch (e) {
|
|
275
290
|
error(`Failed to fetch env operation: ${e.message}`);
|
|
276
291
|
return 1;
|
|
@@ -384,7 +399,7 @@ export function createEnvCommand(deps = {}) {
|
|
|
384
399
|
}
|
|
385
400
|
const mutation = await res.json().catch(() => ({}));
|
|
386
401
|
const projection = await waitForProjection(creds, appId, mutation, envTarget);
|
|
387
|
-
const projectionExitCode = renderProjectionResult(projection);
|
|
402
|
+
const projectionExitCode = renderProjectionResult(projection, appId, envTarget);
|
|
388
403
|
if (projectionExitCode === 0) {
|
|
389
404
|
success(`Stored ${BOLD}${name}${RESET} ${DIM}(cloud: ${appId}, ${envTarget})${RESET}`);
|
|
390
405
|
} else {
|
|
@@ -437,7 +452,7 @@ export function createEnvCommand(deps = {}) {
|
|
|
437
452
|
}
|
|
438
453
|
const mutation = await res.json().catch(() => ({}));
|
|
439
454
|
const projection = await waitForProjection(creds, appId, mutation, envTarget);
|
|
440
|
-
const projectionExitCode = renderProjectionResult(projection);
|
|
455
|
+
const projectionExitCode = renderProjectionResult(projection, appId, envTarget);
|
|
441
456
|
if (projectionExitCode === 0) {
|
|
442
457
|
success(`Removed ${BOLD}${key}${RESET} ${DIM}(cloud: ${appId}, ${envTarget})${RESET}`);
|
|
443
458
|
} else {
|
|
@@ -533,7 +548,8 @@ export function createEnvCommand(deps = {}) {
|
|
|
533
548
|
success(`${key}`);
|
|
534
549
|
}
|
|
535
550
|
log(`\n ${GREEN}${data.count || count} set${RESET} ${DIM}(cloud: ${appId}, ${envTarget})${RESET}`);
|
|
536
|
-
commandFailed =
|
|
551
|
+
commandFailed =
|
|
552
|
+
renderProjectionResult(await waitForProjection(creds, appId, data, envTarget), appId, envTarget) !== 0;
|
|
537
553
|
} catch (e) {
|
|
538
554
|
error(`Failed to push env vars: ${e.message}`);
|
|
539
555
|
commandFailed = true;
|
|
@@ -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": {
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"ai": "^6.0.314",
|
|
41
41
|
"better-auth": "1.7.11",
|
|
42
42
|
"postgres": "^3.4.9",
|
|
43
|
+
"@gencow/client": "0.2.8",
|
|
43
44
|
"@gencow/react": "0.2.8",
|
|
45
|
+
"@gencow/core": "0.1.47",
|
|
44
46
|
"@gencow/server": "0.1.3",
|
|
45
|
-
"@gencow/shared": "0.0.0"
|
|
46
|
-
"@gencow/client": "0.2.8",
|
|
47
|
-
"@gencow/core": "0.1.47"
|
|
47
|
+
"@gencow/shared": "0.0.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "node scripts/bundle-core.mjs && node scripts/bundle-shared.mjs && node scripts/bundle-server.mjs",
|