@empire-builder-kit/nx 1.0.0-rc.45 → 1.0.0-rc.47

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 (187) hide show
  1. package/generators.json +11 -1
  2. package/package.json +3 -3
  3. package/src/aws-authority/stage-authority.d.ts +30 -2
  4. package/src/aws-authority/stage-authority.js +220 -25
  5. package/src/developer-agent/generator-planning.js +109 -9
  6. package/src/developer-agent/model.d.ts +7 -3
  7. package/src/developer-agent/model.js +1 -0
  8. package/src/developer-agent/operation-registry.d.ts +1 -0
  9. package/src/developer-agent/operation-registry.js +44 -3
  10. package/src/developer-agent/planning.js +5 -2
  11. package/src/developer-agent/preview-changes.js +10 -0
  12. package/src/developer-agent/validation.js +7 -3
  13. package/src/developer-agent/workspace-inspection.js +51 -4
  14. package/src/executors/deployment-plan/deployment-plan.js +3 -0
  15. package/src/executors/dev-doctor/dev-doctor.d.ts +25 -3
  16. package/src/executors/dev-doctor/dev-doctor.js +136 -49
  17. package/src/executors/dev-setup/dev-setup.d.ts +18 -1
  18. package/src/executors/dev-setup/dev-setup.js +320 -196
  19. package/src/executors/foundation-preflight/foundation-preflight.js +9 -1
  20. package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js +2 -2
  21. package/src/executors/github-bootstrap/github-bootstrap.d.ts +3 -0
  22. package/src/executors/github-bootstrap/github-bootstrap.js +28 -0
  23. package/src/executors/github-bootstrap/schema.json +14 -0
  24. package/src/executors/infrastructure-plan/infrastructure-plan.js +10 -3
  25. package/src/executors/local-deploy/local-deploy.d.ts +15 -0
  26. package/src/executors/local-deploy/local-deploy.js +96 -14
  27. package/src/executors/sst-lifecycle/logging-preflight.js +12 -1
  28. package/src/executors/sst-lifecycle/run-sst-command.js +51 -5
  29. package/src/foundation/cost-estimate.js +1 -1
  30. package/src/foundation/identity-domain-parent-ready.d.ts +91 -0
  31. package/src/foundation/identity-domain-parent-ready.js +333 -0
  32. package/src/foundation/identity-domain.d.ts +94 -0
  33. package/src/foundation/identity-domain.js +115 -0
  34. package/src/foundation/index.d.ts +2 -0
  35. package/src/foundation/index.js +7 -0
  36. package/src/foundation/preflight.js +17 -1
  37. package/src/foundation/root-site-readiness.d.ts +27 -0
  38. package/src/foundation/root-site-readiness.js +78 -0
  39. package/src/foundation/root-site.d.ts +81 -0
  40. package/src/foundation/root-site.js +268 -0
  41. package/src/generators/framework-prerequisites.d.ts +2 -0
  42. package/src/generators/framework-prerequisites.js +34 -0
  43. package/src/generators/function/function-registration.d.ts +24 -0
  44. package/src/generators/function/function-registration.js +66 -0
  45. package/src/generators/function/function.d.ts +16 -1
  46. package/src/generators/function/function.js +101 -18
  47. package/src/generators/function/schema.d.ts +1 -0
  48. package/src/generators/function/schema.json +6 -0
  49. package/src/generators/function-access/function-access.d.ts +14 -0
  50. package/src/generators/function-access/function-access.js +141 -0
  51. package/src/generators/function-access/schema.d.ts +6 -0
  52. package/src/generators/function-access/schema.json +25 -0
  53. package/src/generators/post-generation-install.d.ts +1 -1
  54. package/src/generators/post-generation-install.js +1 -1
  55. package/src/generators/preset/dependency-overrides.d.ts +1 -1
  56. package/src/generators/preset/dependency-overrides.js +1 -1
  57. package/src/generators/preset/workspace-files-adopter-skills.js +14 -0
  58. package/src/generators/preset/workspace-files-developer-agent.js +17 -11
  59. package/src/generators/preset/workspace-files-stage-authority.js +58 -1
  60. package/src/generators/preset/workspace-files-thin-deploy.d.ts +11 -0
  61. package/src/generators/preset/workspace-files-thin-deploy.js +52 -5
  62. package/src/generators/preset/workspace-files-thin-docs.js +33 -5
  63. package/src/generators/preset/workspace-files.js +238 -41
  64. package/src/generators/repository-policy/repository-policy.js +2 -1
  65. package/src/generators/repository-policy/schema.d.ts +2 -0
  66. package/src/generators/repository-policy/schema.json +7 -2
  67. package/src/generators/site/built-in-site-documentation-files.d.ts +2 -0
  68. package/src/generators/site/built-in-site-documentation-files.js +92 -0
  69. package/src/generators/site/built-in-site-files.d.ts +8 -0
  70. package/src/generators/site/built-in-site-files.js +40 -0
  71. package/src/generators/site/built-in-site-infrastructure-files.d.ts +2 -0
  72. package/src/generators/site/built-in-site-infrastructure-files.js +275 -0
  73. package/src/generators/site/built-in-site-plan.d.ts +19 -0
  74. package/src/generators/site/built-in-site-plan.js +65 -0
  75. package/src/generators/site/built-in-site-project-files.d.ts +3 -0
  76. package/src/generators/site/built-in-site-project-files.js +258 -0
  77. package/src/generators/site/built-in-site-script-files.d.ts +2 -0
  78. package/src/generators/site/built-in-site-script-files.js +306 -0
  79. package/src/generators/site/built-in-site-shared.d.ts +9 -0
  80. package/src/generators/site/built-in-site-shared.js +21 -0
  81. package/src/generators/site/built-in-site-smoke-files.d.ts +2 -0
  82. package/src/generators/site/built-in-site-smoke-files.js +37 -0
  83. package/src/generators/site/built-in-site-sst-config-files.d.ts +2 -0
  84. package/src/generators/site/built-in-site-sst-config-files.js +39 -0
  85. package/src/generators/site/built-in-site-web-files.d.ts +2 -0
  86. package/src/generators/site/built-in-site-web-files.js +284 -0
  87. package/src/generators/site/schema.d.ts +4 -0
  88. package/src/generators/site/schema.json +20 -0
  89. package/src/generators/site/site.d.ts +13 -0
  90. package/src/generators/site/site.js +221 -0
  91. package/src/generators/slice/built-in-plan-alarm-identity.d.ts +9 -0
  92. package/src/generators/slice/built-in-plan-alarm-identity.js +8 -1
  93. package/src/generators/slice/built-in-plan-api-contract-files.js +18 -0
  94. package/src/generators/slice/built-in-plan-async-work-files.js +18 -0
  95. package/src/generators/slice/built-in-plan-data-files.js +126 -14
  96. package/src/generators/slice/built-in-plan-foundation-files.d.ts +12 -0
  97. package/src/generators/slice/built-in-plan-foundation-files.js +114 -5
  98. package/src/generators/slice/built-in-plan-frontend-files.js +2 -271
  99. package/src/generators/slice/built-in-plan-frontend-header-proof.d.ts +6 -0
  100. package/src/generators/slice/built-in-plan-frontend-header-proof.js +282 -0
  101. package/src/generators/slice/built-in-plan-infrastructure-files.js +151 -237
  102. package/src/generators/slice/built-in-plan-key-value-cleanup.js +4 -3
  103. package/src/generators/slice/built-in-plan-log-group-helpers.d.ts +29 -0
  104. package/src/generators/slice/built-in-plan-log-group-helpers.js +130 -0
  105. package/src/generators/slice/built-in-plan-metadata-files.js +25 -5
  106. package/src/generators/slice/built-in-plan-next-build-authority.d.ts +5 -0
  107. package/src/generators/slice/built-in-plan-next-build-authority.js +124 -0
  108. package/src/generators/slice/built-in-plan-operations-files.d.ts +6 -0
  109. package/src/generators/slice/built-in-plan-operations-files.js +107 -219
  110. package/src/generators/slice/built-in-plan-performance-files.js +6 -1
  111. package/src/generators/slice/built-in-plan-release-files.js +0 -1
  112. package/src/generators/slice/built-in-plan-reliability-files.js +12 -8
  113. package/src/generators/slice/built-in-plan-shared.d.ts +1 -1
  114. package/src/generators/slice/built-in-plan-shared.js +1 -1
  115. package/src/generators/slice/built-in-plan-sst-config.d.ts +49 -0
  116. package/src/generators/slice/built-in-plan-sst-config.js +160 -0
  117. package/src/generators/slice/built-in-plan-testing-files.js +92 -49
  118. package/src/generators/slice/built-in-plan-verification-files.js +15 -5
  119. package/src/generators/slice/built-in-plan-web-files.js +69 -5
  120. package/src/generators/slice/built-in-plan.js +1 -2
  121. package/src/generators/slice/deployed-smoke-diagnostics.d.ts +35 -0
  122. package/src/generators/slice/deployed-smoke-diagnostics.js +189 -0
  123. package/src/generators/slice/deployed-smoke-readiness.d.ts +7 -0
  124. package/src/generators/slice/deployed-smoke-readiness.js +118 -23
  125. package/src/generators/slice/persistence-contract.js +2 -2
  126. package/src/generators/slice/pnpm-launch-script.d.ts +13 -0
  127. package/src/generators/slice/pnpm-launch-script.js +28 -0
  128. package/src/generators/slice/slice.js +27 -0
  129. package/src/generators/upgrade/custom-domain-notice.d.ts +19 -0
  130. package/src/generators/upgrade/custom-domain-notice.js +38 -0
  131. package/src/generators/upgrade/external-blueprint-compositions.d.ts +84 -0
  132. package/src/generators/upgrade/external-blueprint-compositions.js +478 -0
  133. package/src/generators/upgrade/framework-package-upgrade.d.ts +58 -0
  134. package/src/generators/upgrade/framework-package-upgrade.js +78 -0
  135. package/src/generators/upgrade/function-authentication-notice.d.ts +29 -0
  136. package/src/generators/upgrade/function-authentication-notice.js +74 -0
  137. package/src/generators/upgrade/schema.json +2 -2
  138. package/src/generators/upgrade/upgrade-plan.d.ts +52 -0
  139. package/src/generators/upgrade/upgrade-plan.js +406 -0
  140. package/src/generators/upgrade/upgrade.d.ts +1 -35
  141. package/src/generators/upgrade/upgrade.js +347 -595
  142. package/src/generators/workload/reliability-registration.d.ts +1 -1
  143. package/src/generators/workload/reliability-registration.js +9 -9
  144. package/src/generators/workload/workload.d.ts +1 -1
  145. package/src/generators/workload/workload.js +87 -13
  146. package/src/git-policy/github-bootstrap.d.ts +24 -5
  147. package/src/git-policy/github-bootstrap.js +105 -10
  148. package/src/local-dev/fleet-process.d.ts +9 -2
  149. package/src/local-dev/fleet-process.js +27 -7
  150. package/src/local-dev/fleet-session.js +41 -4
  151. package/src/local-dev/fleet-supervisor-daemon.js +1 -5
  152. package/src/local-dev/fleet-supervisor.d.ts +1 -0
  153. package/src/local-dev/fleet-supervisor.js +34 -11
  154. package/src/local-dev/gateway-daemon.d.ts +1 -1
  155. package/src/local-dev/gateway-daemon.js +6 -4
  156. package/src/local-dev/portless.d.ts +5 -0
  157. package/src/local-dev/portless.js +5 -0
  158. package/src/local-dev/process-group.d.ts +10 -0
  159. package/src/local-dev/process-group.js +33 -0
  160. package/src/local-dev/tls.js +31 -2
  161. package/src/local-dev/trust-store.d.ts +42 -0
  162. package/src/local-dev/trust-store.js +87 -0
  163. package/src/ownership/composition.d.ts +7 -0
  164. package/src/ownership/composition.js +64 -56
  165. package/src/ownership/index.d.ts +1 -0
  166. package/src/ownership/index.js +1 -0
  167. package/src/ownership/record.d.ts +19 -0
  168. package/src/ownership/record.js +26 -2
  169. package/src/ownership/site-record.d.ts +18 -0
  170. package/src/ownership/site-record.js +105 -0
  171. package/src/repository-policy/deployment-plan.d.ts +3 -0
  172. package/src/repository-policy/deployment-plan.js +33 -4
  173. package/src/repository-policy/index.d.ts +1 -0
  174. package/src/repository-policy/index.js +1 -0
  175. package/src/repository-policy/policy.d.ts +13 -1
  176. package/src/repository-policy/policy.js +55 -1
  177. package/src/repository-policy/public-dns.d.ts +65 -0
  178. package/src/repository-policy/public-dns.js +168 -0
  179. package/src/schemas/generated-ownership-v2.json +6 -0
  180. package/src/schemas/repository-policy-v1.json +67 -1
  181. package/src/supply-chain/blueprint-trust-git.js +24 -0
  182. package/src/supply-chain/blueprint-verification-authority.js +42 -3
  183. package/src/supply-chain/generated-blueprint-trust-command.js +15 -0
  184. package/src/supply-chain/sbom.js +74 -12
  185. package/src/work-markers/work-markers.js +4 -1
  186. package/src/workspace-deployment/ownership.d.ts +15 -0
  187. package/src/workspace-deployment/ownership.js +19 -3
@@ -45,7 +45,15 @@ const executor = async (options, context) => {
45
45
  }
46
46
  (0, index_js_1.assertRepositoryPolicyRequest)(context.root, {
47
47
  action: 'deploy',
48
- projects: [{ kind: 'slice', name: context.projectName }],
48
+ projects: [
49
+ {
50
+ // The root site has its own production gate.
51
+ kind: context.projectsConfigurations?.projects[context.projectName]?.tags?.includes('type:site')
52
+ ? 'site'
53
+ : 'slice',
54
+ name: context.projectName,
55
+ },
56
+ ],
49
57
  stage: stages.consumerStage,
50
58
  });
51
59
  }
@@ -13,12 +13,12 @@ const index_js_1 = require("../../repository-policy/index.js");
13
13
  function evaluateFoundationRemoval(foundationStage, registrationNames) {
14
14
  if (registrationNames.length === 0) {
15
15
  return {
16
- message: `[foundation-remove-preflight] foundationStage=${foundationStage}: no Product Slice registrations remain.`,
16
+ message: `[foundation-remove-preflight] foundationStage=${foundationStage}: no consumer registrations remain.`,
17
17
  success: true,
18
18
  };
19
19
  }
20
20
  return {
21
- message: `[foundation-remove-preflight] foundationStage=${foundationStage}: Foundation removal is blocked by Product Slice registration records: ${registrationNames.join(', ')}. Remove known consumer-stage slice stacks first; investigate every unrecognized record before retrying.`,
21
+ message: `[foundation-remove-preflight] foundationStage=${foundationStage}: Foundation removal is blocked by consumer registration records: ${registrationNames.join(', ')}. Remove the known consumer-stage stacks first (Product Slices, then the root site); investigate every unrecognized record before retrying.`,
22
22
  success: false,
23
23
  };
24
24
  }
@@ -3,6 +3,9 @@ interface GitHubBootstrapExecutorOptions {
3
3
  apply?: boolean;
4
4
  immutableOidcTrustAcknowledgement?: string;
5
5
  npmPrereleaseReviewerIds?: string;
6
+ npmStable?: boolean;
7
+ npmStableReviewerIds?: string;
8
+ npmStablePreventSelfReview?: boolean;
6
9
  productionReviewerIds?: string;
7
10
  repository?: string;
8
11
  }
@@ -10,6 +10,34 @@ function parseReviewerIds(value) {
10
10
  }
11
11
  const executor = async (options, context) => {
12
12
  try {
13
+ if (options.npmStable === true) {
14
+ if (options.npmStableReviewerIds === undefined ||
15
+ !/^[1-9][0-9]*(,[1-9][0-9]*)*$/.test(options.npmStableReviewerIds) ||
16
+ typeof options.npmStablePreventSelfReview !== 'boolean') {
17
+ throw new Error('npm-stable requires explicit reviewer IDs and prevent-self-review choice.');
18
+ }
19
+ if (options.npmPrereleaseReviewerIds !== undefined ||
20
+ options.productionReviewerIds !== undefined ||
21
+ options.immutableOidcTrustAcknowledgement !== undefined) {
22
+ throw new Error('npm-stable does not accept adopter bootstrap options.');
23
+ }
24
+ const report = await (0, index_js_1.runGitHubBootstrap)({
25
+ npmStable: true,
26
+ apply: options.apply === true,
27
+ repository: options.repository?.trim() ?? '',
28
+ npmStableReviewerIds: parseReviewerIds(options.npmStableReviewerIds),
29
+ npmStablePreventSelfReview: options.npmStablePreventSelfReview,
30
+ token: process.env.GH_TOKEN?.trim() ||
31
+ process.env.GITHUB_TOKEN?.trim() ||
32
+ '',
33
+ });
34
+ devkit_1.logger.info(JSON.stringify(report, null, 2));
35
+ return { success: options.apply ? report.ready : true };
36
+ }
37
+ if (options.npmStableReviewerIds !== undefined ||
38
+ options.npmStablePreventSelfReview !== undefined) {
39
+ throw new Error('npm-stable settings require the explicit npmStable selector.');
40
+ }
13
41
  const policy = (0, index_js_2.readRepositoryOperatingPolicy)(context.root);
14
42
  const report = await (0, index_js_1.runGitHubBootstrap)({
15
43
  apply: options.apply === true,
@@ -31,6 +31,20 @@
31
31
  "type": "string",
32
32
  "pattern": "^[1-9][0-9]*(,[1-9][0-9]*)*$",
33
33
  "description": "Optional comma-separated GitHub user IDs when committed Repository Operating Policy selects environment-reviewer mode. Existing reviewers are preserved when omitted."
34
+ },
35
+ "npmStable": {
36
+ "type": "boolean",
37
+ "default": false,
38
+ "description": "Configure only the framework npm-stable environment; exact framework repository required."
39
+ },
40
+ "npmStableReviewerIds": {
41
+ "type": "string",
42
+ "pattern": "^[1-9][0-9]*(,[1-9][0-9]*)*$",
43
+ "description": "Explicit GitHub user IDs for the framework npm-stable required reviewers."
44
+ },
45
+ "npmStablePreventSelfReview": {
46
+ "type": "boolean",
47
+ "description": "Explicit prevent-self-review choice for the framework npm-stable environment."
34
48
  }
35
49
  }
36
50
  }
@@ -6,6 +6,7 @@ const client_sts_1 = require("@aws-sdk/client-sts");
6
6
  const devkit_1 = require("@nx/devkit");
7
7
  const node_path_1 = require("node:path");
8
8
  const index_js_1 = require("../../aws-authority/index.js");
9
+ const root_site_js_1 = require("../../foundation/root-site.js");
9
10
  const identity_js_1 = require("../../aws/identity.js");
10
11
  const index_js_2 = require("../../repository-policy/index.js");
11
12
  const federated_credential_transport_js_1 = require("../local-deploy/federated-credential-transport.js");
@@ -32,10 +33,16 @@ function projectKind(context) {
32
33
  }
33
34
  const foundation = project.tags?.includes('scope:foundation') ?? false;
34
35
  const slice = project.tags?.includes('type:slice') ?? false;
35
- if (foundation === slice) {
36
- throw new Error(`Nx project ${context.projectName} must declare exactly one lifecycle kind tag: scope:foundation or type:slice.`);
36
+ const site = project.tags?.includes('type:site') ?? false;
37
+ if ([foundation, site, slice].filter(Boolean).length !== 1) {
38
+ throw new Error(`Nx project ${context.projectName} must declare exactly one lifecycle kind tag: scope:foundation, type:site or type:slice.`);
37
39
  }
38
- return foundation ? 'foundation' : 'slice';
40
+ // One root site per workspace, at its fixed package.
41
+ if (site &&
42
+ (context.projectName !== root_site_js_1.ROOT_SITE_NAME || project.root !== root_site_js_1.ROOT_SITE_ROOT)) {
43
+ throw new Error(`Nx project ${context.projectName} is tagged type:site; the workspace root site is the ${root_site_js_1.ROOT_SITE_NAME} project at ${root_site_js_1.ROOT_SITE_ROOT}.`);
44
+ }
45
+ return foundation ? 'foundation' : site ? 'site' : 'slice';
39
46
  }
40
47
  function projectWorkingDirectory(options, context) {
41
48
  const configured = context.projectName
@@ -44,6 +44,16 @@ interface ProjectDescriptor {
44
44
  tags: readonly string[];
45
45
  targets: Readonly<Record<string, unknown>>;
46
46
  }
47
+ interface DeployedSmokeTarget {
48
+ apiUrl: string;
49
+ clientId: string;
50
+ userPoolId: string;
51
+ webUrl: string;
52
+ }
53
+ /** The root site publishes only its web URL: no API and no sign-in. */
54
+ interface DeployedSiteSmokeTarget {
55
+ webUrl: string;
56
+ }
47
57
  interface ChildReceipt {
48
58
  completedAt: string;
49
59
  outcome: 'failed' | 'skipped-unchanged' | 'succeeded';
@@ -101,6 +111,11 @@ declare function attestLocalContainerBinding(input: {
101
111
  sourceCommit: string;
102
112
  stage: CanonicalDeploymentStage;
103
113
  }): void;
114
+ /** The root site's bounded public outputs: its kind, name, stage and a web
115
+ * URL at the Router origin's `/`, with the same literal-host refusal as a
116
+ * Slice. */
117
+ export declare function readDeployedSiteSmokeTarget(workspaceRoot: string, project: ProjectDescriptor, stage: CanonicalDeploymentStage): DeployedSiteSmokeTarget;
118
+ export declare function deployedSmokeEnvironment(target: DeployedSiteSmokeTarget | DeployedSmokeTarget): Record<string, string>;
104
119
  export declare function deployedSourceCommit(sourceCommit: string, environment?: NodeJS.ProcessEnv): string;
105
120
  /** Determine the one native deployment order. Foundation is always first and
106
121
  * production Slice admission remains a committed policy decision. */
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.localWorkingTreeDigest = localWorkingTreeDigest;
4
+ exports.readDeployedSiteSmokeTarget = readDeployedSiteSmokeTarget;
5
+ exports.deployedSmokeEnvironment = deployedSmokeEnvironment;
4
6
  exports.deployedSourceCommit = deployedSourceCommit;
5
7
  exports.localDeploymentProjectOrder = localDeploymentProjectOrder;
6
8
  exports.runLocalDeploy = runLocalDeploy;
@@ -26,6 +28,7 @@ const index_js_3 = require("../../workspace-deployment/index.js");
26
28
  const private_smoke_access_js_1 = require("../../foundation/private-smoke-access.js");
27
29
  const local_private_smoke_access_js_1 = require("../../foundation/local-private-smoke-access.js");
28
30
  const capability_plan_js_1 = require("../../foundation/capability-plan.js");
31
+ const root_site_js_1 = require("../../foundation/root-site.js");
29
32
  const sst_environment_source_js_1 = require("../sst-lifecycle/sst-environment-source.js");
30
33
  const SHA = /^[a-f0-9]{40,64}$/u;
31
34
  const ROLE = /^arn:(aws|aws-us-gov|aws-cn):iam::\d{12}:role\/[A-Za-z0-9+=,.@_/-]{1,512}$/u;
@@ -333,6 +336,14 @@ function readDeployedSmokeTarget(workspaceRoot, project, stage) {
333
336
  catch {
334
337
  throw new Error(`Native SST outputs for ${project.name} contain invalid smoke URLs.`);
335
338
  }
339
+ // WHATWG URL keeps '*' in a host. A Slice whose managed infrastructure still
340
+ // publishes SST's referenced-Router URL names the wildcard alias host under a
341
+ // custom domain. Refuse a '*' and any character outside letters, digits, '.'
342
+ // and '-' before smoke; this is not a hostname validator.
343
+ const literalHost = /^[a-z0-9.-]+$/u;
344
+ if (!literalHost.test(api.hostname) || !literalHost.test(web.hostname)) {
345
+ throw new Error(`Native SST outputs for ${project.name} name a host with '*' or a character other than letters, digits, '.' and '-'. Slice URLs must use the Foundation routerUrl host; apply the managed Slice upgrade and redeploy before smoke.`);
346
+ }
336
347
  const credentialFreeHttps = (url) => url.protocol === 'https:' &&
337
348
  !url.username &&
338
349
  !url.password &&
@@ -342,7 +353,9 @@ function readDeployedSmokeTarget(workspaceRoot, project, stage) {
342
353
  value.stage !== stage ||
343
354
  !credentialFreeHttps(api) ||
344
355
  !credentialFreeHttps(web) ||
345
- api.pathname !== '/' ||
356
+ // A bound Slice API is mapped under /<project> on the Foundation's
357
+ // api.<root> domain; an execute-api origin has no path.
358
+ !['/', `/${project.name}`].includes(api.pathname.replace(/\/$/u, '') || '/') ||
346
359
  web.pathname.replace(/\/$/u, '') !== `/${project.name}` ||
347
360
  !/^[a-z0-9]{1,128}$/u.test(String(value.authClientId ?? '')) ||
348
361
  !/^[A-Za-z0-9_-]{1,128}_[A-Za-z0-9]{1,128}$/u.test(String(value.authUserPoolId ?? ''))) {
@@ -355,6 +368,55 @@ function readDeployedSmokeTarget(workspaceRoot, project, stage) {
355
368
  webUrl: web.href,
356
369
  };
357
370
  }
371
+ /** The root site's bounded public outputs: its kind, name, stage and a web
372
+ * URL at the Router origin's `/`, with the same literal-host refusal as a
373
+ * Slice. */
374
+ function readDeployedSiteSmokeTarget(workspaceRoot, project, stage) {
375
+ const projectRoot = confinedWorkspacePath(workspaceRoot, project.root);
376
+ const outputPath = (0, node_path_1.join)(projectRoot, '.sst', 'outputs.json');
377
+ const identity = (0, node_fs_1.lstatSync)(outputPath);
378
+ if (!identity.isFile() ||
379
+ identity.isSymbolicLink() ||
380
+ identity.size < 2 ||
381
+ identity.size > 64 * 1024) {
382
+ throw new Error(`Native SST outputs for ${project.name} are absent or unsafe.`);
383
+ }
384
+ const value = JSON.parse((0, node_fs_1.readFileSync)(outputPath, 'utf8'));
385
+ let web;
386
+ try {
387
+ web = new URL(String(value.webUrl ?? ''));
388
+ }
389
+ catch {
390
+ throw new Error(`Native SST outputs for ${project.name} contain an invalid smoke URL.`);
391
+ }
392
+ if (!/^[a-z0-9.-]+$/u.test(web.hostname)) {
393
+ throw new Error(`Native SST outputs for ${project.name} name a host with '*' or a character other than letters, digits, '.' and '-'. The root site URL must use the Foundation routerUrl host; apply the managed root site upgrade and redeploy before smoke.`);
394
+ }
395
+ if (value.kind !== 'site' ||
396
+ value.name !== root_site_js_1.ROOT_SITE_NAME ||
397
+ value.stage !== stage ||
398
+ ['apiUrl', 'authClientId', 'authUserPoolId'].some((key) => key in value) ||
399
+ web.protocol !== 'https:' ||
400
+ web.username ||
401
+ web.password ||
402
+ web.search ||
403
+ web.hash ||
404
+ web.pathname !== '/') {
405
+ throw new Error(`Native SST outputs for ${project.name} do not match the deployed stage and root site smoke target.`);
406
+ }
407
+ return { webUrl: web.href };
408
+ }
409
+ function deployedSmokeEnvironment(target) {
410
+ if (!('apiUrl' in target))
411
+ return { EBK_SMOKE_URL: target.webUrl };
412
+ return {
413
+ EBK_SMOKE_API_URL: target.apiUrl,
414
+ EBK_SMOKE_AUTHORITY_VERSION: 'cognito-admin-cloudwatch-observe-v1',
415
+ EBK_SMOKE_CLIENT_ID: target.clientId,
416
+ EBK_SMOKE_URL: target.webUrl,
417
+ EBK_SMOKE_USER_POOL_ID: target.userPoolId,
418
+ };
419
+ }
358
420
  const GIT_SHA = /^[a-f0-9]{40,64}$/u;
359
421
  // A trunk promotion deploys the immutable artifacts built from the release
360
422
  // source (EBK_RELEASE_SOURCE_COMMIT, the staging-built head) while it runs
@@ -515,6 +577,16 @@ function localDeploymentProjectOrder(policy, context, stage, requestedSlices) {
515
577
  .filter((project) => project.tags.includes('type:slice') &&
516
578
  supportsTarget(project, 'deploy'))
517
579
  .sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0);
580
+ // The root site deploys after the Foundation and before every Slice, so it
581
+ // is removed after them.
582
+ const sites = projects.filter((project) => project.tags.includes('type:site') && supportsTarget(project, 'deploy'));
583
+ if (slices.some(({ name }) => name === root_site_js_1.ROOT_SITE_NAME)) {
584
+ throw new Error(`Product Slice ${root_site_js_1.ROOT_SITE_NAME} cannot deploy: ${root_site_js_1.ROOT_SITE_NAME} is reserved for the workspace root site. ${root_site_js_1.ROOT_SITE_RENAME_GUIDANCE}`);
585
+ }
586
+ if (sites.length > 1 ||
587
+ sites.some(({ name, root }) => name !== root_site_js_1.ROOT_SITE_NAME || root !== root_site_js_1.ROOT_SITE_ROOT)) {
588
+ throw new Error(`Local deployment accepts one root site, the ${root_site_js_1.ROOT_SITE_NAME} project at ${root_site_js_1.ROOT_SITE_ROOT}.`);
589
+ }
518
590
  if (stage === 'production') {
519
591
  const missing = slices
520
592
  .filter(({ name }) => policy.slices[name] === undefined)
@@ -522,13 +594,22 @@ function localDeploymentProjectOrder(policy, context, stage, requestedSlices) {
522
594
  if (missing.length > 0) {
523
595
  throw new Error(`Registered Product Slices lack an explicit production policy: ${missing.join(', ')}.`);
524
596
  }
597
+ if (sites.length > 0 && policy.site === undefined) {
598
+ throw new Error('The registered root site lacks an explicit production policy: set site.productionStatus to blocked or ready.');
599
+ }
525
600
  }
526
- const eligibleSlices = stage === 'production'
527
- ? slices.filter(({ name }) => {
528
- const status = policy.slices[name]?.productionStatus;
529
- return status === 'pilot' || status === 'ready';
530
- })
531
- : slices;
601
+ const eligibleSites = stage === 'production' && policy.site?.productionStatus !== 'ready'
602
+ ? []
603
+ : sites;
604
+ const eligibleSlices = [
605
+ ...eligibleSites,
606
+ ...(stage === 'production'
607
+ ? slices.filter(({ name }) => {
608
+ const status = policy.slices[name]?.productionStatus;
609
+ return status === 'pilot' || status === 'ready';
610
+ })
611
+ : slices),
612
+ ];
532
613
  if (requestedSlices !== undefined &&
533
614
  (!Array.isArray(requestedSlices) ||
534
615
  requestedSlices.length === 0 ||
@@ -547,7 +628,10 @@ function localDeploymentProjectOrder(policy, context, stage, requestedSlices) {
547
628
  : eligibleSlices.filter(({ name }) => requestedSlices.includes(name));
548
629
  const selected = [
549
630
  { kind: 'foundation', name: foundations[0]?.name ?? '' },
550
- ...selectedSlices.map(({ name }) => ({ kind: 'slice', name })),
631
+ ...selectedSlices.map(({ name, tags }) => ({
632
+ kind: tags.includes('type:site') ? 'site' : 'slice',
633
+ name,
634
+ })),
551
635
  ];
552
636
  const decision = (0, index_js_2.evaluateRepositoryPolicyRequest)(policy, {
553
637
  action: 'deploy',
@@ -1201,7 +1285,9 @@ async function runLocalDeploy(options, context, dependencies = {}) {
1201
1285
  if (supportsTarget(descriptor, 'smoke-deployed')) {
1202
1286
  if (transport)
1203
1287
  await transport.refresh();
1204
- const smokeTarget = readDeployedSmokeTarget(context.root, descriptor, options.stage);
1288
+ const smokeTarget = descriptor.tags.includes('type:site')
1289
+ ? readDeployedSiteSmokeTarget(context.root, descriptor, options.stage)
1290
+ : readDeployedSmokeTarget(context.root, descriptor, options.stage);
1205
1291
  assertDeploymentSourceUnchanged(context.root, source, run);
1206
1292
  const smokeStartedAt = now().toISOString();
1207
1293
  try {
@@ -1218,11 +1304,7 @@ async function runLocalDeploy(options, context, dependencies = {}) {
1218
1304
  EBK_NX_STAGE_LIFECYCLE: githubAuthority ? 'github' : 'local',
1219
1305
  EBK_SOURCE_COMMIT: source.commit,
1220
1306
  EBK_DEPLOYED_SOURCE_COMMIT: deployedSourceCommit(source.commit),
1221
- EBK_SMOKE_API_URL: smokeTarget.apiUrl,
1222
- EBK_SMOKE_AUTHORITY_VERSION: 'cognito-admin-cloudwatch-observe-v1',
1223
- EBK_SMOKE_CLIENT_ID: smokeTarget.clientId,
1224
- EBK_SMOKE_URL: smokeTarget.webUrl,
1225
- EBK_SMOKE_USER_POOL_ID: smokeTarget.userPoolId,
1307
+ ...deployedSmokeEnvironment(smokeTarget),
1226
1308
  EBK_STAGE: options.stage,
1227
1309
  },
1228
1310
  expectedRoleArn,
@@ -11,6 +11,7 @@ const node_child_process_1 = require("node:child_process");
11
11
  const promises_1 = require("node:fs/promises");
12
12
  const node_path_1 = require("node:path");
13
13
  const index_js_1 = require("../../foundation/index.js");
14
+ const root_site_js_1 = require("../../foundation/root-site.js");
14
15
  const logging_registry_js_1 = require("../../generators/logging-registry.js");
15
16
  const MAX_STATE_EXPORT_BYTES = 32 * 1024 * 1024;
16
17
  function normalizedSlug(value, label) {
@@ -137,6 +138,16 @@ async function loadManagedLogGroupContracts(input) {
137
138
  const slice = normalizedSlug(input.context.projectName, 'Product Slice');
138
139
  const packageJson = (await read((0, node_path_1.join)(input.context.root, 'package.json')));
139
140
  const workspace = normalizedSlug(packageJson.name, 'Workspace');
141
+ // The root site's managed log groups are a fixed set: it declares no
142
+ // logging registry and no databases.
143
+ if (input.context.projectsConfigurations?.projects[input.context.projectName]?.tags?.includes('type:site')) {
144
+ return root_site_js_1.ROOT_SITE_LOG_COMPONENTS.map((component) => (0, index_js_1.createManagedLogGroupContract)({
145
+ component,
146
+ slice: root_site_js_1.ROOT_SITE_NAME,
147
+ stage: input.invocation.environment.EBK_CONSUMER_STAGE,
148
+ workspace,
149
+ }));
150
+ }
140
151
  const registry = (0, logging_registry_js_1.parseSliceLoggingRegistry)(await read((0, node_path_1.join)(input.invocation.cwd, logging_registry_js_1.SLICE_LOGGING_REGISTRY_PATH)));
141
152
  const stage = input.invocation.environment.EBK_CONSUMER_STAGE;
142
153
  const localDev = input.context.projectsConfigurations?.projects[input.context.projectName]?.metadata?.['ebk']?.['localDev'];
@@ -171,7 +182,7 @@ async function loadManagedLogGroupContracts(input) {
171
182
  async function preflightManagedLogGroups(command, options, context, invocation, dependencies = {}) {
172
183
  const tags = context.projectsConfigurations?.projects[context.projectName ?? '']?.tags ??
173
184
  [];
174
- if (!tags.includes('type:slice'))
185
+ if (!tags.includes('type:slice') && !tags.includes('type:site'))
175
186
  return;
176
187
  const contracts = await loadManagedLogGroupContracts({
177
188
  context,
@@ -25,6 +25,8 @@ const index_js_2 = require("../../repository-policy/index.js");
25
25
  const index_js_3 = require("../../workspace-deployment/index.js");
26
26
  const index_js_4 = require("../../work-markers/index.js");
27
27
  const secret_preflight_js_1 = require("./secret-preflight.js");
28
+ const root_site_js_1 = require("../../foundation/root-site.js");
29
+ const root_site_readiness_js_1 = require("../../foundation/root-site-readiness.js");
28
30
  const task_native_writer_js_1 = require("../../local-dev/task-native-writer.js");
29
31
  const local_deploy_js_1 = require("../local-deploy/local-deploy.js");
30
32
  const task_stack_absence_js_1 = require("../dev-task-cleanup/task-stack-absence.js");
@@ -51,7 +53,7 @@ const SST_PROCESS_GROUP_POLL_MS = 25;
51
53
  const GOVERNED_PROCESS_GROUP_ENV = 'EBK_GOVERNED_PROCESS_GROUP';
52
54
  function assertGovernedAwsLifecyclePlatform(platform = process.platform) {
53
55
  if (platform === 'win32') {
54
- throw new Error('Governed AWS infrastructure lifecycle is unavailable on native Windows; use macOS, Linux, or WSL2. Native-Windows task Fleet is not validated in this prerelease either.');
56
+ throw new Error('Governed AWS infrastructure lifecycle is unavailable on native Windows; use macOS, Linux, or WSL2. Native-Windows task Fleet is not validated in this release either.');
55
57
  }
56
58
  }
57
59
  function isMissingProcessError(error) {
@@ -393,13 +395,51 @@ function projectKind(context) {
393
395
  if (!context.projectName) {
394
396
  throw new Error('SST lifecycle requires an Nx project name for tag-derived Repository Operating Policy evaluation.');
395
397
  }
396
- const tags = context.projectsConfigurations?.projects[context.projectName]?.tags ?? [];
398
+ const project = context.projectsConfigurations?.projects[context.projectName];
399
+ const tags = project?.tags ?? [];
397
400
  const foundation = tags.includes('scope:foundation');
398
401
  const slice = tags.includes('type:slice');
399
- if (foundation === slice) {
400
- throw new Error(`Nx project ${context.projectName} must declare exactly one lifecycle kind tag: scope:foundation or type:slice.`);
402
+ const site = tags.includes('type:site');
403
+ if ([foundation, site, slice].filter(Boolean).length !== 1) {
404
+ throw new Error(`Nx project ${context.projectName} must declare exactly one lifecycle kind tag: scope:foundation, type:site or type:slice.`);
405
+ }
406
+ // One root site per workspace, at its fixed package.
407
+ if (site &&
408
+ (context.projectName !== root_site_js_1.ROOT_SITE_NAME || project?.root !== root_site_js_1.ROOT_SITE_ROOT)) {
409
+ throw new Error(`Nx project ${context.projectName} is tagged type:site; the workspace root site is the ${root_site_js_1.ROOT_SITE_NAME} project at ${root_site_js_1.ROOT_SITE_ROOT}.`);
410
+ }
411
+ return foundation ? 'foundation' : site ? 'site' : 'slice';
412
+ }
413
+ function readWorkspaceFile(root, path) {
414
+ try {
415
+ return (0, node_fs_1.readFileSync)((0, node_path_1.join)(root, path), 'utf8');
416
+ }
417
+ catch (error) {
418
+ if (error.code === 'ENOENT')
419
+ return undefined;
420
+ throw error;
421
+ }
422
+ }
423
+ /**
424
+ * A Product Slice may not deploy under the reserved root site name, and a
425
+ * Slice deploy beside a root site needs readiness that recognises root-site
426
+ * fallthrough. Both refuse before any mutation.
427
+ */
428
+ function assertSliceDeployBesideRootSite(context) {
429
+ const name = context.projectName ?? '';
430
+ const projects = context.projectsConfigurations?.projects ?? {};
431
+ const root = projects[name]?.root ?? '';
432
+ if (name === root_site_js_1.ROOT_SITE_NAME || root === root_site_js_1.ROOT_SITE_ROOT) {
433
+ throw new Error(`Product Slice ${name} cannot deploy: ${root_site_js_1.ROOT_SITE_NAME} and ${root_site_js_1.ROOT_SITE_ROOT} are reserved for the workspace root site. ${root_site_js_1.ROOT_SITE_RENAME_GUIDANCE}`);
434
+ }
435
+ const read = (path) => readWorkspaceFile(context.root, path);
436
+ if (!(0, root_site_readiness_js_1.workspaceHasRootSite)(read, Object.values(projects).map((project) => project.tags))) {
437
+ return;
438
+ }
439
+ const stale = (0, root_site_readiness_js_1.slicesNeedingRootSiteReadinessUpgrade)(read, [{ name, root }]);
440
+ if (stale.length > 0) {
441
+ throw new Error((0, root_site_readiness_js_1.formatRootSiteReadinessUpgrade)(stale));
401
442
  }
402
- return foundation ? 'foundation' : 'slice';
403
443
  }
404
444
  function createSstChildEnvironment(ambient, invocation) {
405
445
  const stageSanitized = (0, personal_stage_js_1.isFrameworkPersonalStage)(invocation.EBK_CONSUMER_STAGE)
@@ -528,6 +568,12 @@ function buildSstCommandInvocation(command, options, context, environment = proc
528
568
  if (options.stageMode !== expectedStageMode) {
529
569
  throw new Error(`Nx project ${context.projectName} is tagged as ${kind} and requires stageMode ${expectedStageMode}; executor options cannot change project kind.`);
530
570
  }
571
+ if (command === 'dev' && kind === 'site') {
572
+ throw new Error('The root site has no sst dev mode in 1.0; run pnpm nx run site:dev.');
573
+ }
574
+ if (command === 'deploy' && kind === 'slice') {
575
+ assertSliceDeployBesideRootSite(context);
576
+ }
531
577
  const configuredRoot = context.projectName
532
578
  ? context.projectsConfigurations?.projects[context.projectName]?.root
533
579
  : undefined;
@@ -687,7 +687,7 @@ function renderFoundationCostEstimate(options) {
687
687
  'left',
688
688
  ]),
689
689
  '',
690
- 'Not priced: EC2 NAT instance root volumes (AMI default size), EC2 data transfer out (NAT instances have no per-GB processing charge), an adopter-owned public hosted zone for `EBK_ROOT_DOMAIN`, AWS Budgets, Cost Anomaly Detection, SSM standard parameters and SST bootstrap storage.',
690
+ 'Not priced: EC2 NAT instance root volumes (AMI default size), EC2 data transfer out (NAT instances have no per-GB processing charge), an adopter-owned public hosted zone named by a committed `publicDns.<stage>` binding, AWS Budgets, Cost Anomaly Detection, SSM standard parameters and SST bootstrap storage.',
691
691
  '',
692
692
  heading(level + 1, 'Price sources'),
693
693
  '',
@@ -0,0 +1,91 @@
1
+ import { promises as dnsPromises } from 'node:dns';
2
+ /**
3
+ * How long the identity domain's hook waits for `<root>` to answer an A
4
+ * query. It covers CloudFront's deployment of a new Router distribution with
5
+ * room to spare, and the longest negative answer (900 s under Route 53's
6
+ * default SOA) a cache between this machine and the zone could hold. At the
7
+ * bound the hook warns and lets the create go on: Cognito's own check then
8
+ * decides, as it did before the hook existed. Every lookup, poll and pause
9
+ * ends by the bound.
10
+ */
11
+ export declare const IDENTITY_DOMAIN_PARENT_RESOLUTION_BOUND_MS: number;
12
+ /** The pause between two polls, and before the poll that confirms a release. */
13
+ export declare const IDENTITY_DOMAIN_PARENT_POLL_INTERVAL_MS = 10000;
14
+ /**
15
+ * How long every one of the zone's name servers may fail to answer at all,
16
+ * with no definite answer from any of them, before the hook continues
17
+ * through the system resolver.
18
+ */
19
+ export declare const IDENTITY_DOMAIN_PARENT_TRANSPORT_GRACE_MS = 60000;
20
+ /** The least time between two progress lines. */
21
+ export declare const IDENTITY_DOMAIN_PARENT_PROGRESS_INTERVAL_MS = 30000;
22
+ /** The c-ares options of a resolver the hook builds. */
23
+ export interface ParentResolverOptions {
24
+ readonly timeout: number;
25
+ readonly tries: number;
26
+ }
27
+ /**
28
+ * The c-ares options of every resolver the hook builds. With c-ares's
29
+ * back-off, one query to a server that never answers takes about 8 to 10 s
30
+ * (measured), not `timeout` times `tries`.
31
+ */
32
+ export declare const IDENTITY_DOMAIN_PARENT_RESOLVER_OPTIONS: ParentResolverOptions;
33
+ /**
34
+ * The two lookups the hook makes. Node's `resolve*` never read `/etc/hosts`.
35
+ * `cancel` ends the lookups still in flight, which then reject.
36
+ */
37
+ export interface ParentResolver {
38
+ resolveNs(name: string): Promise<string[]>;
39
+ resolve4(name: string): Promise<string[]>;
40
+ cancel?(): void;
41
+ }
42
+ /** Node's `dns.promises.Resolver`, or a stand-in with the same constructor. */
43
+ export type ParentResolverConstructor = typeof dnsPromises.Resolver;
44
+ /**
45
+ * A resolver on this machine's configured DNS servers: it looks up the
46
+ * zone's name servers, and carries the poll on when those servers cannot be
47
+ * reached. Exported so a spec can assert the options it passes.
48
+ */
49
+ export declare function systemParentResolver(options?: ParentResolverOptions, Resolver?: ParentResolverConstructor): ParentResolver;
50
+ /**
51
+ * A resolver that asks one of the zone's own name servers, by address, and
52
+ * no other server: Node falls through to another server only on a timeout or
53
+ * an error, never on a negative answer, so the poll asks each server itself.
54
+ * Exported so a spec can assert the options and the server it passes.
55
+ */
56
+ export declare function authoritativeParentResolver(address: string, options?: ParentResolverOptions, Resolver?: ParentResolverConstructor): ParentResolver;
57
+ /**
58
+ * What this module's specs inject into the hook. An adopter sets none of
59
+ * them, so the public `identityDomainParentReady` takes no options.
60
+ */
61
+ export interface ParentReadyHookOptions {
62
+ boundMs?: number;
63
+ intervalMs?: number;
64
+ transportGraceMs?: number;
65
+ progressIntervalMs?: number;
66
+ /** The system-configured resolver: name-server discovery, and the continuation. */
67
+ systemResolver?: () => ParentResolver;
68
+ /** One resolver per name-server address, for the authoritative poll. */
69
+ authoritativeResolver?: (address: string) => ParentResolver;
70
+ /** A fresh label for each continuation poll, never reused. */
71
+ nonce?: () => string;
72
+ log?: (line: string) => void;
73
+ /** A monotonic clock in milliseconds. */
74
+ now?: () => number;
75
+ /** The pause between two polls; the hook never asks for one past the bound. */
76
+ sleep?: (ms: number) => Promise<void>;
77
+ /**
78
+ * Calls `expire` once `ms` have passed, unless the function it returns is
79
+ * called first: how the hook ends a poll still in flight at the bound.
80
+ */
81
+ timer?: (ms: number, expire: () => void) => () => void;
82
+ }
83
+ /** The arguments Pulumi passes a resource hook, as far as this hook reads them. */
84
+ export interface IdentityDomainParentReadyHookArgs {
85
+ newInputs?: Record<string, unknown>;
86
+ }
87
+ /**
88
+ * The hook `identityDomainParentReady` returns, with what this module's
89
+ * specs inject.
90
+ */
91
+ export declare function createParentReadyHook(rootDomain: string, options?: ParentReadyHookOptions): (args: IdentityDomainParentReadyHookArgs) => Promise<void>;