gencow 0.1.270 → 0.1.271
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 +36 -5
- package/package.json +4 -4
- package/runtime/server.mjs +17 -17
package/lib/env-command.mjs
CHANGED
|
@@ -66,6 +66,23 @@ function targetedNextAction(nextAction, appId, envTarget) {
|
|
|
66
66
|
return `${nextAction} ${envTargetFlags(appId, envTarget)}`;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Renders the safe ACK miss kind from the API. Only the kind and the two integer
|
|
71
|
+
* revisions can appear; any other shape is dropped rather than printed.
|
|
72
|
+
*/
|
|
73
|
+
function formatEnvMismatch(mismatch) {
|
|
74
|
+
if (!mismatch || typeof mismatch !== "object" || typeof mismatch.kind !== "string") return null;
|
|
75
|
+
if (!/^[A-Z_]{1,40}$/u.test(mismatch.kind)) return null;
|
|
76
|
+
if (mismatch.kind !== "REVISION_BEHIND" && mismatch.kind !== "REVISION_AHEAD") {
|
|
77
|
+
return `Mismatch: ${mismatch.kind}`;
|
|
78
|
+
}
|
|
79
|
+
// The API does not record the process revision yet, so an actual revision is shown only when present.
|
|
80
|
+
const parts = [];
|
|
81
|
+
if (Number.isSafeInteger(mismatch.expectedRevision)) parts.push(`expected revision ${mismatch.expectedRevision}`);
|
|
82
|
+
if (Number.isSafeInteger(mismatch.actualRevision)) parts.push(`actual revision ${mismatch.actualRevision}`);
|
|
83
|
+
return parts.length > 0 ? `Mismatch: ${mismatch.kind} (${parts.join(", ")})` : `Mismatch: ${mismatch.kind}`;
|
|
84
|
+
}
|
|
85
|
+
|
|
69
86
|
function envListCommand(appId, envTarget) {
|
|
70
87
|
return `gencow env list ${envTargetFlags(appId, envTarget)}`;
|
|
71
88
|
}
|
|
@@ -201,6 +218,7 @@ export function createEnvCommand(deps = {}) {
|
|
|
201
218
|
typeof result.retryable === "boolean" ? `Retryable: ${result.retryable ? "yes" : "no"}` : null,
|
|
202
219
|
Number.isSafeInteger(Number(result.attemptCount)) ? `Attempts: ${Number(result.attemptCount)}` : null,
|
|
203
220
|
result.failureCode ? `Failure class: ${result.failureCode}` : null,
|
|
221
|
+
formatEnvMismatch(result.mismatch),
|
|
204
222
|
result.correlationId ? `Correlation: ${result.correlationId}` : null,
|
|
205
223
|
result.retryPrecondition ? `Retry precondition: ${result.retryPrecondition}` : null,
|
|
206
224
|
`Next action: ${nextAction}`,
|
|
@@ -222,6 +240,13 @@ export function createEnvCommand(deps = {}) {
|
|
|
222
240
|
return result.runtimeState === "failed" || result.statusQueryFailed === true ? 1 : 0;
|
|
223
241
|
}
|
|
224
242
|
|
|
243
|
+
// Backend-only tips (handler/restart guidance) apply only when some key reached
|
|
244
|
+
// a running backend. A set/unset whose every projected key ended not_running has
|
|
245
|
+
// no backend process to act on, so those tips would be inaccurate.
|
|
246
|
+
function onlyStaticProjections(runtimeStates) {
|
|
247
|
+
return runtimeStates.length > 0 && runtimeStates.every((state) => state === "not_running");
|
|
248
|
+
}
|
|
249
|
+
|
|
225
250
|
return async function env(...envArgs) {
|
|
226
251
|
const filteredArgs = envArgs.filter((arg) => arg !== "--local");
|
|
227
252
|
|
|
@@ -355,6 +380,7 @@ export function createEnvCommand(deps = {}) {
|
|
|
355
380
|
|
|
356
381
|
let appliedCount = 0;
|
|
357
382
|
let commandFailed = false;
|
|
383
|
+
const projectionStates = [];
|
|
358
384
|
for (const pair of pairs) {
|
|
359
385
|
const eqIdx = pair.indexOf("=");
|
|
360
386
|
if (eqIdx < 1) {
|
|
@@ -405,6 +431,7 @@ export function createEnvCommand(deps = {}) {
|
|
|
405
431
|
const mutation = await res.json().catch(() => ({}));
|
|
406
432
|
const projection = await waitForProjection(creds, appId, mutation, envTarget);
|
|
407
433
|
const projectionExitCode = renderProjectionResult(projection, appId, envTarget);
|
|
434
|
+
projectionStates.push(projection.runtimeState);
|
|
408
435
|
if (projectionExitCode === 0) {
|
|
409
436
|
success(`Stored ${BOLD}${name}${RESET} ${DIM}(cloud: ${appId}, ${envTarget})${RESET}`);
|
|
410
437
|
} else {
|
|
@@ -416,7 +443,7 @@ export function createEnvCommand(deps = {}) {
|
|
|
416
443
|
commandFailed = true;
|
|
417
444
|
}
|
|
418
445
|
}
|
|
419
|
-
if (appliedCount > 0) {
|
|
446
|
+
if (appliedCount > 0 && !onlyStaticProjections(projectionStates)) {
|
|
420
447
|
log(
|
|
421
448
|
`\n ${DIM}Runtime applied is reported only after the running process acknowledges the revision.${RESET}`,
|
|
422
449
|
);
|
|
@@ -437,6 +464,7 @@ export function createEnvCommand(deps = {}) {
|
|
|
437
464
|
return;
|
|
438
465
|
}
|
|
439
466
|
let commandFailed = false;
|
|
467
|
+
const projectionStates = [];
|
|
440
468
|
for (const rawKey of keys) {
|
|
441
469
|
const key = sanitizeCloudEnvKey(rawKey);
|
|
442
470
|
try {
|
|
@@ -458,6 +486,7 @@ export function createEnvCommand(deps = {}) {
|
|
|
458
486
|
const mutation = await res.json().catch(() => ({}));
|
|
459
487
|
const projection = await waitForProjection(creds, appId, mutation, envTarget);
|
|
460
488
|
const projectionExitCode = renderProjectionResult(projection, appId, envTarget);
|
|
489
|
+
projectionStates.push(projection.runtimeState);
|
|
461
490
|
if (projectionExitCode === 0) {
|
|
462
491
|
success(`Removed ${BOLD}${key}${RESET} ${DIM}(cloud: ${appId}, ${envTarget})${RESET}`);
|
|
463
492
|
} else {
|
|
@@ -468,10 +497,12 @@ export function createEnvCommand(deps = {}) {
|
|
|
468
497
|
commandFailed = true;
|
|
469
498
|
}
|
|
470
499
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
500
|
+
if (!onlyStaticProjections(projectionStates)) {
|
|
501
|
+
log(
|
|
502
|
+
`\n ${DIM}Runtime applied is reported only after the running process acknowledges the revision.${RESET}`,
|
|
503
|
+
);
|
|
504
|
+
log(` ${DIM}⚠ Platform-managed or startup-captured settings require restart/redeploy${RESET}\n`);
|
|
505
|
+
}
|
|
475
506
|
return commandFailed ? 1 : 0;
|
|
476
507
|
}
|
|
477
508
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gencow",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.271",
|
|
4
4
|
"description": "Gencow — AI Backend Engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"better-auth": "1.7.11",
|
|
42
42
|
"postgres": "^3.4.9",
|
|
43
43
|
"@gencow/client": "0.2.8",
|
|
44
|
-
"@gencow/server": "0.1.3",
|
|
45
44
|
"@gencow/core": "0.1.47",
|
|
46
|
-
"@gencow/
|
|
47
|
-
"@gencow/shared": "0.0.0"
|
|
45
|
+
"@gencow/server": "0.1.3",
|
|
46
|
+
"@gencow/shared": "0.0.0",
|
|
47
|
+
"@gencow/react": "0.2.8"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "node scripts/bundle-core.mjs && node scripts/bundle-shared.mjs && node scripts/bundle-server.mjs",
|