gencow 0.1.265 → 0.1.266
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/env-command.mjs +23 -7
- package/package.json +4 -4
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gencow",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.266",
|
|
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",
|
|
44
45
|
"@gencow/server": "0.1.3",
|
|
45
|
-
"@gencow/
|
|
46
|
-
"@gencow/
|
|
47
|
-
"@gencow/core": "0.1.47"
|
|
46
|
+
"@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",
|