gencow 0.1.196 → 0.1.198

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.
@@ -51,6 +51,10 @@ function normalizeBackendRootDir(pathValue) {
51
51
  function resolveConfiguredBackendRoot(projectConfig) {
52
52
  return normalizeBackendRootDir(projectConfig?.rootDir ?? projectConfig?.functionsDir ?? "gencow");
53
53
  }
54
+
55
+ export function isExplicitEmptyBackendApi(source) {
56
+ return /\bdefineApi\s*\(\s*\{\s*procedures\s*:\s*\{\s*\}\s*,?\s*\}\s*\)\s*;?\s*$/u.test(source);
57
+ }
54
58
  async function loadProjectConfigForDeploy({
55
59
  cwd,
56
60
  existsSyncImpl,
@@ -326,6 +330,31 @@ export function createDeployPackageRuntime({
326
330
  return runMigrationGenerate();
327
331
  }
328
332
 
333
+ async function preflightBackendCapability() {
334
+ const cwd = cwdImpl();
335
+ const projectConfig = await loadProjectConfigForDeploy({
336
+ cwd,
337
+ existsSyncImpl,
338
+ readFileSyncImpl,
339
+ resolvePathImpl,
340
+ statSyncImpl,
341
+ warnImpl,
342
+ errorImpl,
343
+ loadConfigImpl,
344
+ throwOnInvalid: false,
345
+ });
346
+ const entryPoint = resolvePathImpl(cwd, resolveConfiguredBackendRoot(projectConfig), "index.ts");
347
+ if (!existsSyncImpl(entryPoint) || !isExplicitEmptyBackendApi(readFileSyncImpl(entryPoint, "utf8"))) {
348
+ return true;
349
+ }
350
+ errorImpl(
351
+ "BACKEND_CAPABILITY_EMPTY: this backend registers no query, mutation, or procedure; deployment stopped before upload.",
352
+ );
353
+ infoImpl("Add a backend procedure, or use gencow static <build-directory> for a frontend-only app.");
354
+ exitImpl(1);
355
+ return false;
356
+ }
357
+
329
358
  async function packageDeployProject({
330
359
  forceDeploy,
331
360
  existingBundleMode = false,
@@ -361,6 +390,8 @@ export function createDeployPackageRuntime({
361
390
  return null;
362
391
  }
363
392
 
393
+ const entryPoint = resolvePathImpl(cwd, backendRoot, "index.ts");
394
+
364
395
  await runWorkflowShadowingAudit({ cwd, projectConfig, backendRoot });
365
396
 
366
397
  let dependencyAuditManifest = null;
@@ -404,7 +435,6 @@ export function createDeployPackageRuntime({
404
435
  const { auditDeployDependencies, formatAuditError } = await (
405
436
  loadDeployAuditorImpl ?? loadDeployAuditorDefault
406
437
  )();
407
- const entryPoint = resolvePathImpl(cwd, backendRoot, "index.ts");
408
438
  if (existsSyncImpl(entryPoint)) {
409
439
  const auditResult = await auditDeployDependencies(entryPoint);
410
440
  const auditMessage = formatAuditError(auditResult);
@@ -747,6 +777,7 @@ export function createDeployPackageRuntime({
747
777
 
748
778
  return {
749
779
  runMigrationGenerate,
780
+ preflightBackendCapability,
750
781
  prepareDeployProjectSource,
751
782
  packageDeployProject,
752
783
  createCloudAppIfNeeded,
@@ -87,31 +87,15 @@ export async function deployBackendPackage({
87
87
  sourceRoot = null,
88
88
  clientName = null,
89
89
  }) {
90
+ if ((await activePackageRuntime.preflightBackendCapability?.()) === false) return null;
90
91
  const preparedGeneratorVersion = await activePackageRuntime.prepareDeployProjectSource?.({
91
92
  existingBundleMode,
92
93
  });
93
- const activeAppId = await activePackageRuntime.createCloudAppIfNeeded({
94
- creds,
95
- appId,
96
- displayName,
97
- gencowJsonPath,
98
- });
99
- if (!activeAppId) return null;
100
-
101
- const releaseAttempt = prepareReleaseAttempt
102
- ? await prepareReleaseAttempt({ appId: activeAppId, sourceRoot })
103
- : null;
104
- const markAttemptFailed = async (failureStage, failureCode) => {
105
- if (!releaseAttempt || !failReleaseAttempt) return;
106
- await failReleaseAttempt({
107
- appId: activeAppId,
108
- attemptId: releaseAttempt.attemptId,
109
- failureStage,
110
- failureCode,
111
- }).catch(() => {});
112
- };
113
94
  let packageResult = null;
114
95
  let deployed = null;
96
+ let activeAppId = null;
97
+ let releaseAttempt = null;
98
+ let markAttemptFailed = async () => {};
115
99
 
116
100
  try {
117
101
  packageResult = await activePackageRuntime.packageDeployProject({
@@ -126,6 +110,27 @@ export async function deployBackendPackage({
126
110
  return null;
127
111
  }
128
112
 
113
+ activeAppId = await activePackageRuntime.createCloudAppIfNeeded({
114
+ creds,
115
+ appId,
116
+ displayName,
117
+ gencowJsonPath,
118
+ });
119
+ if (!activeAppId) return null;
120
+
121
+ releaseAttempt = prepareReleaseAttempt
122
+ ? await prepareReleaseAttempt({ appId: activeAppId, sourceRoot })
123
+ : null;
124
+ markAttemptFailed = async (failureStage, failureCode) => {
125
+ if (!releaseAttempt || !failReleaseAttempt) return;
126
+ await failReleaseAttempt({
127
+ appId: activeAppId,
128
+ attemptId: releaseAttempt.attemptId,
129
+ failureStage,
130
+ failureCode,
131
+ }).catch(() => {});
132
+ };
133
+
129
134
  deployed = await activePackageRuntime.deployBundleWithRetry({
130
135
  creds,
131
136
  appId: activeAppId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gencow",
3
- "version": "0.1.196",
3
+ "version": "0.1.198",
4
4
  "description": "Gencow — AI Backend Engine",
5
5
  "type": "module",
6
6
  "bin": {
@@ -19,16 +19,8 @@
19
19
  "scripts/",
20
20
  "dashboard/"
21
21
  ],
22
- "scripts": {
23
- "prebuild": "pnpm --filter @gencow/migration-contract run build && pnpm --filter @gencow/server run build",
24
- "build": "node scripts/bundle-core.mjs && node scripts/bundle-internal.mjs && node scripts/bundle-server.mjs",
25
- "build:runtime-bundles": "node scripts/bundle-core.mjs && node scripts/bundle-server.mjs",
26
- "test:coverage": "node ../../scripts/run-package-coverage.mjs",
27
- "coverage:compare": "node ../../scripts/compare-package-coverage.mjs",
28
- "prepublishOnly": "npm run build && node scripts/pre-publish-check.mjs"
29
- },
30
22
  "dependencies": {
31
- "@gencow/migration-contract": "workspace:*",
23
+ "@gencow/migration-contract": "0.1.12",
32
24
  "@modelcontextprotocol/sdk": "^1.29.0",
33
25
  "drizzle-kit": "1.0.0-rc.4",
34
26
  "drizzle-orm": "1.0.0-rc.4",
@@ -39,10 +31,17 @@
39
31
  "zod": "^4.4.3"
40
32
  },
41
33
  "devDependencies": {
42
- "@gencow/client": "workspace:*",
43
- "@gencow/core": "workspace:*",
44
- "@gencow/react": "workspace:*",
45
34
  "@types/node": "^25.9.5",
46
- "better-auth": "^1.6.23"
35
+ "better-auth": "^1.6.23",
36
+ "@gencow/client": "0.2.6",
37
+ "@gencow/react": "0.2.6",
38
+ "@gencow/core": "0.1.42"
39
+ },
40
+ "scripts": {
41
+ "prebuild": "pnpm --filter @gencow/migration-contract run build && pnpm --filter @gencow/server run build",
42
+ "build": "node scripts/bundle-core.mjs && node scripts/bundle-internal.mjs && node scripts/bundle-server.mjs",
43
+ "build:runtime-bundles": "node scripts/bundle-core.mjs && node scripts/bundle-server.mjs",
44
+ "test:coverage": "node ../../scripts/run-package-coverage.mjs",
45
+ "coverage:compare": "node ../../scripts/compare-package-coverage.mjs"
47
46
  }
48
- }
47
+ }