mancode 0.5.4 → 0.5.5

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.
@@ -1945,6 +1945,14 @@ function parseFunctionalScope(value) {
1945
1945
  )
1946
1946
  };
1947
1947
  }
1948
+ function assertRequirementsScopeConsistent(ledger) {
1949
+ const inScope = new Set(
1950
+ ledger.functionalScope.inScope.map((item) => item.trim())
1951
+ );
1952
+ if (ledger.functionalScope.outOfScope.some((item) => inScope.has(item.trim()))) {
1953
+ throw new Error("MANCODE_REQUIREMENTS_SCOPE_CONFLICT");
1954
+ }
1955
+ }
1948
1956
  function parseTechnicalDecisions(value) {
1949
1957
  if (!Array.isArray(value)) {
1950
1958
  throw new Error("requirements ledger technicalDecisions must be an array");
@@ -3634,6 +3642,14 @@ var WorkflowPolicyVersionUnsupportedError = class extends Error {
3634
3642
  }
3635
3643
  code = "MANCODE_POLICY_VERSION_UNSUPPORTED";
3636
3644
  };
3645
+ function assertExecutableImplementationScope(scope) {
3646
+ if (!implementationScopeIsExecutable(scope)) {
3647
+ throw new Error("MANCODE_IMPLEMENTATION_SCOPE_REQUIRED");
3648
+ }
3649
+ }
3650
+ function implementationScopeIsExecutable(scope) {
3651
+ return scope.source !== "legacy_unspecified" && scope.include.length > 0;
3652
+ }
3637
3653
  var TRANSITION_STATES = /* @__PURE__ */ new Set([
3638
3654
  "stable",
3639
3655
  "operation_pending",
@@ -4377,6 +4393,7 @@ function assertTaskAggregateConsistency(input) {
4377
4393
  function assertTaskCompletionGate(input, context) {
4378
4394
  assertTaskAggregateConsistency(input);
4379
4395
  const { metadata, requirements, review, verification } = input;
4396
+ assertRequirementsScopeConsistent(requirements);
4380
4397
  if (metadata.status !== "in_progress" && metadata.status !== "planned") {
4381
4398
  throw new Error("only active workflows may pass the task completion gate");
4382
4399
  }
@@ -4386,6 +4403,9 @@ function assertTaskCompletionGate(input, context) {
4386
4403
  if (metadata.governance.planDecision === null) {
4387
4404
  throw new Error("task completion requires a plan decision");
4388
4405
  }
4406
+ if (metadata.governance.planDecision === "governed_execution" || metadata.governance.planDecision === "solo_handoff") {
4407
+ assertExecutableImplementationScope(metadata.implementationScope);
4408
+ }
4389
4409
  if (metadata.governance.planDecision === "solo_handoff") {
4390
4410
  assertSoloHandoffCompletionGate(input, context);
4391
4411
  return;
@@ -7221,6 +7241,7 @@ export {
7221
7241
  requirementsLedgerDigest,
7222
7242
  assertRequirementsLedgerTransition,
7223
7243
  requirementsAreReady,
7244
+ assertRequirementsScopeConsistent,
7224
7245
  parseArtifactRef,
7225
7246
  parseReviewLedger,
7226
7247
  reviewLedgerDigest,
@@ -7236,6 +7257,8 @@ export {
7236
7257
  parseWorkflowMode,
7237
7258
  normalizeLegacyWorkflowMode,
7238
7259
  assertWorkflowDescriptor,
7260
+ assertExecutableImplementationScope,
7261
+ implementationScopeIsExecutable,
7239
7262
  parseWorkflowMetadata,
7240
7263
  workflowMetadataDigest,
7241
7264
  assertWorkflowMetadataTransition,
@@ -7273,4 +7296,4 @@ export {
7273
7296
  V3ContextStore,
7274
7297
  storedTaskAggregateDigest
7275
7298
  };
7276
- //# sourceMappingURL=chunk-VHZI2WKD.js.map
7299
+ //# sourceMappingURL=chunk-YWHFHZ4A.js.map