gencow 0.1.197 → 0.1.199
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/deploy-package-runtime.mjs +35 -1
- package/lib/deploy-static-fullstack-runtime.mjs +25 -20
- package/package.json +13 -14
- package/runtime/server.mjs +1223 -1166
- package/server/index.js.map +0 -7
|
@@ -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,34 @@ 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 deploy stopped before upload because this project registers no query, mutation, or procedure.",
|
|
352
|
+
);
|
|
353
|
+
infoImpl("Code: BACKEND_CAPABILITY_EMPTY");
|
|
354
|
+
infoImpl("Stage: candidate");
|
|
355
|
+
infoImpl("Next action: EDIT_AND_CHECK");
|
|
356
|
+
infoImpl("Add a backend procedure, or use gencow static <build-directory> for a frontend-only app.");
|
|
357
|
+
exitImpl(1);
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
360
|
+
|
|
329
361
|
async function packageDeployProject({
|
|
330
362
|
forceDeploy,
|
|
331
363
|
existingBundleMode = false,
|
|
@@ -361,6 +393,8 @@ export function createDeployPackageRuntime({
|
|
|
361
393
|
return null;
|
|
362
394
|
}
|
|
363
395
|
|
|
396
|
+
const entryPoint = resolvePathImpl(cwd, backendRoot, "index.ts");
|
|
397
|
+
|
|
364
398
|
await runWorkflowShadowingAudit({ cwd, projectConfig, backendRoot });
|
|
365
399
|
|
|
366
400
|
let dependencyAuditManifest = null;
|
|
@@ -404,7 +438,6 @@ export function createDeployPackageRuntime({
|
|
|
404
438
|
const { auditDeployDependencies, formatAuditError } = await (
|
|
405
439
|
loadDeployAuditorImpl ?? loadDeployAuditorDefault
|
|
406
440
|
)();
|
|
407
|
-
const entryPoint = resolvePathImpl(cwd, backendRoot, "index.ts");
|
|
408
441
|
if (existsSyncImpl(entryPoint)) {
|
|
409
442
|
const auditResult = await auditDeployDependencies(entryPoint);
|
|
410
443
|
const auditMessage = formatAuditError(auditResult);
|
|
@@ -747,6 +780,7 @@ export function createDeployPackageRuntime({
|
|
|
747
780
|
|
|
748
781
|
return {
|
|
749
782
|
runMigrationGenerate,
|
|
783
|
+
preflightBackendCapability,
|
|
750
784
|
prepareDeployProjectSource,
|
|
751
785
|
packageDeployProject,
|
|
752
786
|
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.
|
|
3
|
+
"version": "0.1.199",
|
|
4
4
|
"description": "Gencow — AI Backend Engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -19,14 +19,6 @@
|
|
|
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
23
|
"@gencow/migration-contract": "0.1.12",
|
|
32
24
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
@@ -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/core": "0.1.42",
|
|
38
|
+
"@gencow/react": "0.2.6"
|
|
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
|
+
}
|