@zaip-ai/cli 7.5.0 → 7.6.0

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 (118) hide show
  1. package/README.md +12 -20
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.js +2 -2
  4. package/dist/commands/init.js.map +1 -1
  5. package/dist/services/adapters.d.ts +1 -1
  6. package/dist/services/adapters.js +1 -1
  7. package/dist/services/codex-task-delivery-authority-template.d.ts.map +1 -1
  8. package/dist/services/codex-task-delivery-authority-template.js +39 -1
  9. package/dist/services/codex-task-delivery-authority-template.js.map +1 -1
  10. package/dist/services/global-codex-project-trust.d.ts +1 -1
  11. package/dist/services/global-codex-project-trust.d.ts.map +1 -1
  12. package/dist/services/global-codex-project-trust.js +46 -11
  13. package/dist/services/global-codex-project-trust.js.map +1 -1
  14. package/dist/services/global-codex-project-trust.test.js +35 -4
  15. package/dist/services/global-codex-project-trust.test.js.map +1 -1
  16. package/dist/services/install-agents-template.js +2 -2
  17. package/dist/services/install-agents-template.js.map +1 -1
  18. package/dist/services/install-target-windows.test.d.ts +2 -0
  19. package/dist/services/install-target-windows.test.d.ts.map +1 -0
  20. package/dist/services/install-target-windows.test.js +39 -0
  21. package/dist/services/install-target-windows.test.js.map +1 -0
  22. package/dist/services/install-target.d.ts +6 -0
  23. package/dist/services/install-target.d.ts.map +1 -0
  24. package/dist/services/install-target.js +89 -0
  25. package/dist/services/install-target.js.map +1 -0
  26. package/dist/services/install-target.test.d.ts +2 -0
  27. package/dist/services/install-target.test.d.ts.map +1 -0
  28. package/dist/services/install-target.test.js +47 -0
  29. package/dist/services/install-target.test.js.map +1 -0
  30. package/dist/services/logger.js +5 -3
  31. package/dist/services/logger.js.map +1 -1
  32. package/package.json +1 -1
  33. package/templates/.agents/config/agents/discovery.json +1 -1
  34. package/templates/.agents/dashboard/.zaip-managed.json +72 -32
  35. package/templates/.agents/dashboard/apps/frontend/dist/assets/{ProjectSettingsPage-BCsdQtWG.js → ProjectSettingsPage-86kLUrXm.js} +1 -1
  36. package/templates/.agents/dashboard/apps/frontend/dist/assets/{TraceabilityWorkspace-BN8FwP5S.js → TraceabilityWorkspace-BZ1rH1vl.js} +1 -1
  37. package/templates/.agents/dashboard/apps/frontend/dist/assets/{index-uIVtG2ZR.js → index-C4uiRYHu.js} +2 -2
  38. package/templates/.agents/dashboard/apps/frontend/dist/assets/{traceability-DFY7ZDlu.css → traceability-s5SzQnzt.css} +1 -1
  39. package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-vQx9R6BQ.js +1 -0
  40. package/templates/.agents/dashboard/apps/frontend/dist/index.html +3 -3
  41. package/templates/.agents/dashboard/apps/frontend/e2e/release-delivery-fixture.mjs +117 -0
  42. package/templates/.agents/dashboard/apps/frontend/e2e/release-delivery-lab.mjs +246 -0
  43. package/templates/.agents/dashboard/apps/frontend/e2e/release-delivery-receipt.mjs +65 -0
  44. package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
  45. package/templates/.agents/dashboard/apps/frontend/src/dashboard-runtime-status.ts +5 -1
  46. package/templates/.agents/dashboard/apps/frontend/src/release-delivery.test.tsx +78 -0
  47. package/templates/.agents/dashboard/apps/frontend/src/use-runtime-status.dom.test.ts +28 -6
  48. package/templates/.agents/dashboard/apps/frontend/src/use-runtime-status.ts +18 -7
  49. package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
  50. package/templates/.agents/dashboard/modules/operations/package.json +1 -1
  51. package/templates/.agents/dashboard/modules/traceability/package.json +1 -1
  52. package/templates/.agents/dashboard/modules/traceability/src/contracts.ts +11 -0
  53. package/templates/.agents/dashboard/modules/traceability/src/react/ReleaseDeliveryPanel.tsx +60 -0
  54. package/templates/.agents/dashboard/modules/traceability/src/react/TaskTracePanel.tsx +9 -57
  55. package/templates/.agents/dashboard/modules/traceability/src/react/release-delivery-panel.css +26 -0
  56. package/templates/.agents/dashboard/modules/traceability/src/react/trace-date-format.ts +33 -0
  57. package/templates/.agents/dashboard/modules/traceability/src/react/trace-stage-labels.ts +28 -0
  58. package/templates/.agents/dashboard/packages/branding/package.json +1 -1
  59. package/templates/.agents/dashboard/packages/contracts/package.json +1 -1
  60. package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
  61. package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +236 -235
  62. package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +81 -81
  63. package/templates/.agents/dashboard/packages/local-runtime/package.json +1 -1
  64. package/templates/.agents/dashboard/packages/local-runtime/server.mjs +236 -235
  65. package/templates/.agents/dashboard/packages/local-runtime/src/server-release-receipt.ts +71 -0
  66. package/templates/.agents/dashboard/packages/local-runtime/src/server-trace-release-delivery.ts +120 -0
  67. package/templates/.agents/dashboard/packages/local-runtime/src/server-trace-routes.ts +5 -4
  68. package/templates/.agents/dashboard/packages/ui/package.json +1 -1
  69. package/templates/.agents/dashboard/stack-dependencies.json +3 -3
  70. package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
  71. package/templates/.agents/design/.zaip-managed.json +4 -4
  72. package/templates/.agents/design/apps/catalog/package.json +1 -1
  73. package/templates/.agents/design/design-system-maker/build.json +94 -79
  74. package/templates/.agents/design/packages/local-runtime/package.json +1 -1
  75. package/templates/.agents/requirements/autonomous-assurance.md +1 -1
  76. package/templates/.agents/requirements/cloud-hostinger-autonomy.md +1 -1
  77. package/templates/.agents/requirements/comparative-audit.md +1 -1
  78. package/templates/.agents/requirements/context-engine.md +1 -1
  79. package/templates/.agents/requirements/cost-observability.md +1 -1
  80. package/templates/.agents/requirements/dashboard-launch.md +1 -1
  81. package/templates/.agents/requirements/data-export.md +1 -1
  82. package/templates/.agents/requirements/design-system.md +1 -1
  83. package/templates/.agents/requirements/execution-engine.md +1 -1
  84. package/templates/.agents/requirements/kanban-dashboard.md +1 -1
  85. package/templates/.agents/requirements/landing-page-forms.md +1 -1
  86. package/templates/.agents/requirements/model-orchestration.md +1 -1
  87. package/templates/.agents/requirements/public-distribution.md +1 -1
  88. package/templates/.agents/requirements/site-performance.md +1 -1
  89. package/templates/.agents/requirements/software-architecture.md +1 -1
  90. package/templates/.agents/requirements/strategic-improvements.md +1 -1
  91. package/templates/.agents/requirements/work-lifecycle.md +1 -1
  92. package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
  93. package/templates/.agents/runtime/VERSION +1 -1
  94. package/templates/.agents/runtime/bin/historical-catalog-b6b6516200bdb412c92063e887ccef329d7c5193b5610cba5346e97c71301394.mjs +318 -0
  95. package/templates/.agents/runtime/bin/zaip.mjs +149 -109
  96. package/templates/.agents/runtime/checksums.sha256 +6 -5
  97. package/templates/.agents/runtime/manifest.json +2 -1
  98. package/templates/.agents/runtime/provenance.json +4 -4
  99. package/templates/.agents/runtime/sbom.cdx.json +1 -1
  100. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-contract.mjs +49 -70
  101. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-idempotent-intent.test.mjs +39 -0
  102. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deployment-next-release.mjs +57 -0
  103. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deployment-request.mjs +15 -0
  104. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-intent.mjs +4 -1
  105. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/{chunk-A3ZCURGS.mjs → chunk-CJ5ZQF6M.mjs} +6 -6
  106. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/{chunk-ZOGCYGYB.mjs → chunk-EQTZ3Y7R.mjs} +1 -1
  107. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-FMNUSV2P.mjs +139 -0
  108. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/{chunk-7SBOEN6U.mjs → chunk-LWS3QVJO.mjs} +2 -2
  109. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/lifecycle-records.mjs +1 -1
  110. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/manifest.json +14 -13
  111. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/native-authority.mjs +1 -1
  112. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/proof.mjs +1 -1
  113. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/run-records.mjs +1 -1
  114. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-schema.mjs +1 -1
  115. package/templates/.agents/zaip-aios/VERSION +1 -1
  116. package/templates/template-manifest.json +141 -92
  117. package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-Boz50W9b.js +0 -1
  118. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-NJOFXS7P.mjs +0 -137
@@ -1,11 +1,12 @@
1
1
  b146bd0c7c60b1ab43c4f71e0b1d2262c6df6da6f7053a0425f834ccb77a6b48 LICENSE
2
2
  bc02cba77e8d51e5c580f43668863dc868eda66f1ff663bfaa49fcf3ca16320e THIRD_PARTY_NOTICES.md
3
- 738a7f927a20e3184a388ef7fcdbbd6745f22738b7205fccf454e0737dae0294 VERSION
4
- b3dd42298c1d284e4838a77c794cd6f282ca4cd5dd02f9924ce7a19c7c26f675 bin/zaip.mjs
5
- e67c5fd26cbfeeddb5f474c7d4a9a6f51a37d85842419d39d2decd835ec2d111 manifest.json
3
+ ed168794d9d7df063a415e5653b0e30779b6004fefbae2a84b96cfbad461d62a VERSION
4
+ b6b6516200bdb412c92063e887ccef329d7c5193b5610cba5346e97c71301394 bin/historical-catalog-b6b6516200bdb412c92063e887ccef329d7c5193b5610cba5346e97c71301394.mjs
5
+ b9b75c646ab4c6da685335e36fd855e4b110e9b7168476a9f9ef3f8fb098add8 bin/zaip.mjs
6
+ 70306752086ae84d604684f64a952429245c68cc68c96aaa5277158b6cab5aef manifest.json
6
7
  7f89219d7c567c82a51679ad136d84364bded7ac659492537e125d33b1d58a7a migrations/001-layout-v1.json
7
8
  5f8c48b286d0b44d8fbb57a9a5d009a8a500439aa3148d750b8f193f72995c9f migrations/002-layout-v2.json
8
9
  a565a60a140384751f84a15824df29ddda4a9dc2c608aca96171d2c75731f0f6 pnpm-lock.sha256
9
- aacb317929e35a22880495faae95d76ffcbbdb1e650c4545cd629baedaaf72b2 provenance.json
10
- 8b38027b9122081aeadcb4d3bd9976428e38c0c6bdf33da93bf36eb83724ffd4 sbom.cdx.json
10
+ 0c3c5460bba91a82f280bc5923f306ac9c1b6a67bb908b88a472de772e1fcd67 provenance.json
11
+ f6fef16eef724861d7a5a13cb5dcde75270b104b44681a3fd9d7561b6e0cc40b sbom.cdx.json
11
12
  b3ffedf9e146be802a15b4009f33e031dec3071ca1525e12c67606fd964a3067 schemas/contracts.schema.json
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "name": "zaip-aios",
4
- "version": "7.5.0",
4
+ "version": "7.6.0",
5
5
  "node": ">=22",
6
6
  "files": [
7
7
  "LICENSE",
8
8
  "THIRD_PARTY_NOTICES.md",
9
9
  "VERSION",
10
+ "bin/historical-catalog-b6b6516200bdb412c92063e887ccef329d7c5193b5610cba5346e97c71301394.mjs",
10
11
  "bin/zaip.mjs",
11
12
  "migrations/001-layout-v1.json",
12
13
  "migrations/002-layout-v2.json",
@@ -2,10 +2,10 @@
2
2
  "schema_version": 1,
3
3
  "statement_type": "self_reported_build_integrity",
4
4
  "authenticity": "unverified",
5
- "version": "7.5.0",
5
+ "version": "7.6.0",
6
6
  "source_origin": "zaip-aios:local-build",
7
7
  "lockfile_sha256": "4bc8b0268e9eac5d04122c1b38e72ad075d5037ac9082f84c025ae86fe83bfcd",
8
- "sbom_sha256": "8b38027b9122081aeadcb4d3bd9976428e38c0c6bdf33da93bf36eb83724ffd4",
9
- "runtime_sha256": "8dc9e7d7e6d39ddb4f944b813e5826e058c36408e02f79f712ddd43fbdcd5244",
10
- "statement_sha256": "3a672d721e5010bac1565bc95281d20b28b3ad17b1cfeb9c269a0c6787ca0b3c"
8
+ "sbom_sha256": "f6fef16eef724861d7a5a13cb5dcde75270b104b44681a3fd9d7561b6e0cc40b",
9
+ "runtime_sha256": "a17a233d253f35db64282a05f664d86b4b9742612c6eaed34ee7a98c6ea0bab1",
10
+ "statement_sha256": "01db7127e41f37005bad2a3f3ca742764181c2d703b110d76682e496c27ad00d"
11
11
  }
@@ -6,7 +6,7 @@
6
6
  "component": {
7
7
  "type": "application",
8
8
  "name": "zaip-aios",
9
- "version": "7.5.0"
9
+ "version": "7.6.0"
10
10
  }
11
11
  },
12
12
  "components": [
@@ -18,8 +18,11 @@ import { bindQualifiedPublicationPlan } from "./publication-plan-binding.mjs";
18
18
  import { unsupportedPublicationPlan } from "./publication-plan-refusal.mjs";
19
19
  import { readPublicationProjectPolicy } from "./publication-project-policy.mjs";
20
20
  import {
21
+ assertNativeClosureAuthority,
22
+ assertNativeClosureContract,
21
23
  assertNativePublicationAuthority,
22
24
  assertNativePublicationContract,
25
+ resolveNativeClosureAuthority,
23
26
  resolveNativePublicationAuthority,
24
27
  } from "./publication-proof-schema.mjs";
25
28
 
@@ -61,16 +64,19 @@ export function repositoryKind({
61
64
  return "builder";
62
65
  }
63
66
 
64
- export function resolveDeployment({
65
- request,
66
- policy,
67
- identity,
68
- conditionProof,
69
- nativeAuthority,
70
- candidate,
71
- destination,
72
- projectRestrictions,
73
- }) {
67
+ function resolveDeploymentForPurpose(
68
+ {
69
+ request,
70
+ policy,
71
+ identity,
72
+ conditionProof,
73
+ nativeAuthority,
74
+ candidate,
75
+ destination,
76
+ projectRestrictions,
77
+ },
78
+ purpose,
79
+ ) {
74
80
  const preference = validatePolicy(policy);
75
81
  const kind = repositoryKind(identity);
76
82
  const refusal = unsupportedPublicationPlan(request);
@@ -106,7 +112,10 @@ export function resolveDeployment({
106
112
  mode = "commits";
107
113
  }
108
114
  if (nativeAuthority) {
109
- assertNativePublicationAuthority(nativeAuthority, request);
115
+ (purpose === "closure" ? assertNativeClosureAuthority : assertNativePublicationAuthority)(
116
+ nativeAuthority,
117
+ request,
118
+ );
110
119
  if (nativeAuthority.constraints.release === "forbidden") {
111
120
  assert(
112
121
  intent.override !== "release",
@@ -199,8 +208,12 @@ export function resolveDeployment({
199
208
  };
200
209
  return { ...authorization, contract_sha256: digest(authorization) };
201
210
  }
202
- export function verifyContract(plan, input, expectedMode, expectedPhase = "publish") {
203
- const actual = resolveDeployment(input);
211
+ export function resolveDeployment(input) {
212
+ return resolveDeploymentForPurpose(input, "publication");
213
+ }
214
+ function verifyContractForPurpose(plan, input, expectedMode, expectedPhase, purpose) {
215
+ if (purpose === "closure") assertNativeClosureAuthority(input.nativeAuthority, input.request);
216
+ const actual = resolveDeploymentForPurpose(input, purpose);
204
217
  assert(
205
218
  actual.mode === expectedMode && actual.phase === expectedPhase,
206
219
  "Deployment intent does not authorize this delivery route",
@@ -210,72 +223,31 @@ export function verifyContract(plan, input, expectedMode, expectedPhase = "publi
210
223
  "Deployment contract changed; resolve again before any mutation",
211
224
  );
212
225
  if (input.nativeAuthority && actual.phase === "publish")
213
- assertNativePublicationContract(input.nativeAuthority, actual);
226
+ (purpose === "closure" ? assertNativeClosureContract : assertNativePublicationContract)(
227
+ input.nativeAuthority,
228
+ actual,
229
+ );
214
230
  return actual;
215
231
  }
216
- export function nextRelease(
217
- tags = [],
218
- {
219
- major = false,
220
- publishedSha = null,
221
- candidateSha = null,
222
- publishedTag = null,
223
- existingTag = null,
224
- existingTagSha = null,
225
- } = {},
226
- ) {
227
- assert(
228
- Array.isArray(tags) && tags.every((x) => typeof x === "string"),
229
- "Verified tag list required",
230
- );
231
- const valid = tags
232
- .map((tag) => /^v(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?$/.exec(tag))
233
- .filter(Boolean);
234
- valid.sort((a, b) =>
235
- BigInt(a[1]) === BigInt(b[1])
236
- ? BigInt(a[2]) < BigInt(b[2])
237
- ? -1
238
- : BigInt(a[2]) > BigInt(b[2])
239
- ? 1
240
- : 0
241
- : BigInt(a[1]) < BigInt(b[1])
242
- ? -1
243
- : 1,
244
- );
245
- if (publishedSha && publishedSha === candidateSha) {
246
- assert(
247
- /^[a-f0-9]{40}$/i.test(candidateSha ?? "") &&
248
- tags.includes(publishedTag) &&
249
- /^v(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(publishedTag ?? ""),
250
- "Published identity must include its verified tag and SHA",
251
- );
252
- return { action: "verify-existing", tag: publishedTag, create_release: false };
253
- }
254
- if (existingTag) {
255
- assert(
256
- /^v(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(existingTag) &&
257
- /^[a-f0-9]{40}$/i.test(candidateSha ?? "") &&
258
- existingTagSha === candidateSha,
259
- "Retry requires the exact existing tag and candidate SHA",
260
- );
261
- return { action: "resume", tag: existingTag, create_release: false };
262
- }
263
- const last = valid.at(-1);
264
- const version = !last
265
- ? "1.0"
266
- : major
267
- ? `${BigInt(last[1]) + 1n}.0`
268
- : `${last[1]}.${BigInt(last[2]) + 1n}`;
269
- return { action: "new", tag: `v${version}`, version, create_release: true };
232
+ export function verifyContract(plan, input, expectedMode, expectedPhase = "publish") {
233
+ return verifyContractForPurpose(plan, input, expectedMode, expectedPhase, "publication");
234
+ }
235
+ export function verifyClosureContract(plan, input) {
236
+ assert(plan.kind === "builder", "Closure requires the original builder release contract");
237
+ return verifyContractForPurpose(plan, input, "release", "publish", "closure");
270
238
  }
271
- export async function readDeploymentInput(repository, request, options = {}) {
239
+ export { nextRelease } from "./deployment-next-release.mjs";
240
+
241
+ async function readDeploymentInputForPurpose(repository, request, options, purpose) {
272
242
  const root = await realpath(resolve(repository));
273
243
  assert(
274
244
  (await realpath(git(root, ["rev-parse", "--show-toplevel"]))) === root,
275
245
  "Use the exact Git workspace root",
276
246
  );
277
247
  const sourceRunId = options.source_run_id ?? options.condition?.authorization_run_id;
278
- const nativeAuthority = await resolveNativePublicationAuthority(root, request, sourceRunId);
248
+ const nativeAuthority = await (purpose === "closure"
249
+ ? resolveNativeClosureAuthority
250
+ : resolveNativePublicationAuthority)(root, request, sourceRunId);
279
251
  if (requestedDeployment(request).completionOnly) {
280
252
  const policy = JSON.parse(git(root, ["show", "HEAD:.github/ci-validation.json"]));
281
253
  assert(
@@ -348,6 +320,13 @@ export async function readDeploymentInput(repository, request, options = {}) {
348
320
  identity,
349
321
  };
350
322
  }
323
+ export function readDeploymentInput(repository, request, options = {}) {
324
+ return readDeploymentInputForPurpose(repository, request, options, "publication");
325
+ }
326
+ export function readClosureDeploymentInput(repository, request, options = {}) {
327
+ assert(!options.condition, "publication_closure_conditional_authority_unsupported");
328
+ return readDeploymentInputForPurpose(repository, request, options, "closure");
329
+ }
351
330
  export async function main() {
352
331
  const { values } = parseArgs({
353
332
  options: {
@@ -15,6 +15,45 @@ const plan = (request, identity = builder, policy) =>
15
15
  resolveDeployment({ request, identity, policy });
16
16
  const checkedAdjustments =
17
17
  "verifique se foi feito deploy da v7.5. Se ainda não, faça os ajustes necessários para realizar o deploy corretamente. Garanta que o deploy seja feito.";
18
+ const distributionRecovery =
19
+ "revise se o deploy foi feito no github e no npm, caso contrário resolva as pendencias, faça os ajustes necessários e garanta o deploy feito.";
20
+
21
+ test("check both distribution surfaces and repair only missing publication", () => {
22
+ for (const request of [
23
+ distributionRecovery,
24
+ "Verifique se o deploy foi feito no GitHub e no npm, caso contrário faça deploy!",
25
+ "Confira se deploy foi feito no github e no npm, caso contrário faça os ajustes necessários e faça o deploy",
26
+ ]) {
27
+ const resolved = plan(request);
28
+ assert.equal(resolved.phase, "publish");
29
+ assert.equal(resolved.mode, "release");
30
+ assert.equal(resolved.version, null);
31
+ assert.equal(resolved.scope, "current-work");
32
+ assert.equal(resolved.completion_only, "github-and-npm");
33
+ assert.equal(resolved.npm_publication, true);
34
+ assert.equal(plan(request, consumer).mode, "none");
35
+ }
36
+ });
37
+
38
+ test("distribution recovery retains provenance, holds and exact scope", () => {
39
+ for (const request of [
40
+ `"${distributionRecovery}"`,
41
+ `Ele disse: ${distributionRecovery}`,
42
+ `Exemplo: ${distributionRecovery}`,
43
+ `${distributionRecovery}?`,
44
+ `Não ${distributionRecovery}`,
45
+ `${distributionRecovery} Só publique com minha autorização.`,
46
+ `${distributionRecovery} se eu aprovar`,
47
+ `${distributionRecovery} de tudo`,
48
+ `${distributionRecovery} e publique a v7.7`,
49
+ distributionRecovery.replace("garanta o deploy feito", "não faça deploy"),
50
+ distributionRecovery.replace(" e garanta o deploy feito", ""),
51
+ distributionRecovery.split(", caso contrário")[0],
52
+ ]) {
53
+ assert.notEqual(plan(request).phase, "publish", request);
54
+ assert.notEqual(plan(request).npm_publication, true, request);
55
+ }
56
+ });
18
57
 
19
58
  test("complete only missing GitHub or npm delivery of the same explicit release", () => {
20
59
  const request =
@@ -0,0 +1,57 @@
1
+ import { assert } from "./deployment-request.mjs";
2
+
3
+ export function nextRelease(
4
+ tags = [],
5
+ {
6
+ major = false,
7
+ publishedSha = null,
8
+ candidateSha = null,
9
+ publishedTag = null,
10
+ existingTag = null,
11
+ existingTagSha = null,
12
+ } = {},
13
+ ) {
14
+ assert(
15
+ Array.isArray(tags) && tags.every((x) => typeof x === "string"),
16
+ "Verified tag list required",
17
+ );
18
+ const valid = tags
19
+ .map((tag) => /^v(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?$/.exec(tag))
20
+ .filter(Boolean);
21
+ valid.sort((a, b) =>
22
+ BigInt(a[1]) === BigInt(b[1])
23
+ ? BigInt(a[2]) < BigInt(b[2])
24
+ ? -1
25
+ : BigInt(a[2]) > BigInt(b[2])
26
+ ? 1
27
+ : 0
28
+ : BigInt(a[1]) < BigInt(b[1])
29
+ ? -1
30
+ : 1,
31
+ );
32
+ if (publishedSha && publishedSha === candidateSha) {
33
+ assert(
34
+ /^[a-f0-9]{40}$/i.test(candidateSha ?? "") &&
35
+ tags.includes(publishedTag) &&
36
+ /^v(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(publishedTag ?? ""),
37
+ "Published identity must include its verified tag and SHA",
38
+ );
39
+ return { action: "verify-existing", tag: publishedTag, create_release: false };
40
+ }
41
+ if (existingTag) {
42
+ assert(
43
+ /^v(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(existingTag) &&
44
+ /^[a-f0-9]{40}$/i.test(candidateSha ?? "") &&
45
+ existingTagSha === candidateSha,
46
+ "Retry requires the exact existing tag and candidate SHA",
47
+ );
48
+ return { action: "resume", tag: existingTag, create_release: false };
49
+ }
50
+ const last = valid.at(-1);
51
+ const version = !last
52
+ ? "1.0"
53
+ : major
54
+ ? `${BigInt(last[1]) + 1n}.0`
55
+ : `${last[1]}.${BigInt(last[2]) + 1n}`;
56
+ return { action: "new", tag: `v${version}`, version, create_release: true };
57
+ }
@@ -64,6 +64,21 @@ export function requestedDeployment(request) {
64
64
  scope: "current-work",
65
65
  completionOnly: true,
66
66
  };
67
+ // Both explicitly requested surfaces require the builder's existing release
68
+ // completion path. The active cycle supplies the version; no scope is widened.
69
+ if (
70
+ /^(?:revise|verifique|confira) se (?:o )?deploy foi feito no github e no npm, caso contrario (?:resolva as pendencias, )?(?:faca os ajustes necessarios e )?(?:faca (?:o )?deploy|garanta o deploy feito)[.!]?$/.test(
71
+ text,
72
+ )
73
+ )
74
+ return {
75
+ authorized: true,
76
+ override: "release",
77
+ version: null,
78
+ phase: "publish",
79
+ scope: "current-work",
80
+ completionOnly: true,
81
+ };
67
82
  // Checking whether delivery already happened is the existing idempotency gate,
68
83
  // not a pending human approval. Accept only this complete bounded instruction.
69
84
  const verifyThenDeploy =
@@ -1,4 +1,4 @@
1
- // Generated from packages/core/src/authorization/publication-intent.ts; sha256=72ffe2de36705c3947d4f7436dad1f853318741eb7c97741dadb2533aeb595ec
1
+ // Generated from packages/core/src/authorization/publication-intent.ts; sha256=e5d855489d0833801d4cd58e88a27f6889813c1212712f44a481267f3a5523d8
2
2
  /** Intent only: this parser never proves a condition or grants publication. */
3
3
  export function inspectPublicationIntent(source) {
4
4
  const text = source
@@ -18,6 +18,9 @@ export function inspectPublicationIntent(source) {
18
18
  text,
19
19
  );
20
20
  const idempotentCheck =
21
+ /^(?:revise|verifique|confira) se (?:o )?deploy foi feito no github e no npm, caso contrario (?:resolva as pendencias, )?(?:faca os ajustes necessarios e )?(?:faca (?:o )?deploy|garanta o deploy feito)[.!]?$/.test(
22
+ text,
23
+ ) ||
21
24
  /^(?:revise|verifique|confira) se (?:ja )?foi feito (?:o )?deploy, caso contrario faca deploy(?: (?:da|de) v?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*))?[.!]?$/.test(
22
25
  text,
23
26
  ) ||