gencow 0.1.263 → 0.1.265
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/cloud-targets.mjs +5 -1
- package/lib/config-command.mjs +10 -2
- package/lib/cors-command.mjs +10 -2
- package/lib/db-command.mjs +11 -5
- package/lib/db-push-command.mjs +12 -4
- package/lib/deploy-app-target.mjs +81 -0
- package/lib/deploy-command.mjs +17 -2
- package/lib/deploy-runtime.mjs +15 -0
- package/lib/domain-command.mjs +10 -2
- package/lib/env-command.mjs +10 -2
- package/lib/files-command.mjs +15 -5
- package/lib/jobs-command.mjs +14 -3
- package/lib/origins-command.mjs +10 -2
- package/lib/static-command.mjs +15 -1
- package/package.json +4 -4
package/lib/cloud-targets.mjs
CHANGED
|
@@ -106,7 +106,11 @@ export function resolveCloudAppTarget(restArgs, options = {}) {
|
|
|
106
106
|
acceptExplicitWithoutProdApp: true,
|
|
107
107
|
});
|
|
108
108
|
if (!prodTarget.appId) {
|
|
109
|
-
|
|
109
|
+
const error = describeProdTargetFailure(prodTarget, missingProdMessage);
|
|
110
|
+
if (prodTarget.reason !== "explicit_app_not_prod_app") return { error };
|
|
111
|
+
// Only the explicit mismatch carries its reason and requested app, so callers can render the
|
|
112
|
+
// typed EXPLICIT_APP_NOT_PROD_APP block; every other failure keeps the { error } shape.
|
|
113
|
+
return { error, reason: prodTarget.reason, prodApp: prodTarget.prodApp, explicitAppId: appId };
|
|
110
114
|
}
|
|
111
115
|
appId = prodTarget.appId;
|
|
112
116
|
}
|
package/lib/config-command.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { resolveCloudAppTarget } from "./cloud-targets.mjs";
|
|
2
|
+
import { cloudTargetRejectionMessage, prodRetryCommandLine, redactConfigSetValue, redactEnvPairs } from "./deploy-app-target.mjs";
|
|
2
3
|
import { BOLD, CYAN, DIM, GREEN, RESET, error, info, log, success } from "./output.mjs";
|
|
3
4
|
import { requireCreds, rpcMutation, rpcQuery } from "./platform-client.mjs";
|
|
4
5
|
|
|
@@ -82,8 +83,15 @@ export function createConfigCommand({
|
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
if (target.error) {
|
|
85
|
-
errorImpl(
|
|
86
|
-
|
|
86
|
+
errorImpl(
|
|
87
|
+
cloudTargetRejectionMessage(target, {
|
|
88
|
+
fallbackMessage: target.error,
|
|
89
|
+
stage: "app target resolution",
|
|
90
|
+
changed: "nothing. No config value was changed.",
|
|
91
|
+
next: `${prodRetryCommandLine({ command: "config", args: configArgs, redactValues: redactConfigSetValue })} (omit --app to target this project's prod app)`,
|
|
92
|
+
}),
|
|
93
|
+
);
|
|
94
|
+
return 1;
|
|
87
95
|
}
|
|
88
96
|
|
|
89
97
|
const { appId } = target;
|
package/lib/cors-command.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { resolveCloudAppTarget } from "./cloud-targets.mjs";
|
|
2
|
+
import { cloudTargetRejectionMessage, prodRetryCommandLine } from "./deploy-app-target.mjs";
|
|
2
3
|
import { loadConfig } from "./cli-project-runtime.mjs";
|
|
3
4
|
import { normalizeCliCorsOrigin } from "./domain-helpers.mjs";
|
|
4
5
|
import { BOLD, CYAN, DIM, GREEN, RESET, error, info, log, success } from "./output.mjs";
|
|
@@ -101,8 +102,15 @@ export function createCorsCommand({
|
|
|
101
102
|
});
|
|
102
103
|
|
|
103
104
|
if (target.error) {
|
|
104
|
-
errorImpl(
|
|
105
|
-
|
|
105
|
+
errorImpl(
|
|
106
|
+
cloudTargetRejectionMessage(target, {
|
|
107
|
+
fallbackMessage: target.error,
|
|
108
|
+
stage: "app target resolution",
|
|
109
|
+
changed: "nothing. No trusted origin was changed.",
|
|
110
|
+
next: `${prodRetryCommandLine({ command: "cors", args: corsArgs })} (omit --app to target this project's prod app)`,
|
|
111
|
+
}),
|
|
112
|
+
);
|
|
113
|
+
return 1;
|
|
106
114
|
}
|
|
107
115
|
|
|
108
116
|
const { appId, envTarget } = target;
|
package/lib/db-command.mjs
CHANGED
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
resolveProdAppTarget,
|
|
24
24
|
} from "./cloud-targets.mjs";
|
|
25
25
|
import { platformFetch, requireCreds } from "./platform-client.mjs";
|
|
26
|
+
import { cloudTargetRejectionMessage, prodRetryCommandLine } from "./deploy-app-target.mjs";
|
|
26
27
|
import { readProjectMetadata } from "./project-context.mjs";
|
|
27
28
|
|
|
28
29
|
export function resolveDbCloudTarget(args, gencowJson = null) {
|
|
@@ -59,7 +60,7 @@ export function resolveDbCloudTarget(args, gencowJson = null) {
|
|
|
59
60
|
appId: prodTarget.appId,
|
|
60
61
|
isProd,
|
|
61
62
|
platformUrl,
|
|
62
|
-
prodTargetFailure: prodTarget.appId ? undefined : prodTarget,
|
|
63
|
+
prodTargetFailure: prodTarget.appId ? undefined : { ...prodTarget, explicitAppId },
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
66
|
return { appId: explicitAppId || gencowJson.appId || gencowJson.appName || null, isProd, platformUrl };
|
|
@@ -397,10 +398,15 @@ export function createDbCommands({
|
|
|
397
398
|
|
|
398
399
|
if (isProd && !appId) {
|
|
399
400
|
errorImpl(
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
401
|
+
cloudTargetRejectionMessage(target.prodTargetFailure, {
|
|
402
|
+
fallbackMessage: describeProdTargetFailure(
|
|
403
|
+
target.prodTargetFailure,
|
|
404
|
+
"Prod app not found. Run 'gencow deploy' first to create a prod app.",
|
|
405
|
+
),
|
|
406
|
+
stage: "seed target resolution",
|
|
407
|
+
changed: "nothing. No seed data was written.",
|
|
408
|
+
next: `${prodRetryCommandLine({ command: "db:seed", args: args })} (omit --app to target this project's prod app)`,
|
|
409
|
+
}),
|
|
404
410
|
);
|
|
405
411
|
return 1;
|
|
406
412
|
}
|
package/lib/db-push-command.mjs
CHANGED
|
@@ -54,6 +54,7 @@ import {
|
|
|
54
54
|
} from "./confirm-gate.mjs";
|
|
55
55
|
import { emitMigrationResponsibilityNotice } from "./migration-advisory.mjs";
|
|
56
56
|
import { describeProdTargetFailure } from "./cloud-targets.mjs";
|
|
57
|
+
import { cloudTargetRejectionMessage, prodRetryCommandLine } from "./deploy-app-target.mjs";
|
|
57
58
|
import { readProjectMetadata } from "./project-context.mjs";
|
|
58
59
|
|
|
59
60
|
function clientCorrelationId() {
|
|
@@ -248,10 +249,15 @@ function createDbMigrationCommand(deps, command) {
|
|
|
248
249
|
);
|
|
249
250
|
} else if (isProd) {
|
|
250
251
|
deps.errorImpl(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
252
|
+
cloudTargetRejectionMessage(target.prodTargetFailure, {
|
|
253
|
+
fallbackMessage: describeProdTargetFailure(
|
|
254
|
+
target.prodTargetFailure,
|
|
255
|
+
"Prod app not found. Run 'gencow deploy' first to create a prod app.",
|
|
256
|
+
),
|
|
257
|
+
stage: "migration target resolution",
|
|
258
|
+
changed: `nothing. No migration was ${isCheck ? "checked" : "applied"}, and no database or serving state was changed.`,
|
|
259
|
+
next: `${prodRetryCommandLine({ command, args })} (omit --app to target this project's prod app)`,
|
|
260
|
+
}),
|
|
255
261
|
);
|
|
256
262
|
} else {
|
|
257
263
|
deps.errorImpl("Cloud app not found. Make sure gencow.json exists with an appId.");
|
|
@@ -259,6 +265,8 @@ function createDbMigrationCommand(deps, command) {
|
|
|
259
265
|
deps.infoImpl(`${DIM}To push to local DB: gencow db:push --local${RESET}`);
|
|
260
266
|
deps.logImpl("");
|
|
261
267
|
}
|
|
268
|
+
// JSON mode already exits through emitFailure; text mode must exit non-zero itself.
|
|
269
|
+
if (!jsonMode) deps.exitImpl(1);
|
|
262
270
|
return;
|
|
263
271
|
}
|
|
264
272
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { appNotFoundDiagnostic } from "./app-response-contract.mjs";
|
|
2
|
+
import { describeProdTargetFailure, resolveProdAppTarget } from "./cloud-targets.mjs";
|
|
2
3
|
import { readJsonObjectResponse } from "./http-response-json.mjs";
|
|
3
4
|
|
|
4
5
|
const PUBLIC_LOOKUP_ERROR_CODES = new Set([
|
|
@@ -73,6 +74,86 @@ export function rejectExplicitAppNotFound({ appId, target, correlationId, errorI
|
|
|
73
74
|
return false;
|
|
74
75
|
}
|
|
75
76
|
|
|
77
|
+
const DEPLOY_CHANGED_TEXT =
|
|
78
|
+
"nothing. No app was created or deployed, gencow.json was not modified, and app data and the serving state were not changed.";
|
|
79
|
+
const DEPLOY_NEXT_TEXT = "gencow deploy --prod (deploys to this project's prod app)";
|
|
80
|
+
|
|
81
|
+
// Shared typed block for `--app <id>` with `--prod` when <id> is not this project's prod app. Every
|
|
82
|
+
// target-resolving command renders this one block, so scripts see the same code and exit status.
|
|
83
|
+
// `rejection` is the resolver result ({ reason, prodApp }); `changed` and `next` are per command.
|
|
84
|
+
export function renderExplicitAppNotProdAppLines({
|
|
85
|
+
explicitAppId,
|
|
86
|
+
rejection,
|
|
87
|
+
stage = "deploy target lookup",
|
|
88
|
+
changed = DEPLOY_CHANGED_TEXT,
|
|
89
|
+
next = DEPLOY_NEXT_TEXT,
|
|
90
|
+
}) {
|
|
91
|
+
return [
|
|
92
|
+
"Code: EXPLICIT_APP_NOT_PROD_APP",
|
|
93
|
+
`Stage: ${stage}`,
|
|
94
|
+
`App ID: ${explicitAppId} (requested with --prod)`,
|
|
95
|
+
describeProdTargetFailure(rejection, "--app with --prod must name this project's prod app."),
|
|
96
|
+
`Changed: ${changed}`,
|
|
97
|
+
`Next: ${next}`,
|
|
98
|
+
];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Re-run line for a rejected prod command. It keeps the user's subcommand and arguments, drops
|
|
102
|
+
// --app (the app id is never printed) and any --prod, then appends --prod. `redactValues` may replace
|
|
103
|
+
// secret-bearing values with placeholders before the line is rendered.
|
|
104
|
+
export function prodRetryCommandLine({ command, args, redactValues = (list) => list }) {
|
|
105
|
+
const kept = [];
|
|
106
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
107
|
+
const arg = args[index];
|
|
108
|
+
if (arg === "--app" || arg === "-a") {
|
|
109
|
+
index += 1;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (arg === "--prod") continue;
|
|
113
|
+
kept.push(arg);
|
|
114
|
+
}
|
|
115
|
+
return ["gencow", command, ...redactValues(kept), "--prod"].join(" ");
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// env set KEY=VALUE: keep the key, never print the value.
|
|
119
|
+
export function redactEnvPairs(list) {
|
|
120
|
+
return list.map((arg) => {
|
|
121
|
+
if (arg.startsWith("-") || !arg.includes("=")) return arg;
|
|
122
|
+
return `${arg.slice(0, arg.indexOf("="))}=<value>`;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// config set <key> <value>: keep the key, never print the value.
|
|
127
|
+
export function redactConfigSetValue(list) {
|
|
128
|
+
return list.map((arg, index) => (index === 2 && list[0] === "set" ? "<value>" : arg));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Message for a failed cloud target: the typed block for an explicit prod mismatch, otherwise the
|
|
132
|
+
// command's own existing text. Only the explicit reason gets the Code block.
|
|
133
|
+
export function cloudTargetRejectionMessage(rejection, { fallbackMessage, ...options }) {
|
|
134
|
+
if (rejection?.reason !== "explicit_app_not_prod_app") return fallbackMessage;
|
|
135
|
+
return renderExplicitAppNotProdAppLines({
|
|
136
|
+
explicitAppId: rejection.explicitAppId,
|
|
137
|
+
rejection,
|
|
138
|
+
...options,
|
|
139
|
+
}).join("\n");
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// `--prod --app <id>` on a project with a prod app must name that prod app. Returns true when the
|
|
143
|
+
// target is accepted; otherwise prints a typed rejection and exits before any app or metadata change.
|
|
144
|
+
export function checkExplicitProdAppTarget({ explicitAppId, prodApp, errorImpl, exitImpl }) {
|
|
145
|
+
const prodTarget = resolveProdAppTarget({ explicitAppId, prodApp });
|
|
146
|
+
if (prodTarget.appId) return true;
|
|
147
|
+
errorImpl(
|
|
148
|
+
renderExplicitAppNotProdAppLines({
|
|
149
|
+
explicitAppId,
|
|
150
|
+
rejection: prodTarget,
|
|
151
|
+
}).join("\n"),
|
|
152
|
+
);
|
|
153
|
+
exitImpl(1);
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
|
|
76
157
|
export async function lookupOwnedApp({ creds, appId, environment, platformFetchImpl }) {
|
|
77
158
|
try {
|
|
78
159
|
const response = await platformFetchImpl(
|
package/lib/deploy-command.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from "./app-diagnostics.mjs";
|
|
8
8
|
import { appNotFoundDiagnostic, parseAppLookupResponse } from "./app-response-contract.mjs";
|
|
9
9
|
import { resolveCloudAppTarget } from "./cloud-targets.mjs";
|
|
10
|
+
import { cloudTargetRejectionMessage, prodRetryCommandLine } from "./deploy-app-target.mjs";
|
|
10
11
|
import { readJsonValueResponse } from "./http-response-json.mjs";
|
|
11
12
|
import { renderDeployFailureDiagnosticLines } from "./deploy-failure-diagnostic.mjs";
|
|
12
13
|
import { formatAppLogDiagnosis } from "./deploy-logs-diagnostic.mjs";
|
|
@@ -156,7 +157,14 @@ export async function handleDeployReadonlySubcommand(params) {
|
|
|
156
157
|
missingProdMessage: "No prod app yet. Run gencow deploy --prod first.",
|
|
157
158
|
});
|
|
158
159
|
if (target.error) {
|
|
159
|
-
errorImpl(
|
|
160
|
+
errorImpl(
|
|
161
|
+
cloudTargetRejectionMessage(target, {
|
|
162
|
+
fallbackMessage: target.error,
|
|
163
|
+
stage: "deploy target resolution",
|
|
164
|
+
changed: "nothing. Deployment data was only read; no app or serving state was changed.",
|
|
165
|
+
next: `${prodRetryCommandLine({ command: "deploy", args: deployArgs })} (omit --app to target this project's prod app)`,
|
|
166
|
+
}),
|
|
167
|
+
);
|
|
160
168
|
exitImpl(1);
|
|
161
169
|
return true;
|
|
162
170
|
}
|
|
@@ -233,7 +241,14 @@ export async function handleDeployReadonlySubcommand(params) {
|
|
|
233
241
|
missingProdMessage: "No prod app yet. Run gencow deploy --prod first.",
|
|
234
242
|
});
|
|
235
243
|
if (target.error) {
|
|
236
|
-
errorImpl(
|
|
244
|
+
errorImpl(
|
|
245
|
+
cloudTargetRejectionMessage(target, {
|
|
246
|
+
fallbackMessage: target.error,
|
|
247
|
+
stage: "deploy target resolution",
|
|
248
|
+
changed: "nothing. Deployment data was only read; no app or serving state was changed.",
|
|
249
|
+
next: `${prodRetryCommandLine({ command: "deploy", args: deployArgs })} (omit --app to target this project's prod app)`,
|
|
250
|
+
}),
|
|
251
|
+
);
|
|
237
252
|
exitImpl(1);
|
|
238
253
|
return true;
|
|
239
254
|
}
|
package/lib/deploy-runtime.mjs
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
releasePreparedBackendSource,
|
|
25
25
|
} from "./deploy-prepared-source.mjs";
|
|
26
26
|
import { resolveImplicitProdEnvironment } from "./cloud-targets.mjs";
|
|
27
|
+
import { checkExplicitProdAppTarget } from "./deploy-app-target.mjs";
|
|
27
28
|
|
|
28
29
|
export function parseDeployArgs(deployArgs) {
|
|
29
30
|
const parsed = {
|
|
@@ -438,6 +439,20 @@ export function createDeployCommand({
|
|
|
438
439
|
prodApp: prodAppId,
|
|
439
440
|
});
|
|
440
441
|
const rootAppId = appId;
|
|
442
|
+
// Rollback resolves its own prod target below. Every other --prod --app <id> must name the prod app,
|
|
443
|
+
// checked before resolveEnvironmentDeployTarget would otherwise replace the explicit id with prodApp.
|
|
444
|
+
if (!parsed.isRollback && parsed.envTarget === "prod" && parsed.appId && prodAppId) {
|
|
445
|
+
if (
|
|
446
|
+
!checkExplicitProdAppTarget({
|
|
447
|
+
explicitAppId: parsed.appId,
|
|
448
|
+
prodApp: prodAppId,
|
|
449
|
+
errorImpl,
|
|
450
|
+
exitImpl,
|
|
451
|
+
})
|
|
452
|
+
) {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
441
456
|
appId = resolveEnvironmentDeployTarget({ appId, envTarget: parsed.envTarget, prodAppId });
|
|
442
457
|
const backendProjectRoot = projectDir ?? projectRoot;
|
|
443
458
|
const projectConfig = loadConfigImpl
|
package/lib/domain-command.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { resolveCloudAppTarget } from "./cloud-targets.mjs";
|
|
2
|
+
import { cloudTargetRejectionMessage, prodRetryCommandLine } from "./deploy-app-target.mjs";
|
|
2
3
|
import { BOLD, CYAN, DIM, GREEN, RESET, error, info, log, success, warn } from "./output.mjs";
|
|
3
4
|
import { platformFetch, requireCreds } from "./platform-client.mjs";
|
|
4
5
|
|
|
@@ -128,8 +129,15 @@ export function createDomainCommand({
|
|
|
128
129
|
missingProdMessage: "No prod app yet. Run gencow deploy --prod first.",
|
|
129
130
|
});
|
|
130
131
|
if (target.error) {
|
|
131
|
-
errorImpl(
|
|
132
|
-
|
|
132
|
+
errorImpl(
|
|
133
|
+
cloudTargetRejectionMessage(target, {
|
|
134
|
+
fallbackMessage: target.error,
|
|
135
|
+
stage: "app target resolution",
|
|
136
|
+
changed: "nothing. No domain was connected or changed.",
|
|
137
|
+
next: `${prodRetryCommandLine({ command: "domain", args: domainArgs })} (omit --app to target this project's prod app)`,
|
|
138
|
+
}),
|
|
139
|
+
);
|
|
140
|
+
return 1;
|
|
133
141
|
}
|
|
134
142
|
const { appId, envTarget } = target;
|
|
135
143
|
const flags = parseDomainFlags(restArgs);
|
package/lib/env-command.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
resolveExplicitEnvFile,
|
|
8
8
|
} from "./backend-env-resolver.mjs";
|
|
9
9
|
import { resolveCloudAppTarget } from "./cloud-targets.mjs";
|
|
10
|
+
import { cloudTargetRejectionMessage, prodRetryCommandLine, redactConfigSetValue, redactEnvPairs } from "./deploy-app-target.mjs";
|
|
10
11
|
import { BOLD, CYAN, DIM, GREEN, RESET, error, info, log, success, warn } from "./output.mjs";
|
|
11
12
|
import { platformFetch, requireCreds } from "./platform-client.mjs";
|
|
12
13
|
|
|
@@ -248,8 +249,15 @@ export function createEnvCommand(deps = {}) {
|
|
|
248
249
|
missingProdMessage: "No prod app yet. Run gencow deploy --prod first.",
|
|
249
250
|
});
|
|
250
251
|
if (target.error) {
|
|
251
|
-
error(
|
|
252
|
-
|
|
252
|
+
error(
|
|
253
|
+
cloudTargetRejectionMessage(target, {
|
|
254
|
+
fallbackMessage: target.error,
|
|
255
|
+
stage: "env target resolution",
|
|
256
|
+
changed: "nothing. No env value was stored, changed, or read from the prod app.",
|
|
257
|
+
next: `${prodRetryCommandLine({ command: "env", args: filteredArgs, redactValues: redactEnvPairs })} (omit --app to target this project's prod app)`,
|
|
258
|
+
}),
|
|
259
|
+
);
|
|
260
|
+
return 1;
|
|
253
261
|
}
|
|
254
262
|
|
|
255
263
|
const { appId, envTarget } = target;
|
package/lib/files-command.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { existsSync, readFileSync, readdirSync, statSync } from "fs";
|
|
|
3
3
|
import { resolveProjectMetadataPath, resolveProjectSelection } from "./project-context.mjs";
|
|
4
4
|
import { getAppUrl } from "./domain-helpers.mjs";
|
|
5
5
|
import { describeProdTargetFailure, resolveProdAppTarget } from "./cloud-targets.mjs";
|
|
6
|
+
import { cloudTargetRejectionMessage, prodRetryCommandLine } from "./deploy-app-target.mjs";
|
|
6
7
|
import { BOLD, CYAN, DIM, RESET, YELLOW, error, info, log, success, warn } from "./output.mjs";
|
|
7
8
|
import { requireCreds } from "./platform-client.mjs";
|
|
8
9
|
|
|
@@ -149,18 +150,27 @@ export function createFilesCommand({
|
|
|
149
150
|
const appId = resolveFilesAppId({ explicitAppId, gencowJson, isProd });
|
|
150
151
|
|
|
151
152
|
if (isProd && !appId) {
|
|
153
|
+
const prodTarget = resolveProdAppTarget({ explicitAppId, prodApp: gencowJson?.prodApp || null });
|
|
152
154
|
errorImpl(
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
cloudTargetRejectionMessage(
|
|
156
|
+
{ ...prodTarget, explicitAppId },
|
|
157
|
+
{
|
|
158
|
+
fallbackMessage: describeProdTargetFailure(
|
|
159
|
+
prodTarget,
|
|
160
|
+
"Prod app not found. Run 'gencow deploy' first to create a prod app.",
|
|
161
|
+
),
|
|
162
|
+
stage: "files target resolution",
|
|
163
|
+
changed: "nothing. No file was uploaded, changed, or deleted.",
|
|
164
|
+
next: `${prodRetryCommandLine({ command: "files", args: filesArgs })} (omit --app to target this project's prod app)`,
|
|
165
|
+
},
|
|
156
166
|
),
|
|
157
167
|
);
|
|
158
|
-
return;
|
|
168
|
+
return 1;
|
|
159
169
|
}
|
|
160
170
|
|
|
161
171
|
if (!appId) {
|
|
162
172
|
errorImpl("App not found. Run 'gencow dev' first.");
|
|
163
|
-
return;
|
|
173
|
+
return 1;
|
|
164
174
|
}
|
|
165
175
|
|
|
166
176
|
const MAX_FILE_SIZE = 50 * 1024 * 1024;
|
package/lib/jobs-command.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "fs";
|
|
2
2
|
import { describeProdTargetFailure, resolveProdAppTarget } from "./cloud-targets.mjs";
|
|
3
|
+
import { cloudTargetRejectionMessage, prodRetryCommandLine } from "./deploy-app-target.mjs";
|
|
3
4
|
import { resolveProjectMetadataPath, resolveProjectSelection } from "./project-context.mjs";
|
|
4
5
|
import { parseDurationToMinutes } from "./domain-helpers.mjs";
|
|
5
6
|
import { BOLD, CYAN, DIM, GREEN, RED, RESET, YELLOW, error, info, log, success, warn } from "./output.mjs";
|
|
@@ -692,12 +693,22 @@ export function createJobsCommand() {
|
|
|
692
693
|
const appId = appTarget.appId;
|
|
693
694
|
|
|
694
695
|
if (parsed.isProd && !appId) {
|
|
695
|
-
error(
|
|
696
|
-
|
|
696
|
+
error(
|
|
697
|
+
cloudTargetRejectionMessage(
|
|
698
|
+
{ ...appTarget, explicitAppId: parsed.appId },
|
|
699
|
+
{
|
|
700
|
+
fallbackMessage: describeProdTargetFailure(appTarget, "No prod app yet. Run gencow deploy --prod first."),
|
|
701
|
+
stage: "jobs target resolution",
|
|
702
|
+
changed: "nothing. No job was started, changed, or cancelled.",
|
|
703
|
+
next: `${prodRetryCommandLine({ command: "jobs", args: jobsArgs })} (omit --app to target this project's prod app)`,
|
|
704
|
+
},
|
|
705
|
+
),
|
|
706
|
+
);
|
|
707
|
+
return 1;
|
|
697
708
|
}
|
|
698
709
|
if (!appId) {
|
|
699
710
|
error("App ID not found. Run gencow deploy first, or use --app <name>.");
|
|
700
|
-
return;
|
|
711
|
+
return 1;
|
|
701
712
|
}
|
|
702
713
|
|
|
703
714
|
const target = parsed.isProd ? ` ${YELLOW}(prod)${RESET}` : "";
|
package/lib/origins-command.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { resolveCloudAppTarget } from "./cloud-targets.mjs";
|
|
2
|
+
import { cloudTargetRejectionMessage, prodRetryCommandLine } from "./deploy-app-target.mjs";
|
|
2
3
|
import { loadConfig } from "./cli-project-runtime.mjs";
|
|
3
4
|
import { BOLD, CYAN, DIM, GREEN, RESET, error, info, log, success } from "./output.mjs";
|
|
4
5
|
import { platformFetch, requireCreds } from "./platform-client.mjs";
|
|
@@ -140,8 +141,15 @@ export function createOriginsCommand({
|
|
|
140
141
|
});
|
|
141
142
|
|
|
142
143
|
if (target.error) {
|
|
143
|
-
errorImpl(
|
|
144
|
-
|
|
144
|
+
errorImpl(
|
|
145
|
+
cloudTargetRejectionMessage(target, {
|
|
146
|
+
fallbackMessage: target.error,
|
|
147
|
+
stage: "app target resolution",
|
|
148
|
+
changed: "nothing. No allowed origin was changed.",
|
|
149
|
+
next: `${prodRetryCommandLine({ command: "origins", args: originArgs })} (omit --app to target this project's prod app)`,
|
|
150
|
+
}),
|
|
151
|
+
);
|
|
152
|
+
return 1;
|
|
145
153
|
}
|
|
146
154
|
|
|
147
155
|
const { appId, envTarget } = target;
|
package/lib/static-command.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { isAbsolute, resolve } from "path";
|
|
|
3
3
|
|
|
4
4
|
import { readProjectDisplayName } from "./cli-project-runtime.mjs";
|
|
5
5
|
import { formatCommandError } from "./cli-command-runner.mjs";
|
|
6
|
+
import { cloudTargetRejectionMessage, prodRetryCommandLine } from "./deploy-app-target.mjs";
|
|
6
7
|
import {
|
|
7
8
|
describeProdTargetFailure,
|
|
8
9
|
resolveImplicitProdEnvironment,
|
|
@@ -290,7 +291,20 @@ export function createStaticCommand(options = {}) {
|
|
|
290
291
|
// An explicit --app must be this project's prod app; it is never silently replaced by the default.
|
|
291
292
|
const prodTarget = resolveProdAppTarget({ explicitAppId: parsed.appId, prodApp: prodAppId });
|
|
292
293
|
if (!prodTarget.appId) {
|
|
293
|
-
errorImpl(
|
|
294
|
+
errorImpl(
|
|
295
|
+
cloudTargetRejectionMessage(
|
|
296
|
+
{ ...prodTarget, explicitAppId: parsed.appId },
|
|
297
|
+
{
|
|
298
|
+
fallbackMessage: describeProdTargetFailure(
|
|
299
|
+
prodTarget,
|
|
300
|
+
"Prod app not found. Run 'gencow deploy' first to create a prod app.",
|
|
301
|
+
),
|
|
302
|
+
stage: "static target resolution",
|
|
303
|
+
changed: "nothing. No files were uploaded and the serving state was not changed.",
|
|
304
|
+
next: `${prodRetryCommandLine({ command: "static", args: staticArgs })} (omit --app to target this project's prod app)`,
|
|
305
|
+
},
|
|
306
|
+
),
|
|
307
|
+
);
|
|
294
308
|
exitImpl(1);
|
|
295
309
|
return;
|
|
296
310
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gencow",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.265",
|
|
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",
|
|
44
43
|
"@gencow/react": "0.2.8",
|
|
45
|
-
"@gencow/
|
|
44
|
+
"@gencow/server": "0.1.3",
|
|
46
45
|
"@gencow/shared": "0.0.0",
|
|
47
|
-
"@gencow/
|
|
46
|
+
"@gencow/client": "0.2.8",
|
|
47
|
+
"@gencow/core": "0.1.47"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "node scripts/bundle-core.mjs && node scripts/bundle-shared.mjs && node scripts/bundle-server.mjs",
|