gencow 0.1.263 → 0.1.264

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.
@@ -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,25 @@ export function rejectExplicitAppNotFound({ appId, target, correlationId, errorI
73
74
  return false;
74
75
  }
75
76
 
77
+ // `--prod --app <id>` on a project with a prod app must name that prod app. Returns true when the
78
+ // target is accepted; otherwise prints a typed rejection and exits before any app or metadata change.
79
+ export function checkExplicitProdAppTarget({ explicitAppId, prodApp, errorImpl, exitImpl }) {
80
+ const prodTarget = resolveProdAppTarget({ explicitAppId, prodApp });
81
+ if (prodTarget.appId) return true;
82
+ errorImpl(
83
+ [
84
+ "Code: EXPLICIT_APP_NOT_PROD_APP",
85
+ "Stage: deploy target lookup",
86
+ `App ID: ${explicitAppId} (requested with --prod)`,
87
+ describeProdTargetFailure(prodTarget, "--app with --prod must name this project's prod app."),
88
+ "Changed: nothing. No app was created or deployed, gencow.json was not modified, and app data and the serving state were not changed.",
89
+ "Next: gencow deploy --prod (deploys to this project's prod app)",
90
+ ].join("\n"),
91
+ );
92
+ exitImpl(1);
93
+ return false;
94
+ }
95
+
76
96
  export async function lookupOwnedApp({ creds, appId, environment, platformFetchImpl }) {
77
97
  try {
78
98
  const response = await platformFetchImpl(
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gencow",
3
- "version": "0.1.263",
3
+ "version": "0.1.264",
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",
44
+ "@gencow/client": "0.2.8",
45
45
  "@gencow/core": "0.1.47",
46
- "@gencow/shared": "0.0.0",
47
- "@gencow/server": "0.1.3"
46
+ "@gencow/server": "0.1.3",
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",