@runa-ai/runa-cli 0.5.68 → 0.5.69
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/dist/commands/ci/commands/ci-prod-db-operations.d.ts +15 -0
- package/dist/commands/ci/commands/ci-prod-db-operations.d.ts.map +1 -1
- package/dist/commands/ci/commands/ci-prod-workflow.d.ts.map +1 -1
- package/dist/commands/db/commands/db-schema.d.ts.map +1 -1
- package/dist/commands/template-check/config.d.ts.map +1 -1
- package/dist/index.js +85 -17
- package/package.json +2 -2
|
@@ -40,6 +40,21 @@ export interface InitialDeploymentCheck {
|
|
|
40
40
|
* @returns Detection result with details
|
|
41
41
|
*/
|
|
42
42
|
export declare function checkIfInitialDeployment(repoRoot: string, productionDbUrl: string): InitialDeploymentCheck;
|
|
43
|
+
/**
|
|
44
|
+
* Check if there are any schema changes between origin/main and HEAD.
|
|
45
|
+
* Uses git diff --quiet (exit 1 = changes exist, exit 0 = no changes).
|
|
46
|
+
*
|
|
47
|
+
* Returns:
|
|
48
|
+
* - true: schema changes detected
|
|
49
|
+
* - false: no schema changes (confirmed via git diff)
|
|
50
|
+
* - null: unable to determine (no schema dir found, or git error)
|
|
51
|
+
* Callers should treat null as "unknown" and NOT skip steps.
|
|
52
|
+
*
|
|
53
|
+
* Detection order (SQL-First Architecture):
|
|
54
|
+
* 1. supabase/schemas/declarative/ + idempotent/ (SSOT)
|
|
55
|
+
* 2. Drizzle TypeScript schemas (legacy fallback)
|
|
56
|
+
*/
|
|
57
|
+
export declare function hasSchemaChanges(repoRoot: string): boolean | null;
|
|
43
58
|
export declare function showSchemaDiff(repoRoot: string, tmpDir: string): Promise<void>;
|
|
44
59
|
/**
|
|
45
60
|
* Detect risky schema changes via git diff analysis.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-prod-db-operations.d.ts","sourceRoot":"","sources":["../../../../src/commands/ci/commands/ci-prod-db-operations.ts"],"names":[],"mappings":"AAAA;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Z,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB,GACA,OAAO,CAAC,IAAI,CAAC,CA4Bf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-prod-workflow.d.ts","sourceRoot":"","sources":["../../../../src/commands/ci/commands/ci-prod-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"ci-prod-workflow.d.ts","sourceRoot":"","sources":["../../../../src/commands/ci/commands/ci-prod-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAcxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AA2BnE,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;IAC1C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA6B;gBAErC,IAAI,EAAE;QAChB,OAAO,EAAE,wBAAwB,CAAC;QAClC,MAAM,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;QAC3C,OAAO,EAAE,SAAS,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,eAAe,CAAC;KACzB;IAsNK,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAoB3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-schema.d.ts","sourceRoot":"","sources":["../../../../src/commands/db/commands/db-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAiBH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;iBAInC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,SA2CxB,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"db-schema.d.ts","sourceRoot":"","sources":["../../../../src/commands/db/commands/db-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAiBH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;iBAInC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,SA2CxB,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,YAAY,SA6ErB,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,YAAY,SAgDrB,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,eAAe,SAyCxB,CAAC;AAEL;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,SAgEpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/commands/template-check/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,2CAA4C,CAAC;AAMzE;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/commands/template-check/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,2CAA4C,CAAC;AAMzE;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAyEnC,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAwDvC,CAAC;AAMX;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EvB,CAAC;AAMX;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,EAAE,SAAS,MAAM,EA6DjD,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1161,7 +1161,7 @@ var CLI_VERSION, HAS_ADMIN_COMMAND;
|
|
|
1161
1161
|
var init_version = __esm({
|
|
1162
1162
|
"src/version.ts"() {
|
|
1163
1163
|
init_esm_shims();
|
|
1164
|
-
CLI_VERSION = "0.5.
|
|
1164
|
+
CLI_VERSION = "0.5.69";
|
|
1165
1165
|
HAS_ADMIN_COMMAND = false;
|
|
1166
1166
|
}
|
|
1167
1167
|
});
|
|
@@ -10360,6 +10360,49 @@ function checkIfInitialDeployment(repoRoot, productionDbUrl) {
|
|
|
10360
10360
|
};
|
|
10361
10361
|
}
|
|
10362
10362
|
}
|
|
10363
|
+
function hasSchemaChanges(repoRoot) {
|
|
10364
|
+
const declarativeSqlPath = path12__default.join(repoRoot, "supabase/schemas/declarative");
|
|
10365
|
+
const idempotentSqlPath = path12__default.join(repoRoot, "supabase/schemas/idempotent");
|
|
10366
|
+
if (existsSync(declarativeSqlPath) || existsSync(idempotentSqlPath)) {
|
|
10367
|
+
const diffPaths = [
|
|
10368
|
+
...existsSync(declarativeSqlPath) ? ["supabase/schemas/declarative/"] : [],
|
|
10369
|
+
...existsSync(idempotentSqlPath) ? ["supabase/schemas/idempotent/"] : []
|
|
10370
|
+
];
|
|
10371
|
+
const result = spawnSync(
|
|
10372
|
+
"git",
|
|
10373
|
+
["diff", "--quiet", "origin/main", "HEAD", "--", ...diffPaths],
|
|
10374
|
+
{
|
|
10375
|
+
cwd: repoRoot,
|
|
10376
|
+
stdio: "ignore",
|
|
10377
|
+
timeout: 3e4
|
|
10378
|
+
}
|
|
10379
|
+
);
|
|
10380
|
+
if (result.error || result.signal === "SIGTERM") {
|
|
10381
|
+
return null;
|
|
10382
|
+
}
|
|
10383
|
+
return result.status !== 0;
|
|
10384
|
+
}
|
|
10385
|
+
const detected = detectDatabasePackage(repoRoot);
|
|
10386
|
+
if (detected) {
|
|
10387
|
+
const schemaPath = path12__default.join(detected, "src", "schema");
|
|
10388
|
+
if (existsSync(path12__default.join(repoRoot, schemaPath))) {
|
|
10389
|
+
const result = spawnSync(
|
|
10390
|
+
"git",
|
|
10391
|
+
["diff", "--quiet", "origin/main", "HEAD", "--", `${schemaPath}/`],
|
|
10392
|
+
{
|
|
10393
|
+
cwd: repoRoot,
|
|
10394
|
+
stdio: "ignore",
|
|
10395
|
+
timeout: 3e4
|
|
10396
|
+
}
|
|
10397
|
+
);
|
|
10398
|
+
if (result.error || result.signal === "SIGTERM") {
|
|
10399
|
+
return null;
|
|
10400
|
+
}
|
|
10401
|
+
return result.status !== 0;
|
|
10402
|
+
}
|
|
10403
|
+
}
|
|
10404
|
+
return null;
|
|
10405
|
+
}
|
|
10363
10406
|
async function showSchemaDiff(repoRoot, tmpDir) {
|
|
10364
10407
|
const diffLog = path12__default.join(tmpDir, "schema-diff.log");
|
|
10365
10408
|
const safeEnv = getSafeEnv();
|
|
@@ -11076,6 +11119,14 @@ var CiProdApplyWorkflow = class {
|
|
|
11076
11119
|
description: "Show schema diff",
|
|
11077
11120
|
run: async (ctx) => {
|
|
11078
11121
|
await showSchemaDiff(ctx.repoRoot, ctx.tmpDir);
|
|
11122
|
+
ctx.hasSchemaChanges = hasSchemaChanges(ctx.repoRoot);
|
|
11123
|
+
if (ctx.hasSchemaChanges === false) {
|
|
11124
|
+
ctx.logger.info("No schema changes detected \u2014 schema apply steps will be skipped");
|
|
11125
|
+
} else if (ctx.hasSchemaChanges === null) {
|
|
11126
|
+
ctx.logger.warn(
|
|
11127
|
+
"Could not determine schema changes (schema dir not found or git error). Proceeding with all steps."
|
|
11128
|
+
);
|
|
11129
|
+
}
|
|
11079
11130
|
}
|
|
11080
11131
|
},
|
|
11081
11132
|
{
|
|
@@ -11111,7 +11162,11 @@ var CiProdApplyWorkflow = class {
|
|
|
11111
11162
|
{
|
|
11112
11163
|
id: "detect-risks",
|
|
11113
11164
|
description: "Detect risky schema changes",
|
|
11114
|
-
shouldSkip: (ctx) =>
|
|
11165
|
+
shouldSkip: (ctx) => {
|
|
11166
|
+
if (ctx.skipRisksReason) return { reason: ctx.skipRisksReason };
|
|
11167
|
+
if (ctx.hasSchemaChanges === false) return { reason: "No schema changes detected" };
|
|
11168
|
+
return null;
|
|
11169
|
+
},
|
|
11115
11170
|
run: async (ctx) => {
|
|
11116
11171
|
await detectRisks(ctx.repoRoot, ctx.tmpDir);
|
|
11117
11172
|
}
|
|
@@ -11119,6 +11174,7 @@ var CiProdApplyWorkflow = class {
|
|
|
11119
11174
|
{
|
|
11120
11175
|
id: "snapshot",
|
|
11121
11176
|
description: "Create pre-deploy snapshot",
|
|
11177
|
+
shouldSkip: (ctx) => ctx.hasSchemaChanges === false ? { reason: "No schema changes to snapshot" } : null,
|
|
11122
11178
|
run: async (ctx) => {
|
|
11123
11179
|
await snapshotCreate(
|
|
11124
11180
|
ctx.repoRoot,
|
|
@@ -11131,6 +11187,7 @@ var CiProdApplyWorkflow = class {
|
|
|
11131
11187
|
{
|
|
11132
11188
|
id: "repair-timestamps",
|
|
11133
11189
|
description: "Repair timestamp invariants",
|
|
11190
|
+
shouldSkip: (ctx) => ctx.hasSchemaChanges === false ? { reason: "No schema changes" } : null,
|
|
11134
11191
|
run: async (ctx) => {
|
|
11135
11192
|
await repairTimestampInvariants({
|
|
11136
11193
|
repoRoot: ctx.repoRoot,
|
|
@@ -11143,6 +11200,7 @@ var CiProdApplyWorkflow = class {
|
|
|
11143
11200
|
{
|
|
11144
11201
|
id: "apply-schema",
|
|
11145
11202
|
description: "Apply production schema",
|
|
11203
|
+
shouldSkip: (ctx) => ctx.hasSchemaChanges === false ? { reason: "No schema changes to apply" } : null,
|
|
11146
11204
|
run: async (ctx) => {
|
|
11147
11205
|
try {
|
|
11148
11206
|
ctx.schemaApplyResult = await applyProductionSchema(
|
|
@@ -15199,8 +15257,8 @@ function generateProductionPreviewSection(prodPreview, schemaDrift, schemaStats)
|
|
|
15199
15257
|
if (indexWarning.length > 0) return indexWarning;
|
|
15200
15258
|
return ["**\u672C\u756A\u30D7\u30EC\u30D3\u30E5\u30FC**: \u2705 \u672C\u756A\u306B\u9069\u7528\u3059\u308B\u30B9\u30AD\u30FC\u30DE\u5909\u66F4\u306F\u3042\u308A\u307E\u305B\u3093", ""];
|
|
15201
15259
|
}
|
|
15202
|
-
function shouldShowDeployButton(productionPreview, schemaDrift,
|
|
15203
|
-
if (
|
|
15260
|
+
function shouldShowDeployButton(productionPreview, schemaDrift, hasSchemaChanges2) {
|
|
15261
|
+
if (hasSchemaChanges2) return true;
|
|
15204
15262
|
if (productionPreview?.error) return true;
|
|
15205
15263
|
if (!productionPreview?.executed && schemaDrift?.gitDiff?.filesChanged?.length) return true;
|
|
15206
15264
|
return false;
|
|
@@ -15210,16 +15268,16 @@ function generateDeploySection(exitCode, layerResults, gitBranchName, production
|
|
|
15210
15268
|
const deployWorkflowUrl = env2.repository ? `${env2.serverUrl}/${env2.repository}/actions/workflows/deploy-db.yml` : null;
|
|
15211
15269
|
const hasPgSchemaDiffChanges = productionPreview?.hasChanges === true;
|
|
15212
15270
|
const hasIndexChanges = schemaStats?.local && schemaStats?.production ? hasIndexDiff(compareIndexLists(schemaStats.local, schemaStats.production)) : false;
|
|
15213
|
-
const
|
|
15214
|
-
const headerEmoji =
|
|
15215
|
-
const headerText =
|
|
15271
|
+
const hasSchemaChanges2 = hasPgSchemaDiffChanges || hasIndexChanges;
|
|
15272
|
+
const headerEmoji = hasSchemaChanges2 ? "\u{1F6A8}" : "\u{1F680}";
|
|
15273
|
+
const headerText = hasSchemaChanges2 ? "\u672C\u756A\u30C7\u30D7\u30ED\u30A4 (\u30B9\u30AD\u30FC\u30DE\u5909\u66F4\u3042\u308A!)" : "\u672C\u756A\u30C7\u30D7\u30ED\u30A4";
|
|
15216
15274
|
const lines = ["---", "", `### ${headerEmoji} ${headerText}`, ""];
|
|
15217
15275
|
if (exitCode !== 0)
|
|
15218
15276
|
lines.push("> **\u6CE8**: Layer 4 (E2E) \u306F\u5931\u6557\u3057\u307E\u3057\u305F\u304C\u3001\u30B9\u30AD\u30FC\u30DE\u5909\u66F4\u306F\u30C7\u30D7\u30ED\u30A4\u53EF\u80FD\u3067\u3059\u3002", "");
|
|
15219
15277
|
lines.push(...generateProductionPreviewSection(productionPreview, schemaDrift, schemaStats));
|
|
15220
|
-
const showButton = shouldShowDeployButton(productionPreview, schemaDrift,
|
|
15278
|
+
const showButton = shouldShowDeployButton(productionPreview, schemaDrift, hasSchemaChanges2);
|
|
15221
15279
|
if (deployWorkflowUrl && showButton) {
|
|
15222
|
-
const buttonText =
|
|
15280
|
+
const buttonText = hasSchemaChanges2 ? "\u26A1 \u30B9\u30AD\u30FC\u30DE\u5909\u66F4\u3092\u672C\u756A\u306B\u30C7\u30D7\u30ED\u30A4" : "\u25B6\uFE0F \u672C\u756A\u306B\u30C7\u30D7\u30ED\u30A4";
|
|
15223
15281
|
lines.push(
|
|
15224
15282
|
`**\u30C7\u30D7\u30ED\u30A4\u30D6\u30E9\u30F3\u30C1**: \`${gitBranchName}\``,
|
|
15225
15283
|
"",
|
|
@@ -27793,17 +27851,23 @@ var risksCommand = new Command("risks").description("Detect risky schema changes
|
|
|
27793
27851
|
throw error;
|
|
27794
27852
|
}
|
|
27795
27853
|
const cause = error instanceof Error ? error.message : String(error);
|
|
27854
|
+
const hints = ["Review schema changes", "Consider safer migration strategy", ""];
|
|
27855
|
+
if (cause.includes("script not found") || cause.includes("SDK script")) {
|
|
27856
|
+
hints.push("The detect-risks.sh script may not be installed correctly.");
|
|
27857
|
+
hints.push("Try: pnpm install @runa-ai/runa");
|
|
27858
|
+
} else if (cause.includes("No common ancestor") || cause.includes("INITIAL DEPLOYMENT")) {
|
|
27859
|
+
hints.push("This appears to be an initial deployment (no baseline).");
|
|
27860
|
+
hints.push(" --skip flag: runa db risks --skip");
|
|
27861
|
+
hints.push(" Environment: RUNA_SKIP_SCHEMA_RISK=1");
|
|
27862
|
+
} else {
|
|
27863
|
+
hints.push("If this is an initial deployment:");
|
|
27864
|
+
hints.push(" --skip flag: runa db risks --skip");
|
|
27865
|
+
hints.push(" Environment: RUNA_SKIP_SCHEMA_RISK=1");
|
|
27866
|
+
}
|
|
27796
27867
|
throw new CLIError(
|
|
27797
27868
|
`Risk analysis failed: ${cause}`,
|
|
27798
27869
|
"RISK_ANALYSIS_FAILED",
|
|
27799
|
-
|
|
27800
|
-
"Review schema changes",
|
|
27801
|
-
"Consider safer migration strategy",
|
|
27802
|
-
"",
|
|
27803
|
-
"If this is an initial deployment:",
|
|
27804
|
-
" --skip flag: runa db risks --skip",
|
|
27805
|
-
" Environment: RUNA_SKIP_SCHEMA_RISK=1"
|
|
27806
|
-
],
|
|
27870
|
+
hints,
|
|
27807
27871
|
error instanceof Error ? error : void 0
|
|
27808
27872
|
);
|
|
27809
27873
|
}
|
|
@@ -37021,6 +37085,10 @@ var RUNA_ONLY_FILES = [
|
|
|
37021
37085
|
".github/workflows/runa-templates.yml",
|
|
37022
37086
|
// Template validation (pj-repos don't have templates)
|
|
37023
37087
|
// === runa-repo Specific Scripts ===
|
|
37088
|
+
"packages/database/scripts/db-sync-partition.ts",
|
|
37089
|
+
// Partition defense (TODO: add to template)
|
|
37090
|
+
"packages/database/scripts/db-sync-partition.test.ts",
|
|
37091
|
+
// Partition defense tests
|
|
37024
37092
|
"packages/database/scripts/check-plpgsql.ts",
|
|
37025
37093
|
"packages/database/scripts/run-splinter.ts",
|
|
37026
37094
|
"packages/database/scripts/seed-generators/index.ts",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runa-ai/runa-cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.69",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "AI-powered DevOps CLI",
|
|
6
6
|
"type": "module",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"typescript": "5.9.3",
|
|
54
54
|
"xstate": "5.28.0",
|
|
55
55
|
"zod": "4.3.6",
|
|
56
|
-
"@runa-ai/runa": "0.5.
|
|
56
|
+
"@runa-ai/runa": "0.5.69",
|
|
57
57
|
"@runa-ai/runa-xstate-test-plugin": "0.5.58"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|