@everystack/cli 0.4.60 → 0.4.61

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.
Files changed (116) hide show
  1. package/package.json +2 -2
  2. package/src/backfill.ts +3 -3
  3. package/src/cli/alter-type-dependents.ts +1 -1
  4. package/src/cli/apply-authority.ts +1 -1
  5. package/src/cli/apply-execute.ts +10 -10
  6. package/src/cli/audit-api.ts +4 -4
  7. package/src/cli/audit-source-api.ts +2 -2
  8. package/src/cli/authz-adoption-class.ts +4 -4
  9. package/src/cli/authz-baseline.ts +2 -2
  10. package/src/cli/authz-canonical.ts +2 -2
  11. package/src/cli/authz-compile.ts +3 -3
  12. package/src/cli/authz-contract-io.ts +2 -2
  13. package/src/cli/authz-contract.ts +4 -4
  14. package/src/cli/authz-derive.ts +2 -2
  15. package/src/cli/authz-identity.ts +1 -1
  16. package/src/cli/authz-ownership.ts +1 -1
  17. package/src/cli/authz-reconcile.ts +4 -4
  18. package/src/cli/authz-redteam.ts +1 -1
  19. package/src/cli/authz-render.ts +2 -2
  20. package/src/cli/aws.ts +53 -4
  21. package/src/cli/backfill.ts +3 -3
  22. package/src/cli/branch-db.ts +5 -5
  23. package/src/cli/bundle-weight.ts +2 -2
  24. package/src/cli/commands/analyze.ts +2 -2
  25. package/src/cli/commands/audit.ts +10 -10
  26. package/src/cli/commands/bundle.ts +6 -6
  27. package/src/cli/commands/cache.ts +75 -3
  28. package/src/cli/commands/console.ts +6 -6
  29. package/src/cli/commands/db-apply.ts +25 -25
  30. package/src/cli/commands/db-approvers.ts +4 -4
  31. package/src/cli/commands/db-authz.ts +15 -15
  32. package/src/cli/commands/db-backfill.ts +10 -10
  33. package/src/cli/commands/db-backup.ts +7 -7
  34. package/src/cli/commands/db-branch.ts +8 -8
  35. package/src/cli/commands/db-build.ts +7 -7
  36. package/src/cli/commands/db-check.ts +16 -16
  37. package/src/cli/commands/db-diff.ts +6 -6
  38. package/src/cli/commands/db-exec.ts +8 -8
  39. package/src/cli/commands/db-export.ts +10 -10
  40. package/src/cli/commands/db-fingerprint.ts +14 -14
  41. package/src/cli/commands/db-fork.ts +6 -6
  42. package/src/cli/commands/db-generate.ts +19 -19
  43. package/src/cli/commands/db-plan.ts +25 -25
  44. package/src/cli/commands/db-pull.ts +18 -18
  45. package/src/cli/commands/db-reconcile.ts +14 -14
  46. package/src/cli/commands/db-refresh.ts +7 -7
  47. package/src/cli/commands/db-snapshot.ts +5 -5
  48. package/src/cli/commands/db-swap.ts +26 -26
  49. package/src/cli/commands/db-sync.ts +18 -18
  50. package/src/cli/commands/db.ts +15 -15
  51. package/src/cli/commands/deploy.ts +39 -5
  52. package/src/cli/commands/diag.ts +4 -4
  53. package/src/cli/commands/lighthouse.ts +3 -3
  54. package/src/cli/commands/logs.ts +5 -5
  55. package/src/cli/commands/pipeline-run.ts +7 -7
  56. package/src/cli/commands/runbook.ts +5 -5
  57. package/src/cli/commands/secrets.ts +5 -5
  58. package/src/cli/commands/security-probe.ts +4 -4
  59. package/src/cli/commands/security.ts +6 -6
  60. package/src/cli/commands/status.ts +3 -3
  61. package/src/cli/commands/task-probe.ts +4 -4
  62. package/src/cli/commands/ui-audit.ts +5 -5
  63. package/src/cli/commands/update.ts +64 -8
  64. package/src/cli/component-audit.ts +5 -5
  65. package/src/cli/config.ts +2 -2
  66. package/src/cli/db-build.ts +6 -6
  67. package/src/cli/db-source.ts +2 -2
  68. package/src/cli/declared-derived.ts +5 -5
  69. package/src/cli/declared-diff.ts +5 -5
  70. package/src/cli/deploy-probe.ts +3 -3
  71. package/src/cli/derived-apply.ts +5 -5
  72. package/src/cli/derived-compile.ts +4 -4
  73. package/src/cli/derived-grants.ts +1 -1
  74. package/src/cli/derived-introspect.ts +3 -3
  75. package/src/cli/derived-lint.ts +2 -2
  76. package/src/cli/derived-plan.ts +5 -5
  77. package/src/cli/derived-render.ts +6 -6
  78. package/src/cli/direct-venue.ts +2 -2
  79. package/src/cli/discover.ts +2 -2
  80. package/src/cli/edge-plan.ts +8 -8
  81. package/src/cli/exec-digest.ts +1 -1
  82. package/src/cli/exec-execute.ts +1 -1
  83. package/src/cli/exec-log.ts +1 -1
  84. package/src/cli/exec-run.ts +2 -2
  85. package/src/cli/git-descent.ts +5 -5
  86. package/src/cli/index.ts +46 -46
  87. package/src/cli/migration-compile.ts +7 -7
  88. package/src/cli/migration-generate.ts +6 -6
  89. package/src/cli/model-api.ts +16 -16
  90. package/src/cli/model-render.ts +6 -6
  91. package/src/cli/mutation-lease.ts +1 -1
  92. package/src/cli/observability.ts +1 -1
  93. package/src/cli/refresh-execute.ts +2 -2
  94. package/src/cli/runbook/generate.ts +3 -3
  95. package/src/cli/runbook/index.ts +7 -7
  96. package/src/cli/runbook/sections.ts +2 -2
  97. package/src/cli/schema-compile.ts +4 -4
  98. package/src/cli/schema-diff.ts +1 -1
  99. package/src/cli/schema-fingerprint.ts +7 -7
  100. package/src/cli/schema-introspect.ts +3 -3
  101. package/src/cli/schema-source.ts +1 -1
  102. package/src/cli/schema-swap.ts +4 -4
  103. package/src/cli/security-catalog.ts +1 -1
  104. package/src/cli/stage-backup.ts +3 -3
  105. package/src/cli/stage-read-consistency.ts +6 -6
  106. package/src/cli/state-apply.ts +7 -7
  107. package/src/cli/swap-execute.ts +3 -3
  108. package/src/cli/swap-heartbeat.ts +1 -1
  109. package/src/cli/swap-pair.ts +7 -7
  110. package/src/cli/task-poll.ts +2 -2
  111. package/src/cli/ui-bloat.ts +1 -1
  112. package/src/cli/utils/secrets.ts +1 -1
  113. package/src/exec.ts +7 -7
  114. package/src/reconcile.ts +2 -2
  115. package/src/refresh.ts +2 -2
  116. package/src/sst.ts +1 -1
@@ -5,13 +5,13 @@ import zlib from 'node:zlib';
5
5
  import { pipeline } from 'node:stream/promises';
6
6
  import { createWriteStream } from 'node:fs';
7
7
  import { spawn } from 'node:child_process';
8
- import { resolveConfig, type CliConfig } from '../config.js';
9
- import { uploadToS3, headS3, invokeAction } from '../aws.js';
10
- import { step, success, warn, fail, info } from '../output.js';
11
- import { opsAdviceLines, IAM_ADVICE } from '../ops-advice.js';
12
- import { exportApp } from '../utils/export.js';
13
- import { walkDirectory } from '../utils/walk.js';
14
- import { loadSstSecrets } from '../utils/secrets.js';
8
+ import { resolveConfig, type CliConfig } from '../config';
9
+ import { uploadToS3, headS3, invokeAction, rollingRestart } from '../aws';
10
+ import { step, success, warn, fail, info } from '../output';
11
+ import { opsAdviceLines, IAM_ADVICE } from '../ops-advice';
12
+ import { exportApp } from '../utils/export';
13
+ import { walkDirectory } from '../utils/walk';
14
+ import { loadSstSecrets } from '../utils/secrets';
15
15
 
16
16
  /**
17
17
  * Embed an 8-char content hash in a filename for cache busting.
@@ -111,7 +111,7 @@ export async function updateCommand(flags: UpdateFlags & Record<string, string>)
111
111
  // filter that gates what reaches the bundle (see env.config.js tiers).
112
112
  // This avoids requiring `sst shell` in deploy scripts.
113
113
  try {
114
- const { parseAppName } = await import('../discover.js');
114
+ const { parseAppName } = await import('../discover');
115
115
  const appName = await parseAppName();
116
116
  const region = resolvedConfig?.region || process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION || 'us-east-1';
117
117
  step('Loading SST secrets...');
@@ -627,6 +627,27 @@ export async function updateCommand(flags: UpdateFlags & Record<string, string>)
627
627
  }
628
628
  }
629
629
 
630
+ // 6. Rolling restart — retire warm containers so they cold-start with the new bundle.
631
+ step('Restarting Lambda containers...');
632
+ try {
633
+ const { newGen } = await rollingRestart(config.region, config.apiFunctionName);
634
+ success(`Containers restarting (gen ${newGen})`);
635
+ } catch (err: any) {
636
+ warn(`Rolling restart failed: ${err.message}`);
637
+ info('Warm containers will pick up the new bundle after the 60s TTL expires.');
638
+ }
639
+
640
+ // 7. Verify the origin is serving the new release.
641
+ step('Verifying origin serves new release...');
642
+ const verified = await verifyOriginRelease(config.baseUrl, updateId);
643
+ if (verified) {
644
+ success(`Origin confirmed: ${updateId.slice(0, 12)}...`);
645
+ } else {
646
+ warn('Origin did not confirm the new release within the timeout.');
647
+ info('The release may still be propagating. Check manually:');
648
+ info(` curl -sI ${config.baseUrl} | grep x-everystack-release`);
649
+ }
650
+
630
651
  // Clean up archive
631
652
  await fs.unlink(archivePath).catch(() => {});
632
653
 
@@ -787,3 +808,38 @@ export function getExpoRouterSsrFlags(appConfig: any): {
787
808
  }
788
809
  return { useServerRendering: false, useServerDataLoaders: false };
789
810
  }
811
+
812
+ const VERIFY_CONSECUTIVE = 3;
813
+ const VERIFY_INTERVAL_MS = 2_000;
814
+ const VERIFY_TIMEOUT_MS = 30_000;
815
+
816
+ /**
817
+ * Poll the origin until N consecutive responses carry the expected updateId.
818
+ * Uses a cache-busting query param so each request reaches the Lambda origin.
819
+ * @internal Exported for testing.
820
+ */
821
+ export async function verifyOriginRelease(
822
+ baseUrl: string,
823
+ expectedUpdateId: string,
824
+ ): Promise<boolean> {
825
+ const deadline = Date.now() + VERIFY_TIMEOUT_MS;
826
+ let consecutive = 0;
827
+
828
+ while (Date.now() < deadline) {
829
+ try {
830
+ const probe = `${baseUrl}?_probe=${Date.now()}`;
831
+ const res = await fetch(probe, { redirect: 'follow' });
832
+ const release = res.headers.get('x-everystack-release');
833
+ if (release === expectedUpdateId) {
834
+ consecutive++;
835
+ if (consecutive >= VERIFY_CONSECUTIVE) return true;
836
+ } else {
837
+ consecutive = 0;
838
+ }
839
+ } catch {
840
+ consecutive = 0;
841
+ }
842
+ await new Promise((r) => setTimeout(r, VERIFY_INTERVAL_MS));
843
+ }
844
+ return false;
845
+ }
@@ -17,12 +17,12 @@
17
17
  * this file; this file imports the model, never the reverse.
18
18
  */
19
19
 
20
- import type { AuditFinding, SourceLoc } from './bundle-audit.js';
21
- import type { ComponentDescriptor, JsxNode } from './component-model.js';
22
- import { canonicalizeStyle, isDesignStyle, type UiBloatBudget } from './ui-bloat.js';
20
+ import type { AuditFinding, SourceLoc } from './bundle-audit';
21
+ import type { ComponentDescriptor, JsxNode } from './component-model';
22
+ import { canonicalizeStyle, isDesignStyle, type UiBloatBudget } from './ui-bloat';
23
23
 
24
- export { DEFAULT_UI_BLOAT_BUDGET, type UiBloatBudget } from './ui-bloat.js';
25
- import { DEFAULT_UI_BLOAT_BUDGET } from './ui-bloat.js';
24
+ export { DEFAULT_UI_BLOAT_BUDGET, type UiBloatBudget } from './ui-bloat';
25
+ import { DEFAULT_UI_BLOAT_BUDGET } from './ui-bloat';
26
26
 
27
27
  const VERIFY = 'rerun ui:audit; this finding clears when its occurrence count drops below the threshold';
28
28
 
package/src/cli/config.ts CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  import fs from 'node:fs/promises';
11
11
  import path from 'node:path';
12
- import { step } from './output.js';
12
+ import { step } from './output';
13
13
 
14
14
  export interface CliConfig {
15
15
  baseUrl: string;
@@ -91,7 +91,7 @@ export async function resolveConfig(stage?: string): Promise<CliConfig> {
91
91
  discoverConfig,
92
92
  getCachedConfig,
93
93
  setCachedConfig,
94
- } = await import('./discover.js');
94
+ } = await import('./discover');
95
95
 
96
96
  // Check cache first
97
97
  const cached = await getCachedConfig(stage);
@@ -11,13 +11,13 @@
11
11
  */
12
12
 
13
13
  import type { ModelDescriptor } from '@everystack/model';
14
- import type { TableContract, QueryRunner } from './authz-contract.js';
15
- import type { SourceObject } from './derived-source.js';
14
+ import type { TableContract, QueryRunner } from './authz-contract';
15
+ import type { SourceObject } from './derived-source';
16
16
  import type { SequenceDescriptor } from '@everystack/model';
17
- import { compileDeclaredState } from './declared-diff.js';
18
- import { createUrlRunner } from './db-source.js';
19
- import { executeSync, buildSyncReport } from './commands/db-sync.js';
20
- import { executeReconcile } from './commands/db-reconcile.js';
17
+ import { compileDeclaredState } from './declared-diff';
18
+ import { createUrlRunner } from './db-source';
19
+ import { executeSync, buildSyncReport } from './commands/db-sync';
20
+ import { executeReconcile } from './commands/db-reconcile';
21
21
 
22
22
  const SAFE_NAME = /^[a-z_][a-z0-9_$]*$/;
23
23
 
@@ -24,8 +24,8 @@
24
24
  * driver only surfaces — with instructions — when the direct path is actually used.
25
25
  */
26
26
 
27
- import type { QueryRunner } from './authz-contract.js';
28
- import { buildSearchPathSql, type SessionRunner, type SessionResult } from './session.js';
27
+ import type { QueryRunner } from './authz-contract';
28
+ import { buildSearchPathSql, type SessionRunner, type SessionResult } from './session';
29
29
 
30
30
  export type DbSource =
31
31
  | { kind: 'url'; url: string; from: 'flag' | 'env' | 'admin-env' | 'operator' }
@@ -13,11 +13,11 @@ import fs from 'node:fs/promises';
13
13
  import { pathToFileURL } from 'node:url';
14
14
  import type { Module, ModelDescriptor, SequenceDescriptor, DerivedDescriptor } from '@everystack/model';
15
15
  import { moduleGovernedRoles } from '@everystack/model';
16
- import { compileDerived } from './derived-compile.js';
17
- import { compileTableRenames, compileTableMoves } from './schema-compile.js';
18
- import type { SourceObject } from './derived-source.js';
19
- import { resolveModelsPath } from './models-path.js';
20
- import { asModelComposeError } from './ops-advice.js';
16
+ import { compileDerived } from './derived-compile';
17
+ import { compileTableRenames, compileTableMoves } from './schema-compile';
18
+ import type { SourceObject } from './derived-source';
19
+ import { resolveModelsPath } from './models-path';
20
+ import { asModelComposeError } from './ops-advice';
21
21
 
22
22
  export interface DeclaredDerived {
23
23
  /** Descriptor-compiled derived objects, in dependency order. */
@@ -27,11 +27,11 @@
27
27
  */
28
28
 
29
29
  import type { ModelDescriptor } from '@everystack/model';
30
- import type { SchemaSnapshot } from './schema-introspect.js';
31
- import type { AuthzContract } from './authz-contract.js';
32
- import { compileTableSchema, compileEnums } from './schema-compile.js';
33
- import { compileTableContract } from './authz-compile.js';
34
- import { generateMigrationSql } from './migration-generate.js';
30
+ import type { SchemaSnapshot } from './schema-introspect';
31
+ import type { AuthzContract } from './authz-contract';
32
+ import { compileTableSchema, compileEnums } from './schema-compile';
33
+ import { compileTableContract } from './authz-compile';
34
+ import { generateMigrationSql } from './migration-generate';
35
35
 
36
36
  export interface DeclaredState {
37
37
  snapshot: SchemaSnapshot;
@@ -16,9 +16,9 @@
16
16
  * and must never fail the deploy.
17
17
  */
18
18
 
19
- import { isOpsHandlerCrash } from './ops-diagnostics.js';
20
- import { diagnoseOpsCrash, importOptionalAws } from './aws.js';
21
- import { step, success, fail, info } from './output.js';
19
+ import { isOpsHandlerCrash } from './ops-diagnostics';
20
+ import { diagnoseOpsCrash, importOptionalAws } from './aws';
21
+ import { step, success, fail, info } from './output';
22
22
 
23
23
  /** The raw outcome of one probe invoke, before classification. */
24
24
  export interface ProbeOutcome {
@@ -13,11 +13,11 @@
13
13
  * the reconciler writes it and never reads it.
14
14
  */
15
15
 
16
- import { normalizeSql, parseQualified, type SourceObject } from './derived-source.js';
17
- import type { ReconcilePlan } from './derived-plan.js';
18
- import { parseGrantAttachments } from './derived-grants.js';
19
- import { quoteIdent, quoteQualified } from './pg-ident.js';
20
- import { splitFunctionIdentity } from './pg-argtypes.js';
16
+ import { normalizeSql, parseQualified, type SourceObject } from './derived-source';
17
+ import type { ReconcilePlan } from './derived-plan';
18
+ import { parseGrantAttachments } from './derived-grants';
19
+ import { quoteIdent, quoteQualified } from './pg-ident';
20
+ import { splitFunctionIdentity } from './pg-argtypes';
21
21
 
22
22
  /** SQL string literal with '' doubling (standard_conforming_strings). */
23
23
  export function escapeLiteral(value: string): string {
@@ -21,10 +21,10 @@ import type {
21
21
  ModelDescriptor, DerivedDescriptor, ViewDescriptor, MaterializedViewDescriptor,
22
22
  FunctionDescriptor, SqlDescriptor, TriggerSpec, TriggerDescriptor, Ability, SetofReturn, DependsOnRef,
23
23
  } from '@everystack/model';
24
- import { hashSourceContent, parseQualified, DECLARED_SOURCE_FILE, type Attachment, type SourceObject } from './derived-source.js';
25
- import { isPlainGrantAttachment } from './derived-grants.js';
26
- import { functionIdentity } from './pg-argtypes.js';
27
- import { findInvokerReachabilityGaps } from './derived-lint.js';
24
+ import { hashSourceContent, parseQualified, DECLARED_SOURCE_FILE, type Attachment, type SourceObject } from './derived-source';
25
+ import { isPlainGrantAttachment } from './derived-grants';
26
+ import { functionIdentity } from './pg-argtypes';
27
+ import { findInvokerReachabilityGaps } from './derived-lint';
28
28
 
29
29
  /** The provenance marker for descriptor-compiled objects (SourceObject.file). */
30
30
  const DECLARED = DECLARED_SOURCE_FILE;
@@ -23,7 +23,7 @@
23
23
  * silently half-diffed.
24
24
  */
25
25
 
26
- import type { Attachment } from './derived-source.js';
26
+ import type { Attachment } from './derived-source';
27
27
 
28
28
  export interface ParsedGrants {
29
29
  /** grantee → sorted privileges. PUBLIC present-with-[] means explicitly revoked. */
@@ -18,9 +18,9 @@
18
18
  */
19
19
 
20
20
  import { createHash } from 'node:crypto';
21
- import { IGNORED_SCHEMAS, type QueryRunner } from './authz-contract.js';
22
- import { normalizeSql, type DerivedKind } from './derived-source.js';
23
- import { INTROSPECTION_SESSION, rowsOrEmpty, type SessionRunner } from './session.js';
21
+ import { IGNORED_SCHEMAS, type QueryRunner } from './authz-contract';
22
+ import { normalizeSql, type DerivedKind } from './derived-source';
23
+ import { INTROSPECTION_SESSION, rowsOrEmpty, type SessionRunner } from './session';
24
24
 
25
25
  export interface LiveObject {
26
26
  kind: DerivedKind;
@@ -31,8 +31,8 @@ import type {
31
31
  ModelDescriptor, DerivedDescriptor, ViewDescriptor, MaterializedViewDescriptor,
32
32
  FunctionDescriptor, DependsOnRef,
33
33
  } from '@everystack/model';
34
- import { parseQualified } from './derived-source.js';
35
- import { GOVERNED_VOCABULARY } from './authz-derive.js';
34
+ import { parseQualified } from './derived-source';
35
+ import { GOVERNED_VOCABULARY } from './authz-derive';
36
36
 
37
37
  export interface DerivedAuthzGap {
38
38
  /** `schema.name` of the descriptor that fails the gate. */
@@ -24,11 +24,11 @@
24
24
  * drift report, not a silent skip.
25
25
  */
26
26
 
27
- import { type ParsedSources, type SourceObject, type DerivedKind } from './derived-source.js';
28
- import type { DerivedCatalog, LiveObject } from './derived-introspect.js';
29
- import { triggerDropSql } from './derived-apply.js';
30
- import { parseGrantAttachments, diffObjectGrants } from './derived-grants.js';
31
- import { legacyFunctionIdentity, splitFunctionIdentity } from './pg-argtypes.js';
27
+ import { type ParsedSources, type SourceObject, type DerivedKind } from './derived-source';
28
+ import type { DerivedCatalog, LiveObject } from './derived-introspect';
29
+ import { triggerDropSql } from './derived-apply';
30
+ import { parseGrantAttachments, diffObjectGrants } from './derived-grants';
31
+ import { legacyFunctionIdentity, splitFunctionIdentity } from './pg-argtypes';
32
32
 
33
33
  export type ReconcileVerb = 'create' | 'replace' | 'refresh' | 'drop' | 'baseline' | 'rebaseline' | 'prune' | 'backfill';
34
34
 
@@ -13,12 +13,12 @@
13
13
  * checklist effect, on purpose — never a silent drop.
14
14
  */
15
15
 
16
- import type { DerivedCatalog, LiveObject } from './derived-introspect.js';
17
- import type { ColumnSchema, SequenceSchema, TableSchema } from './schema-introspect.js';
18
- import { parseIndexDefinition } from './schema-introspect.js';
19
- import { modelImportPath, renderFieldLines } from './model-render.js';
20
- import { splitFunctionIdentity } from './pg-argtypes.js';
21
- import { GOVERNED_VOCABULARY, KNOWN_ROLES } from './authz-derive.js';
16
+ import type { DerivedCatalog, LiveObject } from './derived-introspect';
17
+ import type { ColumnSchema, SequenceSchema, TableSchema } from './schema-introspect';
18
+ import { parseIndexDefinition } from './schema-introspect';
19
+ import { modelImportPath, renderFieldLines } from './model-render';
20
+ import { splitFunctionIdentity } from './pg-argtypes';
21
+ import { GOVERNED_VOCABULARY, KNOWN_ROLES } from './authz-derive';
22
22
 
23
23
  export interface DerivedRenderResult {
24
24
  /** The source block: `export const … = defineView(…)` etc., dependency-ordered. */
@@ -11,8 +11,8 @@
11
11
  * never written, never exported. Callers pass it straight to createUrlRunner and drop it.
12
12
  */
13
13
 
14
- import { resolveConfig, opsFunction } from './config.js';
15
- import { invokeAction } from './aws.js';
14
+ import { resolveConfig, opsFunction } from './config';
15
+ import { invokeAction } from './aws';
16
16
 
17
17
  export interface OperatorConnection {
18
18
  /** The operator connection string — hold in memory, never print. */
@@ -13,7 +13,7 @@
13
13
 
14
14
  import fs from 'node:fs/promises';
15
15
  import path from 'node:path';
16
- import { importOptionalAws } from './aws.js';
16
+ import { importOptionalAws } from './aws';
17
17
 
18
18
  /** Mirrors CliConfig from config.ts — defined locally to avoid circular imports. */
19
19
  interface DiscoveredConfig {
@@ -285,7 +285,7 @@ export async function discoverConfig(
285
285
  // Distribution discovery is best-effort (status CDN section, cache:purge --invalidate)
286
286
  let distributionId: string | undefined;
287
287
  try {
288
- const { discoverDistribution } = await import('./discover-distribution.js');
288
+ const { discoverDistribution } = await import('./discover-distribution');
289
289
  const routerHost = lambdaResult.routerUrl
290
290
  ? new URL(lambdaResult.routerUrl).host
291
291
  : undefined;
@@ -26,14 +26,14 @@
26
26
 
27
27
  import { createHash } from 'node:crypto';
28
28
  import type { ModelDescriptor } from '@everystack/model';
29
- import type { SchemaSnapshot } from './schema-introspect.js';
30
- import type { AuthzContract } from './authz-contract.js';
31
- import { generateMigrationSql, unmodeledTables } from './migration-generate.js';
32
- import { compileTableContract } from './authz-compile.js';
33
- import { classifyGeneratedStatements, classifyDestructive, partitionStatements, renderStatementHistogram } from './state-apply.js';
34
- import { fingerprintLive, fingerprintState, fingerprintModels, governedRolesForModels, stableStringify, compareStoredFingerprint, formatChangedMessage, FINGERPRINT_VERSION } from './schema-fingerprint.js';
35
- import { compileDeclaredState } from './declared-diff.js';
36
- import { compileTableRenames, compileTableMoves } from './schema-compile.js';
29
+ import type { SchemaSnapshot } from './schema-introspect';
30
+ import type { AuthzContract } from './authz-contract';
31
+ import { generateMigrationSql, unmodeledTables } from './migration-generate';
32
+ import { compileTableContract } from './authz-compile';
33
+ import { classifyGeneratedStatements, classifyDestructive, partitionStatements, renderStatementHistogram } from './state-apply';
34
+ import { fingerprintLive, fingerprintState, fingerprintModels, governedRolesForModels, stableStringify, compareStoredFingerprint, formatChangedMessage, FINGERPRINT_VERSION } from './schema-fingerprint';
35
+ import { compileDeclaredState } from './declared-diff';
36
+ import { compileTableRenames, compileTableMoves } from './schema-compile';
37
37
 
38
38
  export const PLAN_VERSION = 2;
39
39
 
@@ -21,7 +21,7 @@
21
21
  * models?". Server-side, no CLI/model dependency: a plain string that any runner can execute.
22
22
  */
23
23
 
24
- import { escapeLiteral } from './derived-apply.js';
24
+ import { escapeLiteral } from './derived-apply';
25
25
 
26
26
  /**
27
27
  * Build the digest query. Returns SQL selecting a single `digest` column (md5 hex, or md5('')
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  import { createHash } from 'node:crypto';
18
- import { lex } from './derived-source.js';
18
+ import { lex } from './derived-source';
19
19
 
20
20
  export interface ExecIntent {
21
21
  /** sha256 of the exact file bytes — content identity + a free join to a consumer's stage sha. */
@@ -11,7 +11,7 @@
11
11
  * Mirrors everystack.backfill_log: a per-database ledger the way schema_log is a write-only memoir.
12
12
  */
13
13
 
14
- import { escapeLiteral } from './derived-apply.js';
14
+ import { escapeLiteral } from './derived-apply';
15
15
 
16
16
  export const ENSURE_EXEC_LOG_SQL: string[] = [
17
17
  'CREATE SCHEMA IF NOT EXISTS everystack',
@@ -19,8 +19,8 @@
19
19
  * (against PostgreSQL) is in __tests__/integration/exec.test.ts.
20
20
  */
21
21
 
22
- import { splitSqlStatements } from './derived-source.js';
23
- import { catalogDigestQuery } from './exec-digest.js';
22
+ import { splitSqlStatements } from './derived-source';
23
+ import { catalogDigestQuery } from './exec-digest';
24
24
 
25
25
  /** The normalized result of one statement: its rows and how many it affected. */
26
26
  export interface ExecStmtResult {
@@ -29,11 +29,11 @@ import os from 'node:os';
29
29
  import path from 'node:path';
30
30
  import { pathToFileURL } from 'node:url';
31
31
  import type { ModelDescriptor } from '@everystack/model';
32
- import type { SchemaSnapshot } from './schema-introspect.js';
33
- import type { AuthzContract } from './authz-contract.js';
34
- import { fingerprintLive } from './schema-fingerprint.js';
35
- import { predictLiveFingerprint, governedLiveFingerprint } from './edge-plan.js';
36
- import { governedRolesForModels } from './schema-fingerprint.js';
32
+ import type { SchemaSnapshot } from './schema-introspect';
33
+ import type { AuthzContract } from './authz-contract';
34
+ import { fingerprintLive } from './schema-fingerprint';
35
+ import { predictLiveFingerprint, governedLiveFingerprint } from './edge-plan';
36
+ import { governedRolesForModels } from './schema-fingerprint';
37
37
 
38
38
  /** Compile a models barrel on disk. The default rides the CLI's runtime (tsx). */
39
39
  export type ModelsLoader = (barrel: string) => Promise<ModelDescriptor[]>;
package/src/cli/index.ts CHANGED
@@ -2,51 +2,51 @@
2
2
 
3
3
  import fs from 'node:fs/promises';
4
4
  import path from 'node:path';
5
- import { updateCommand } from './commands/update.js';
6
- import { deployCommand } from './commands/deploy.js';
7
- import { certsCommand } from './commands/certs.js';
8
- import { channelsCommand } from './commands/channels.js';
9
- import { branchesCommand } from './commands/branches.js';
10
- import { dbMigrateCommand, dbSeedCommand, dbResetCommand, dbPsqlCommand, dbDoctorCommand, dbProvisionCommand } from './commands/db.js';
11
- import { dbAuthzPullCommand, dbAuthzDiffCommand, dbAuthzTestCommand, dbAuthzOwnerCommand, dbAuthzReportCommand } from './commands/db-authz.js';
12
- import { dbGenerateCommand } from './commands/db-generate.js';
13
- import { dbPullCommand } from './commands/db-pull.js';
14
- import { dbReconcileCommand } from './commands/db-reconcile.js';
15
- import { dbRefreshCommand } from './commands/db-refresh.js';
16
- import { dbFingerprintCommand } from './commands/db-fingerprint.js';
17
- import { dbSyncCommand } from './commands/db-sync.js';
18
- import { dbDiffCommand } from './commands/db-diff.js';
19
- import { dbPlanCommand } from './commands/db-plan.js';
20
- import { dbApplyCommand } from './commands/db-apply.js';
21
- import { dbCheckCommand } from './commands/db-check.js';
22
- import { dbBuildCommand } from './commands/db-build.js';
23
- import { dbApproversCommand } from './commands/db-approvers.js';
24
- import { dbBackfillCommand } from './commands/db-backfill.js';
25
- import { dbExecCommand } from './commands/db-exec.js';
26
- import { taskProbeCommand } from './commands/task-probe.js';
27
- import { pipelineRunCommand, pipelineListCommand } from './commands/pipeline-run.js';
28
- import { dbTemplateRefreshCommand, dbBranchCommand } from './commands/db-branch.js';
29
- import { dbForkCommand } from './commands/db-fork.js';
30
- import { dbSnapshotCommand, dbSnapshotsCommand } from './commands/db-snapshot.js';
31
- import { dbBackupCommand, dbBackupsCommand, dbRestoreCommand, dbBackupDownloadCommand } from './commands/db-backup.js';
32
- import { dbExportCommand } from './commands/db-export.js';
33
- import { dbSwapCommand } from './commands/db-swap.js';
34
- import { consoleCommand } from './commands/console.js';
35
- import { cachePurgeCommand } from './commands/cache.js';
36
- import { statusCommand } from './commands/status.js';
37
- import { diagCommand } from './commands/diag.js';
38
- import { analyzeSSRCommand } from './commands/analyze.js';
39
- import { logsErrorsCommand, logsTailCommand, logsQueryCommand } from './commands/logs.js';
40
- import { secretsCommand } from './commands/secrets.js';
41
- import { securityAuditCommand } from './commands/security.js';
42
- import { securityProbeCommand } from './commands/security-probe.js';
43
- import { bundleAnalyzeCommand, bundleAuditCommand } from './commands/bundle.js';
44
- import { auditLighthouseCommand } from './commands/lighthouse.js';
45
- import { auditCommand } from './commands/audit.js';
46
- import { uiAuditCommand } from './commands/ui-audit.js';
47
- import { runbookCommand } from './commands/runbook.js';
48
- import { fail } from './output.js';
49
- import { parseFlags } from './parse-flags.js';
5
+ import { updateCommand } from './commands/update';
6
+ import { deployCommand } from './commands/deploy';
7
+ import { certsCommand } from './commands/certs';
8
+ import { channelsCommand } from './commands/channels';
9
+ import { branchesCommand } from './commands/branches';
10
+ import { dbMigrateCommand, dbSeedCommand, dbResetCommand, dbPsqlCommand, dbDoctorCommand, dbProvisionCommand } from './commands/db';
11
+ import { dbAuthzPullCommand, dbAuthzDiffCommand, dbAuthzTestCommand, dbAuthzOwnerCommand, dbAuthzReportCommand } from './commands/db-authz';
12
+ import { dbGenerateCommand } from './commands/db-generate';
13
+ import { dbPullCommand } from './commands/db-pull';
14
+ import { dbReconcileCommand } from './commands/db-reconcile';
15
+ import { dbRefreshCommand } from './commands/db-refresh';
16
+ import { dbFingerprintCommand } from './commands/db-fingerprint';
17
+ import { dbSyncCommand } from './commands/db-sync';
18
+ import { dbDiffCommand } from './commands/db-diff';
19
+ import { dbPlanCommand } from './commands/db-plan';
20
+ import { dbApplyCommand } from './commands/db-apply';
21
+ import { dbCheckCommand } from './commands/db-check';
22
+ import { dbBuildCommand } from './commands/db-build';
23
+ import { dbApproversCommand } from './commands/db-approvers';
24
+ import { dbBackfillCommand } from './commands/db-backfill';
25
+ import { dbExecCommand } from './commands/db-exec';
26
+ import { taskProbeCommand } from './commands/task-probe';
27
+ import { pipelineRunCommand, pipelineListCommand } from './commands/pipeline-run';
28
+ import { dbTemplateRefreshCommand, dbBranchCommand } from './commands/db-branch';
29
+ import { dbForkCommand } from './commands/db-fork';
30
+ import { dbSnapshotCommand, dbSnapshotsCommand } from './commands/db-snapshot';
31
+ import { dbBackupCommand, dbBackupsCommand, dbRestoreCommand, dbBackupDownloadCommand } from './commands/db-backup';
32
+ import { dbExportCommand } from './commands/db-export';
33
+ import { dbSwapCommand } from './commands/db-swap';
34
+ import { consoleCommand } from './commands/console';
35
+ import { cachePurgeCommand } from './commands/cache';
36
+ import { statusCommand } from './commands/status';
37
+ import { diagCommand } from './commands/diag';
38
+ import { analyzeSSRCommand } from './commands/analyze';
39
+ import { logsErrorsCommand, logsTailCommand, logsQueryCommand } from './commands/logs';
40
+ import { secretsCommand } from './commands/secrets';
41
+ import { securityAuditCommand } from './commands/security';
42
+ import { securityProbeCommand } from './commands/security-probe';
43
+ import { bundleAnalyzeCommand, bundleAuditCommand } from './commands/bundle';
44
+ import { auditLighthouseCommand } from './commands/lighthouse';
45
+ import { auditCommand } from './commands/audit';
46
+ import { uiAuditCommand } from './commands/ui-audit';
47
+ import { runbookCommand } from './commands/runbook';
48
+ import { fail } from './output';
49
+ import { parseFlags } from './parse-flags';
50
50
 
51
51
  const args = process.argv.slice(2);
52
52
  const command = args[0];
@@ -109,7 +109,7 @@ async function main() {
109
109
  // (loadSstOutputs and resolveConfig both consult it). Use after a deploy the CLI didn't run,
110
110
  // or whenever a stage command resolves to the wrong function.
111
111
  if (flags.refresh && flags.stage) {
112
- const { invalidateCachedConfig } = await import('./discover.js');
112
+ const { invalidateCachedConfig } = await import('./discover');
113
113
  await invalidateCachedConfig(flags.stage);
114
114
  }
115
115
 
@@ -20,13 +20,13 @@
20
20
  */
21
21
 
22
22
  import type { ModelDescriptor, Module, SequenceDescriptor } from '@everystack/model';
23
- import type { AuthzContract, TableContract } from './authz-contract.js';
24
- import { compileCreateTable, compileEnums, compileSequences, sequenceCreateSql, foreignKeySql, modelConstraintSpecs, qualifiedTable, toSnakeCase, type CompileTableOptions } from './schema-compile.js';
25
- import { compileTableContract } from './authz-compile.js';
26
- import { emitReconcileSql } from './authz-reconcile.js';
27
- import { emitSchemaSql, nextvalSequence, type SchemaChange } from './schema-diff.js';
28
- import { compileDerived } from './derived-compile.js';
29
- import { renderEnsureObjectSchemas } from './derived-apply.js';
23
+ import type { AuthzContract, TableContract } from './authz-contract';
24
+ import { compileCreateTable, compileEnums, compileSequences, sequenceCreateSql, foreignKeySql, modelConstraintSpecs, qualifiedTable, toSnakeCase, type CompileTableOptions } from './schema-compile';
25
+ import { compileTableContract } from './authz-compile';
26
+ import { emitReconcileSql } from './authz-reconcile';
27
+ import { emitSchemaSql, nextvalSequence, type SchemaChange } from './schema-diff';
28
+ import { compileDerived } from './derived-compile';
29
+ import { renderEnsureObjectSchemas } from './derived-apply';
30
30
 
31
31
  /** The empty (not-yet-created) authz state for a table — the greenfield baseline. */
32
32
  function emptyTable(table: string): TableContract {
@@ -16,12 +16,12 @@
16
16
  */
17
17
 
18
18
  import type { ModelDescriptor, SequenceDescriptor } from '@everystack/model';
19
- import type { SchemaSnapshot } from './schema-introspect.js';
20
- import type { AuthzContract } from './authz-contract.js';
21
- import { compileTableSchema, compileRenames, compileTableRenames, compileTableMoves, compileCreateTable, compileEnums, compileSequences } from './schema-compile.js';
22
- import { compileTableContract } from './authz-compile.js';
23
- import { emitReconcileSql, governedRoleSet } from './authz-reconcile.js';
24
- import { diffSchema, emitSchemaSql, type SchemaChange } from './schema-diff.js';
19
+ import type { SchemaSnapshot } from './schema-introspect';
20
+ import type { AuthzContract } from './authz-contract';
21
+ import { compileTableSchema, compileRenames, compileTableRenames, compileTableMoves, compileCreateTable, compileEnums, compileSequences } from './schema-compile';
22
+ import { compileTableContract } from './authz-compile';
23
+ import { emitReconcileSql, governedRoleSet } from './authz-reconcile';
24
+ import { diffSchema, emitSchemaSql, type SchemaChange } from './schema-diff';
25
25
 
26
26
  export interface GenerateOptions {
27
27
  /** The Postgres schema the Models live in. Default: `public`. */