@acorex-platform/module-software-management-client 1.0.2 → 2.0.0-beta.1

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 (70) hide show
  1. package/fesm2022/{acorex-platform-module-software-management-client-accept-software-suggestion.command-DVcM5TTv.mjs → acorex-platform-module-software-management-client-accept-software-suggestion.command-BzPDjIw0.mjs} +7 -6
  2. package/fesm2022/acorex-platform-module-software-management-client-accept-software-suggestion.command-BzPDjIw0.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-module-software-management-client-behavior-specification.commands-4rkD2uP9.mjs +212 -0
  4. package/fesm2022/acorex-platform-module-software-management-client-behavior-specification.commands-4rkD2uP9.mjs.map +1 -0
  5. package/fesm2022/acorex-platform-module-software-management-client-behavior-task.activities-WmCC3-3L.mjs +79 -0
  6. package/fesm2022/acorex-platform-module-software-management-client-behavior-task.activities-WmCC3-3L.mjs.map +1 -0
  7. package/fesm2022/acorex-platform-module-software-management-client-complete-software-phase.activity-C61GUc78.mjs +512 -0
  8. package/fesm2022/acorex-platform-module-software-management-client-complete-software-phase.activity-C61GUc78.mjs.map +1 -0
  9. package/fesm2022/acorex-platform-module-software-management-client-contracts-acceptance-criterion.entity-CHEusZ4z.mjs +62 -0
  10. package/fesm2022/acorex-platform-module-software-management-client-contracts-acceptance-criterion.entity-CHEusZ4z.mjs.map +1 -0
  11. package/fesm2022/acorex-platform-module-software-management-client-contracts-business-rule.entity-Cew1yY4A.mjs +76 -0
  12. package/fesm2022/acorex-platform-module-software-management-client-contracts-business-rule.entity-Cew1yY4A.mjs.map +1 -0
  13. package/fesm2022/acorex-platform-module-software-management-client-contracts-design-decision.entity-BDRnAUj9.mjs +94 -0
  14. package/fesm2022/acorex-platform-module-software-management-client-contracts-design-decision.entity-BDRnAUj9.mjs.map +1 -0
  15. package/fesm2022/acorex-platform-module-software-management-client-contracts-discovery-item.entity-Ah5hlc5n.mjs +71 -0
  16. package/fesm2022/acorex-platform-module-software-management-client-contracts-discovery-item.entity-Ah5hlc5n.mjs.map +1 -0
  17. package/fesm2022/acorex-platform-module-software-management-client-contracts-feature.entity-D9es0yAv.mjs +49 -0
  18. package/fesm2022/acorex-platform-module-software-management-client-contracts-feature.entity-D9es0yAv.mjs.map +1 -0
  19. package/fesm2022/acorex-platform-module-software-management-client-contracts-module.entity-E9XKlo1v.mjs +26 -0
  20. package/fesm2022/acorex-platform-module-software-management-client-contracts-module.entity-E9XKlo1v.mjs.map +1 -0
  21. package/fesm2022/acorex-platform-module-software-management-client-contracts-requirement.entity-DKr-En_J.mjs +86 -0
  22. package/fesm2022/acorex-platform-module-software-management-client-contracts-requirement.entity-DKr-En_J.mjs.map +1 -0
  23. package/fesm2022/acorex-platform-module-software-management-client-contracts-scope-item.entity-D25tkUvi.mjs +73 -0
  24. package/fesm2022/acorex-platform-module-software-management-client-contracts-scope-item.entity-D25tkUvi.mjs.map +1 -0
  25. package/fesm2022/acorex-platform-module-software-management-client-contracts-software-entity.util-sRHl21Jh.mjs +281 -0
  26. package/fesm2022/acorex-platform-module-software-management-client-contracts-software-entity.util-sRHl21Jh.mjs.map +1 -0
  27. package/fesm2022/acorex-platform-module-software-management-client-contracts-software.entity-DfeM7KfF.mjs +751 -0
  28. package/fesm2022/acorex-platform-module-software-management-client-contracts-software.entity-DfeM7KfF.mjs.map +1 -0
  29. package/fesm2022/acorex-platform-module-software-management-client-contracts-use-case.entity-dPBFz-xN.mjs +92 -0
  30. package/fesm2022/acorex-platform-module-software-management-client-contracts-use-case.entity-dPBFz-xN.mjs.map +1 -0
  31. package/fesm2022/acorex-platform-module-software-management-client-contracts.mjs +2709 -156
  32. package/fesm2022/acorex-platform-module-software-management-client-contracts.mjs.map +1 -1
  33. package/fesm2022/acorex-platform-module-software-management-client-delivery-plan.commands-ccrjppbE.mjs +212 -0
  34. package/fesm2022/acorex-platform-module-software-management-client-delivery-plan.commands-ccrjppbE.mjs.map +1 -0
  35. package/fesm2022/acorex-platform-module-software-management-client-delivery-task.activities-L955X3RX.mjs +216 -0
  36. package/fesm2022/acorex-platform-module-software-management-client-delivery-task.activities-L955X3RX.mjs.map +1 -0
  37. package/fesm2022/acorex-platform-module-software-management-client-design-document.commands-BDE3x0KG.mjs +212 -0
  38. package/fesm2022/acorex-platform-module-software-management-client-design-document.commands-BDE3x0KG.mjs.map +1 -0
  39. package/fesm2022/acorex-platform-module-software-management-client-design-task.activities-Cra2LNal.mjs +79 -0
  40. package/fesm2022/acorex-platform-module-software-management-client-design-task.activities-Cra2LNal.mjs.map +1 -0
  41. package/fesm2022/{acorex-platform-module-software-management-client-discovery-kickoff.commands-gB0_htfF.mjs → acorex-platform-module-software-management-client-discovery-kickoff.commands-BZxzDJs9.mjs} +4 -2
  42. package/fesm2022/{acorex-platform-module-software-management-client-discovery-kickoff.commands-gB0_htfF.mjs.map → acorex-platform-module-software-management-client-discovery-kickoff.commands-BZxzDJs9.mjs.map} +1 -1
  43. package/fesm2022/{acorex-platform-module-software-management-client-discovery-report.commands-D2ricLpq.mjs → acorex-platform-module-software-management-client-discovery-report.commands-C9GKrnHs.mjs} +3 -2
  44. package/fesm2022/acorex-platform-module-software-management-client-discovery-report.commands-C9GKrnHs.mjs.map +1 -0
  45. package/fesm2022/acorex-platform-module-software-management-client-discovery-task.activities-PIJEUza7.mjs +228 -0
  46. package/fesm2022/acorex-platform-module-software-management-client-discovery-task.activities-PIJEUza7.mjs.map +1 -0
  47. package/fesm2022/{acorex-platform-module-software-management-client-introduction-exit-message.util-DShFM8MY.mjs → acorex-platform-module-software-management-client-introduction-exit-message.util-cYtN92HY.mjs} +1 -1
  48. package/fesm2022/{acorex-platform-module-software-management-client-introduction-exit-message.util-DShFM8MY.mjs.map → acorex-platform-module-software-management-client-introduction-exit-message.util-cYtN92HY.mjs.map} +1 -1
  49. package/fesm2022/{acorex-platform-module-software-management-client-introduction-task.activities-BOsJbeJe.mjs → acorex-platform-module-software-management-client-introduction-task.activities-DQPpsJaH.mjs} +78 -3
  50. package/fesm2022/acorex-platform-module-software-management-client-introduction-task.activities-DQPpsJaH.mjs.map +1 -0
  51. package/fesm2022/acorex-platform-module-software-management-client-scope-document.commands-oLGsbLoA.mjs +212 -0
  52. package/fesm2022/acorex-platform-module-software-management-client-scope-document.commands-oLGsbLoA.mjs.map +1 -0
  53. package/fesm2022/acorex-platform-module-software-management-client-scope-task.activities-BCSPq0eO.mjs +79 -0
  54. package/fesm2022/acorex-platform-module-software-management-client-scope-task.activities-BCSPq0eO.mjs.map +1 -0
  55. package/fesm2022/{acorex-platform-module-software-management-client-software-command.util-BsoKQCX5.mjs → acorex-platform-module-software-management-client-software-command.util-CvlYk7tC.mjs} +1 -1
  56. package/fesm2022/{acorex-platform-module-software-management-client-software-command.util-BsoKQCX5.mjs.map → acorex-platform-module-software-management-client-software-command.util-CvlYk7tC.mjs.map} +1 -1
  57. package/fesm2022/{acorex-platform-module-software-management-client-start-software-definition-flow.command-B0YCgv2V.mjs → acorex-platform-module-software-management-client-start-software-definition-flow.command-BfxtMIGb.mjs} +2 -2
  58. package/fesm2022/{acorex-platform-module-software-management-client-start-software-definition-flow.command-B0YCgv2V.mjs.map → acorex-platform-module-software-management-client-start-software-definition-flow.command-BfxtMIGb.mjs.map} +1 -1
  59. package/fesm2022/acorex-platform-module-software-management-client.mjs +400 -32
  60. package/fesm2022/acorex-platform-module-software-management-client.mjs.map +1 -1
  61. package/i18n/en-AU/software-management.json +473 -24
  62. package/i18n/en-US/software-management.json +473 -24
  63. package/i18n/fa-IR/software-management.json +474 -25
  64. package/package.json +1 -1
  65. package/types/acorex-platform-module-software-management-client-contracts.d.ts +640 -11
  66. package/fesm2022/acorex-platform-module-software-management-client-accept-software-suggestion.command-DVcM5TTv.mjs.map +0 -1
  67. package/fesm2022/acorex-platform-module-software-management-client-complete-software-phase.activity-C56HhK20.mjs +0 -182
  68. package/fesm2022/acorex-platform-module-software-management-client-complete-software-phase.activity-C56HhK20.mjs.map +0 -1
  69. package/fesm2022/acorex-platform-module-software-management-client-discovery-report.commands-D2ricLpq.mjs.map +0 -1
  70. package/fesm2022/acorex-platform-module-software-management-client-introduction-task.activities-BOsJbeJe.mjs.map +0 -1
@@ -1,3 +1,5 @@
1
+ import { resolveMultiLanguageString } from '@acorex-platform/framework-shared/core';
2
+
1
3
  /**
2
4
  * Applications & Platform capability for defining standalone software products.
3
5
  * Group ids live in `AXPCommonPermissionGroupKeys`.
@@ -136,11 +138,57 @@ const AXPSoftwareManagementCommandKeys = {
136
138
  ExportDiscoveryReportPdf: 'SoftwareManagement.Software:ExportDiscoveryReportPdf',
137
139
  OpenDiscoveryReport: 'SoftwareManagement.Software:OpenDiscoveryReport',
138
140
  LinkDiscoveryQuestionnaire: 'SoftwareManagement.Software:LinkDiscoveryQuestionnaire',
141
+ ViewPinnedDiscovery: 'SoftwareManagement.Software:ViewPinnedDiscovery',
142
+ GenerateScopeDocument: 'SoftwareManagement.Software:GenerateScopeDocument',
143
+ SubmitScopeDocument: 'SoftwareManagement.Software:SubmitScopeDocument',
144
+ ExportScopePdf: 'SoftwareManagement.Software:ExportScopePdf',
145
+ OpenScopeDocument: 'SoftwareManagement.Software:OpenScopeDocument',
146
+ GenerateBehaviorDocument: 'SoftwareManagement.Software:GenerateBehaviorDocument',
147
+ SubmitBehaviorDocument: 'SoftwareManagement.Software:SubmitBehaviorDocument',
148
+ ExportBehaviorPdf: 'SoftwareManagement.Software:ExportBehaviorPdf',
149
+ OpenBehaviorDocument: 'SoftwareManagement.Software:OpenBehaviorDocument',
150
+ ViewPinnedScope: 'SoftwareManagement.Software:ViewPinnedScope',
151
+ GenerateDesignDocument: 'SoftwareManagement.Software:GenerateDesignDocument',
152
+ SubmitDesignDocument: 'SoftwareManagement.Software:SubmitDesignDocument',
153
+ ExportDesignPdf: 'SoftwareManagement.Software:ExportDesignPdf',
154
+ OpenDesignDocument: 'SoftwareManagement.Software:OpenDesignDocument',
155
+ ViewPinnedBehavior: 'SoftwareManagement.Software:ViewPinnedBehavior',
156
+ GenerateDeliveryPlan: 'SoftwareManagement.Software:GenerateDeliveryPlan',
157
+ SubmitDeliveryPlan: 'SoftwareManagement.Software:SubmitDeliveryPlan',
158
+ ExportDeliveryPdf: 'SoftwareManagement.Software:ExportDeliveryPdf',
159
+ OpenDeliveryPlan: 'SoftwareManagement.Software:OpenDeliveryPlan',
160
+ ViewPinnedDesign: 'SoftwareManagement.Software:ViewPinnedDesign',
139
161
  },
140
162
  WorkflowActivity: {
141
163
  CompletePhase: 'workflow-activity:complete-software-phase',
142
164
  LoadIntroduction: 'workflow-activity:load-software-introduction',
143
165
  SaveIntroduction: 'workflow-activity:save-software-introduction',
166
+ GenerateKickoff: 'workflow-activity:generate-software-kickoff',
167
+ SubmitKickoff: 'workflow-activity:submit-software-kickoff',
168
+ LoadDiscovery: 'workflow-activity:load-software-discovery',
169
+ SaveDiscoveryDecision: 'workflow-activity:save-software-discovery-decision',
170
+ GenerateDiscoveryReport: 'workflow-activity:generate-software-discovery-report',
171
+ SubmitDiscoveryReport: 'workflow-activity:submit-software-discovery-report',
172
+ ViewPinnedKickoff: 'workflow-activity:view-software-pinned-kickoff',
173
+ OpenDiscoveryReport: 'workflow-activity:open-software-discovery-report',
174
+ ViewPinnedDiscovery: 'workflow-activity:view-software-pinned-discovery',
175
+ GenerateScopeDocument: 'workflow-activity:generate-software-scope-document',
176
+ SubmitScopeDocument: 'workflow-activity:submit-software-scope-document',
177
+ OpenScopeDocument: 'workflow-activity:open-software-scope-document',
178
+ GenerateBehaviorDocument: 'workflow-activity:generate-software-behavior-document',
179
+ SubmitBehaviorDocument: 'workflow-activity:submit-software-behavior-document',
180
+ OpenBehaviorDocument: 'workflow-activity:open-software-behavior-document',
181
+ ViewPinnedScope: 'workflow-activity:view-software-pinned-scope',
182
+ GenerateDesignDocument: 'workflow-activity:generate-software-design-document',
183
+ SubmitDesignDocument: 'workflow-activity:submit-software-design-document',
184
+ OpenDesignDocument: 'workflow-activity:open-software-design-document',
185
+ ViewPinnedBehavior: 'workflow-activity:view-software-pinned-behavior',
186
+ LoadDelivery: 'workflow-activity:load-software-delivery',
187
+ SaveDeliveryPlan: 'workflow-activity:save-software-delivery-plan',
188
+ GenerateDeliveryPlan: 'workflow-activity:generate-software-delivery-plan',
189
+ SubmitDeliveryPlan: 'workflow-activity:submit-software-delivery-plan',
190
+ OpenDeliveryPlan: 'workflow-activity:open-software-delivery-plan',
191
+ ViewPinnedDesign: 'workflow-activity:view-software-pinned-design',
144
192
  },
145
193
  };
146
194
 
@@ -182,8 +230,26 @@ const SOFTWARE_DISCOVERY_KINDS = [
182
230
  'evidence',
183
231
  'unknown',
184
232
  ];
233
+ const DISCOVERY_KIND_INVALID_REASON = 'Choose an allowed finding type. The stored value was not a valid discovery kind. / یک نوع یافتهٔ مجاز انتخاب کنید. مقدار ذخیره‌شده نوع معتبری نبود.';
234
+ function isSoftwareDiscoveryKind(value) {
235
+ return typeof value === 'string' && SOFTWARE_DISCOVERY_KINDS.includes(value);
236
+ }
185
237
  const SOFTWARE_SCOPE_KINDS = ['capability', 'out-of-scope', 'success-metric'];
238
+ /** DSDM / BABOK MoSCoW for the first-version timebox. */
239
+ const SOFTWARE_MOSCOW_PRIORITIES = ['must', 'should', 'could', 'wont'];
186
240
  const SOFTWARE_DESIGN_KINDS = ['data-model', 'ux', 'technical'];
241
+ /** ISO/IEC/IEEE 29148 SRS grouping: functions, quality attributes, design constraints. */
242
+ const SOFTWARE_REQUIREMENT_KINDS = ['functional', 'quality', 'constraint'];
243
+ /** IEEE 29148 verification methods (inspection / analysis / demonstration / test). */
244
+ const SOFTWARE_VERIFICATION_METHODS = ['inspection', 'analysis', 'demonstration', 'test'];
245
+ /** SBVR: definitional (structural) vs behavioral (operative) rules. */
246
+ const SOFTWARE_BUSINESS_RULE_KINDS = ['structural', 'operative'];
247
+ /** SBVR example enforcement scale, trimmed to three levels used in this module. */
248
+ const SOFTWARE_ENFORCEMENT_LEVELS = ['strict', 'override', 'guideline'];
249
+ /** Cockburn use-case goal levels. */
250
+ const SOFTWARE_USE_CASE_LEVELS = ['summary', 'user-goal', 'subfunction'];
251
+ /** Nygard ADR status (proposed / accepted / superseded). */
252
+ const SOFTWARE_ADR_STATUSES = ['proposed', 'accepted', 'superseded'];
187
253
 
188
254
  const M = (en, fa) => ({ 'en-US': en, 'fa-IR': fa });
189
255
  const completeAction = {
@@ -278,6 +344,294 @@ function introductionDialogContext() {
278
344
  openQuestions: '{{ context.eval("outputs.last.openQuestions") }}',
279
345
  };
280
346
  }
347
+ function discoveryDecisionField(readonly) {
348
+ return {
349
+ type: 'grid-item-layout',
350
+ options: { colSpan: 12 },
351
+ children: [
352
+ {
353
+ type: 'form-field',
354
+ options: { label: '@software-management:entities.software.fields.discovery-decision.title', showLabel: true },
355
+ children: [
356
+ {
357
+ type: 'select-editor',
358
+ path: 'discoveryDecision',
359
+ name: 'discoveryDecision',
360
+ options: {
361
+ readonly,
362
+ disabled: readonly,
363
+ valueField: 'value',
364
+ textField: 'text',
365
+ dataSource: [
366
+ { value: 'proceed', text: '@software-management:terms.discovery-decision.proceed' },
367
+ { value: 'revise', text: '@software-management:terms.discovery-decision.revise' },
368
+ { value: 'stop', text: '@software-management:terms.discovery-decision.stop' },
369
+ ],
370
+ },
371
+ },
372
+ ],
373
+ },
374
+ ],
375
+ };
376
+ }
377
+ function discoveryDialogLayout(readonly) {
378
+ return {
379
+ type: 'grid-layout',
380
+ mode: readonly ? 'view' : 'edit',
381
+ options: {
382
+ grid: {
383
+ default: {
384
+ columns: 'repeat(12, 1fr)',
385
+ rows: 'repeat(3, auto)',
386
+ gap: '16px',
387
+ },
388
+ },
389
+ },
390
+ children: [
391
+ discoveryDecisionField(readonly),
392
+ introductionField('@software-management:entities.software.fields.discovery-rationale.title', 'discoveryRationale', 'large-text-editor', readonly),
393
+ introductionField('@software-management:workflows.definition.approval-status.label', 'approvalText', 'large-text-editor', true),
394
+ ],
395
+ };
396
+ }
397
+ function discoveryDialogContext() {
398
+ return {
399
+ discoveryDecision: '{{ context.eval("outputs.last.discoveryDecision") }}',
400
+ discoveryRationale: '{{ context.eval("outputs.last.discoveryRationale") }}',
401
+ approvalText: '{{ context.eval("outputs.last.approvalText") }}',
402
+ };
403
+ }
404
+ function discoveryTaskActions() {
405
+ return {
406
+ suffix: [
407
+ {
408
+ name: 'edit-discovery-decision',
409
+ title: '@software-management:actions.edit-discovery-decision.title',
410
+ icon: 'fa-light fa-pen',
411
+ color: 'primary',
412
+ command: { name: 'edit-discovery-decision' },
413
+ },
414
+ {
415
+ name: 'view-pinned-kickoff',
416
+ title: '@software-management:actions.view-pinned-kickoff.title',
417
+ icon: 'fa-light fa-eye',
418
+ color: 'default',
419
+ command: { name: 'view-pinned-kickoff' },
420
+ },
421
+ {
422
+ name: 'generate-report',
423
+ title: '@software-management:actions.generate-discovery-report.title',
424
+ icon: 'fa-light fa-file-lines',
425
+ color: 'primary',
426
+ command: { name: 'generate-report' },
427
+ },
428
+ {
429
+ name: 'submit-report',
430
+ title: '@software-management:actions.submit-discovery-report.title',
431
+ icon: 'fa-light fa-paper-plane',
432
+ color: 'default',
433
+ command: { name: 'submit-report' },
434
+ },
435
+ {
436
+ name: 'open-report',
437
+ title: '@software-management:actions.open-discovery-report.title',
438
+ icon: 'fa-light fa-folder-open',
439
+ color: 'default',
440
+ command: { name: 'open-report' },
441
+ },
442
+ completeAction,
443
+ ],
444
+ };
445
+ }
446
+ function scopeTaskActions() {
447
+ return {
448
+ suffix: [
449
+ {
450
+ name: 'view-pinned-discovery',
451
+ title: '@software-management:actions.view-pinned-discovery.title',
452
+ icon: 'fa-light fa-eye',
453
+ color: 'default',
454
+ command: { name: 'view-pinned-discovery' },
455
+ },
456
+ {
457
+ name: 'generate-scope',
458
+ title: '@software-management:actions.generate-scope-document.title',
459
+ icon: 'fa-light fa-file-lines',
460
+ color: 'primary',
461
+ command: { name: 'generate-scope' },
462
+ },
463
+ {
464
+ name: 'submit-scope',
465
+ title: '@software-management:actions.submit-scope-document.title',
466
+ icon: 'fa-light fa-paper-plane',
467
+ color: 'default',
468
+ command: { name: 'submit-scope' },
469
+ },
470
+ {
471
+ name: 'open-scope',
472
+ title: '@software-management:actions.open-scope-document.title',
473
+ icon: 'fa-light fa-folder-open',
474
+ color: 'default',
475
+ command: { name: 'open-scope' },
476
+ },
477
+ completeAction,
478
+ ],
479
+ };
480
+ }
481
+ function behaviorTaskActions() {
482
+ return {
483
+ suffix: [
484
+ {
485
+ name: 'view-pinned-scope',
486
+ title: '@software-management:actions.view-pinned-scope.title',
487
+ icon: 'fa-light fa-eye',
488
+ color: 'default',
489
+ command: { name: 'view-pinned-scope' },
490
+ },
491
+ {
492
+ name: 'generate-behavior',
493
+ title: '@software-management:actions.generate-behavior-document.title',
494
+ icon: 'fa-light fa-file-lines',
495
+ color: 'primary',
496
+ command: { name: 'generate-behavior' },
497
+ },
498
+ {
499
+ name: 'submit-behavior',
500
+ title: '@software-management:actions.submit-behavior-document.title',
501
+ icon: 'fa-light fa-paper-plane',
502
+ color: 'default',
503
+ command: { name: 'submit-behavior' },
504
+ },
505
+ {
506
+ name: 'open-behavior',
507
+ title: '@software-management:actions.open-behavior-document.title',
508
+ icon: 'fa-light fa-folder-open',
509
+ color: 'default',
510
+ command: { name: 'open-behavior' },
511
+ },
512
+ completeAction,
513
+ ],
514
+ };
515
+ }
516
+ function designTaskActions() {
517
+ return {
518
+ suffix: [
519
+ {
520
+ name: 'view-pinned-behavior',
521
+ title: '@software-management:actions.view-pinned-behavior.title',
522
+ icon: 'fa-light fa-eye',
523
+ color: 'default',
524
+ command: { name: 'view-pinned-behavior' },
525
+ },
526
+ {
527
+ name: 'generate-design',
528
+ title: '@software-management:actions.generate-design-document.title',
529
+ icon: 'fa-light fa-file-lines',
530
+ color: 'primary',
531
+ command: { name: 'generate-design' },
532
+ },
533
+ {
534
+ name: 'submit-design',
535
+ title: '@software-management:actions.submit-design-document.title',
536
+ icon: 'fa-light fa-paper-plane',
537
+ color: 'default',
538
+ command: { name: 'submit-design' },
539
+ },
540
+ {
541
+ name: 'open-design',
542
+ title: '@software-management:actions.open-design-document.title',
543
+ icon: 'fa-light fa-folder-open',
544
+ color: 'default',
545
+ command: { name: 'open-design' },
546
+ },
547
+ completeAction,
548
+ ],
549
+ };
550
+ }
551
+ function deliveryField(label, path, editor, readonly) {
552
+ return introductionField(label, path, editor, readonly);
553
+ }
554
+ function deliveryDialogLayout(readonly) {
555
+ return {
556
+ type: 'grid-layout',
557
+ mode: readonly ? 'view' : 'edit',
558
+ options: {
559
+ grid: {
560
+ default: {
561
+ columns: 'repeat(12, 1fr)',
562
+ rows: 'repeat(9, auto)',
563
+ gap: '16px',
564
+ },
565
+ },
566
+ },
567
+ children: [
568
+ deliveryField('@software-management:entities.software.fields.delivery-work-packages.title', 'deliveryWorkPackages', 'large-text-editor', readonly),
569
+ deliveryField('@software-management:entities.software.fields.delivery-milestones.title', 'deliveryMilestones', 'large-text-editor', readonly),
570
+ deliveryField('@software-management:entities.software.fields.delivery-estimate-assumptions.title', 'deliveryEstimateAssumptions', 'large-text-editor', readonly),
571
+ deliveryField('@software-management:entities.software.fields.delivery-verification-criteria.title', 'deliveryVerificationCriteria', 'large-text-editor', readonly),
572
+ deliveryField('@software-management:entities.software.fields.delivery-release-criteria.title', 'deliveryReleaseCriteria', 'large-text-editor', readonly),
573
+ deliveryField('@software-management:entities.software.fields.delivery-risks.title', 'deliveryRisks', 'large-text-editor', readonly),
574
+ deliveryField('@software-management:entities.software.fields.delivery-traced-requirement.title', 'deliveryTracedRequirementId', 'text-editor', readonly),
575
+ deliveryField('@software-management:entities.software.fields.delivery-traced-design-decision.title', 'deliveryTracedDesignDecisionId', 'text-editor', readonly),
576
+ deliveryField('@software-management:workflows.definition.approval-status.label', 'approvalText', 'large-text-editor', true),
577
+ ],
578
+ };
579
+ }
580
+ function deliveryDialogContext() {
581
+ return {
582
+ deliveryWorkPackages: '{{ context.eval("outputs.last.deliveryWorkPackages") }}',
583
+ deliveryMilestones: '{{ context.eval("outputs.last.deliveryMilestones") }}',
584
+ deliveryEstimateAssumptions: '{{ context.eval("outputs.last.deliveryEstimateAssumptions") }}',
585
+ deliveryVerificationCriteria: '{{ context.eval("outputs.last.deliveryVerificationCriteria") }}',
586
+ deliveryReleaseCriteria: '{{ context.eval("outputs.last.deliveryReleaseCriteria") }}',
587
+ deliveryRisks: '{{ context.eval("outputs.last.deliveryRisks") }}',
588
+ deliveryTracedRequirementId: '{{ context.eval("outputs.last.deliveryTracedRequirementId") }}',
589
+ deliveryTracedDesignDecisionId: '{{ context.eval("outputs.last.deliveryTracedDesignDecisionId") }}',
590
+ approvalText: '{{ context.eval("outputs.last.approvalText") }}',
591
+ };
592
+ }
593
+ function deliveryTaskActions() {
594
+ return {
595
+ suffix: [
596
+ {
597
+ name: 'edit-delivery-plan',
598
+ title: '@software-management:actions.edit-delivery-plan.title',
599
+ icon: 'fa-light fa-pen',
600
+ color: 'primary',
601
+ command: { name: 'edit-delivery-plan' },
602
+ },
603
+ {
604
+ name: 'view-pinned-design',
605
+ title: '@software-management:actions.view-pinned-design.title',
606
+ icon: 'fa-light fa-eye',
607
+ color: 'default',
608
+ command: { name: 'view-pinned-design' },
609
+ },
610
+ {
611
+ name: 'generate-delivery',
612
+ title: '@software-management:actions.generate-delivery-plan.title',
613
+ icon: 'fa-light fa-file-lines',
614
+ color: 'primary',
615
+ command: { name: 'generate-delivery' },
616
+ },
617
+ {
618
+ name: 'submit-delivery',
619
+ title: '@software-management:actions.submit-delivery-plan.title',
620
+ icon: 'fa-light fa-paper-plane',
621
+ color: 'default',
622
+ command: { name: 'submit-delivery' },
623
+ },
624
+ {
625
+ name: 'open-delivery',
626
+ title: '@software-management:actions.open-delivery-plan.title',
627
+ icon: 'fa-light fa-folder-open',
628
+ color: 'default',
629
+ command: { name: 'open-delivery' },
630
+ },
631
+ completeAction,
632
+ ],
633
+ };
634
+ }
281
635
  function phaseTask(id, phase, title, description) {
282
636
  return {
283
637
  id,
@@ -444,13 +798,13 @@ const softwareDefinitionWorkflowDefinition = {
444
798
  },
445
799
  {
446
800
  id: 'generateKickoffFromTask',
447
- name: AXPSoftwareManagementCommandKeys.Software.GenerateKickoffSheet,
801
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.GenerateKickoff,
448
802
  title: 'Generate kickoff sheet',
449
803
  inputs: { softwareId: '{{ inputs.softwareId }}' },
450
804
  },
451
805
  {
452
806
  id: 'submitKickoffFromTask',
453
- name: AXPSoftwareManagementCommandKeys.Software.SubmitKickoffSheet,
807
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.SubmitKickoff,
454
808
  title: 'Submit kickoff sheet',
455
809
  inputs: { softwareId: '{{ inputs.softwareId }}' },
456
810
  },
@@ -484,39 +838,339 @@ const softwareDefinitionWorkflowDefinition = {
484
838
  },
485
839
  },
486
840
  completePhaseActivity('completeIntroduction', 'introduction'),
487
- phaseTask('discoveryTask', 'discovery', 'Discovery', 'Read the approved kickoff version, collect evidence, then generate and approve a discovery report. Proceed enters scope only after that approval. Revise and stop stay in discovery.'),
841
+ failedToast('introductionFailedToast', '@software-management:messages.introduction.complete-blocked'),
842
+ {
843
+ id: 'discoveryTask',
844
+ name: 'workflow-activity:human-task',
845
+ title: 'Discovery',
846
+ inputs: {
847
+ title: '{{ inputs.softwareTitle }} — Discovery',
848
+ description: '@software-management:workflows.definition.discovery-task.description',
849
+ assignedUserIds: '{{ inputs.ownerId }}',
850
+ context: {
851
+ softwareId: '{{ inputs.softwareId }}',
852
+ phase: 'discovery',
853
+ entityType: 'SoftwareManagement.Software',
854
+ },
855
+ actions: discoveryTaskActions(),
856
+ },
857
+ },
858
+ {
859
+ id: 'loadDiscoveryForEdit',
860
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.LoadDiscovery,
861
+ title: 'Load discovery',
862
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
863
+ },
864
+ {
865
+ id: 'editDiscoveryDialog',
866
+ name: 'workflow-activity:show-layout-popup',
867
+ title: 'Edit discovery decision',
868
+ inputs: {
869
+ title: '@software-management:actions.edit-discovery-decision.title',
870
+ size: 'lg',
871
+ context: discoveryDialogContext(),
872
+ layout: discoveryDialogLayout(false),
873
+ actions: { suffix: [dialogCancelAction, dialogSaveAction] },
874
+ },
875
+ },
876
+ {
877
+ id: 'viewDiscoveryDialog',
878
+ name: 'workflow-activity:show-layout-popup',
879
+ title: 'View discovery decision',
880
+ inputs: {
881
+ title: '@software-management:actions.edit-discovery-decision.title',
882
+ size: 'lg',
883
+ context: discoveryDialogContext(),
884
+ layout: discoveryDialogLayout(true),
885
+ actions: { suffix: [dialogCancelAction] },
886
+ },
887
+ },
888
+ {
889
+ id: 'saveDiscoveryFromTask',
890
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.SaveDiscoveryDecision,
891
+ title: 'Save discovery decision',
892
+ inputs: {
893
+ softwareId: '{{ inputs.softwareId }}',
894
+ discoveryDecision: '{{ context.eval("outputs.last.discoveryDecision") }}',
895
+ discoveryRationale: '{{ context.eval("outputs.last.discoveryRationale") }}',
896
+ },
897
+ },
898
+ {
899
+ id: 'generateReportFromTask',
900
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.GenerateDiscoveryReport,
901
+ title: 'Generate discovery report',
902
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
903
+ },
904
+ {
905
+ id: 'submitReportFromTask',
906
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.SubmitDiscoveryReport,
907
+ title: 'Submit discovery report',
908
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
909
+ },
910
+ {
911
+ id: 'viewPinnedKickoffFromTask',
912
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.ViewPinnedKickoff,
913
+ title: 'View pinned kickoff',
914
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
915
+ },
916
+ {
917
+ id: 'openReportFromTask',
918
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.OpenDiscoveryReport,
919
+ title: 'Open discovery report',
920
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
921
+ },
488
922
  completePhaseActivity('completeDiscovery', 'discovery'),
489
- failedToast('discoveryFailedToast', 'Discovery cannot enter scope without an approved report, a recorded rationale, and validated user or problem evidence.'),
490
- phaseTask('scopeTask', 'first-version-scope', 'First-version scope', 'Record essential capabilities, out-of-scope items, and success metrics.'),
923
+ failedToast('discoveryFailedToast', '@software-management:messages.discovery.complete-blocked'),
924
+ {
925
+ id: 'discoveryRevisedToast',
926
+ name: 'workflow-activity:show-toast',
927
+ title: 'Discovery remains open',
928
+ inputs: {
929
+ message: '@software-management:messages.discovery.revised',
930
+ type: 'info',
931
+ },
932
+ },
933
+ {
934
+ id: 'discoveryStoppedToast',
935
+ name: 'workflow-activity:show-toast',
936
+ title: 'Discovery stopped',
937
+ inputs: {
938
+ message: '@software-management:messages.discovery.stopped',
939
+ type: 'info',
940
+ },
941
+ },
942
+ {
943
+ id: 'scopeTask',
944
+ name: 'workflow-activity:human-task',
945
+ title: 'First-version scope',
946
+ inputs: {
947
+ title: '{{ inputs.softwareTitle }} — First-version scope',
948
+ description: '@software-management:workflows.definition.scope-task.description',
949
+ assignedUserIds: '{{ inputs.ownerId }}',
950
+ context: {
951
+ softwareId: '{{ inputs.softwareId }}',
952
+ phase: 'first-version-scope',
953
+ entityType: 'SoftwareManagement.Software',
954
+ },
955
+ actions: scopeTaskActions(),
956
+ },
957
+ },
958
+ {
959
+ id: 'viewPinnedDiscoveryFromTask',
960
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.ViewPinnedDiscovery,
961
+ title: 'View pinned discovery',
962
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
963
+ },
964
+ {
965
+ id: 'generateScopeFromTask',
966
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.GenerateScopeDocument,
967
+ title: 'Generate scope document',
968
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
969
+ },
970
+ {
971
+ id: 'submitScopeFromTask',
972
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.SubmitScopeDocument,
973
+ title: 'Submit scope document',
974
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
975
+ },
976
+ {
977
+ id: 'openScopeFromTask',
978
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.OpenScopeDocument,
979
+ title: 'Open scope document',
980
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
981
+ },
491
982
  completePhaseActivity('completeScope', 'first-version-scope'),
492
- failedToast('scopeFailedToast', 'First-version scope cannot complete until discovery is approved.'),
493
- phaseTask('behaviorTask', 'behavior-specification', 'Behavior specification', 'Record requirements, use cases, business rules, and acceptance criteria.'),
983
+ failedToast('scopeFailedToast', '@software-management:messages.scope.complete-blocked'),
984
+ {
985
+ id: 'behaviorTask',
986
+ name: 'workflow-activity:human-task',
987
+ title: 'Behavior specification',
988
+ inputs: {
989
+ title: '{{ inputs.softwareTitle }} — Behavior specification',
990
+ description: '@software-management:workflows.definition.behavior-task.description',
991
+ assignedUserIds: '{{ inputs.ownerId }}',
992
+ context: {
993
+ softwareId: '{{ inputs.softwareId }}',
994
+ phase: 'behavior-specification',
995
+ entityType: 'SoftwareManagement.Software',
996
+ },
997
+ actions: behaviorTaskActions(),
998
+ },
999
+ },
1000
+ {
1001
+ id: 'viewPinnedScopeFromTask',
1002
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.ViewPinnedScope,
1003
+ title: 'View pinned scope',
1004
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
1005
+ },
1006
+ {
1007
+ id: 'generateBehaviorFromTask',
1008
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.GenerateBehaviorDocument,
1009
+ title: 'Generate behavior document',
1010
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
1011
+ },
1012
+ {
1013
+ id: 'submitBehaviorFromTask',
1014
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.SubmitBehaviorDocument,
1015
+ title: 'Submit behavior document',
1016
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
1017
+ },
1018
+ {
1019
+ id: 'openBehaviorFromTask',
1020
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.OpenBehaviorDocument,
1021
+ title: 'Open behavior document',
1022
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
1023
+ },
494
1024
  completePhaseActivity('completeBehavior', 'behavior-specification'),
495
- failedToast('behaviorFailedToast', 'Behavior specification cannot complete until first-version scope is approved.'),
496
- phaseTask('designTask', 'design', 'Design', 'Record data-model, UX, and technical decisions. Do not pick a stack before this phase.'),
1025
+ failedToast('behaviorFailedToast', '@software-management:messages.behavior.complete-blocked'),
1026
+ {
1027
+ id: 'designTask',
1028
+ name: 'workflow-activity:human-task',
1029
+ title: 'Design',
1030
+ inputs: {
1031
+ title: '{{ inputs.softwareTitle }} — Design',
1032
+ description: '@software-management:workflows.definition.design-task.description',
1033
+ assignedUserIds: '{{ inputs.ownerId }}',
1034
+ context: {
1035
+ softwareId: '{{ inputs.softwareId }}',
1036
+ phase: 'design',
1037
+ entityType: 'SoftwareManagement.Software',
1038
+ },
1039
+ actions: designTaskActions(),
1040
+ },
1041
+ },
1042
+ {
1043
+ id: 'viewPinnedBehaviorFromTask',
1044
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.ViewPinnedBehavior,
1045
+ title: 'View pinned behavior',
1046
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
1047
+ },
1048
+ {
1049
+ id: 'generateDesignFromTask',
1050
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.GenerateDesignDocument,
1051
+ title: 'Generate design document',
1052
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
1053
+ },
1054
+ {
1055
+ id: 'submitDesignFromTask',
1056
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.SubmitDesignDocument,
1057
+ title: 'Submit design document',
1058
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
1059
+ },
1060
+ {
1061
+ id: 'openDesignFromTask',
1062
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.OpenDesignDocument,
1063
+ title: 'Open design document',
1064
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
1065
+ },
497
1066
  completePhaseActivity('completeDesign', 'design'),
498
- failedToast('designFailedToast', 'Design cannot complete until behavior specification is approved.'),
499
- phaseTask('deliveryTask', 'delivery-planning', 'Delivery planning', 'Link an existing Project and tasks only after the Software definition exists. Do not clone Project or Task.'),
500
- completePhaseActivity('completeDelivery', 'delivery-planning'),
501
- failedToast('deliveryFailedToast', 'Delivery planning cannot complete until design is approved.'),
1067
+ failedToast('designFailedToast', '@software-management:messages.design.complete-blocked'),
502
1068
  {
503
- id: 'definitionFinishedToast',
504
- name: 'workflow-activity:show-toast',
505
- title: 'Definition complete',
1069
+ id: 'deliveryTask',
1070
+ name: 'workflow-activity:human-task',
1071
+ title: 'Delivery planning',
506
1072
  inputs: {
507
- message: 'Software definition phases are complete. Implementation of the target product is still out of this module.',
508
- type: 'success',
1073
+ title: '{{ inputs.softwareTitle }} — Delivery planning',
1074
+ description: '@software-management:workflows.definition.delivery-task.description',
1075
+ assignedUserIds: '{{ inputs.ownerId }}',
1076
+ context: {
1077
+ softwareId: '{{ inputs.softwareId }}',
1078
+ phase: 'delivery-planning',
1079
+ entityType: 'SoftwareManagement.Software',
1080
+ },
1081
+ actions: deliveryTaskActions(),
509
1082
  },
510
1083
  },
511
- ],
512
- connections: [
513
- { source: { activtyName: 'introductionTask', port: 'edit-introduction' }, target: { activtyName: 'loadIntroductionForEdit' } },
514
- { source: { activtyName: 'loadIntroductionForEdit', port: 'edit' }, target: { activtyName: 'editIntroductionDialog' } },
515
- { source: { activtyName: 'loadIntroductionForEdit', port: 'view' }, target: { activtyName: 'viewIntroductionDialog' } },
516
- { source: { activtyName: 'loadIntroductionForEdit', port: 'Failed' }, target: { activtyName: 'introductionTask' } },
517
- { source: { activtyName: 'editIntroductionDialog', port: 'submit' }, target: { activtyName: 'saveIntroductionFromTask' } },
518
- { source: { activtyName: 'editIntroductionDialog', port: 'cancel' }, target: { activtyName: 'introductionTask' } },
519
- { source: { activtyName: 'viewIntroductionDialog', port: 'cancel' }, target: { activtyName: 'introductionTask' } },
1084
+ {
1085
+ id: 'loadDeliveryForEdit',
1086
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.LoadDelivery,
1087
+ title: 'Load delivery plan',
1088
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
1089
+ },
1090
+ {
1091
+ id: 'editDeliveryDialog',
1092
+ name: 'workflow-activity:show-layout-popup',
1093
+ title: 'Edit delivery plan',
1094
+ inputs: {
1095
+ title: '@software-management:actions.edit-delivery-plan.title',
1096
+ size: 'lg',
1097
+ context: deliveryDialogContext(),
1098
+ layout: deliveryDialogLayout(false),
1099
+ actions: { suffix: [dialogCancelAction, dialogSaveAction] },
1100
+ },
1101
+ },
1102
+ {
1103
+ id: 'viewDeliveryDialog',
1104
+ name: 'workflow-activity:show-layout-popup',
1105
+ title: 'View delivery plan',
1106
+ inputs: {
1107
+ title: '@software-management:actions.edit-delivery-plan.title',
1108
+ size: 'lg',
1109
+ context: deliveryDialogContext(),
1110
+ layout: deliveryDialogLayout(true),
1111
+ actions: { suffix: [dialogCancelAction] },
1112
+ },
1113
+ },
1114
+ {
1115
+ id: 'saveDeliveryFromTask',
1116
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.SaveDeliveryPlan,
1117
+ title: 'Save delivery plan',
1118
+ inputs: {
1119
+ softwareId: '{{ inputs.softwareId }}',
1120
+ deliveryWorkPackages: '{{ context.eval("outputs.last.deliveryWorkPackages") }}',
1121
+ deliveryMilestones: '{{ context.eval("outputs.last.deliveryMilestones") }}',
1122
+ deliveryEstimateAssumptions: '{{ context.eval("outputs.last.deliveryEstimateAssumptions") }}',
1123
+ deliveryVerificationCriteria: '{{ context.eval("outputs.last.deliveryVerificationCriteria") }}',
1124
+ deliveryReleaseCriteria: '{{ context.eval("outputs.last.deliveryReleaseCriteria") }}',
1125
+ deliveryRisks: '{{ context.eval("outputs.last.deliveryRisks") }}',
1126
+ deliveryTracedRequirementId: '{{ context.eval("outputs.last.deliveryTracedRequirementId") }}',
1127
+ deliveryTracedDesignDecisionId: '{{ context.eval("outputs.last.deliveryTracedDesignDecisionId") }}',
1128
+ },
1129
+ },
1130
+ {
1131
+ id: 'viewPinnedDesignFromTask',
1132
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.ViewPinnedDesign,
1133
+ title: 'View pinned design',
1134
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
1135
+ },
1136
+ {
1137
+ id: 'generateDeliveryFromTask',
1138
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.GenerateDeliveryPlan,
1139
+ title: 'Generate delivery plan',
1140
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
1141
+ },
1142
+ {
1143
+ id: 'submitDeliveryFromTask',
1144
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.SubmitDeliveryPlan,
1145
+ title: 'Submit delivery plan',
1146
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
1147
+ },
1148
+ {
1149
+ id: 'openDeliveryFromTask',
1150
+ name: AXPSoftwareManagementCommandKeys.WorkflowActivity.OpenDeliveryPlan,
1151
+ title: 'Open delivery plan',
1152
+ inputs: { softwareId: '{{ inputs.softwareId }}' },
1153
+ },
1154
+ completePhaseActivity('completeDelivery', 'delivery-planning'),
1155
+ failedToast('deliveryFailedToast', '@software-management:messages.delivery.complete-blocked'),
1156
+ {
1157
+ id: 'definitionFinishedToast',
1158
+ name: 'workflow-activity:show-toast',
1159
+ title: 'Definition complete',
1160
+ inputs: {
1161
+ message: '@software-management:messages.delivery.definition-finished',
1162
+ type: 'success',
1163
+ },
1164
+ },
1165
+ ],
1166
+ connections: [
1167
+ { source: { activtyName: 'introductionTask', port: 'edit-introduction' }, target: { activtyName: 'loadIntroductionForEdit' } },
1168
+ { source: { activtyName: 'loadIntroductionForEdit', port: 'edit' }, target: { activtyName: 'editIntroductionDialog' } },
1169
+ { source: { activtyName: 'loadIntroductionForEdit', port: 'view' }, target: { activtyName: 'viewIntroductionDialog' } },
1170
+ { source: { activtyName: 'loadIntroductionForEdit', port: 'Failed' }, target: { activtyName: 'introductionTask' } },
1171
+ { source: { activtyName: 'editIntroductionDialog', port: 'submit' }, target: { activtyName: 'saveIntroductionFromTask' } },
1172
+ { source: { activtyName: 'editIntroductionDialog', port: 'cancel' }, target: { activtyName: 'introductionTask' } },
1173
+ { source: { activtyName: 'viewIntroductionDialog', port: 'cancel' }, target: { activtyName: 'introductionTask' } },
520
1174
  { source: { activtyName: 'saveIntroductionFromTask', port: 'Done' }, target: { activtyName: 'introductionTask' } },
521
1175
  { source: { activtyName: 'saveIntroductionFromTask', port: 'Failed' }, target: { activtyName: 'introductionTask' } },
522
1176
  { source: { activtyName: 'introductionTask', port: 'generate-kickoff' }, target: { activtyName: 'generateKickoffFromTask' } },
@@ -532,23 +1186,106 @@ const softwareDefinitionWorkflowDefinition = {
532
1186
  { source: { activtyName: 'approvalStatusDialog', port: 'cancel' }, target: { activtyName: 'introductionTask' } },
533
1187
  { source: { activtyName: 'introductionTask', port: 'complete-phase' }, target: { activtyName: 'completeIntroduction' } },
534
1188
  { source: { activtyName: 'completeIntroduction', port: 'Done' }, target: { activtyName: 'discoveryTask' } },
535
- { source: { activtyName: 'completeIntroduction', port: 'Failed' }, target: { activtyName: 'introductionTask' } },
1189
+ { source: { activtyName: 'completeIntroduction', port: 'Failed' }, target: { activtyName: 'introductionFailedToast' } },
1190
+ { source: { activtyName: 'introductionFailedToast', port: 'Done' }, target: { activtyName: 'introductionTask' } },
1191
+ { source: { activtyName: 'discoveryTask', port: 'edit-discovery-decision' }, target: { activtyName: 'loadDiscoveryForEdit' } },
1192
+ { source: { activtyName: 'loadDiscoveryForEdit', port: 'edit' }, target: { activtyName: 'editDiscoveryDialog' } },
1193
+ { source: { activtyName: 'loadDiscoveryForEdit', port: 'view' }, target: { activtyName: 'viewDiscoveryDialog' } },
1194
+ { source: { activtyName: 'loadDiscoveryForEdit', port: 'Failed' }, target: { activtyName: 'discoveryTask' } },
1195
+ { source: { activtyName: 'editDiscoveryDialog', port: 'submit' }, target: { activtyName: 'saveDiscoveryFromTask' } },
1196
+ { source: { activtyName: 'editDiscoveryDialog', port: 'cancel' }, target: { activtyName: 'discoveryTask' } },
1197
+ { source: { activtyName: 'viewDiscoveryDialog', port: 'cancel' }, target: { activtyName: 'discoveryTask' } },
1198
+ { source: { activtyName: 'saveDiscoveryFromTask', port: 'Done' }, target: { activtyName: 'discoveryTask' } },
1199
+ { source: { activtyName: 'saveDiscoveryFromTask', port: 'Failed' }, target: { activtyName: 'discoveryTask' } },
1200
+ { source: { activtyName: 'discoveryTask', port: 'view-pinned-kickoff' }, target: { activtyName: 'viewPinnedKickoffFromTask' } },
1201
+ { source: { activtyName: 'viewPinnedKickoffFromTask', port: 'Done' }, target: { activtyName: 'discoveryTask' } },
1202
+ { source: { activtyName: 'viewPinnedKickoffFromTask', port: 'Failed' }, target: { activtyName: 'discoveryTask' } },
1203
+ { source: { activtyName: 'discoveryTask', port: 'generate-report' }, target: { activtyName: 'generateReportFromTask' } },
1204
+ { source: { activtyName: 'generateReportFromTask', port: 'Done' }, target: { activtyName: 'discoveryTask' } },
1205
+ { source: { activtyName: 'generateReportFromTask', port: 'Failed' }, target: { activtyName: 'discoveryTask' } },
1206
+ { source: { activtyName: 'discoveryTask', port: 'submit-report' }, target: { activtyName: 'submitReportFromTask' } },
1207
+ { source: { activtyName: 'submitReportFromTask', port: 'Done' }, target: { activtyName: 'discoveryTask' } },
1208
+ { source: { activtyName: 'submitReportFromTask', port: 'Failed' }, target: { activtyName: 'discoveryTask' } },
1209
+ { source: { activtyName: 'discoveryTask', port: 'open-report' }, target: { activtyName: 'openReportFromTask' } },
1210
+ { source: { activtyName: 'openReportFromTask', port: 'Done' }, target: { activtyName: 'discoveryTask' } },
1211
+ { source: { activtyName: 'openReportFromTask', port: 'Failed' }, target: { activtyName: 'discoveryTask' } },
536
1212
  { source: { activtyName: 'discoveryTask', port: 'complete-phase' }, target: { activtyName: 'completeDiscovery' } },
537
1213
  { source: { activtyName: 'completeDiscovery', port: 'Done' }, target: { activtyName: 'scopeTask' } },
1214
+ { source: { activtyName: 'completeDiscovery', port: 'Proceed' }, target: { activtyName: 'scopeTask' } },
1215
+ { source: { activtyName: 'completeDiscovery', port: 'Revise' }, target: { activtyName: 'discoveryRevisedToast' } },
1216
+ { source: { activtyName: 'completeDiscovery', port: 'Stop' }, target: { activtyName: 'discoveryStoppedToast' } },
538
1217
  { source: { activtyName: 'completeDiscovery', port: 'Failed' }, target: { activtyName: 'discoveryFailedToast' } },
539
1218
  { source: { activtyName: 'discoveryFailedToast', port: 'Done' }, target: { activtyName: 'discoveryTask' } },
1219
+ { source: { activtyName: 'discoveryRevisedToast', port: 'Done' }, target: { activtyName: 'discoveryTask' } },
1220
+ { source: { activtyName: 'scopeTask', port: 'view-pinned-discovery' }, target: { activtyName: 'viewPinnedDiscoveryFromTask' } },
1221
+ { source: { activtyName: 'viewPinnedDiscoveryFromTask', port: 'Done' }, target: { activtyName: 'scopeTask' } },
1222
+ { source: { activtyName: 'viewPinnedDiscoveryFromTask', port: 'Failed' }, target: { activtyName: 'scopeTask' } },
1223
+ { source: { activtyName: 'scopeTask', port: 'generate-scope' }, target: { activtyName: 'generateScopeFromTask' } },
1224
+ { source: { activtyName: 'generateScopeFromTask', port: 'Done' }, target: { activtyName: 'scopeTask' } },
1225
+ { source: { activtyName: 'generateScopeFromTask', port: 'Failed' }, target: { activtyName: 'scopeTask' } },
1226
+ { source: { activtyName: 'scopeTask', port: 'submit-scope' }, target: { activtyName: 'submitScopeFromTask' } },
1227
+ { source: { activtyName: 'submitScopeFromTask', port: 'Done' }, target: { activtyName: 'scopeTask' } },
1228
+ { source: { activtyName: 'submitScopeFromTask', port: 'Failed' }, target: { activtyName: 'scopeTask' } },
1229
+ { source: { activtyName: 'scopeTask', port: 'open-scope' }, target: { activtyName: 'openScopeFromTask' } },
1230
+ { source: { activtyName: 'openScopeFromTask', port: 'Done' }, target: { activtyName: 'scopeTask' } },
1231
+ { source: { activtyName: 'openScopeFromTask', port: 'Failed' }, target: { activtyName: 'scopeTask' } },
540
1232
  { source: { activtyName: 'scopeTask', port: 'complete-phase' }, target: { activtyName: 'completeScope' } },
541
1233
  { source: { activtyName: 'completeScope', port: 'Done' }, target: { activtyName: 'behaviorTask' } },
542
1234
  { source: { activtyName: 'completeScope', port: 'Failed' }, target: { activtyName: 'scopeFailedToast' } },
543
1235
  { source: { activtyName: 'scopeFailedToast', port: 'Done' }, target: { activtyName: 'scopeTask' } },
1236
+ { source: { activtyName: 'behaviorTask', port: 'view-pinned-scope' }, target: { activtyName: 'viewPinnedScopeFromTask' } },
1237
+ { source: { activtyName: 'viewPinnedScopeFromTask', port: 'Done' }, target: { activtyName: 'behaviorTask' } },
1238
+ { source: { activtyName: 'viewPinnedScopeFromTask', port: 'Failed' }, target: { activtyName: 'behaviorTask' } },
1239
+ { source: { activtyName: 'behaviorTask', port: 'generate-behavior' }, target: { activtyName: 'generateBehaviorFromTask' } },
1240
+ { source: { activtyName: 'generateBehaviorFromTask', port: 'Done' }, target: { activtyName: 'behaviorTask' } },
1241
+ { source: { activtyName: 'generateBehaviorFromTask', port: 'Failed' }, target: { activtyName: 'behaviorTask' } },
1242
+ { source: { activtyName: 'behaviorTask', port: 'submit-behavior' }, target: { activtyName: 'submitBehaviorFromTask' } },
1243
+ { source: { activtyName: 'submitBehaviorFromTask', port: 'Done' }, target: { activtyName: 'behaviorTask' } },
1244
+ { source: { activtyName: 'submitBehaviorFromTask', port: 'Failed' }, target: { activtyName: 'behaviorTask' } },
1245
+ { source: { activtyName: 'behaviorTask', port: 'open-behavior' }, target: { activtyName: 'openBehaviorFromTask' } },
1246
+ { source: { activtyName: 'openBehaviorFromTask', port: 'Done' }, target: { activtyName: 'behaviorTask' } },
1247
+ { source: { activtyName: 'openBehaviorFromTask', port: 'Failed' }, target: { activtyName: 'behaviorTask' } },
544
1248
  { source: { activtyName: 'behaviorTask', port: 'complete-phase' }, target: { activtyName: 'completeBehavior' } },
545
1249
  { source: { activtyName: 'completeBehavior', port: 'Done' }, target: { activtyName: 'designTask' } },
546
1250
  { source: { activtyName: 'completeBehavior', port: 'Failed' }, target: { activtyName: 'behaviorFailedToast' } },
547
1251
  { source: { activtyName: 'behaviorFailedToast', port: 'Done' }, target: { activtyName: 'behaviorTask' } },
1252
+ { source: { activtyName: 'designTask', port: 'view-pinned-behavior' }, target: { activtyName: 'viewPinnedBehaviorFromTask' } },
1253
+ { source: { activtyName: 'viewPinnedBehaviorFromTask', port: 'Done' }, target: { activtyName: 'designTask' } },
1254
+ { source: { activtyName: 'viewPinnedBehaviorFromTask', port: 'Failed' }, target: { activtyName: 'designTask' } },
1255
+ { source: { activtyName: 'designTask', port: 'generate-design' }, target: { activtyName: 'generateDesignFromTask' } },
1256
+ { source: { activtyName: 'generateDesignFromTask', port: 'Done' }, target: { activtyName: 'designTask' } },
1257
+ { source: { activtyName: 'generateDesignFromTask', port: 'Failed' }, target: { activtyName: 'designTask' } },
1258
+ { source: { activtyName: 'designTask', port: 'submit-design' }, target: { activtyName: 'submitDesignFromTask' } },
1259
+ { source: { activtyName: 'submitDesignFromTask', port: 'Done' }, target: { activtyName: 'designTask' } },
1260
+ { source: { activtyName: 'submitDesignFromTask', port: 'Failed' }, target: { activtyName: 'designTask' } },
1261
+ { source: { activtyName: 'designTask', port: 'open-design' }, target: { activtyName: 'openDesignFromTask' } },
1262
+ { source: { activtyName: 'openDesignFromTask', port: 'Done' }, target: { activtyName: 'designTask' } },
1263
+ { source: { activtyName: 'openDesignFromTask', port: 'Failed' }, target: { activtyName: 'designTask' } },
548
1264
  { source: { activtyName: 'designTask', port: 'complete-phase' }, target: { activtyName: 'completeDesign' } },
549
1265
  { source: { activtyName: 'completeDesign', port: 'Done' }, target: { activtyName: 'deliveryTask' } },
550
1266
  { source: { activtyName: 'completeDesign', port: 'Failed' }, target: { activtyName: 'designFailedToast' } },
551
1267
  { source: { activtyName: 'designFailedToast', port: 'Done' }, target: { activtyName: 'designTask' } },
1268
+ { source: { activtyName: 'deliveryTask', port: 'edit-delivery-plan' }, target: { activtyName: 'loadDeliveryForEdit' } },
1269
+ { source: { activtyName: 'loadDeliveryForEdit', port: 'edit' }, target: { activtyName: 'editDeliveryDialog' } },
1270
+ { source: { activtyName: 'loadDeliveryForEdit', port: 'view' }, target: { activtyName: 'viewDeliveryDialog' } },
1271
+ { source: { activtyName: 'loadDeliveryForEdit', port: 'Failed' }, target: { activtyName: 'deliveryTask' } },
1272
+ { source: { activtyName: 'editDeliveryDialog', port: 'submit' }, target: { activtyName: 'saveDeliveryFromTask' } },
1273
+ { source: { activtyName: 'editDeliveryDialog', port: 'cancel' }, target: { activtyName: 'deliveryTask' } },
1274
+ { source: { activtyName: 'viewDeliveryDialog', port: 'cancel' }, target: { activtyName: 'deliveryTask' } },
1275
+ { source: { activtyName: 'saveDeliveryFromTask', port: 'Done' }, target: { activtyName: 'deliveryTask' } },
1276
+ { source: { activtyName: 'saveDeliveryFromTask', port: 'Failed' }, target: { activtyName: 'deliveryTask' } },
1277
+ { source: { activtyName: 'deliveryTask', port: 'view-pinned-design' }, target: { activtyName: 'viewPinnedDesignFromTask' } },
1278
+ { source: { activtyName: 'viewPinnedDesignFromTask', port: 'Done' }, target: { activtyName: 'deliveryTask' } },
1279
+ { source: { activtyName: 'viewPinnedDesignFromTask', port: 'Failed' }, target: { activtyName: 'deliveryTask' } },
1280
+ { source: { activtyName: 'deliveryTask', port: 'generate-delivery' }, target: { activtyName: 'generateDeliveryFromTask' } },
1281
+ { source: { activtyName: 'generateDeliveryFromTask', port: 'Done' }, target: { activtyName: 'deliveryTask' } },
1282
+ { source: { activtyName: 'generateDeliveryFromTask', port: 'Failed' }, target: { activtyName: 'deliveryTask' } },
1283
+ { source: { activtyName: 'deliveryTask', port: 'submit-delivery' }, target: { activtyName: 'submitDeliveryFromTask' } },
1284
+ { source: { activtyName: 'submitDeliveryFromTask', port: 'Done' }, target: { activtyName: 'deliveryTask' } },
1285
+ { source: { activtyName: 'submitDeliveryFromTask', port: 'Failed' }, target: { activtyName: 'deliveryTask' } },
1286
+ { source: { activtyName: 'deliveryTask', port: 'open-delivery' }, target: { activtyName: 'openDeliveryFromTask' } },
1287
+ { source: { activtyName: 'openDeliveryFromTask', port: 'Done' }, target: { activtyName: 'deliveryTask' } },
1288
+ { source: { activtyName: 'openDeliveryFromTask', port: 'Failed' }, target: { activtyName: 'deliveryTask' } },
552
1289
  { source: { activtyName: 'deliveryTask', port: 'complete-phase' }, target: { activtyName: 'completeDelivery' } },
553
1290
  { source: { activtyName: 'completeDelivery', port: 'Done' }, target: { activtyName: 'definitionFinishedToast' } },
554
1291
  { source: { activtyName: 'completeDelivery', port: 'Failed' }, target: { activtyName: 'deliveryFailedToast' } },
@@ -557,10 +1294,80 @@ const softwareDefinitionWorkflowDefinition = {
557
1294
  },
558
1295
  };
559
1296
 
1297
+ //#region ----- Types -----
1298
+ //#endregion
1299
+ //#region ----- Resolve -----
1300
+ /** UI locale (`fa-IR`) → sheet language. Missing locale keeps bilingual copy for callers that omit it. */
1301
+ function resolveSheetLang(locale) {
1302
+ const raw = typeof locale === 'string' ? locale.trim().toLowerCase() : '';
1303
+ if (!raw) {
1304
+ return 'both';
1305
+ }
1306
+ return raw.startsWith('fa') ? 'fa' : 'en';
1307
+ }
1308
+ function sheetBilingual(en, fa, lang) {
1309
+ if (lang === 'en') {
1310
+ return en;
1311
+ }
1312
+ if (lang === 'fa') {
1313
+ return fa;
1314
+ }
1315
+ return `${en} / ${fa}`;
1316
+ }
1317
+ function sheetUnknown(lang) {
1318
+ return sheetBilingual('Unknown', 'نامعلوم', lang);
1319
+ }
1320
+ function sheetHeading(en, fa, locale) {
1321
+ const lang = resolveSheetLang(locale);
1322
+ return sheetBilingual(en, fa, lang === 'both' ? 'en' : lang);
1323
+ }
1324
+ function sheetDisplayLocale(locale) {
1325
+ return resolveSheetLang(locale) === 'fa' ? 'fa-IR' : 'en-US';
1326
+ }
1327
+ function escapeHtml$6(value) {
1328
+ return value
1329
+ .replace(/&/g, '&')
1330
+ .replace(/</g, '&lt;')
1331
+ .replace(/>/g, '&gt;')
1332
+ .replace(/"/g, '&quot;');
1333
+ }
1334
+ /**
1335
+ * Print HTML chrome for software PDFs. Persian uses `dir="rtl"` and Tahoma.
1336
+ * Later sheets (scope, design, …) should render through this helper.
1337
+ */
1338
+ function wrapSheetHtml(title, innerHtml, lang) {
1339
+ const dir = lang === 'fa' ? 'rtl' : 'ltr';
1340
+ const htmlLang = lang === 'fa' ? 'fa' : 'en';
1341
+ return [
1342
+ '<!DOCTYPE html>',
1343
+ `<html lang="${htmlLang}" dir="${dir}">`,
1344
+ '<head>',
1345
+ '<meta charset="utf-8">',
1346
+ `<title>${escapeHtml$6(title)}</title>`,
1347
+ '<style>',
1348
+ `body{font-family:Tahoma,Segoe UI,sans-serif;line-height:1.5;margin:2rem;color:#1a1a1a;${lang === 'fa' ? 'direction:rtl;text-align:right;' : ''}}`,
1349
+ 'html[dir="rtl"] body{direction:rtl;text-align:right;}',
1350
+ 'h1{font-size:1.6rem;} h2{font-size:1.1rem;margin-bottom:0.2rem;}',
1351
+ '.banner{background:#fff6d8;border:1px solid #e6d38a;padding:0.75rem 1rem;}',
1352
+ '.certainty{font-size:0.85rem;color:#555;margin-top:0;}',
1353
+ 'section{margin:1.25rem 0;padding-top:0.5rem;border-top:1px solid #ddd;}',
1354
+ '</style>',
1355
+ '</head>',
1356
+ '<body>',
1357
+ innerHtml,
1358
+ '</body>',
1359
+ '</html>',
1360
+ ].join('');
1361
+ }
1362
+ //#endregion
1363
+
1364
+ //#region ----- Imports -----
1365
+ //#endregion
560
1366
  //#region ----- Constants -----
561
1367
  /** Document type name in Document Management. One kickoff sheet per Software record. */
562
1368
  const DISCOVERY_KICKOFF_DOCUMENT_TYPE_NAME = 'software-discovery-kickoff';
563
- const DISCOVERY_KICKOFF_FILE_NAME = 'discovery-kickoff.html';
1369
+ const DISCOVERY_KICKOFF_FILE_NAME = 'discovery-kickoff.pdf';
1370
+ const DISCOVERY_KICKOFF_LEGACY_HTML_FILE_NAME = 'discovery-kickoff.html';
564
1371
  /**
565
1372
  * Review statuses stored on DocumentManagement.Document.
566
1373
  * Same vocabulary as the EDMS document review workflow.
@@ -601,19 +1408,43 @@ const INTRODUCTION_EXIT_MESSAGE = {
601
1408
  ready: '@software-management:messages.introduction.ready',
602
1409
  saved: '@software-management:messages.introduction.saved',
603
1410
  };
604
- //#endregion
605
- //#region ----- Labels -----
606
1411
  const CERTAINTY_LABEL = {
607
1412
  recorded: { en: 'Recorded', fa: 'ثبت‌شده' },
608
1413
  hypothesis: { en: 'Hypothesis', fa: 'فرضیه' },
609
1414
  unknown: { en: 'Unknown', fa: 'نامعلوم' },
610
1415
  };
611
- const UNKNOWN_BODY = 'Unknown / نامعلوم';
1416
+ const SHEET_COPY = {
1417
+ heading: { en: 'Discovery Kickoff Sheet', fa: 'برگهٔ آغاز کشف' },
1418
+ subtitle: {
1419
+ en: 'Unconfirmed items are marked Hypothesis or Unknown. This sheet is not evidence.',
1420
+ fa: 'موارد تأییدنشده فرضیه یا نامعلوم‌اند. این برگه شاهد نیست.',
1421
+ },
1422
+ aiNote: {
1423
+ en: 'AI draft only. This text is not evidence and is not a confirmed fact.',
1424
+ fa: 'فقط پیش‌نویس هوش مصنوعی. این متن شاهد یا واقعیت تأییدشده نیست.',
1425
+ },
1426
+ fingerprint: { en: 'Fingerprint', fa: 'اثرانگشت' },
1427
+ };
1428
+ /** UI locale (`fa-IR`) → sheet language. Missing locale keeps bilingual copy for callers that omit it. */
1429
+ const resolveKickoffSheetLang = resolveSheetLang;
1430
+ function kickoffSheetHeading(locale) {
1431
+ return sheetHeading(SHEET_COPY.heading.en, SHEET_COPY.heading.fa, locale);
1432
+ }
1433
+ function unknownBody(lang) {
1434
+ return sheetUnknown(lang);
1435
+ }
1436
+ function certaintyLabel(certainty, lang) {
1437
+ const label = CERTAINTY_LABEL[certainty];
1438
+ return sheetBilingual(label.en, label.fa, lang);
1439
+ }
612
1440
  //#endregion
613
1441
  //#region ----- Text helpers -----
614
1442
  function kickoffText(value) {
615
1443
  return typeof value === 'string' ? value.trim() : '';
616
1444
  }
1445
+ function kickoffDisplayLocale(locale) {
1446
+ return sheetDisplayLocale(locale);
1447
+ }
617
1448
  /** Review status stored as a string or as a lookup `{ id }`. */
618
1449
  function kickoffStatusId(value) {
619
1450
  const direct = kickoffText(value);
@@ -630,7 +1461,7 @@ const LOOKUP_STUB_KEYS = new Set(['id', 'displayName', 'title', 'name', 'usernam
630
1461
  * Reads introduction text from a string, a locale map, or a lookup stub such as `{ id, displayName }`.
631
1462
  * A lookup stub contributes its id. Other objects contribute the first non-empty locale string.
632
1463
  */
633
- function introductionValueText(value) {
1464
+ function introductionValueText(value, locale) {
634
1465
  const direct = kickoffText(value);
635
1466
  if (direct) {
636
1467
  return direct;
@@ -644,22 +1475,12 @@ function introductionValueText(value) {
644
1475
  if (id && keys.length > 0 && keys.every((key) => LOOKUP_STUB_KEYS.has(key))) {
645
1476
  return id;
646
1477
  }
647
- const preferred = kickoffText(record['en-US']) || kickoffText(record['fa-IR']) || kickoffText(record['en-AU']);
648
- if (preferred) {
649
- return preferred;
650
- }
651
- for (const entry of Object.values(record)) {
652
- const text = kickoffText(entry);
653
- if (text) {
654
- return text;
655
- }
656
- }
657
- return '';
1478
+ return resolveMultiLanguageString(value, kickoffDisplayLocale(locale)).trim();
658
1479
  }
659
1480
  function missingIntroductionFields(software) {
660
1481
  return INTRODUCTION_REQUIRED_FIELDS.filter((field) => !introductionValueText(software[field]));
661
1482
  }
662
- function escapeHtml$1(value) {
1483
+ function escapeHtml$5(value) {
663
1484
  return value
664
1485
  .replace(/&/g, '&amp;')
665
1486
  .replace(/</g, '&lt;')
@@ -678,12 +1499,12 @@ function narrativeCertainty(source, body) {
678
1499
  function openCertainty(body) {
679
1500
  return body ? 'hypothesis' : 'unknown';
680
1501
  }
681
- function section(key, titleEn, titleFa, body, certainty) {
1502
+ function section(key, titleEn, titleFa, body, certainty, fallback) {
682
1503
  return {
683
1504
  key,
684
1505
  titleEn,
685
1506
  titleFa,
686
- body: body || UNKNOWN_BODY,
1507
+ body: body || fallback,
687
1508
  certainty,
688
1509
  };
689
1510
  }
@@ -736,31 +1557,34 @@ function kickoffSourceFromSoftware(software) {
736
1557
  * Empty research items stay Unknown. Author-supplied guesses stay Hypothesis.
737
1558
  * AI text is a draft: it is never labeled as evidence or a confirmed fact.
738
1559
  */
739
- function buildDiscoveryKickoffSheet(source) {
1560
+ function buildDiscoveryKickoffSheet(source, locale) {
1561
+ const lang = resolveKickoffSheetLang(locale);
1562
+ const displayLocale = lang === 'both' ? undefined : locale;
740
1563
  const aiDraft = isAiDraft(source);
741
- const title = introductionValueText(source.title);
742
- const idea = introductionValueText(source.idea);
743
- const originalIdea = introductionValueText(source.originalIdea) || idea;
744
- const problem = introductionValueText(source.initialProblem);
745
- const goal = introductionValueText(source.goal);
746
- const owner = kickoffText(source.ownerName) || introductionValueText(source.ownerId);
747
- const potentialUsers = introductionValueText(source.potentialUsers);
748
- const openQuestions = introductionValueText(source.openQuestions);
1564
+ const title = introductionValueText(source.title, displayLocale);
1565
+ const idea = introductionValueText(source.idea, displayLocale);
1566
+ const originalIdea = introductionValueText(source.originalIdea, displayLocale) || idea;
1567
+ const problem = introductionValueText(source.initialProblem, displayLocale);
1568
+ const goal = introductionValueText(source.goal, displayLocale);
1569
+ const owner = kickoffText(source.ownerName) || introductionValueText(source.ownerId, displayLocale);
1570
+ const potentialUsers = introductionValueText(source.potentialUsers, displayLocale);
1571
+ const openQuestions = introductionValueText(source.openQuestions, displayLocale);
1572
+ const fallback = unknownBody(lang);
749
1573
  const sections = [
750
- section('title', 'Title', 'عنوان', title, narrativeCertainty(source, title)),
751
- section('original-idea', 'Original Idea at Registration', 'ایدهٔ اولیه هنگام ثبت', originalIdea, narrativeCertainty(source, originalIdea)),
752
- section('idea', 'Idea Description', 'شرح ایده', idea, narrativeCertainty(source, idea)),
753
- section('initial-problem', 'Initial Problem', 'مسئلهٔ اولیه', problem, narrativeCertainty(source, problem)),
754
- section('goal', 'Goal', 'هدف', goal, narrativeCertainty(source, goal)),
755
- section('owner', 'Owner', 'مسئول', owner, owner ? 'recorded' : 'unknown'),
756
- section('potential-users', 'Potential Users', 'کاربران احتمالی', potentialUsers, openCertainty(potentialUsers)),
757
- section('open-questions', 'Open Research Questions', 'پرسش‌های باز تحقیق', openQuestions, openCertainty(openQuestions)),
1574
+ section('title', 'Title', 'عنوان', title, narrativeCertainty(source, title), fallback),
1575
+ section('original-idea', 'Original Idea at Registration', 'ایدهٔ اولیه هنگام ثبت', originalIdea, narrativeCertainty(source, originalIdea), fallback),
1576
+ section('idea', 'Idea Description', 'شرح ایده', idea, narrativeCertainty(source, idea), fallback),
1577
+ section('initial-problem', 'Initial Problem', 'مسئلهٔ اولیه', problem, narrativeCertainty(source, problem), fallback),
1578
+ section('goal', 'Goal', 'هدف', goal, narrativeCertainty(source, goal), fallback),
1579
+ section('owner', 'Owner', 'مسئول', owner, owner ? 'recorded' : 'unknown', fallback),
1580
+ section('potential-users', 'Potential Users', 'کاربران احتمالی', potentialUsers, openCertainty(potentialUsers), fallback),
1581
+ section('open-questions', 'Open Research Questions', 'پرسش‌های باز تحقیق', openQuestions, openCertainty(openQuestions), fallback),
758
1582
  ];
759
1583
  const fingerprint = discoveryKickoffFingerprint(source);
760
- const plainText = renderPlainText(title, sections, aiDraft, fingerprint);
761
- const html = renderHtml(title, sections, aiDraft, fingerprint);
1584
+ const plainText = renderPlainText(title, sections, aiDraft, fingerprint, lang);
1585
+ const html = renderHtml(title, sections, aiDraft, fingerprint, lang);
762
1586
  return {
763
- title: title || 'Discovery Kickoff Sheet',
1587
+ title: title || sheetBilingual(SHEET_COPY.heading.en, SHEET_COPY.heading.fa, lang),
764
1588
  fingerprint,
765
1589
  html,
766
1590
  plainText,
@@ -768,62 +1592,44 @@ function buildDiscoveryKickoffSheet(source) {
768
1592
  aiDraft,
769
1593
  };
770
1594
  }
771
- function renderPlainText(title, sections, aiDraft, fingerprint) {
1595
+ function renderPlainText(title, sections, aiDraft, fingerprint, lang) {
772
1596
  const lines = [
773
- 'Discovery Kickoff Sheet / برگهٔ آغاز کشف',
774
- title ? `Title / عنوان: ${title}` : '',
775
- 'Unconfirmed items are marked Hypothesis or Unknown. This sheet is not evidence.',
776
- 'موارد تأییدنشده فرضیه یا نامعلوم‌اند. این برگه شاهد نیست.',
1597
+ sheetBilingual(SHEET_COPY.heading.en, SHEET_COPY.heading.fa, lang),
1598
+ title ? `${sheetBilingual('Title', 'عنوان', lang)}: ${title}` : '',
1599
+ sheetBilingual(SHEET_COPY.subtitle.en, SHEET_COPY.subtitle.fa, lang),
777
1600
  ];
778
1601
  if (aiDraft) {
779
- lines.push('AI draft only. This text is not evidence and is not a confirmed fact.', 'فقط پیش‌نویس هوش مصنوعی. این متن شاهد یا واقعیت تأییدشده نیست.');
1602
+ lines.push(sheetBilingual(SHEET_COPY.aiNote.en, SHEET_COPY.aiNote.fa, lang));
780
1603
  }
781
1604
  for (const item of sections) {
782
- const label = CERTAINTY_LABEL[item.certainty];
783
- lines.push('', `${item.titleEn} / ${item.titleFa} [${label.en} / ${label.fa}]`, item.body);
1605
+ lines.push('', `${sheetBilingual(item.titleEn, item.titleFa, lang)} [${certaintyLabel(item.certainty, lang)}]`, item.body);
784
1606
  }
785
- lines.push('', `Fingerprint: ${fingerprint}`);
1607
+ lines.push('', `${sheetBilingual(SHEET_COPY.fingerprint.en, SHEET_COPY.fingerprint.fa, lang)}: ${fingerprint}`);
786
1608
  return lines.filter((line) => line !== undefined).join('\n');
787
1609
  }
788
- function renderHtml(title, sections, aiDraft, fingerprint) {
1610
+ function renderHtml(title, sections, aiDraft, fingerprint, lang) {
1611
+ const heading = sheetBilingual(SHEET_COPY.heading.en, SHEET_COPY.heading.fa, lang);
789
1612
  const blocks = sections
790
1613
  .map((item) => {
791
- const label = CERTAINTY_LABEL[item.certainty];
792
1614
  return [
793
1615
  '<section>',
794
- `<h2>${escapeHtml$1(item.titleEn)} / ${escapeHtml$1(item.titleFa)}</h2>`,
795
- `<p class="certainty">${escapeHtml$1(label.en)} / ${escapeHtml$1(label.fa)}</p>`,
796
- `<p>${escapeHtml$1(item.body).replace(/\n/g, '<br>')}</p>`,
1616
+ `<h2>${escapeHtml$5(sheetBilingual(item.titleEn, item.titleFa, lang))}</h2>`,
1617
+ `<p class="certainty">${escapeHtml$5(certaintyLabel(item.certainty, lang))}</p>`,
1618
+ `<p>${escapeHtml$5(item.body).replace(/\n/g, '<br>')}</p>`,
797
1619
  '</section>',
798
1620
  ].join('');
799
1621
  })
800
1622
  .join('');
801
1623
  const aiNote = aiDraft
802
- ? '<p class="banner">AI draft only. This text is not evidence and is not a confirmed fact. / فقط پیش‌نویس هوش مصنوعی. این متن شاهد یا واقعیت تأییدشده نیست.</p>'
1624
+ ? `<p class="banner">${escapeHtml$5(sheetBilingual(SHEET_COPY.aiNote.en, SHEET_COPY.aiNote.fa, lang))}</p>`
803
1625
  : '';
804
- return [
805
- '<!DOCTYPE html>',
806
- '<html lang="fa">',
807
- '<head>',
808
- '<meta charset="utf-8">',
809
- `<title>${escapeHtml$1(title || 'Discovery Kickoff Sheet')}</title>`,
810
- '<style>',
811
- 'body{font-family:Segoe UI,Tahoma,sans-serif;line-height:1.5;margin:2rem;color:#1a1a1a;}',
812
- 'h1{font-size:1.6rem;} h2{font-size:1.1rem;margin-bottom:0.2rem;}',
813
- '.banner{background:#fff6d8;border:1px solid #e6d38a;padding:0.75rem 1rem;}',
814
- '.certainty{font-size:0.85rem;color:#555;margin-top:0;}',
815
- 'section{margin:1.25rem 0;padding-top:0.5rem;border-top:1px solid #ddd;}',
816
- '</style>',
817
- '</head>',
818
- '<body>',
819
- '<h1>Discovery Kickoff Sheet / برگهٔ آغاز کشف</h1>',
820
- '<p>Unconfirmed items are marked Hypothesis or Unknown. This sheet is not evidence. / موارد تأییدنشده فرضیه یا نامعلوم‌اند. این برگه شاهد نیست.</p>',
1626
+ return wrapSheetHtml(title || heading, [
1627
+ `<h1>${escapeHtml$5(heading)}</h1>`,
1628
+ `<p>${escapeHtml$5(sheetBilingual(SHEET_COPY.subtitle.en, SHEET_COPY.subtitle.fa, lang))}</p>`,
821
1629
  aiNote,
822
1630
  blocks,
823
- `<p class="certainty">Fingerprint: ${escapeHtml$1(fingerprint)}</p>`,
824
- '</body>',
825
- '</html>',
826
- ].join('');
1631
+ `<p class="certainty">${escapeHtml$5(sheetBilingual(SHEET_COPY.fingerprint.en, SHEET_COPY.fingerprint.fa, lang))}: ${escapeHtml$5(fingerprint)}</p>`,
1632
+ ].join(''), lang);
827
1633
  }
828
1634
  function readKickoffMeta(value) {
829
1635
  if (!value || typeof value !== 'object') {
@@ -974,9 +1780,133 @@ function kickoffAfterBaseDataChange(approved, next) {
974
1780
  }
975
1781
  //#endregion
976
1782
 
1783
+ const UPSTREAM_EXIT_MESSAGE = {
1784
+ kickoffMissing: INTRODUCTION_EXIT_MESSAGE.kickoffMissing,
1785
+ kickoffRejected: INTRODUCTION_EXIT_MESSAGE.kickoffRejected,
1786
+ kickoffNotApproved: INTRODUCTION_EXIT_MESSAGE.kickoffNotApproved,
1787
+ kickoffStale: INTRODUCTION_EXIT_MESSAGE.kickoffStale,
1788
+ kickoffVersionMismatch: INTRODUCTION_EXIT_MESSAGE.kickoffVersionMismatch,
1789
+ discoveryMissing: '@software-management:messages.scope.discovery-required',
1790
+ discoveryRejected: '@software-management:messages.scope.discovery-rejected',
1791
+ discoveryNotApproved: '@software-management:messages.scope.discovery-not-approved',
1792
+ discoveryStale: '@software-management:messages.scope.discovery-stale',
1793
+ discoveryVersionMismatch: '@software-management:messages.scope.discovery-version-mismatch',
1794
+ scopeMissing: '@software-management:messages.behavior.scope-required',
1795
+ scopeRejected: '@software-management:messages.behavior.scope-rejected',
1796
+ scopeNotApproved: '@software-management:messages.behavior.scope-not-approved',
1797
+ scopeStale: '@software-management:messages.behavior.scope-stale',
1798
+ scopeVersionMismatch: '@software-management:messages.behavior.scope-version-mismatch',
1799
+ behaviorMissing: '@software-management:messages.design.behavior-required',
1800
+ behaviorRejected: '@software-management:messages.design.behavior-rejected',
1801
+ behaviorNotApproved: '@software-management:messages.design.behavior-not-approved',
1802
+ behaviorStale: '@software-management:messages.design.behavior-stale',
1803
+ behaviorVersionMismatch: '@software-management:messages.design.behavior-version-mismatch',
1804
+ designMissing: '@software-management:messages.delivery.design-required',
1805
+ designRejected: '@software-management:messages.delivery.design-rejected',
1806
+ designNotApproved: '@software-management:messages.delivery.design-not-approved',
1807
+ designStale: '@software-management:messages.delivery.design-stale',
1808
+ designVersionMismatch: '@software-management:messages.delivery.design-version-mismatch',
1809
+ };
1810
+ /**
1811
+ * Compares a stored approval pin to the live host document and current inputs.
1812
+ * `needsReview` is ignored. Callers must pass live fingerprints; omitted
1813
+ * fingerprint / host fields skip that slice so existing unit fixtures stay valid.
1814
+ */
1815
+ function evaluateApprovedUpstreamPin(input) {
1816
+ const pinVersionId = kickoffText(input.pinVersionId);
1817
+ if (!pinVersionId) {
1818
+ return input.messages.missing;
1819
+ }
1820
+ if (input.statusId !== undefined) {
1821
+ const statusId = kickoffText(input.statusId);
1822
+ if (statusId !== KICKOFF_REVIEW_STATUS.Approved) {
1823
+ return statusId === KICKOFF_REVIEW_STATUS.Rejected
1824
+ ? input.messages.rejected
1825
+ : input.messages.notApproved;
1826
+ }
1827
+ }
1828
+ if (input.hostVersionId !== undefined) {
1829
+ const hostVersionId = kickoffText(input.hostVersionId);
1830
+ if (!hostVersionId || hostVersionId !== pinVersionId) {
1831
+ return input.messages.versionMismatch;
1832
+ }
1833
+ }
1834
+ if (input.currentFingerprint !== undefined) {
1835
+ const pinFingerprint = kickoffText(input.pinFingerprint);
1836
+ const currentFingerprint = kickoffText(input.currentFingerprint);
1837
+ if (!pinFingerprint || !currentFingerprint || pinFingerprint !== currentFingerprint) {
1838
+ return input.messages.stale;
1839
+ }
1840
+ }
1841
+ return null;
1842
+ }
1843
+ function evaluateKickoffUpstreamPin(input) {
1844
+ return evaluateApprovedUpstreamPin({
1845
+ ...input,
1846
+ messages: {
1847
+ missing: UPSTREAM_EXIT_MESSAGE.kickoffMissing,
1848
+ rejected: UPSTREAM_EXIT_MESSAGE.kickoffRejected,
1849
+ notApproved: UPSTREAM_EXIT_MESSAGE.kickoffNotApproved,
1850
+ stale: UPSTREAM_EXIT_MESSAGE.kickoffStale,
1851
+ versionMismatch: UPSTREAM_EXIT_MESSAGE.kickoffVersionMismatch,
1852
+ },
1853
+ });
1854
+ }
1855
+ function evaluateDiscoveryUpstreamPin(input) {
1856
+ return evaluateApprovedUpstreamPin({
1857
+ ...input,
1858
+ messages: {
1859
+ missing: UPSTREAM_EXIT_MESSAGE.discoveryMissing,
1860
+ rejected: UPSTREAM_EXIT_MESSAGE.discoveryRejected,
1861
+ notApproved: UPSTREAM_EXIT_MESSAGE.discoveryNotApproved,
1862
+ stale: UPSTREAM_EXIT_MESSAGE.discoveryStale,
1863
+ versionMismatch: UPSTREAM_EXIT_MESSAGE.discoveryVersionMismatch,
1864
+ },
1865
+ });
1866
+ }
1867
+ function evaluateScopeUpstreamPin(input) {
1868
+ return evaluateApprovedUpstreamPin({
1869
+ ...input,
1870
+ messages: {
1871
+ missing: UPSTREAM_EXIT_MESSAGE.scopeMissing,
1872
+ rejected: UPSTREAM_EXIT_MESSAGE.scopeRejected,
1873
+ notApproved: UPSTREAM_EXIT_MESSAGE.scopeNotApproved,
1874
+ stale: UPSTREAM_EXIT_MESSAGE.scopeStale,
1875
+ versionMismatch: UPSTREAM_EXIT_MESSAGE.scopeVersionMismatch,
1876
+ },
1877
+ });
1878
+ }
1879
+ function evaluateBehaviorUpstreamPin(input) {
1880
+ return evaluateApprovedUpstreamPin({
1881
+ ...input,
1882
+ messages: {
1883
+ missing: UPSTREAM_EXIT_MESSAGE.behaviorMissing,
1884
+ rejected: UPSTREAM_EXIT_MESSAGE.behaviorRejected,
1885
+ notApproved: UPSTREAM_EXIT_MESSAGE.behaviorNotApproved,
1886
+ stale: UPSTREAM_EXIT_MESSAGE.behaviorStale,
1887
+ versionMismatch: UPSTREAM_EXIT_MESSAGE.behaviorVersionMismatch,
1888
+ },
1889
+ });
1890
+ }
1891
+ function evaluateDesignUpstreamPin(input) {
1892
+ return evaluateApprovedUpstreamPin({
1893
+ ...input,
1894
+ messages: {
1895
+ missing: UPSTREAM_EXIT_MESSAGE.designMissing,
1896
+ rejected: UPSTREAM_EXIT_MESSAGE.designRejected,
1897
+ notApproved: UPSTREAM_EXIT_MESSAGE.designNotApproved,
1898
+ stale: UPSTREAM_EXIT_MESSAGE.designStale,
1899
+ versionMismatch: UPSTREAM_EXIT_MESSAGE.designVersionMismatch,
1900
+ },
1901
+ });
1902
+ }
1903
+
1904
+ //#region ----- Imports -----
1905
+ //#endregion
977
1906
  //#region ----- Constants -----
978
1907
  const DISCOVERY_REPORT_DOCUMENT_TYPE_NAME = 'software-discovery-report';
979
- const DISCOVERY_REPORT_FILE_NAME = 'discovery-report.html';
1908
+ const DISCOVERY_REPORT_FILE_NAME = 'discovery-report.pdf';
1909
+ const DISCOVERY_REPORT_LEGACY_HTML_FILE_NAME = 'discovery-report.html';
980
1910
  const DISCOVERY_DECISIONS = ['proceed', 'revise', 'stop'];
981
1911
  const DISCOVERY_STANCES = ['assumption', 'validated'];
982
1912
  const DISCOVERY_METHODS = [
@@ -988,8 +1918,28 @@ const DISCOVERY_METHODS = [
988
1918
  'other',
989
1919
  ];
990
1920
  const DISCOVERY_FINDINGS_CHANGED = 'discovery-findings-changed';
1921
+ /**
1922
+ * Assessment session statuses that can unlock Discovery proceed.
1923
+ * Draft, in-progress, rejected, and missing/invalid status do not qualify.
1924
+ */
1925
+ const USABLE_DISCOVERY_QUESTIONNAIRE_SESSION_STATUSES = [
1926
+ 'submitted',
1927
+ 'under-review',
1928
+ 'approved',
1929
+ 'completed',
1930
+ ];
991
1931
  //#endregion
992
1932
  //#region ----- Findings -----
1933
+ const METHOD_SET = new Set(DISCOVERY_METHODS);
1934
+ const USABLE_SESSION_STATUS_SET = new Set(USABLE_DISCOVERY_QUESTIONNAIRE_SESSION_STATUSES);
1935
+ const SOFTWARE_SUBJECT_TYPE = 'SoftwareManagement.Software';
1936
+ const SOURCE_ENTITY_PREFIX = /^(AssessmentSession|AssessmentCase|AssessmentManagement\.AssessmentSession|AssessmentManagement\.AssessmentCase|Document|DocumentManagement\.Document|DocumentVersion|DocumentManagement\.DocumentVersion)[:\s]+(.+)$/i;
1937
+ function asEvidenceRow(value) {
1938
+ return value && typeof value === 'object' ? value : null;
1939
+ }
1940
+ function isDiscoveryMethod(value) {
1941
+ return METHOD_SET.has(kickoffText(value));
1942
+ }
993
1943
  function discoveryStance(value) {
994
1944
  return kickoffText(value) === 'validated' ? 'validated' : 'assumption';
995
1945
  }
@@ -999,11 +1949,199 @@ function parseSourceRefs(value) {
999
1949
  .map((line) => line.trim())
1000
1950
  .filter((line) => line.length > 0);
1001
1951
  }
1002
- function findingSupportsProceed(finding) {
1952
+ function parseSourceRef(line) {
1953
+ const raw = line.trim();
1954
+ const prefixed = raw.match(SOURCE_ENTITY_PREFIX);
1955
+ if (prefixed) {
1956
+ return { raw, entity: prefixed[1], id: prefixed[2].trim() };
1957
+ }
1958
+ return { raw, id: raw };
1959
+ }
1960
+ function idSet(values) {
1961
+ return new Set((values ?? []).map((value) => value.trim()).filter((value) => value.length > 0));
1962
+ }
1963
+ function sourceLooksLikeMethodLabel(ref, method) {
1964
+ const methodText = method.trim().toLowerCase();
1965
+ return ref.raw.toLowerCase() === methodText || ref.id.toLowerCase() === methodText;
1966
+ }
1967
+ function discoveryQuestionnaireSessionHasAnswers(session) {
1968
+ const count = Number(session.answeredQuestionsCount);
1969
+ if (Number.isFinite(count) && count > 0) {
1970
+ return true;
1971
+ }
1972
+ const answers = session.answers;
1973
+ if (!answers || typeof answers !== 'object' || Array.isArray(answers)) {
1974
+ return false;
1975
+ }
1976
+ return Object.keys(answers).length > 0;
1977
+ }
1978
+ function isUsableDiscoveryQuestionnaireSession(session) {
1979
+ if (!session) {
1980
+ return false;
1981
+ }
1982
+ const status = kickoffText(session.statusId) || kickoffText(session.status);
1983
+ return USABLE_SESSION_STATUS_SET.has(status) && discoveryQuestionnaireSessionHasAnswers(session);
1984
+ }
1985
+ function assessmentSubjectMatchesSoftware(subjectRef, softwareId) {
1986
+ const ref = asEvidenceRow(subjectRef);
1987
+ return kickoffText(ref?.['id']) === softwareId && kickoffText(ref?.['type']) === SOFTWARE_SUBJECT_TYPE;
1988
+ }
1989
+ function citedQuestionnaireSourceIds(findings) {
1990
+ const ids = new Set();
1991
+ for (const finding of findings) {
1992
+ if (kickoffText(finding.method) !== 'questionnaire') {
1993
+ continue;
1994
+ }
1995
+ for (const line of parseSourceRefs(finding.sourceRefs)) {
1996
+ const id = parseSourceRef(line).id;
1997
+ if (id) {
1998
+ ids.add(id);
1999
+ }
2000
+ }
2001
+ }
2002
+ return [...ids];
2003
+ }
2004
+ /**
2005
+ * Resolve questionnaire and document citations by id. Callers must look up the cited
2006
+ * case/session/document rather than paging the first N rows in the application.
2007
+ * A case citation counts only when that case has a usable submitted session with answers.
2008
+ */
2009
+ async function resolveDiscoveryEvidenceFromLookup(softwareId, findings, lookup) {
2010
+ const questionnaireSessionIds = [];
2011
+ const questionnaireCaseIds = [];
2012
+ const documentIds = [];
2013
+ const sessionSeen = new Set();
2014
+ const caseSeen = new Set();
2015
+ const documentSeen = new Set();
2016
+ const addUsableSession = (session, caseId) => {
2017
+ const sessionId = kickoffText(session['id']);
2018
+ if (!sessionId || sessionSeen.has(sessionId) || !isUsableDiscoveryQuestionnaireSession(session)) {
2019
+ return;
2020
+ }
2021
+ sessionSeen.add(sessionId);
2022
+ questionnaireSessionIds.push(sessionId);
2023
+ if (caseId && !caseSeen.has(caseId)) {
2024
+ caseSeen.add(caseId);
2025
+ questionnaireCaseIds.push(caseId);
2026
+ }
2027
+ };
2028
+ const resolveCaseSessions = async (caseRow) => {
2029
+ const caseId = kickoffText(caseRow['id']);
2030
+ if (!caseId || !assessmentSubjectMatchesSoftware(caseRow['subjectRef'], softwareId)) {
2031
+ return;
2032
+ }
2033
+ const sessions = await lookup.listSessionsForCase(caseId);
2034
+ for (const item of sessions) {
2035
+ const session = asEvidenceRow(item);
2036
+ if (session && kickoffText(session['caseId']) === caseId) {
2037
+ addUsableSession(session, caseId);
2038
+ }
2039
+ }
2040
+ };
2041
+ const resolveCitedQuestionnaire = async (ref) => {
2042
+ const entity = (ref.entity ?? '').toLowerCase();
2043
+ const trySession = async () => {
2044
+ const session = asEvidenceRow(await lookup.getSession(ref.id));
2045
+ if (!session) {
2046
+ return false;
2047
+ }
2048
+ const caseId = kickoffText(session['caseId']);
2049
+ const caseRow = caseId ? asEvidenceRow(await lookup.getCase(caseId)) : null;
2050
+ if (caseRow && assessmentSubjectMatchesSoftware(caseRow['subjectRef'], softwareId)) {
2051
+ addUsableSession(session, caseId);
2052
+ }
2053
+ return true;
2054
+ };
2055
+ const tryCase = async () => {
2056
+ const caseRow = asEvidenceRow(await lookup.getCase(ref.id));
2057
+ if (!caseRow) {
2058
+ return false;
2059
+ }
2060
+ await resolveCaseSessions(caseRow);
2061
+ return true;
2062
+ };
2063
+ if (entity.includes('session')) {
2064
+ await trySession();
2065
+ return;
2066
+ }
2067
+ if (entity.includes('case')) {
2068
+ await tryCase();
2069
+ return;
2070
+ }
2071
+ if (await trySession()) {
2072
+ return;
2073
+ }
2074
+ await tryCase();
2075
+ };
2076
+ for (const finding of findings) {
2077
+ const method = kickoffText(finding.method);
2078
+ if (method === 'questionnaire') {
2079
+ for (const line of parseSourceRefs(finding.sourceRefs)) {
2080
+ await resolveCitedQuestionnaire(parseSourceRef(line));
2081
+ }
2082
+ }
2083
+ if (method === 'document') {
2084
+ for (const line of parseSourceRefs(finding.sourceRefs)) {
2085
+ const ref = parseSourceRef(line);
2086
+ if (!ref.id || documentSeen.has(ref.id)) {
2087
+ continue;
2088
+ }
2089
+ const document = asEvidenceRow(await lookup.getDocument(ref.id));
2090
+ if (document) {
2091
+ documentSeen.add(ref.id);
2092
+ documentIds.push(ref.id);
2093
+ }
2094
+ }
2095
+ }
2096
+ }
2097
+ return { questionnaireSessionIds, questionnaireCaseIds, documentIds };
2098
+ }
2099
+ function sourceRefIsTraceable(ref, method, evidence) {
2100
+ if (!ref.raw || sourceLooksLikeMethodLabel(ref, method)) {
2101
+ return false;
2102
+ }
2103
+ const entity = (ref.entity ?? '').toLowerCase();
2104
+ if (method === 'questionnaire') {
2105
+ const sessions = idSet(evidence?.questionnaireSessionIds);
2106
+ const cases = idSet(evidence?.questionnaireCaseIds);
2107
+ if (!evidence) {
2108
+ return false;
2109
+ }
2110
+ if (entity.includes('session')) {
2111
+ return sessions.has(ref.id);
2112
+ }
2113
+ if (entity.includes('case')) {
2114
+ return cases.has(ref.id) && sessions.size > 0;
2115
+ }
2116
+ return sessions.has(ref.id) || (cases.has(ref.id) && sessions.size > 0);
2117
+ }
2118
+ if (method === 'document') {
2119
+ const documents = idSet(evidence?.documentIds);
2120
+ if (!evidence) {
2121
+ return ref.raw.length >= 4;
2122
+ }
2123
+ return documents.has(ref.id) || documents.has(ref.raw);
2124
+ }
2125
+ return ref.raw.length >= 3;
2126
+ }
2127
+ function findingHasTraceableEvidence(finding, evidence) {
2128
+ if (!isDiscoveryMethod(finding.method)) {
2129
+ return false;
2130
+ }
2131
+ const method = finding.method;
2132
+ const refs = parseSourceRefs(finding.sourceRefs).map(parseSourceRef);
2133
+ if (!refs.length) {
2134
+ return false;
2135
+ }
2136
+ return refs.some((ref) => sourceRefIsTraceable(ref, method, evidence));
2137
+ }
2138
+ function findingSupportsProceed(finding, evidence) {
1003
2139
  const kind = kickoffText(finding.kind);
1004
2140
  const userOrProblem = kind === 'audience' || kind === 'problem' || kind === 'pain';
1005
- const hasEvidence = Boolean(kickoffText(finding.method) || parseSourceRefs(finding.sourceRefs).length);
1006
- return discoveryStance(finding.stance) === 'validated' && userOrProblem && hasEvidence && Boolean(kickoffText(finding.claim) || kickoffText(finding.title));
2141
+ return (discoveryStance(finding.stance) === 'validated' &&
2142
+ userOrProblem &&
2143
+ findingHasTraceableEvidence(finding, evidence) &&
2144
+ Boolean(kickoffText(finding.claim) || kickoffText(finding.title)));
1007
2145
  }
1008
2146
  function discoveryReportFingerprint(source) {
1009
2147
  const findings = [...source.findings]
@@ -1031,7 +2169,81 @@ function discoveryReportFingerprint(source) {
1031
2169
  }
1032
2170
  //#endregion
1033
2171
  //#region ----- Report -----
1034
- function escapeHtml(value) {
2172
+ const REPORT_COPY$4 = {
2173
+ heading: { en: 'Discovery Report', fa: 'گزارش کشف' },
2174
+ subtitle: {
2175
+ en: 'Assumptions stay labeled as assumptions. Validated findings cite a research method and a traceable source.',
2176
+ fa: 'فرضیه‌ها فرضیه می‌مانند. یافتهٔ اعتبارسنجی‌شده روش پژوهش و منبع قابل پیگیری دارد.',
2177
+ },
2178
+ kickoffVersion: { en: 'Kickoff version', fa: 'نسخهٔ آغاز' },
2179
+ pinned: { en: 'Pinned introduction', fa: 'معرفی تأییدشده' },
2180
+ decision: { en: 'Decision', fa: 'تصمیم' },
2181
+ rationale: { en: 'Rationale', fa: 'دلیل' },
2182
+ method: { en: 'Method', fa: 'روش' },
2183
+ userGroup: { en: 'User group', fa: 'گروه کاربر' },
2184
+ date: { en: 'Date', fa: 'تاریخ' },
2185
+ sources: { en: 'Sources', fa: 'منابع' },
2186
+ version: { en: 'Kickoff version', fa: 'نسخه' },
2187
+ fingerprint: { en: 'Fingerprint', fa: 'اثرانگشت' },
2188
+ item: { en: 'Item', fa: 'مورد' },
2189
+ };
2190
+ const DECISION_LABEL = {
2191
+ proceed: { en: 'Proceed', fa: 'ادامه' },
2192
+ revise: { en: 'Revise', fa: 'بازبینی دوباره' },
2193
+ stop: { en: 'Stop', fa: 'توقف' },
2194
+ };
2195
+ const STANCE_LABEL = {
2196
+ assumption: { en: 'Hypothesis', fa: 'فرضیه' },
2197
+ validated: { en: 'Validated', fa: 'اعتبارسنجی‌شده' },
2198
+ };
2199
+ const KIND_LABEL$1 = {
2200
+ audience: { en: 'Intended Users', fa: 'کاربران هدف' },
2201
+ problem: { en: 'Problem', fa: 'مسئله' },
2202
+ pain: { en: 'Pain', fa: 'درد' },
2203
+ 'current-practice': { en: 'Current Practice', fa: 'رویهٔ فعلی' },
2204
+ constraint: { en: 'Constraint', fa: 'محدودیت' },
2205
+ alternative: { en: 'Alternative', fa: 'گزینهٔ جایگزین' },
2206
+ hypothesis: { en: 'Hypothesis', fa: 'فرضیه' },
2207
+ evidence: { en: 'Evidence', fa: 'شواهد' },
2208
+ unknown: { en: 'Unknown', fa: 'ناشناخته' },
2209
+ };
2210
+ const METHOD_LABEL = {
2211
+ interview: { en: 'Interview', fa: 'مصاحبه' },
2212
+ observation: { en: 'Observation', fa: 'مشاهده' },
2213
+ analytics: { en: 'Analytics', fa: 'تحلیل داده' },
2214
+ document: { en: 'Document', fa: 'سند' },
2215
+ questionnaire: { en: 'Questionnaire', fa: 'پرسش‌نامه' },
2216
+ other: { en: 'Other', fa: 'سایر' },
2217
+ };
2218
+ function pairLabel$4(copy, lang) {
2219
+ return sheetBilingual(copy.en, copy.fa, lang);
2220
+ }
2221
+ function mappedLabel$1(map, key, lang, fallback) {
2222
+ const entry = map[key];
2223
+ if (!entry) {
2224
+ return fallback;
2225
+ }
2226
+ if (lang === 'both') {
2227
+ return key;
2228
+ }
2229
+ return sheetBilingual(entry.en, entry.fa, lang);
2230
+ }
2231
+ function decisionLabel(decision, lang) {
2232
+ return mappedLabel$1(DECISION_LABEL, decision, lang, decision || sheetUnknown(lang));
2233
+ }
2234
+ function stanceLabel(stance, lang) {
2235
+ return mappedLabel$1(STANCE_LABEL, stance, lang, stance);
2236
+ }
2237
+ function kindLabel$1(kind, lang) {
2238
+ return mappedLabel$1(KIND_LABEL$1, kind, lang, kind || pairLabel$4(REPORT_COPY$4.item, lang));
2239
+ }
2240
+ function methodLabel(method, lang) {
2241
+ return mappedLabel$1(METHOD_LABEL, method, lang, method || sheetUnknown(lang));
2242
+ }
2243
+ function labeled$4(copy, value, lang) {
2244
+ return `${pairLabel$4(copy, lang)}: ${value}`;
2245
+ }
2246
+ function escapeHtml$4(value) {
1035
2247
  return value
1036
2248
  .replace(/&/g, '&amp;')
1037
2249
  .replace(/</g, '&lt;')
@@ -1041,35 +2253,75 @@ function kickoffPlainTextFromVersion(version) {
1041
2253
  const meta = readKickoffMeta(version?.metaDataForm);
1042
2254
  return kickoffText(meta.plainText) || kickoffText(meta.bodyHtml);
1043
2255
  }
1044
- function buildDiscoveryReport(source) {
2256
+ function discoveryReportHeading(locale) {
2257
+ return sheetHeading(REPORT_COPY$4.heading.en, REPORT_COPY$4.heading.fa, locale);
2258
+ }
2259
+ function buildDiscoveryReport(source, locale) {
2260
+ const lang = resolveSheetLang(locale);
2261
+ const displayLocale = lang === 'both' ? undefined : locale;
1045
2262
  const fingerprint = discoveryReportFingerprint(source);
2263
+ const unknown = sheetUnknown(lang);
2264
+ const heading = pairLabel$4(REPORT_COPY$4.heading, lang);
2265
+ const decision = decisionLabel(source.decision, lang) || unknown;
2266
+ const rationale = source.rationale || unknown;
2267
+ const kickoffBody = source.kickoffPlainText || unknown;
1046
2268
  const lines = [
1047
- 'Discovery Report / گزارش کشف',
1048
- `Kickoff version / نسخهٔ آغاز: ${source.kickoffVersionId}`,
1049
- 'Assumptions stay labeled as assumptions. Validated findings cite a method or source.',
1050
- 'فرضیه‌ها فرضیه می‌مانند. یافتهٔ اعتبارسنجی‌شده روش یا منبع دارد.',
2269
+ heading,
2270
+ labeled$4(REPORT_COPY$4.kickoffVersion, source.kickoffVersionId, lang),
2271
+ pairLabel$4(REPORT_COPY$4.subtitle, lang),
1051
2272
  '',
1052
- 'Pinned introduction / معرفی تأییدشده',
1053
- source.kickoffPlainText || 'Unknown / نامعلوم',
2273
+ pairLabel$4(REPORT_COPY$4.pinned, lang),
2274
+ kickoffBody,
1054
2275
  '',
1055
- `Decision / تصمیم: ${source.decision || 'Unknown / نامعلوم'}`,
1056
- `Rationale / دلیل: ${source.rationale || 'Unknown / نامعلوم'}`,
2276
+ labeled$4(REPORT_COPY$4.decision, decision, lang),
2277
+ labeled$4(REPORT_COPY$4.rationale, rationale, lang),
1057
2278
  ];
2279
+ const findingBlocks = [];
1058
2280
  for (const finding of source.findings) {
1059
2281
  const sources = parseSourceRefs(finding.sourceRefs);
1060
- lines.push('', `${kickoffText(finding.kind) || 'item'} / ${discoveryStance(finding.stance)}`, kickoffText(finding.title) || 'Unknown / نامعلوم', kickoffText(finding.claim) || kickoffText(finding.body) || 'Unknown / نامعلوم', `Method / روش: ${kickoffText(finding.method) || 'Unknown / نامعلوم'}`, `User group / گروه کاربر: ${kickoffText(finding.userGroup) || 'Unknown / نامعلوم'}`, `Date / تاریخ: ${kickoffText(finding.researchDate) || 'Unknown / نامعلوم'}`, `Sources / منابع: ${sources.length ? sources.join('; ') : 'Unknown / نامعلوم'}`, `Kickoff version / نسخه: ${kickoffText(finding.kickoffVersionId) || source.kickoffVersionId}`);
2282
+ const kind = kindLabel$1(kickoffText(finding.kind), lang);
2283
+ const stance = stanceLabel(discoveryStance(finding.stance), lang);
2284
+ const title = introductionValueText(finding.title, displayLocale) || unknown;
2285
+ const claim = introductionValueText(finding.claim, displayLocale) ||
2286
+ introductionValueText(finding.body, displayLocale) ||
2287
+ unknown;
2288
+ const method = methodLabel(kickoffText(finding.method), lang);
2289
+ const userGroup = introductionValueText(finding.userGroup, displayLocale) || unknown;
2290
+ const date = kickoffText(finding.researchDate) || unknown;
2291
+ const sourcesText = sources.length ? sources.join('; ') : unknown;
2292
+ const version = kickoffText(finding.kickoffVersionId) || source.kickoffVersionId;
2293
+ lines.push('', `${kind} / ${stance}`, title, claim, labeled$4(REPORT_COPY$4.method, method, lang), labeled$4(REPORT_COPY$4.userGroup, userGroup, lang), labeled$4(REPORT_COPY$4.date, date, lang), labeled$4(REPORT_COPY$4.sources, sourcesText, lang), labeled$4(REPORT_COPY$4.version, version, lang));
2294
+ findingBlocks.push([
2295
+ '<section>',
2296
+ `<h2>${escapeHtml$4(`${kind} / ${stance}`)}</h2>`,
2297
+ `<p>${escapeHtml$4(title).replace(/\n/g, '<br>')}</p>`,
2298
+ `<p>${escapeHtml$4(claim).replace(/\n/g, '<br>')}</p>`,
2299
+ `<p class="certainty">${escapeHtml$4(labeled$4(REPORT_COPY$4.method, method, lang))}</p>`,
2300
+ `<p class="certainty">${escapeHtml$4(labeled$4(REPORT_COPY$4.userGroup, userGroup, lang))}</p>`,
2301
+ `<p class="certainty">${escapeHtml$4(labeled$4(REPORT_COPY$4.date, date, lang))}</p>`,
2302
+ `<p class="certainty">${escapeHtml$4(labeled$4(REPORT_COPY$4.sources, sourcesText, lang))}</p>`,
2303
+ `<p class="certainty">${escapeHtml$4(labeled$4(REPORT_COPY$4.version, version, lang))}</p>`,
2304
+ '</section>',
2305
+ ].join(''));
1061
2306
  }
1062
- lines.push('', `Fingerprint: ${fingerprint}`);
2307
+ lines.push('', labeled$4(REPORT_COPY$4.fingerprint, fingerprint, lang));
1063
2308
  const plainText = lines.join('\n');
1064
- const html = [
1065
- '<!DOCTYPE html>',
1066
- '<html>',
1067
- '<head><meta charset="utf-8"><title>Discovery Report</title></head>',
1068
- '<body>',
1069
- `<pre>${escapeHtml(plainText)}</pre>`,
1070
- '</body>',
1071
- '</html>',
1072
- ].join('');
2309
+ const html = wrapSheetHtml(heading, [
2310
+ `<h1>${escapeHtml$4(heading)}</h1>`,
2311
+ `<p class="certainty">${escapeHtml$4(labeled$4(REPORT_COPY$4.kickoffVersion, source.kickoffVersionId, lang))}</p>`,
2312
+ `<p>${escapeHtml$4(pairLabel$4(REPORT_COPY$4.subtitle, lang))}</p>`,
2313
+ '<section>',
2314
+ `<h2>${escapeHtml$4(pairLabel$4(REPORT_COPY$4.pinned, lang))}</h2>`,
2315
+ `<p>${escapeHtml$4(kickoffBody).replace(/\n/g, '<br>')}</p>`,
2316
+ '</section>',
2317
+ '<section>',
2318
+ `<h2>${escapeHtml$4(pairLabel$4(REPORT_COPY$4.decision, lang))}</h2>`,
2319
+ `<p>${escapeHtml$4(decision)}</p>`,
2320
+ `<p>${escapeHtml$4(labeled$4(REPORT_COPY$4.rationale, rationale, lang))}</p>`,
2321
+ '</section>',
2322
+ ...findingBlocks,
2323
+ `<p class="certainty">${escapeHtml$4(labeled$4(REPORT_COPY$4.fingerprint, fingerprint, lang))}</p>`,
2324
+ ].join(''), lang);
1073
2325
  return { fingerprint, html, plainText };
1074
2326
  }
1075
2327
  //#endregion
@@ -1091,8 +2343,15 @@ function evaluateDiscoveryExit(input) {
1091
2343
  if (phase && phase !== 'discovery' && phase !== 'introduction') {
1092
2344
  return { ok: true, advance: false, message: '', discoveryVersionId: approvedVersionId };
1093
2345
  }
1094
- if (!kickoffText(input.kickoffApprovedVersionId)) {
1095
- return stay('Discovery needs the approved introduction kickoff version.');
2346
+ const kickoffPin = evaluateKickoffUpstreamPin({
2347
+ pinVersionId: input.kickoffApprovedVersionId,
2348
+ pinFingerprint: input.kickoffApprovedFingerprint,
2349
+ currentFingerprint: input.currentKickoffFingerprint,
2350
+ statusId: input.kickoffStatusId,
2351
+ hostVersionId: input.kickoffHostVersionId,
2352
+ });
2353
+ if (kickoffPin) {
2354
+ return stay(kickoffPin);
1096
2355
  }
1097
2356
  if (decision !== 'proceed' && decision !== 'revise' && decision !== 'stop') {
1098
2357
  return stay('Discovery needs a decision: proceed, revise, or stop.');
@@ -1117,8 +2376,8 @@ function evaluateDiscoveryExit(input) {
1117
2376
  };
1118
2377
  }
1119
2378
  const findings = input.findings ?? [];
1120
- if (!findings.some(findingSupportsProceed)) {
1121
- return stay('Proceed needs at least one validated user or problem finding with a method or source. A questionnaire alone is not a conclusion.', approvedVersionId);
2379
+ if (!findings.some((finding) => findingSupportsProceed(finding, input.evidence))) {
2380
+ return stay('Proceed needs at least one validated user or problem finding with a research method and a traceable source. A questionnaire is not evidence until a submitted session with answers is cited.', approvedVersionId);
1122
2381
  }
1123
2382
  return {
1124
2383
  ok: true,
@@ -1129,42 +2388,1295 @@ function evaluateDiscoveryExit(input) {
1129
2388
  }
1130
2389
  //#endregion
1131
2390
 
1132
- function textPresent(value) {
1133
- return typeof value === 'string' && value.trim().length > 0;
2391
+ //#region ----- Imports -----
2392
+ //#endregion
2393
+ //#region ----- Constants -----
2394
+ const SCOPE_DOCUMENT_TYPE_NAME = 'software-first-version-scope';
2395
+ const SCOPE_DOCUMENT_FILE_NAME = 'first-version-scope.pdf';
2396
+ const SCOPE_DOCUMENT_LEGACY_HTML_FILE_NAME = 'first-version-scope.html';
2397
+ const SCOPE_ITEMS_CHANGED = 'scope-items-changed';
2398
+ const SCOPE_SOURCE_CHANGED = 'discovery-approved-version-changed';
2399
+ //#endregion
2400
+ //#region ----- Items -----
2401
+ const KIND_SET = new Set(SOFTWARE_SCOPE_KINDS);
2402
+ const PRIORITY_SET = new Set(SOFTWARE_MOSCOW_PRIORITIES);
2403
+ function isScopeKind(value) {
2404
+ return KIND_SET.has(kickoffText(value));
1134
2405
  }
1135
- function canCompleteIntroduction(software) {
1136
- return missingIntroductionFields(software).length === 0;
2406
+ function isMoscowPriority(value) {
2407
+ return PRIORITY_SET.has(kickoffText(value));
1137
2408
  }
1138
- function isIntroductionComplete(software) {
1139
- if (software.introductionCompletedAt) {
1140
- return true;
2409
+ function scopeItemKind(value) {
2410
+ return isScopeKind(value) ? kickoffText(value) : '';
2411
+ }
2412
+ function capabilitySupportsScope(item) {
2413
+ return (scopeItemKind(item.kind) === 'capability' &&
2414
+ Boolean(kickoffText(item.title)) &&
2415
+ isMoscowPriority(item.priority) &&
2416
+ Boolean(kickoffText(item.rationale)));
2417
+ }
2418
+ function exclusionSupportsScope(item) {
2419
+ return (scopeItemKind(item.kind) === 'out-of-scope' &&
2420
+ Boolean(kickoffText(item.title)) &&
2421
+ Boolean(kickoffText(item.rationale)));
2422
+ }
2423
+ function metricSupportsScope(item) {
2424
+ return (scopeItemKind(item.kind) === 'success-metric' &&
2425
+ Boolean(kickoffText(item.title)) &&
2426
+ Boolean(kickoffText(item.metricBaseline)) &&
2427
+ Boolean(kickoffText(item.metricTarget)) &&
2428
+ Boolean(kickoffText(item.metricMethod)));
2429
+ }
2430
+ function scopeDocumentFingerprint(source) {
2431
+ const items = [...source.items]
2432
+ .map((item) => [
2433
+ kickoffText(item.id),
2434
+ scopeItemKind(item.kind),
2435
+ kickoffText(item.title),
2436
+ kickoffText(item.body),
2437
+ kickoffText(item.priority),
2438
+ kickoffText(item.rationale),
2439
+ kickoffText(item.metricBaseline),
2440
+ kickoffText(item.metricTarget),
2441
+ kickoffText(item.metricMethod),
2442
+ kickoffText(item.discoveryVersionId),
2443
+ ].join('\u001f'))
2444
+ .sort();
2445
+ const payload = [source.discoveryVersionId, source.discoveryFingerprint, ...items].join('\u001e');
2446
+ let hash = 0x811c9dc5;
2447
+ for (let index = 0; index < payload.length; index += 1) {
2448
+ hash ^= payload.charCodeAt(index);
2449
+ hash = Math.imul(hash, 0x01000193);
1141
2450
  }
1142
- return isSoftwarePhaseAtLeast(String(software.currentPhase ?? ''), 'discovery');
2451
+ return `scope-${(hash >>> 0).toString(16).padStart(8, '0')}-${payload.length}`;
1143
2452
  }
1144
- function canLinkProject(software) {
1145
- return isIntroductionComplete(software);
2453
+ //#endregion
2454
+ //#region ----- Report -----
2455
+ const REPORT_COPY$3 = {
2456
+ heading: { en: 'First-Version Scope', fa: 'محدوده نسخه اول' },
2457
+ subtitle: {
2458
+ en: 'Essential capabilities, explicit exclusions, and measurable success criteria for the first version.',
2459
+ fa: 'قابلیت‌های ضروری، موارد خارج از محدوده، و معیارهای موفقیت قابل اندازه‌گیری برای نسخه اول.',
2460
+ },
2461
+ discoveryVersion: { en: 'Discovery version', fa: 'نسخهٔ کشف' },
2462
+ pinned: { en: 'Pinned discovery', fa: 'کشف تأییدشده' },
2463
+ priority: { en: 'Priority', fa: 'اولویت' },
2464
+ rationale: { en: 'Rationale', fa: 'دلیل' },
2465
+ baseline: { en: 'Baseline', fa: 'خط پایه' },
2466
+ target: { en: 'Target', fa: 'هدف' },
2467
+ method: { en: 'Measurement', fa: 'روش اندازه‌گیری' },
2468
+ version: { en: 'Discovery version', fa: 'نسخهٔ کشف' },
2469
+ fingerprint: { en: 'Fingerprint', fa: 'اثرانگشت' },
2470
+ item: { en: 'Item', fa: 'مورد' },
2471
+ };
2472
+ const KIND_LABEL = {
2473
+ capability: { en: 'Essential Capability', fa: 'قابلیت ضروری' },
2474
+ 'out-of-scope': { en: 'Out Of Scope', fa: 'خارج از محدوده' },
2475
+ 'success-metric': { en: 'Success Metric', fa: 'معیار موفقیت' },
2476
+ };
2477
+ const PRIORITY_LABEL = {
2478
+ must: { en: 'Must Have', fa: 'باید باشد' },
2479
+ should: { en: 'Should Have', fa: 'بهتر است باشد' },
2480
+ could: { en: 'Could Have', fa: 'می‌تواند باشد' },
2481
+ wont: { en: "Won't Have", fa: 'نباید باشد' },
2482
+ };
2483
+ function pairLabel$3(copy, lang) {
2484
+ return sheetBilingual(copy.en, copy.fa, lang);
1146
2485
  }
1147
- function canWriteDesignKind(software, kind) {
1148
- if (kind === 'technical') {
1149
- return isSoftwarePhaseAtLeast(String(software.currentPhase ?? ''), 'design');
2486
+ function mappedLabel(map, key, lang, fallback) {
2487
+ const entry = map[key];
2488
+ if (!entry) {
2489
+ return fallback;
1150
2490
  }
1151
- return isSoftwarePhaseAtLeast(String(software.currentPhase ?? ''), 'behavior-specification');
2491
+ if (lang === 'both') {
2492
+ return key;
2493
+ }
2494
+ return sheetBilingual(entry.en, entry.fa, lang);
1152
2495
  }
1153
- const INTRODUCTION_UPSTREAM_FIELDS = [
1154
- 'title',
1155
- 'idea',
1156
- 'initialProblem',
2496
+ function kindLabel(kind, lang) {
2497
+ return mappedLabel(KIND_LABEL, kind, lang, kind || pairLabel$3(REPORT_COPY$3.item, lang));
2498
+ }
2499
+ function priorityLabel(priority, lang) {
2500
+ return mappedLabel(PRIORITY_LABEL, priority, lang, priority || sheetUnknown(lang));
2501
+ }
2502
+ function labeled$3(copy, value, lang) {
2503
+ return `${pairLabel$3(copy, lang)}: ${value}`;
2504
+ }
2505
+ function escapeHtml$3(value) {
2506
+ return value
2507
+ .replace(/&/g, '&amp;')
2508
+ .replace(/</g, '&lt;')
2509
+ .replace(/>/g, '&gt;');
2510
+ }
2511
+ function scopeDocumentHeading(locale) {
2512
+ return sheetHeading(REPORT_COPY$3.heading.en, REPORT_COPY$3.heading.fa, locale);
2513
+ }
2514
+ function buildScopeDocument(source, locale) {
2515
+ const lang = resolveSheetLang(locale);
2516
+ const displayLocale = lang === 'both' ? undefined : sheetDisplayLocale(locale);
2517
+ const fingerprint = scopeDocumentFingerprint(source);
2518
+ const unknown = sheetUnknown(lang);
2519
+ const heading = pairLabel$3(REPORT_COPY$3.heading, lang);
2520
+ const discoveryBody = source.discoveryPlainText || unknown;
2521
+ const lines = [
2522
+ heading,
2523
+ labeled$3(REPORT_COPY$3.discoveryVersion, source.discoveryVersionId, lang),
2524
+ pairLabel$3(REPORT_COPY$3.subtitle, lang),
2525
+ '',
2526
+ pairLabel$3(REPORT_COPY$3.pinned, lang),
2527
+ discoveryBody,
2528
+ ];
2529
+ const itemBlocks = [];
2530
+ for (const item of source.items) {
2531
+ const kind = kindLabel(scopeItemKind(item.kind), lang);
2532
+ const title = introductionValueText(item.title, displayLocale) || unknown;
2533
+ const body = introductionValueText(item.body, displayLocale) || unknown;
2534
+ const priority = priorityLabel(kickoffText(item.priority), lang);
2535
+ const rationale = introductionValueText(item.rationale, displayLocale) || unknown;
2536
+ const baseline = introductionValueText(item.metricBaseline, displayLocale) || unknown;
2537
+ const target = introductionValueText(item.metricTarget, displayLocale) || unknown;
2538
+ const method = introductionValueText(item.metricMethod, displayLocale) || unknown;
2539
+ const version = kickoffText(item.discoveryVersionId) || source.discoveryVersionId;
2540
+ lines.push('', kind, title, body, labeled$3(REPORT_COPY$3.priority, priority, lang), labeled$3(REPORT_COPY$3.rationale, rationale, lang), labeled$3(REPORT_COPY$3.baseline, baseline, lang), labeled$3(REPORT_COPY$3.target, target, lang), labeled$3(REPORT_COPY$3.method, method, lang), labeled$3(REPORT_COPY$3.version, version, lang));
2541
+ itemBlocks.push([
2542
+ '<section>',
2543
+ `<h2>${escapeHtml$3(kind)}</h2>`,
2544
+ `<p>${escapeHtml$3(title).replace(/\n/g, '<br>')}</p>`,
2545
+ `<p>${escapeHtml$3(body).replace(/\n/g, '<br>')}</p>`,
2546
+ `<p class="certainty">${escapeHtml$3(labeled$3(REPORT_COPY$3.priority, priority, lang))}</p>`,
2547
+ `<p class="certainty">${escapeHtml$3(labeled$3(REPORT_COPY$3.rationale, rationale, lang))}</p>`,
2548
+ `<p class="certainty">${escapeHtml$3(labeled$3(REPORT_COPY$3.baseline, baseline, lang))}</p>`,
2549
+ `<p class="certainty">${escapeHtml$3(labeled$3(REPORT_COPY$3.target, target, lang))}</p>`,
2550
+ `<p class="certainty">${escapeHtml$3(labeled$3(REPORT_COPY$3.method, method, lang))}</p>`,
2551
+ `<p class="certainty">${escapeHtml$3(labeled$3(REPORT_COPY$3.version, version, lang))}</p>`,
2552
+ '</section>',
2553
+ ].join(''));
2554
+ }
2555
+ lines.push('', labeled$3(REPORT_COPY$3.fingerprint, fingerprint, lang));
2556
+ const plainText = lines.join('\n');
2557
+ const html = wrapSheetHtml(heading, [
2558
+ `<h1>${escapeHtml$3(heading)}</h1>`,
2559
+ `<p class="certainty">${escapeHtml$3(labeled$3(REPORT_COPY$3.discoveryVersion, source.discoveryVersionId, lang))}</p>`,
2560
+ `<p>${escapeHtml$3(pairLabel$3(REPORT_COPY$3.subtitle, lang))}</p>`,
2561
+ '<section>',
2562
+ `<h2>${escapeHtml$3(pairLabel$3(REPORT_COPY$3.pinned, lang))}</h2>`,
2563
+ `<p>${escapeHtml$3(discoveryBody).replace(/\n/g, '<br>')}</p>`,
2564
+ '</section>',
2565
+ ...itemBlocks,
2566
+ `<p class="certainty">${escapeHtml$3(labeled$3(REPORT_COPY$3.fingerprint, fingerprint, lang))}</p>`,
2567
+ ].join(''), lang);
2568
+ return { fingerprint, html, plainText };
2569
+ }
2570
+ //#endregion
2571
+ //#region ----- Exit gate -----
2572
+ function evaluateScopeExit(input) {
2573
+ const stay = (message, scopeVersionId = '') => ({
2574
+ ok: false,
2575
+ advance: false,
2576
+ message,
2577
+ scopeVersionId,
2578
+ });
2579
+ const phase = kickoffText(input.currentPhase);
2580
+ const approvedVersionId = kickoffText(input.approvedVersionId);
2581
+ const fingerprint = kickoffText(input.reportFingerprint);
2582
+ const approvedFingerprint = kickoffText(input.approvedFingerprint);
2583
+ const hostVersionId = kickoffText(input.hostVersionId);
2584
+ const statusId = kickoffText(input.statusId);
2585
+ if (phase &&
2586
+ phase !== 'first-version-scope' &&
2587
+ phase !== 'discovery' &&
2588
+ phase !== 'introduction') {
2589
+ return { ok: true, advance: false, message: '', scopeVersionId: approvedVersionId };
2590
+ }
2591
+ const hasKickoffCheck = input.kickoffApprovedVersionId !== undefined ||
2592
+ input.kickoffApprovedFingerprint !== undefined ||
2593
+ input.currentKickoffFingerprint !== undefined ||
2594
+ input.kickoffStatusId !== undefined ||
2595
+ input.kickoffHostVersionId !== undefined;
2596
+ if (hasKickoffCheck) {
2597
+ const kickoffPin = evaluateKickoffUpstreamPin({
2598
+ pinVersionId: input.kickoffApprovedVersionId,
2599
+ pinFingerprint: input.kickoffApprovedFingerprint,
2600
+ currentFingerprint: input.currentKickoffFingerprint,
2601
+ statusId: input.kickoffStatusId,
2602
+ hostVersionId: input.kickoffHostVersionId,
2603
+ });
2604
+ if (kickoffPin) {
2605
+ return stay(kickoffPin);
2606
+ }
2607
+ }
2608
+ const discoveryPin = evaluateDiscoveryUpstreamPin({
2609
+ pinVersionId: input.discoveryApprovedVersionId,
2610
+ pinFingerprint: input.discoveryApprovedFingerprint,
2611
+ currentFingerprint: input.currentDiscoveryFingerprint,
2612
+ statusId: input.discoveryStatusId,
2613
+ hostVersionId: input.discoveryHostVersionId,
2614
+ });
2615
+ if (discoveryPin) {
2616
+ return stay(discoveryPin);
2617
+ }
2618
+ if (!approvedVersionId || statusId !== 'approved' || hostVersionId !== approvedVersionId) {
2619
+ return stay('First-version scope needs an approved scope document before Behavior can start.');
2620
+ }
2621
+ if (!fingerprint || approvedFingerprint !== fingerprint) {
2622
+ return stay('Scope items or the approved discovery source changed after approval. The approved scope document was not changed. Generate and approve a new document.', approvedVersionId);
2623
+ }
2624
+ const items = input.items ?? [];
2625
+ if (!items.some(capabilitySupportsScope)) {
2626
+ return stay('Scope needs at least one essential capability with a MoSCoW priority and rationale.', approvedVersionId);
2627
+ }
2628
+ if (!items.some(exclusionSupportsScope)) {
2629
+ return stay('Scope needs at least one explicit exclusion with a rationale.', approvedVersionId);
2630
+ }
2631
+ if (!items.some(metricSupportsScope)) {
2632
+ return stay('Scope needs at least one success metric with a baseline, target, and measurement method.', approvedVersionId);
2633
+ }
2634
+ return {
2635
+ ok: true,
2636
+ advance: true,
2637
+ message: '',
2638
+ scopeVersionId: approvedVersionId,
2639
+ };
2640
+ }
2641
+ //#endregion
2642
+
2643
+ //#region ----- Imports -----
2644
+ //#endregion
2645
+ //#region ----- Constants -----
2646
+ const BEHAVIOR_DOCUMENT_TYPE_NAME = 'software-behavior-specification';
2647
+ const BEHAVIOR_DOCUMENT_FILE_NAME = 'behavior-specification.pdf';
2648
+ const BEHAVIOR_DOCUMENT_LEGACY_HTML_FILE_NAME = 'behavior-specification.html';
2649
+ const BEHAVIOR_CONTENT_CHANGED = 'behavior-content-changed';
2650
+ const BEHAVIOR_SOURCE_CHANGED = 'scope-approved-version-changed';
2651
+ const BEHAVIOR_EXIT_MESSAGE = {
2652
+ missingApproved: 'Behavior specification needs an approved behavior document before Design can start.',
2653
+ stale: 'Requirements, acceptance criteria, or related rules changed after approval. The approved specification was not changed. Generate and approve a new document.',
2654
+ requirement: 'Behavior needs at least one requirement with a title, statement, and an in-scope capability.',
2655
+ acceptance: 'Behavior needs at least one acceptance criterion linked to a requirement, with a statement or Given/When/Then.',
2656
+ trace: 'Behavior needs at least one business rule or use case that traces to a requirement or in-scope capability.',
2657
+ };
2658
+ //#endregion
2659
+ //#region ----- Quality -----
2660
+ function sortedJoin$2(parts) {
2661
+ return [...parts].sort().join('\u001e');
2662
+ }
2663
+ function recordKey$1(parts) {
2664
+ return parts.map((part) => kickoffText(part)).join('\u001f');
2665
+ }
2666
+ function requirementSupportsBehavior(requirement, capabilities) {
2667
+ const title = kickoffText(requirement.title);
2668
+ const statement = kickoffText(requirement.statement);
2669
+ const scopeItemId = kickoffText(requirement.scopeItemId);
2670
+ if (!title || !statement || !scopeItemId) {
2671
+ return false;
2672
+ }
2673
+ return capabilities.some((item) => capabilitySupportsScope(item) &&
2674
+ kickoffText(item.id) === scopeItemId);
2675
+ }
2676
+ function acceptanceCriterionSupportsBehavior(criterion, requirementIds) {
2677
+ const requirementId = kickoffText(criterion.requirementId);
2678
+ if (!requirementId || !requirementIds.has(requirementId)) {
2679
+ return false;
2680
+ }
2681
+ if (kickoffText(criterion.statement)) {
2682
+ return true;
2683
+ }
2684
+ return Boolean(kickoffText(criterion.given) && kickoffText(criterion.when) && kickoffText(criterion.then));
2685
+ }
2686
+ function businessRuleSupportsBehavior(rule, requirementIds, capabilities) {
2687
+ if (!kickoffText(rule.title) || !kickoffText(rule.statement)) {
2688
+ return false;
2689
+ }
2690
+ const requirementId = kickoffText(rule.requirementId);
2691
+ if (requirementId && requirementIds.has(requirementId)) {
2692
+ return true;
2693
+ }
2694
+ const scopeItemId = kickoffText(rule.scopeItemId);
2695
+ return capabilities.some((item) => capabilitySupportsScope(item) && kickoffText(item.id) === scopeItemId);
2696
+ }
2697
+ function useCaseSupportsBehavior(useCase, requirementIds, capabilities) {
2698
+ if (!kickoffText(useCase.title) || !kickoffText(useCase.mainFlow)) {
2699
+ return false;
2700
+ }
2701
+ const requirementId = kickoffText(useCase.requirementId);
2702
+ if (requirementId && requirementIds.has(requirementId)) {
2703
+ return true;
2704
+ }
2705
+ const scopeItemId = kickoffText(useCase.scopeItemId);
2706
+ return capabilities.some((item) => capabilitySupportsScope(item) && kickoffText(item.id) === scopeItemId);
2707
+ }
2708
+ function behaviorDocumentFingerprint(source) {
2709
+ const requirements = source.requirements.map((item) => recordKey$1([
2710
+ item.id,
2711
+ item.title,
2712
+ item.statement,
2713
+ item.kind,
2714
+ item.priority,
2715
+ item.rationale,
2716
+ item.scopeItemId,
2717
+ item.scopeVersionId,
2718
+ ]));
2719
+ const criteria = source.acceptanceCriteria.map((item) => recordKey$1([item.id, item.requirementId, item.statement, item.given, item.when, item.then, item.scopeVersionId]));
2720
+ const rules = source.businessRules.map((item) => recordKey$1([item.id, item.title, item.statement, item.requirementId, item.scopeItemId, item.scopeVersionId]));
2721
+ const useCases = source.useCases.map((item) => recordKey$1([
2722
+ item.id,
2723
+ item.code,
2724
+ item.title,
2725
+ item.mainFlow,
2726
+ item.requirementId,
2727
+ item.scopeItemId,
2728
+ item.scopeVersionId,
2729
+ ]));
2730
+ const payload = [
2731
+ source.scopeVersionId,
2732
+ source.scopeFingerprint,
2733
+ sortedJoin$2(requirements),
2734
+ sortedJoin$2(criteria),
2735
+ sortedJoin$2(rules),
2736
+ sortedJoin$2(useCases),
2737
+ ].join('\u001e');
2738
+ let hash = 0x811c9dc5;
2739
+ for (let index = 0; index < payload.length; index += 1) {
2740
+ hash ^= payload.charCodeAt(index);
2741
+ hash = Math.imul(hash, 0x01000193);
2742
+ }
2743
+ return `behavior-${(hash >>> 0).toString(16).padStart(8, '0')}-${payload.length}`;
2744
+ }
2745
+ //#endregion
2746
+ //#region ----- Report -----
2747
+ const REPORT_COPY$2 = {
2748
+ heading: { en: 'Behavior Specification', fa: 'مشخصات رفتار' },
2749
+ subtitle: {
2750
+ en: 'Concrete requirements, acceptance criteria, and traced business rules or use cases for the pinned scope.',
2751
+ fa: 'نیازمندی‌های مشخص، معیارهای پذیرش، و قوانین کسب‌وکار یا موارد کاربرد ردیابی‌شده برای محدوده تأییدشده.',
2752
+ },
2753
+ scopeVersion: { en: 'Scope version', fa: 'نسخهٔ محدوده' },
2754
+ pinned: { en: 'Pinned scope', fa: 'محدوده تأییدشده' },
2755
+ requirements: { en: 'Requirements', fa: 'نیازمندی‌ها' },
2756
+ criteria: { en: 'Acceptance Criteria', fa: 'معیارهای پذیرش' },
2757
+ rules: { en: 'Business Rules', fa: 'قوانین کسب‌وکار' },
2758
+ useCases: { en: 'Use Cases', fa: 'موارد کاربرد' },
2759
+ capability: { en: 'Capability', fa: 'قابلیت' },
2760
+ requirement: { en: 'Requirement', fa: 'نیازمندی' },
2761
+ statement: { en: 'Statement', fa: 'بیان' },
2762
+ given: { en: 'Given', fa: 'با فرض' },
2763
+ when: { en: 'When', fa: 'وقتی' },
2764
+ then: { en: 'Then', fa: 'آنگاه' },
2765
+ flow: { en: 'Main flow', fa: 'جریان اصلی' },
2766
+ fingerprint: { en: 'Fingerprint', fa: 'اثرانگشت' },
2767
+ };
2768
+ function pairLabel$2(copy, lang) {
2769
+ return sheetBilingual(copy.en, copy.fa, lang);
2770
+ }
2771
+ function labeled$2(copy, value, lang) {
2772
+ return `${pairLabel$2(copy, lang)}: ${value}`;
2773
+ }
2774
+ function escapeHtml$2(value) {
2775
+ return value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
2776
+ }
2777
+ function behaviorDocumentHeading(locale) {
2778
+ return sheetHeading(REPORT_COPY$2.heading.en, REPORT_COPY$2.heading.fa, locale);
2779
+ }
2780
+ function buildBehaviorDocument(source, locale) {
2781
+ const lang = resolveSheetLang(locale);
2782
+ const displayLocale = lang === 'both' ? undefined : sheetDisplayLocale(locale);
2783
+ const fingerprint = behaviorDocumentFingerprint(source);
2784
+ const unknown = sheetUnknown(lang);
2785
+ const heading = pairLabel$2(REPORT_COPY$2.heading, lang);
2786
+ const scopeBody = source.scopePlainText || unknown;
2787
+ const lines = [
2788
+ heading,
2789
+ labeled$2(REPORT_COPY$2.scopeVersion, source.scopeVersionId, lang),
2790
+ pairLabel$2(REPORT_COPY$2.subtitle, lang),
2791
+ '',
2792
+ pairLabel$2(REPORT_COPY$2.pinned, lang),
2793
+ scopeBody,
2794
+ ];
2795
+ const blocks = [];
2796
+ const pushSection = (copy, body) => {
2797
+ lines.push('', pairLabel$2(copy, lang), body);
2798
+ blocks.push(`<section><h2>${escapeHtml$2(pairLabel$2(copy, lang))}</h2><p>${escapeHtml$2(body).replace(/\n/g, '<br>')}</p></section>`);
2799
+ };
2800
+ for (const item of source.requirements) {
2801
+ const title = introductionValueText(item.title, displayLocale) || unknown;
2802
+ const statement = introductionValueText(item.statement, displayLocale) || unknown;
2803
+ pushSection(REPORT_COPY$2.requirements, `${title}\n${labeled$2(REPORT_COPY$2.statement, statement, lang)}\n${labeled$2(REPORT_COPY$2.capability, kickoffText(item.scopeItemId) || unknown, lang)}`);
2804
+ }
2805
+ for (const item of source.acceptanceCriteria) {
2806
+ const statement = introductionValueText(item.statement, displayLocale) || unknown;
2807
+ const given = introductionValueText(item.given, displayLocale);
2808
+ const when = introductionValueText(item.when, displayLocale);
2809
+ const then = introductionValueText(item.then, displayLocale);
2810
+ const gwt = [given, when, then].filter(Boolean).join('\n');
2811
+ pushSection(REPORT_COPY$2.criteria, `${labeled$2(REPORT_COPY$2.requirement, kickoffText(item.requirementId) || unknown, lang)}\n${labeled$2(REPORT_COPY$2.statement, statement, lang)}${gwt ? `\n${gwt}` : ''}`);
2812
+ }
2813
+ for (const item of source.businessRules) {
2814
+ const title = introductionValueText(item.title, displayLocale) || unknown;
2815
+ const statement = introductionValueText(item.statement, displayLocale) || unknown;
2816
+ pushSection(REPORT_COPY$2.rules, `${title}\n${labeled$2(REPORT_COPY$2.statement, statement, lang)}`);
2817
+ }
2818
+ for (const item of source.useCases) {
2819
+ const title = introductionValueText(item.title, displayLocale) || unknown;
2820
+ const flow = introductionValueText(item.mainFlow, displayLocale) || unknown;
2821
+ pushSection(REPORT_COPY$2.useCases, `${title}\n${labeled$2(REPORT_COPY$2.flow, flow, lang)}`);
2822
+ }
2823
+ lines.push('', labeled$2(REPORT_COPY$2.fingerprint, fingerprint, lang));
2824
+ const plainText = lines.join('\n');
2825
+ const html = wrapSheetHtml(heading, [
2826
+ `<h1>${escapeHtml$2(heading)}</h1>`,
2827
+ `<p class="certainty">${escapeHtml$2(labeled$2(REPORT_COPY$2.scopeVersion, source.scopeVersionId, lang))}</p>`,
2828
+ `<p>${escapeHtml$2(pairLabel$2(REPORT_COPY$2.subtitle, lang))}</p>`,
2829
+ '<section>',
2830
+ `<h2>${escapeHtml$2(pairLabel$2(REPORT_COPY$2.pinned, lang))}</h2>`,
2831
+ `<p>${escapeHtml$2(scopeBody).replace(/\n/g, '<br>')}</p>`,
2832
+ '</section>',
2833
+ ...blocks,
2834
+ `<p class="certainty">${escapeHtml$2(labeled$2(REPORT_COPY$2.fingerprint, fingerprint, lang))}</p>`,
2835
+ ].join(''), lang);
2836
+ return { fingerprint, html, plainText };
2837
+ }
2838
+ //#endregion
2839
+ //#region ----- Exit gate -----
2840
+ function evaluateBehaviorExit(input) {
2841
+ const stay = (message, behaviorVersionId = '') => ({
2842
+ ok: false,
2843
+ advance: false,
2844
+ message,
2845
+ behaviorVersionId,
2846
+ });
2847
+ const phase = kickoffText(input.currentPhase);
2848
+ const approvedVersionId = kickoffText(input.approvedVersionId);
2849
+ const fingerprint = kickoffText(input.reportFingerprint);
2850
+ const approvedFingerprint = kickoffText(input.approvedFingerprint);
2851
+ const hostVersionId = kickoffText(input.hostVersionId);
2852
+ const statusId = kickoffText(input.statusId);
2853
+ if (phase && phase !== 'behavior-specification' && phase !== 'first-version-scope' && phase !== 'discovery' && phase !== 'introduction') {
2854
+ return { ok: true, advance: false, message: '', behaviorVersionId: approvedVersionId };
2855
+ }
2856
+ const hasKickoffCheck = input.kickoffApprovedVersionId !== undefined ||
2857
+ input.kickoffApprovedFingerprint !== undefined ||
2858
+ input.currentKickoffFingerprint !== undefined ||
2859
+ input.kickoffStatusId !== undefined ||
2860
+ input.kickoffHostVersionId !== undefined;
2861
+ if (hasKickoffCheck) {
2862
+ const kickoffPin = evaluateKickoffUpstreamPin({
2863
+ pinVersionId: input.kickoffApprovedVersionId,
2864
+ pinFingerprint: input.kickoffApprovedFingerprint,
2865
+ currentFingerprint: input.currentKickoffFingerprint,
2866
+ statusId: input.kickoffStatusId,
2867
+ hostVersionId: input.kickoffHostVersionId,
2868
+ });
2869
+ if (kickoffPin) {
2870
+ return stay(kickoffPin);
2871
+ }
2872
+ }
2873
+ const hasDiscoveryCheck = input.discoveryApprovedVersionId !== undefined ||
2874
+ input.discoveryApprovedFingerprint !== undefined ||
2875
+ input.currentDiscoveryFingerprint !== undefined ||
2876
+ input.discoveryStatusId !== undefined ||
2877
+ input.discoveryHostVersionId !== undefined;
2878
+ if (hasDiscoveryCheck) {
2879
+ const discoveryPin = evaluateDiscoveryUpstreamPin({
2880
+ pinVersionId: input.discoveryApprovedVersionId,
2881
+ pinFingerprint: input.discoveryApprovedFingerprint,
2882
+ currentFingerprint: input.currentDiscoveryFingerprint,
2883
+ statusId: input.discoveryStatusId,
2884
+ hostVersionId: input.discoveryHostVersionId,
2885
+ });
2886
+ if (discoveryPin) {
2887
+ return stay(discoveryPin);
2888
+ }
2889
+ }
2890
+ const scopePin = evaluateScopeUpstreamPin({
2891
+ pinVersionId: input.scopeApprovedVersionId,
2892
+ pinFingerprint: input.scopeApprovedFingerprint,
2893
+ currentFingerprint: input.currentScopeFingerprint,
2894
+ statusId: input.scopeStatusId,
2895
+ hostVersionId: input.scopeHostVersionId,
2896
+ });
2897
+ if (scopePin) {
2898
+ return stay(scopePin);
2899
+ }
2900
+ if (!approvedVersionId || statusId !== 'approved' || hostVersionId !== approvedVersionId) {
2901
+ return stay(BEHAVIOR_EXIT_MESSAGE.missingApproved);
2902
+ }
2903
+ if (!fingerprint || approvedFingerprint !== fingerprint) {
2904
+ return stay(BEHAVIOR_EXIT_MESSAGE.stale, approvedVersionId);
2905
+ }
2906
+ const capabilities = (input.items ?? []).filter(capabilitySupportsScope);
2907
+ const requirements = input.requirements ?? [];
2908
+ if (!requirements.some((item) => requirementSupportsBehavior(item, capabilities))) {
2909
+ return stay(BEHAVIOR_EXIT_MESSAGE.requirement, approvedVersionId);
2910
+ }
2911
+ const requirementIds = new Set(requirements
2912
+ .filter((item) => requirementSupportsBehavior(item, capabilities))
2913
+ .map((item) => kickoffText(item.id))
2914
+ .filter(Boolean));
2915
+ if (!(input.acceptanceCriteria ?? []).some((item) => acceptanceCriterionSupportsBehavior(item, requirementIds))) {
2916
+ return stay(BEHAVIOR_EXIT_MESSAGE.acceptance, approvedVersionId);
2917
+ }
2918
+ const hasRule = (input.businessRules ?? []).some((item) => businessRuleSupportsBehavior(item, requirementIds, capabilities));
2919
+ const hasUseCase = (input.useCases ?? []).some((item) => useCaseSupportsBehavior(item, requirementIds, capabilities));
2920
+ if (!hasRule && !hasUseCase) {
2921
+ return stay(BEHAVIOR_EXIT_MESSAGE.trace, approvedVersionId);
2922
+ }
2923
+ return {
2924
+ ok: true,
2925
+ advance: true,
2926
+ message: '',
2927
+ behaviorVersionId: approvedVersionId,
2928
+ };
2929
+ }
2930
+ //#endregion
2931
+
2932
+ //#region ----- Imports -----
2933
+ //#endregion
2934
+ //#region ----- Constants -----
2935
+ const DESIGN_DOCUMENT_TYPE_NAME = 'software-design';
2936
+ const DESIGN_DOCUMENT_FILE_NAME = 'design.pdf';
2937
+ const DESIGN_DOCUMENT_LEGACY_HTML_FILE_NAME = 'design.html';
2938
+ const DESIGN_CONTENT_CHANGED = 'design-content-changed';
2939
+ const DESIGN_SOURCE_CHANGED = 'behavior-approved-version-changed';
2940
+ const DESIGN_EXIT_MESSAGE = {
2941
+ missingApproved: 'Design needs an approved design document before Delivery planning can start.',
2942
+ stale: 'Design decisions changed after approval. The approved document was not changed. Generate and approve a new document.',
2943
+ dataModel: 'Design needs at least one data-model decision with a title, decision body, context, and alternatives.',
2944
+ ux: 'Design needs at least one UX decision with a title, decision body, context, and alternatives.',
2945
+ technical: 'Design needs at least one technical decision with a title, decision body, context, alternatives, and a technology choice.',
2946
+ requirement: 'Design needs at least one decision linked to a behavior requirement.',
2947
+ };
2948
+ //#endregion
2949
+ //#region ----- Quality -----
2950
+ function sortedJoin$1(parts) {
2951
+ return [...parts].sort().join('\u001e');
2952
+ }
2953
+ function recordKey(parts) {
2954
+ return parts.map((part) => kickoffText(part)).join('\u001f');
2955
+ }
2956
+ function hasCoreDecision(item) {
2957
+ return Boolean(kickoffText(item.title) && kickoffText(item.body) && kickoffText(item.context) && kickoffText(item.alternatives));
2958
+ }
2959
+ function designDecisionSupportsDataModel(item) {
2960
+ return kickoffText(item.kind) === 'data-model' && hasCoreDecision(item);
2961
+ }
2962
+ function designDecisionSupportsUx(item) {
2963
+ return kickoffText(item.kind) === 'ux' && hasCoreDecision(item);
2964
+ }
2965
+ function designDecisionSupportsTechnical(item) {
2966
+ return kickoffText(item.kind) === 'technical' && hasCoreDecision(item) && Boolean(kickoffText(item.technology));
2967
+ }
2968
+ function designDecisionLinksRequirement(item, requirementIds) {
2969
+ const requirementId = kickoffText(item.requirementId);
2970
+ return Boolean(requirementId && requirementIds.has(requirementId));
2971
+ }
2972
+ function designDocumentFingerprint(source) {
2973
+ const decisions = source.decisions.map((item) => recordKey([
2974
+ item.id,
2975
+ item.kind,
2976
+ item.adrStatus,
2977
+ item.title,
2978
+ item.context,
2979
+ item.body,
2980
+ item.alternatives,
2981
+ item.consequences,
2982
+ item.technology,
2983
+ item.requirementId,
2984
+ item.useCaseId,
2985
+ item.behaviorVersionId,
2986
+ ]));
2987
+ const payload = [source.behaviorVersionId, source.behaviorFingerprint, sortedJoin$1(decisions)].join('\u001e');
2988
+ let hash = 0x811c9dc5;
2989
+ for (let index = 0; index < payload.length; index += 1) {
2990
+ hash ^= payload.charCodeAt(index);
2991
+ hash = Math.imul(hash, 0x01000193);
2992
+ }
2993
+ return `design-${(hash >>> 0).toString(16).padStart(8, '0')}-${payload.length}`;
2994
+ }
2995
+ //#endregion
2996
+ //#region ----- Report -----
2997
+ const REPORT_COPY$1 = {
2998
+ heading: { en: 'Design', fa: 'طراحی' },
2999
+ subtitle: {
3000
+ en: 'Key components, data flow, and decisions with alternatives, linked to the pinned behavior specification.',
3001
+ fa: 'اجزای کلیدی، جریان داده، و تصمیم‌ها همراه با گزینه‌های جایگزین، متصل به مشخصات رفتار تأییدشده.',
3002
+ },
3003
+ behaviorVersion: { en: 'Behavior version', fa: 'نسخهٔ رفتار' },
3004
+ pinned: { en: 'Pinned behavior', fa: 'رفتار تأییدشده' },
3005
+ dataModel: { en: 'Data Model', fa: 'مدل داده' },
3006
+ ux: { en: 'UX', fa: 'تجربه کاربری' },
3007
+ technical: { en: 'Technical', fa: 'فنی' },
3008
+ other: { en: 'Decisions', fa: 'تصمیم‌ها' },
3009
+ context: { en: 'Context', fa: 'زمینه' },
3010
+ decision: { en: 'Decision', fa: 'تصمیم' },
3011
+ alternatives: { en: 'Alternatives', fa: 'گزینه‌های جایگزین' },
3012
+ consequences: { en: 'Consequences', fa: 'پیامدها' },
3013
+ technology: { en: 'Technology', fa: 'فناوری' },
3014
+ requirement: { en: 'Requirement', fa: 'نیازمندی' },
3015
+ fingerprint: { en: 'Fingerprint', fa: 'اثرانگشت' },
3016
+ };
3017
+ function pairLabel$1(copy, lang) {
3018
+ return sheetBilingual(copy.en, copy.fa, lang);
3019
+ }
3020
+ function labeled$1(copy, value, lang) {
3021
+ return `${pairLabel$1(copy, lang)}: ${value}`;
3022
+ }
3023
+ function escapeHtml$1(value) {
3024
+ return value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
3025
+ }
3026
+ function kindCopy(kind) {
3027
+ if (kind === 'data-model') {
3028
+ return REPORT_COPY$1.dataModel;
3029
+ }
3030
+ if (kind === 'ux') {
3031
+ return REPORT_COPY$1.ux;
3032
+ }
3033
+ if (kind === 'technical') {
3034
+ return REPORT_COPY$1.technical;
3035
+ }
3036
+ return REPORT_COPY$1.other;
3037
+ }
3038
+ function designDocumentHeading(locale) {
3039
+ return sheetHeading(REPORT_COPY$1.heading.en, REPORT_COPY$1.heading.fa, locale);
3040
+ }
3041
+ function buildDesignDocument(source, locale) {
3042
+ const lang = resolveSheetLang(locale);
3043
+ const displayLocale = lang === 'both' ? undefined : sheetDisplayLocale(locale);
3044
+ const fingerprint = designDocumentFingerprint(source);
3045
+ const unknown = sheetUnknown(lang);
3046
+ const heading = pairLabel$1(REPORT_COPY$1.heading, lang);
3047
+ const behaviorBody = source.behaviorPlainText || unknown;
3048
+ const lines = [
3049
+ heading,
3050
+ labeled$1(REPORT_COPY$1.behaviorVersion, source.behaviorVersionId, lang),
3051
+ pairLabel$1(REPORT_COPY$1.subtitle, lang),
3052
+ '',
3053
+ pairLabel$1(REPORT_COPY$1.pinned, lang),
3054
+ behaviorBody,
3055
+ ];
3056
+ const blocks = [];
3057
+ const pushSection = (copy, body) => {
3058
+ lines.push('', pairLabel$1(copy, lang), body);
3059
+ blocks.push(`<section><h2>${escapeHtml$1(pairLabel$1(copy, lang))}</h2><p>${escapeHtml$1(body).replace(/\n/g, '<br>')}</p></section>`);
3060
+ };
3061
+ for (const item of source.decisions) {
3062
+ const title = introductionValueText(item.title, displayLocale) || unknown;
3063
+ const context = introductionValueText(item.context, displayLocale) || unknown;
3064
+ const body = introductionValueText(item.body, displayLocale) || unknown;
3065
+ const alternatives = introductionValueText(item.alternatives, displayLocale) || unknown;
3066
+ const consequences = introductionValueText(item.consequences, displayLocale);
3067
+ const technology = introductionValueText(item.technology, displayLocale);
3068
+ const requirementId = kickoffText(item.requirementId) || unknown;
3069
+ const parts = [
3070
+ title,
3071
+ labeled$1(REPORT_COPY$1.context, context, lang),
3072
+ labeled$1(REPORT_COPY$1.decision, body, lang),
3073
+ labeled$1(REPORT_COPY$1.alternatives, alternatives, lang),
3074
+ ];
3075
+ if (consequences) {
3076
+ parts.push(labeled$1(REPORT_COPY$1.consequences, consequences, lang));
3077
+ }
3078
+ if (technology) {
3079
+ parts.push(labeled$1(REPORT_COPY$1.technology, technology, lang));
3080
+ }
3081
+ parts.push(labeled$1(REPORT_COPY$1.requirement, requirementId, lang));
3082
+ pushSection(kindCopy(kickoffText(item.kind)), parts.join('\n'));
3083
+ }
3084
+ lines.push('', labeled$1(REPORT_COPY$1.fingerprint, fingerprint, lang));
3085
+ const plainText = lines.join('\n');
3086
+ const html = wrapSheetHtml(heading, [
3087
+ `<h1>${escapeHtml$1(heading)}</h1>`,
3088
+ `<p class="certainty">${escapeHtml$1(labeled$1(REPORT_COPY$1.behaviorVersion, source.behaviorVersionId, lang))}</p>`,
3089
+ `<p>${escapeHtml$1(pairLabel$1(REPORT_COPY$1.subtitle, lang))}</p>`,
3090
+ '<section>',
3091
+ `<h2>${escapeHtml$1(pairLabel$1(REPORT_COPY$1.pinned, lang))}</h2>`,
3092
+ `<p>${escapeHtml$1(behaviorBody).replace(/\n/g, '<br>')}</p>`,
3093
+ '</section>',
3094
+ ...blocks,
3095
+ `<p class="certainty">${escapeHtml$1(labeled$1(REPORT_COPY$1.fingerprint, fingerprint, lang))}</p>`,
3096
+ ].join(''), lang);
3097
+ return { fingerprint, html, plainText };
3098
+ }
3099
+ //#endregion
3100
+ //#region ----- Exit gate -----
3101
+ function evaluateDesignExit(input) {
3102
+ const stay = (message, designVersionId = '') => ({
3103
+ ok: false,
3104
+ advance: false,
3105
+ message,
3106
+ designVersionId,
3107
+ });
3108
+ const phase = kickoffText(input.currentPhase);
3109
+ const approvedVersionId = kickoffText(input.approvedVersionId);
3110
+ const fingerprint = kickoffText(input.reportFingerprint);
3111
+ const approvedFingerprint = kickoffText(input.approvedFingerprint);
3112
+ const hostVersionId = kickoffText(input.hostVersionId);
3113
+ const statusId = kickoffText(input.statusId);
3114
+ if (phase &&
3115
+ phase !== 'design' &&
3116
+ phase !== 'behavior-specification' &&
3117
+ phase !== 'first-version-scope' &&
3118
+ phase !== 'discovery' &&
3119
+ phase !== 'introduction') {
3120
+ return { ok: true, advance: false, message: '', designVersionId: approvedVersionId };
3121
+ }
3122
+ const hasKickoffCheck = input.kickoffApprovedVersionId !== undefined ||
3123
+ input.kickoffApprovedFingerprint !== undefined ||
3124
+ input.currentKickoffFingerprint !== undefined ||
3125
+ input.kickoffStatusId !== undefined ||
3126
+ input.kickoffHostVersionId !== undefined;
3127
+ if (hasKickoffCheck) {
3128
+ const kickoffPin = evaluateKickoffUpstreamPin({
3129
+ pinVersionId: input.kickoffApprovedVersionId,
3130
+ pinFingerprint: input.kickoffApprovedFingerprint,
3131
+ currentFingerprint: input.currentKickoffFingerprint,
3132
+ statusId: input.kickoffStatusId,
3133
+ hostVersionId: input.kickoffHostVersionId,
3134
+ });
3135
+ if (kickoffPin) {
3136
+ return stay(kickoffPin);
3137
+ }
3138
+ }
3139
+ const hasDiscoveryCheck = input.discoveryApprovedVersionId !== undefined ||
3140
+ input.discoveryApprovedFingerprint !== undefined ||
3141
+ input.currentDiscoveryFingerprint !== undefined ||
3142
+ input.discoveryStatusId !== undefined ||
3143
+ input.discoveryHostVersionId !== undefined;
3144
+ if (hasDiscoveryCheck) {
3145
+ const discoveryPin = evaluateDiscoveryUpstreamPin({
3146
+ pinVersionId: input.discoveryApprovedVersionId,
3147
+ pinFingerprint: input.discoveryApprovedFingerprint,
3148
+ currentFingerprint: input.currentDiscoveryFingerprint,
3149
+ statusId: input.discoveryStatusId,
3150
+ hostVersionId: input.discoveryHostVersionId,
3151
+ });
3152
+ if (discoveryPin) {
3153
+ return stay(discoveryPin);
3154
+ }
3155
+ }
3156
+ const hasScopeCheck = input.scopeApprovedVersionId !== undefined ||
3157
+ input.scopeApprovedFingerprint !== undefined ||
3158
+ input.currentScopeFingerprint !== undefined ||
3159
+ input.scopeStatusId !== undefined ||
3160
+ input.scopeHostVersionId !== undefined;
3161
+ if (hasScopeCheck) {
3162
+ const scopePin = evaluateScopeUpstreamPin({
3163
+ pinVersionId: input.scopeApprovedVersionId,
3164
+ pinFingerprint: input.scopeApprovedFingerprint,
3165
+ currentFingerprint: input.currentScopeFingerprint,
3166
+ statusId: input.scopeStatusId,
3167
+ hostVersionId: input.scopeHostVersionId,
3168
+ });
3169
+ if (scopePin) {
3170
+ return stay(scopePin);
3171
+ }
3172
+ }
3173
+ const behaviorPin = evaluateBehaviorUpstreamPin({
3174
+ pinVersionId: input.behaviorApprovedVersionId,
3175
+ pinFingerprint: input.behaviorApprovedFingerprint,
3176
+ currentFingerprint: input.currentBehaviorFingerprint,
3177
+ statusId: input.behaviorStatusId,
3178
+ hostVersionId: input.behaviorHostVersionId,
3179
+ });
3180
+ if (behaviorPin) {
3181
+ return stay(behaviorPin);
3182
+ }
3183
+ if (!approvedVersionId || statusId !== 'approved' || hostVersionId !== approvedVersionId) {
3184
+ return stay(DESIGN_EXIT_MESSAGE.missingApproved);
3185
+ }
3186
+ if (!fingerprint || approvedFingerprint !== fingerprint) {
3187
+ return stay(DESIGN_EXIT_MESSAGE.stale, approvedVersionId);
3188
+ }
3189
+ const decisions = input.decisions ?? [];
3190
+ if (!decisions.some(designDecisionSupportsDataModel)) {
3191
+ return stay(DESIGN_EXIT_MESSAGE.dataModel, approvedVersionId);
3192
+ }
3193
+ if (!decisions.some(designDecisionSupportsUx)) {
3194
+ return stay(DESIGN_EXIT_MESSAGE.ux, approvedVersionId);
3195
+ }
3196
+ if (!decisions.some(designDecisionSupportsTechnical)) {
3197
+ return stay(DESIGN_EXIT_MESSAGE.technical, approvedVersionId);
3198
+ }
3199
+ const requirementIds = new Set((input.requirements ?? []).map((item) => kickoffText(item.id)).filter(Boolean));
3200
+ if (!decisions.some((item) => designDecisionLinksRequirement(item, requirementIds))) {
3201
+ return stay(DESIGN_EXIT_MESSAGE.requirement, approvedVersionId);
3202
+ }
3203
+ return {
3204
+ ok: true,
3205
+ advance: true,
3206
+ message: '',
3207
+ designVersionId: approvedVersionId,
3208
+ };
3209
+ }
3210
+ //#endregion
3211
+
3212
+ //#region ----- Imports -----
3213
+ //#endregion
3214
+ //#region ----- Constants -----
3215
+ const DELIVERY_DOCUMENT_TYPE_NAME = 'software-delivery-plan';
3216
+ const DELIVERY_DOCUMENT_FILE_NAME = 'delivery-plan.pdf';
3217
+ const DELIVERY_DOCUMENT_LEGACY_HTML_FILE_NAME = 'delivery-plan.html';
3218
+ const DELIVERY_CONTENT_CHANGED = 'delivery-content-changed';
3219
+ const DELIVERY_SOURCE_CHANGED = 'design-approved-version-changed';
3220
+ const DELIVERY_PLAN_FIELDS = [
3221
+ 'deliveryWorkPackages',
3222
+ 'deliveryMilestones',
3223
+ 'deliveryEstimateAssumptions',
3224
+ 'deliveryVerificationCriteria',
3225
+ 'deliveryReleaseCriteria',
3226
+ 'deliveryRisks',
3227
+ 'deliveryTracedRequirementId',
3228
+ 'deliveryTracedDesignDecisionId',
3229
+ ];
3230
+ const DELIVERY_EXIT_MESSAGE = {
3231
+ missingApproved: 'Delivery planning needs an approved delivery plan before the software definition can complete.',
3232
+ stale: 'Delivery plan content changed after approval. The approved document was not changed. Generate and approve a new document.',
3233
+ workPackages: 'Delivery planning needs work packages with order, dependencies, and responsible roles.',
3234
+ milestones: 'Delivery planning needs at least one milestone with a sequence or dependency.',
3235
+ estimates: 'Delivery planning needs the estimate assumptions that the plan relies on.',
3236
+ verification: 'Delivery planning needs verification criteria for the planned work.',
3237
+ release: 'Delivery planning needs release or readiness criteria.',
3238
+ risks: 'Delivery planning needs at least one material risk.',
3239
+ requirement: 'Delivery planning needs a work package traced to a behavior requirement.',
3240
+ designDecision: 'Delivery planning needs a work package traced to an approved design decision.',
3241
+ };
3242
+ //#endregion
3243
+ //#region ----- Quality -----
3244
+ function sortedJoin(parts) {
3245
+ return [...parts].sort().join('\u001e');
3246
+ }
3247
+ function deliveryPlanHasText(value) {
3248
+ return Boolean(kickoffText(value));
3249
+ }
3250
+ function deliveryPlanFingerprint(source) {
3251
+ const payload = sortedJoin([
3252
+ source.designVersionId,
3253
+ source.designFingerprint,
3254
+ kickoffText(source.workPackages),
3255
+ kickoffText(source.milestones),
3256
+ kickoffText(source.estimateAssumptions),
3257
+ kickoffText(source.verificationCriteria),
3258
+ kickoffText(source.releaseCriteria),
3259
+ kickoffText(source.risks),
3260
+ kickoffText(source.tracedRequirementId),
3261
+ kickoffText(source.tracedDesignDecisionId),
3262
+ kickoffText(source.projectId),
3263
+ ]);
3264
+ let hash = 0x811c9dc5;
3265
+ for (let index = 0; index < payload.length; index += 1) {
3266
+ hash ^= payload.charCodeAt(index);
3267
+ hash = Math.imul(hash, 0x01000193);
3268
+ }
3269
+ return `delivery-${(hash >>> 0).toString(16).padStart(8, '0')}-${payload.length}`;
3270
+ }
3271
+ function deliveryPlanFromSoftware(software) {
3272
+ return {
3273
+ workPackages: software?.['deliveryWorkPackages'],
3274
+ milestones: software?.['deliveryMilestones'],
3275
+ estimateAssumptions: software?.['deliveryEstimateAssumptions'],
3276
+ verificationCriteria: software?.['deliveryVerificationCriteria'],
3277
+ releaseCriteria: software?.['deliveryReleaseCriteria'],
3278
+ risks: software?.['deliveryRisks'],
3279
+ tracedRequirementId: software?.['deliveryTracedRequirementId'],
3280
+ tracedDesignDecisionId: software?.['deliveryTracedDesignDecisionId'],
3281
+ projectId: software?.['projectId'],
3282
+ };
3283
+ }
3284
+ //#endregion
3285
+ //#region ----- Report -----
3286
+ const REPORT_COPY = {
3287
+ heading: { en: 'Delivery Plan', fa: 'برنامه تحویل' },
3288
+ subtitle: {
3289
+ en: 'Work packages, milestones, estimate assumptions, verification and release criteria, and material risks, linked to the pinned design.',
3290
+ fa: 'بسته‌های کاری، نقاط عطف، فرض‌های برآورد، معیارهای راستی‌آزمایی و آمادگی انتشار، و ریسک‌های مهم، متصل به طراحی تأییدشده.',
3291
+ },
3292
+ designVersion: { en: 'Design version', fa: 'نسخهٔ طراحی' },
3293
+ pinned: { en: 'Pinned design', fa: 'طراحی تأییدشده' },
3294
+ workPackages: { en: 'Work Packages', fa: 'بسته‌های کاری' },
3295
+ milestones: { en: 'Milestones', fa: 'نقاط عطف' },
3296
+ estimates: { en: 'Estimate Assumptions', fa: 'فرض‌های برآورد' },
3297
+ verification: { en: 'Verification Criteria', fa: 'معیارهای راستی‌آزمایی' },
3298
+ release: { en: 'Release / Readiness Criteria', fa: 'معیارهای آمادگی انتشار' },
3299
+ risks: { en: 'Material Risks', fa: 'ریسک‌های مهم' },
3300
+ requirement: { en: 'Traced requirement', fa: 'نیازمندی مرتبط' },
3301
+ designDecision: { en: 'Traced design decision', fa: 'تصمیم طراحی مرتبط' },
3302
+ project: { en: 'Linked project', fa: 'پروژهٔ متصل' },
3303
+ fingerprint: { en: 'Fingerprint', fa: 'اثرانگشت' },
3304
+ };
3305
+ function pairLabel(copy, lang) {
3306
+ return sheetBilingual(copy.en, copy.fa, lang);
3307
+ }
3308
+ function labeled(copy, value, lang) {
3309
+ return `${pairLabel(copy, lang)}: ${value}`;
3310
+ }
3311
+ function escapeHtml(value) {
3312
+ return value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
3313
+ }
3314
+ function deliveryPlanHeading(locale) {
3315
+ return sheetHeading(REPORT_COPY.heading.en, REPORT_COPY.heading.fa, locale);
3316
+ }
3317
+ function buildDeliveryPlan(source, locale) {
3318
+ const lang = resolveSheetLang(locale);
3319
+ const displayLocale = lang === 'both' ? undefined : sheetDisplayLocale(locale);
3320
+ const fingerprint = deliveryPlanFingerprint(source);
3321
+ const unknown = sheetUnknown(lang);
3322
+ const heading = pairLabel(REPORT_COPY.heading, lang);
3323
+ const designBody = source.designPlainText || unknown;
3324
+ const workPackages = introductionValueText(source.workPackages, displayLocale) || unknown;
3325
+ const milestones = introductionValueText(source.milestones, displayLocale) || unknown;
3326
+ const estimates = introductionValueText(source.estimateAssumptions, displayLocale) || unknown;
3327
+ const verification = introductionValueText(source.verificationCriteria, displayLocale) || unknown;
3328
+ const release = introductionValueText(source.releaseCriteria, displayLocale) || unknown;
3329
+ const risks = introductionValueText(source.risks, displayLocale) || unknown;
3330
+ const requirementId = kickoffText(source.tracedRequirementId) || unknown;
3331
+ const designDecisionId = kickoffText(source.tracedDesignDecisionId) || unknown;
3332
+ const projectId = kickoffText(source.projectId);
3333
+ const lines = [
3334
+ heading,
3335
+ labeled(REPORT_COPY.designVersion, source.designVersionId, lang),
3336
+ pairLabel(REPORT_COPY.subtitle, lang),
3337
+ '',
3338
+ pairLabel(REPORT_COPY.pinned, lang),
3339
+ designBody,
3340
+ ];
3341
+ const blocks = [];
3342
+ const pushSection = (copy, body) => {
3343
+ lines.push('', pairLabel(copy, lang), body);
3344
+ blocks.push(`<section><h2>${escapeHtml(pairLabel(copy, lang))}</h2><p>${escapeHtml(body).replace(/\n/g, '<br>')}</p></section>`);
3345
+ };
3346
+ pushSection(REPORT_COPY.workPackages, workPackages);
3347
+ pushSection(REPORT_COPY.milestones, milestones);
3348
+ pushSection(REPORT_COPY.estimates, estimates);
3349
+ pushSection(REPORT_COPY.verification, verification);
3350
+ pushSection(REPORT_COPY.release, release);
3351
+ pushSection(REPORT_COPY.risks, risks);
3352
+ pushSection(REPORT_COPY.requirement, requirementId);
3353
+ pushSection(REPORT_COPY.designDecision, designDecisionId);
3354
+ if (projectId) {
3355
+ pushSection(REPORT_COPY.project, projectId);
3356
+ }
3357
+ lines.push('', labeled(REPORT_COPY.fingerprint, fingerprint, lang));
3358
+ const plainText = lines.join('\n');
3359
+ const html = wrapSheetHtml(heading, [
3360
+ `<h1>${escapeHtml(heading)}</h1>`,
3361
+ `<p class="certainty">${escapeHtml(labeled(REPORT_COPY.designVersion, source.designVersionId, lang))}</p>`,
3362
+ `<p>${escapeHtml(pairLabel(REPORT_COPY.subtitle, lang))}</p>`,
3363
+ '<section>',
3364
+ `<h2>${escapeHtml(pairLabel(REPORT_COPY.pinned, lang))}</h2>`,
3365
+ `<p>${escapeHtml(designBody).replace(/\n/g, '<br>')}</p>`,
3366
+ '</section>',
3367
+ ...blocks,
3368
+ `<p class="certainty">${escapeHtml(labeled(REPORT_COPY.fingerprint, fingerprint, lang))}</p>`,
3369
+ ].join(''), lang);
3370
+ return { fingerprint, html, plainText };
3371
+ }
3372
+ //#endregion
3373
+ //#region ----- Exit gate -----
3374
+ function evaluateDeliveryExit(input) {
3375
+ const stay = (message, deliveryVersionId = '') => ({
3376
+ ok: false,
3377
+ advance: false,
3378
+ alreadyComplete: false,
3379
+ message,
3380
+ deliveryVersionId,
3381
+ });
3382
+ const approvedVersionId = kickoffText(input.approvedVersionId);
3383
+ if (kickoffText(input.definitionCompletedAt)) {
3384
+ return {
3385
+ ok: true,
3386
+ advance: false,
3387
+ alreadyComplete: true,
3388
+ message: '',
3389
+ deliveryVersionId: approvedVersionId,
3390
+ };
3391
+ }
3392
+ const phase = kickoffText(input.currentPhase);
3393
+ if (phase && phase !== 'delivery-planning') {
3394
+ return stay(`Software must be in delivery-planning before this phase can complete.`);
3395
+ }
3396
+ const fingerprint = kickoffText(input.reportFingerprint);
3397
+ const approvedFingerprint = kickoffText(input.approvedFingerprint);
3398
+ const hostVersionId = kickoffText(input.hostVersionId);
3399
+ const statusId = kickoffText(input.statusId);
3400
+ const hasKickoffCheck = input.kickoffApprovedVersionId !== undefined ||
3401
+ input.kickoffApprovedFingerprint !== undefined ||
3402
+ input.currentKickoffFingerprint !== undefined ||
3403
+ input.kickoffStatusId !== undefined ||
3404
+ input.kickoffHostVersionId !== undefined;
3405
+ if (hasKickoffCheck) {
3406
+ const kickoffPin = evaluateKickoffUpstreamPin({
3407
+ pinVersionId: input.kickoffApprovedVersionId,
3408
+ pinFingerprint: input.kickoffApprovedFingerprint,
3409
+ currentFingerprint: input.currentKickoffFingerprint,
3410
+ statusId: input.kickoffStatusId,
3411
+ hostVersionId: input.kickoffHostVersionId,
3412
+ });
3413
+ if (kickoffPin) {
3414
+ return stay(kickoffPin);
3415
+ }
3416
+ }
3417
+ const hasDiscoveryCheck = input.discoveryApprovedVersionId !== undefined ||
3418
+ input.discoveryApprovedFingerprint !== undefined ||
3419
+ input.currentDiscoveryFingerprint !== undefined ||
3420
+ input.discoveryStatusId !== undefined ||
3421
+ input.discoveryHostVersionId !== undefined;
3422
+ if (hasDiscoveryCheck) {
3423
+ const discoveryPin = evaluateDiscoveryUpstreamPin({
3424
+ pinVersionId: input.discoveryApprovedVersionId,
3425
+ pinFingerprint: input.discoveryApprovedFingerprint,
3426
+ currentFingerprint: input.currentDiscoveryFingerprint,
3427
+ statusId: input.discoveryStatusId,
3428
+ hostVersionId: input.discoveryHostVersionId,
3429
+ });
3430
+ if (discoveryPin) {
3431
+ return stay(discoveryPin);
3432
+ }
3433
+ }
3434
+ const hasScopeCheck = input.scopeApprovedVersionId !== undefined ||
3435
+ input.scopeApprovedFingerprint !== undefined ||
3436
+ input.currentScopeFingerprint !== undefined ||
3437
+ input.scopeStatusId !== undefined ||
3438
+ input.scopeHostVersionId !== undefined;
3439
+ if (hasScopeCheck) {
3440
+ const scopePin = evaluateScopeUpstreamPin({
3441
+ pinVersionId: input.scopeApprovedVersionId,
3442
+ pinFingerprint: input.scopeApprovedFingerprint,
3443
+ currentFingerprint: input.currentScopeFingerprint,
3444
+ statusId: input.scopeStatusId,
3445
+ hostVersionId: input.scopeHostVersionId,
3446
+ });
3447
+ if (scopePin) {
3448
+ return stay(scopePin);
3449
+ }
3450
+ }
3451
+ const hasBehaviorCheck = input.behaviorApprovedVersionId !== undefined ||
3452
+ input.behaviorApprovedFingerprint !== undefined ||
3453
+ input.currentBehaviorFingerprint !== undefined ||
3454
+ input.behaviorStatusId !== undefined ||
3455
+ input.behaviorHostVersionId !== undefined;
3456
+ if (hasBehaviorCheck) {
3457
+ const behaviorPin = evaluateBehaviorUpstreamPin({
3458
+ pinVersionId: input.behaviorApprovedVersionId,
3459
+ pinFingerprint: input.behaviorApprovedFingerprint,
3460
+ currentFingerprint: input.currentBehaviorFingerprint,
3461
+ statusId: input.behaviorStatusId,
3462
+ hostVersionId: input.behaviorHostVersionId,
3463
+ });
3464
+ if (behaviorPin) {
3465
+ return stay(behaviorPin);
3466
+ }
3467
+ }
3468
+ const designPin = evaluateDesignUpstreamPin({
3469
+ pinVersionId: input.designApprovedVersionId,
3470
+ pinFingerprint: input.designApprovedFingerprint,
3471
+ currentFingerprint: input.currentDesignFingerprint,
3472
+ statusId: input.designStatusId,
3473
+ hostVersionId: input.designHostVersionId,
3474
+ });
3475
+ if (designPin) {
3476
+ return stay(designPin);
3477
+ }
3478
+ if (!approvedVersionId || statusId !== 'approved' || hostVersionId !== approvedVersionId) {
3479
+ return stay(DELIVERY_EXIT_MESSAGE.missingApproved);
3480
+ }
3481
+ if (!fingerprint || approvedFingerprint !== fingerprint) {
3482
+ return stay(DELIVERY_EXIT_MESSAGE.stale, approvedVersionId);
3483
+ }
3484
+ if (!deliveryPlanHasText(input.workPackages)) {
3485
+ return stay(DELIVERY_EXIT_MESSAGE.workPackages, approvedVersionId);
3486
+ }
3487
+ if (!deliveryPlanHasText(input.milestones)) {
3488
+ return stay(DELIVERY_EXIT_MESSAGE.milestones, approvedVersionId);
3489
+ }
3490
+ if (!deliveryPlanHasText(input.estimateAssumptions)) {
3491
+ return stay(DELIVERY_EXIT_MESSAGE.estimates, approvedVersionId);
3492
+ }
3493
+ if (!deliveryPlanHasText(input.verificationCriteria)) {
3494
+ return stay(DELIVERY_EXIT_MESSAGE.verification, approvedVersionId);
3495
+ }
3496
+ if (!deliveryPlanHasText(input.releaseCriteria)) {
3497
+ return stay(DELIVERY_EXIT_MESSAGE.release, approvedVersionId);
3498
+ }
3499
+ if (!deliveryPlanHasText(input.risks)) {
3500
+ return stay(DELIVERY_EXIT_MESSAGE.risks, approvedVersionId);
3501
+ }
3502
+ const requirementId = kickoffText(input.tracedRequirementId);
3503
+ const requirementIds = new Set((input.requirements ?? []).map((item) => kickoffText(item.id)).filter(Boolean));
3504
+ if (!requirementId || (requirementIds.size > 0 && !requirementIds.has(requirementId))) {
3505
+ return stay(DELIVERY_EXIT_MESSAGE.requirement, approvedVersionId);
3506
+ }
3507
+ const designDecisionId = kickoffText(input.tracedDesignDecisionId);
3508
+ const decisionIds = new Set((input.decisions ?? []).map((item) => kickoffText(item.id)).filter(Boolean));
3509
+ if (!designDecisionId || (decisionIds.size > 0 && !decisionIds.has(designDecisionId))) {
3510
+ return stay(DELIVERY_EXIT_MESSAGE.designDecision, approvedVersionId);
3511
+ }
3512
+ return {
3513
+ ok: true,
3514
+ advance: true,
3515
+ alreadyComplete: false,
3516
+ message: '',
3517
+ deliveryVersionId: approvedVersionId,
3518
+ };
3519
+ }
3520
+ //#endregion
3521
+
3522
+ function textPresent(value) {
3523
+ return typeof value === 'string' && value.trim().length > 0;
3524
+ }
3525
+ function canCompleteIntroduction(software) {
3526
+ return missingIntroductionFields(software).length === 0;
3527
+ }
3528
+ function isIntroductionComplete(software) {
3529
+ if (software.introductionCompletedAt) {
3530
+ return true;
3531
+ }
3532
+ return isSoftwarePhaseAtLeast(String(software.currentPhase ?? ''), 'discovery');
3533
+ }
3534
+ function canLinkProject(software) {
3535
+ return isIntroductionComplete(software);
3536
+ }
3537
+ function canWriteDesignKind(software, kind) {
3538
+ if (kind === 'technical') {
3539
+ return isSoftwarePhaseAtLeast(String(software.currentPhase ?? ''), 'design');
3540
+ }
3541
+ return isSoftwarePhaseAtLeast(String(software.currentPhase ?? ''), 'behavior-specification');
3542
+ }
3543
+ const INTRODUCTION_UPSTREAM_FIELDS = [
3544
+ 'title',
3545
+ 'idea',
3546
+ 'initialProblem',
1157
3547
  'goal',
1158
3548
  'ownerId',
1159
3549
  'potentialUsers',
1160
3550
  'openQuestions',
1161
3551
  ];
1162
- function canCompletePhase(phase, software, kickoff, discovery) {
3552
+ /**
3553
+ * Complete Phase may load discovery while Software is already in first-version-scope.
3554
+ * Force the discovery evaluator's phase after the payload so currentPhase from the
3555
+ * activity cannot skip the discovery gate with { ok: true, advance: false }.
3556
+ */
3557
+ function evaluateDiscoveryExitForCompletePhase(discovery) {
3558
+ return evaluateDiscoveryExit({
3559
+ ...discovery,
3560
+ currentPhase: 'discovery',
3561
+ });
3562
+ }
3563
+ function evaluateScopeExitForCompletePhase(scope) {
3564
+ return evaluateScopeExit({
3565
+ ...scope,
3566
+ currentPhase: 'first-version-scope',
3567
+ });
3568
+ }
3569
+ function evaluateBehaviorExitForCompletePhase(behavior) {
3570
+ return evaluateBehaviorExit({
3571
+ ...behavior,
3572
+ currentPhase: 'behavior-specification',
3573
+ });
3574
+ }
3575
+ function evaluateDesignExitForCompletePhase(design) {
3576
+ return evaluateDesignExit({
3577
+ ...design,
3578
+ currentPhase: 'design',
3579
+ });
3580
+ }
3581
+ function evaluateDeliveryExitForCompletePhase(delivery) {
3582
+ return evaluateDeliveryExit({
3583
+ ...delivery,
3584
+ currentPhase: 'delivery-planning',
3585
+ });
3586
+ }
3587
+ function canCompletePhase(phase, software, kickoff, discovery, scope, behavior, design, delivery) {
3588
+ if ((phase === 'discovery' ||
3589
+ phase === 'first-version-scope' ||
3590
+ phase === 'behavior-specification' ||
3591
+ phase === 'design' ||
3592
+ phase === 'delivery-planning') &&
3593
+ kickoff) {
3594
+ const intro = evaluateIntroductionExit(software, kickoff);
3595
+ if (!intro.ok) {
3596
+ return { ok: false, message: intro.message, missingFields: intro.missingFields };
3597
+ }
3598
+ }
1163
3599
  if (phase === 'discovery') {
1164
- const decision = evaluateDiscoveryExit({
1165
- currentPhase: software.currentPhase,
1166
- ...discovery,
1167
- });
3600
+ const decision = evaluateDiscoveryExitForCompletePhase(discovery);
3601
+ return { ok: decision.ok, message: decision.message, advance: decision.advance };
3602
+ }
3603
+ if (phase === 'first-version-scope') {
3604
+ if (discovery) {
3605
+ const discoveryGate = evaluateDiscoveryExitForCompletePhase(discovery);
3606
+ if (!discoveryGate.ok || !discoveryGate.advance) {
3607
+ return { ok: false, message: discoveryGate.message, advance: false };
3608
+ }
3609
+ }
3610
+ const decision = evaluateScopeExitForCompletePhase(scope);
3611
+ return { ok: decision.ok, message: decision.message, advance: decision.advance };
3612
+ }
3613
+ if (phase === 'behavior-specification') {
3614
+ if (discovery) {
3615
+ const discoveryGate = evaluateDiscoveryExitForCompletePhase(discovery);
3616
+ if (!discoveryGate.ok || !discoveryGate.advance) {
3617
+ return { ok: false, message: discoveryGate.message, advance: false };
3618
+ }
3619
+ }
3620
+ if (scope) {
3621
+ const scopeGate = evaluateScopeExitForCompletePhase(scope);
3622
+ if (!scopeGate.ok || !scopeGate.advance) {
3623
+ return { ok: false, message: scopeGate.message, advance: false };
3624
+ }
3625
+ }
3626
+ const decision = evaluateBehaviorExitForCompletePhase(behavior);
3627
+ return { ok: decision.ok, message: decision.message, advance: decision.advance };
3628
+ }
3629
+ if (phase === 'design') {
3630
+ if (discovery) {
3631
+ const discoveryGate = evaluateDiscoveryExitForCompletePhase(discovery);
3632
+ if (!discoveryGate.ok || !discoveryGate.advance) {
3633
+ return { ok: false, message: discoveryGate.message, advance: false };
3634
+ }
3635
+ }
3636
+ if (scope) {
3637
+ const scopeGate = evaluateScopeExitForCompletePhase(scope);
3638
+ if (!scopeGate.ok || !scopeGate.advance) {
3639
+ return { ok: false, message: scopeGate.message, advance: false };
3640
+ }
3641
+ }
3642
+ if (behavior) {
3643
+ const behaviorGate = evaluateBehaviorExitForCompletePhase(behavior);
3644
+ if (!behaviorGate.ok || !behaviorGate.advance) {
3645
+ return { ok: false, message: behaviorGate.message, advance: false };
3646
+ }
3647
+ }
3648
+ const decision = evaluateDesignExitForCompletePhase(design);
3649
+ return { ok: decision.ok, message: decision.message, advance: decision.advance };
3650
+ }
3651
+ if (phase === 'delivery-planning') {
3652
+ const decision = evaluateDeliveryExitForCompletePhase(delivery);
3653
+ if (decision.alreadyComplete) {
3654
+ return { ok: true, message: '', advance: true };
3655
+ }
3656
+ if (discovery) {
3657
+ const discoveryGate = evaluateDiscoveryExitForCompletePhase(discovery);
3658
+ if (!discoveryGate.ok || !discoveryGate.advance) {
3659
+ return { ok: false, message: discoveryGate.message, advance: false };
3660
+ }
3661
+ }
3662
+ if (scope) {
3663
+ const scopeGate = evaluateScopeExitForCompletePhase(scope);
3664
+ if (!scopeGate.ok || !scopeGate.advance) {
3665
+ return { ok: false, message: scopeGate.message, advance: false };
3666
+ }
3667
+ }
3668
+ if (behavior) {
3669
+ const behaviorGate = evaluateBehaviorExitForCompletePhase(behavior);
3670
+ if (!behaviorGate.ok || !behaviorGate.advance) {
3671
+ return { ok: false, message: behaviorGate.message, advance: false };
3672
+ }
3673
+ }
3674
+ if (design) {
3675
+ const designGate = evaluateDesignExitForCompletePhase(design);
3676
+ if (!designGate.ok || !designGate.advance) {
3677
+ return { ok: false, message: designGate.message, advance: false };
3678
+ }
3679
+ }
1168
3680
  return { ok: decision.ok, message: decision.message, advance: decision.advance };
1169
3681
  }
1170
3682
  if (phase === 'introduction') {
@@ -1187,10 +3699,51 @@ function canCompletePhase(phase, software, kickoff, discovery) {
1187
3699
  }
1188
3700
  return { ok: true, message: '' };
1189
3701
  }
3702
+ /**
3703
+ * Workflow port emitted by Complete Phase. Discovery revise/stop must not use Done,
3704
+ * because Done is wired to the next-stage human task.
3705
+ */
3706
+ function completePhaseWorkflowOutcome(phase, gate, discoveryDecision) {
3707
+ if (!gate.ok) {
3708
+ return 'Failed';
3709
+ }
3710
+ if (phase === 'discovery' && gate.advance === false) {
3711
+ return kickoffText(discoveryDecision) === 'stop' ? 'Stop' : 'Revise';
3712
+ }
3713
+ if (phase === 'first-version-scope' && gate.advance === false) {
3714
+ return 'Failed';
3715
+ }
3716
+ if (phase === 'behavior-specification' && gate.advance === false) {
3717
+ return 'Failed';
3718
+ }
3719
+ if (phase === 'design' && gate.advance === false) {
3720
+ return 'Failed';
3721
+ }
3722
+ if (phase === 'delivery-planning' && gate.advance === false) {
3723
+ return 'Failed';
3724
+ }
3725
+ return 'Done';
3726
+ }
3727
+
3728
+ const softwareManagementLocalEntityCatalog = {
3729
+ moduleName: 'software-management',
3730
+ loaders: {
3731
+ [RootConfig.entities.software.name]: () => import('./acorex-platform-module-software-management-client-contracts-software.entity-DfeM7KfF.mjs').then((m) => m.softwareFactory()),
3732
+ [RootConfig.entities.discoveryItem.name]: () => import('./acorex-platform-module-software-management-client-contracts-discovery-item.entity-Ah5hlc5n.mjs').then((m) => m.softwareDiscoveryItemFactory()),
3733
+ [RootConfig.entities.scopeItem.name]: () => import('./acorex-platform-module-software-management-client-contracts-scope-item.entity-D25tkUvi.mjs').then((m) => m.softwareScopeItemFactory()),
3734
+ [RootConfig.entities.requirement.name]: () => import('./acorex-platform-module-software-management-client-contracts-requirement.entity-DKr-En_J.mjs').then((m) => m.softwareRequirementFactory()),
3735
+ [RootConfig.entities.acceptanceCriterion.name]: () => import('./acorex-platform-module-software-management-client-contracts-acceptance-criterion.entity-CHEusZ4z.mjs').then((m) => m.softwareAcceptanceCriterionFactory()),
3736
+ [RootConfig.entities.businessRule.name]: () => import('./acorex-platform-module-software-management-client-contracts-business-rule.entity-Cew1yY4A.mjs').then((m) => m.softwareBusinessRuleFactory()),
3737
+ [RootConfig.entities.module.name]: () => import('./acorex-platform-module-software-management-client-contracts-module.entity-E9XKlo1v.mjs').then((m) => m.softwareModuleFactory()),
3738
+ [RootConfig.entities.feature.name]: () => import('./acorex-platform-module-software-management-client-contracts-feature.entity-D9es0yAv.mjs').then((m) => m.softwareFeatureFactory()),
3739
+ [RootConfig.entities.useCase.name]: () => import('./acorex-platform-module-software-management-client-contracts-use-case.entity-dPBFz-xN.mjs').then((m) => m.softwareUseCaseFactory()),
3740
+ [RootConfig.entities.designDecision.name]: () => import('./acorex-platform-module-software-management-client-contracts-design-decision.entity-BDRnAUj9.mjs').then((m) => m.softwareDesignDecisionFactory()),
3741
+ },
3742
+ };
1190
3743
 
1191
3744
  /**
1192
3745
  * Generated bundle index. Do not edit.
1193
3746
  */
1194
3747
 
1195
- export { AXPSoftwareManagementCommandKeys, AXPSoftwareManagementMenuKeys, AXPSoftwareManagementPermissionKeys, DISCOVERY_DECISIONS, DISCOVERY_FINDINGS_CHANGED, DISCOVERY_KICKOFF_DOCUMENT_TYPE_NAME, DISCOVERY_KICKOFF_FILE_NAME, DISCOVERY_METHODS, DISCOVERY_REPORT_DOCUMENT_TYPE_NAME, DISCOVERY_REPORT_FILE_NAME, DISCOVERY_STANCES, INTRODUCTION_EXIT_MESSAGE, INTRODUCTION_REQUIRED_FIELDS, INTRODUCTION_UPSTREAM_FIELDS, KICKOFF_REVIEW_REASON_BASE_DATA, KICKOFF_REVIEW_STATUS, KICKOFF_SOURCE_FIELDS, RootConfig, SOFTWARE_DEFINITION_WORKFLOW_NAME, SOFTWARE_DESIGN_KINDS, SOFTWARE_DISCOVERY_KINDS, SOFTWARE_ORIGINS, SOFTWARE_PHASES, SOFTWARE_PROPOSED_BY, SOFTWARE_SCOPE_KINDS, SoftwareManagementManifest, approvedKickoffPdfSource, buildDiscoveryKickoffSheet, buildDiscoveryReport, buildIntroductionKickoffCheck, canCompleteIntroduction, canCompletePhase, canLinkProject, canWriteDesignKind, discoveryKickoffFingerprint, discoveryReportFingerprint, discoveryStance, evaluateDiscoveryExit, evaluateIntroductionExit, findingSupportsProceed, introductionValueText, isIntroductionComplete, isSoftwarePhaseAtLeast, kickoffAfterBaseDataChange, kickoffFingerprintFromRows, kickoffPlainTextFromVersion, kickoffReviewKeepsIntroduction, kickoffSourceFromSoftware, kickoffStatusId, kickoffText, missingIntroductionFields, nextSoftwarePhase, parseSourceRefs, readKickoffMeta, softwareDefinitionWorkflowDefinition, softwarePhaseIndex, textPresent };
3748
+ export { AXPSoftwareManagementCommandKeys, AXPSoftwareManagementMenuKeys, AXPSoftwareManagementPermissionKeys, BEHAVIOR_CONTENT_CHANGED, BEHAVIOR_DOCUMENT_FILE_NAME, BEHAVIOR_DOCUMENT_LEGACY_HTML_FILE_NAME, BEHAVIOR_DOCUMENT_TYPE_NAME, BEHAVIOR_EXIT_MESSAGE, BEHAVIOR_SOURCE_CHANGED, DELIVERY_CONTENT_CHANGED, DELIVERY_DOCUMENT_FILE_NAME, DELIVERY_DOCUMENT_LEGACY_HTML_FILE_NAME, DELIVERY_DOCUMENT_TYPE_NAME, DELIVERY_EXIT_MESSAGE, DELIVERY_PLAN_FIELDS, DELIVERY_SOURCE_CHANGED, DESIGN_CONTENT_CHANGED, DESIGN_DOCUMENT_FILE_NAME, DESIGN_DOCUMENT_LEGACY_HTML_FILE_NAME, DESIGN_DOCUMENT_TYPE_NAME, DESIGN_EXIT_MESSAGE, DESIGN_SOURCE_CHANGED, DISCOVERY_DECISIONS, DISCOVERY_FINDINGS_CHANGED, DISCOVERY_KICKOFF_DOCUMENT_TYPE_NAME, DISCOVERY_KICKOFF_FILE_NAME, DISCOVERY_KICKOFF_LEGACY_HTML_FILE_NAME, DISCOVERY_KIND_INVALID_REASON, DISCOVERY_METHODS, DISCOVERY_REPORT_DOCUMENT_TYPE_NAME, DISCOVERY_REPORT_FILE_NAME, DISCOVERY_REPORT_LEGACY_HTML_FILE_NAME, DISCOVERY_STANCES, INTRODUCTION_EXIT_MESSAGE, INTRODUCTION_REQUIRED_FIELDS, INTRODUCTION_UPSTREAM_FIELDS, KICKOFF_REVIEW_REASON_BASE_DATA, KICKOFF_REVIEW_STATUS, KICKOFF_SOURCE_FIELDS, RootConfig, SCOPE_DOCUMENT_FILE_NAME, SCOPE_DOCUMENT_LEGACY_HTML_FILE_NAME, SCOPE_DOCUMENT_TYPE_NAME, SCOPE_ITEMS_CHANGED, SCOPE_SOURCE_CHANGED, SOFTWARE_ADR_STATUSES, SOFTWARE_BUSINESS_RULE_KINDS, SOFTWARE_DEFINITION_WORKFLOW_NAME, SOFTWARE_DESIGN_KINDS, SOFTWARE_DISCOVERY_KINDS, SOFTWARE_ENFORCEMENT_LEVELS, SOFTWARE_MOSCOW_PRIORITIES, SOFTWARE_ORIGINS, SOFTWARE_PHASES, SOFTWARE_PROPOSED_BY, SOFTWARE_REQUIREMENT_KINDS, SOFTWARE_SCOPE_KINDS, SOFTWARE_USE_CASE_LEVELS, SOFTWARE_VERIFICATION_METHODS, SoftwareManagementManifest, UPSTREAM_EXIT_MESSAGE, USABLE_DISCOVERY_QUESTIONNAIRE_SESSION_STATUSES, acceptanceCriterionSupportsBehavior, approvedKickoffPdfSource, assessmentSubjectMatchesSoftware, behaviorDocumentFingerprint, behaviorDocumentHeading, buildBehaviorDocument, buildDeliveryPlan, buildDesignDocument, buildDiscoveryKickoffSheet, buildDiscoveryReport, buildIntroductionKickoffCheck, buildScopeDocument, businessRuleSupportsBehavior, canCompleteIntroduction, canCompletePhase, canLinkProject, canWriteDesignKind, capabilitySupportsScope, citedQuestionnaireSourceIds, completePhaseWorkflowOutcome, deliveryPlanFingerprint, deliveryPlanFromSoftware, deliveryPlanHasText, deliveryPlanHeading, designDecisionLinksRequirement, designDecisionSupportsDataModel, designDecisionSupportsTechnical, designDecisionSupportsUx, designDocumentFingerprint, designDocumentHeading, discoveryKickoffFingerprint, discoveryQuestionnaireSessionHasAnswers, discoveryReportFingerprint, discoveryReportHeading, discoveryStance, evaluateApprovedUpstreamPin, evaluateBehaviorExit, evaluateBehaviorUpstreamPin, evaluateDeliveryExit, evaluateDesignExit, evaluateDesignUpstreamPin, evaluateDiscoveryExit, evaluateDiscoveryUpstreamPin, evaluateIntroductionExit, evaluateKickoffUpstreamPin, evaluateScopeExit, evaluateScopeUpstreamPin, exclusionSupportsScope, findingHasTraceableEvidence, findingSupportsProceed, introductionValueText, isDiscoveryMethod, isIntroductionComplete, isMoscowPriority, isScopeKind, isSoftwareDiscoveryKind, isSoftwarePhaseAtLeast, isUsableDiscoveryQuestionnaireSession, kickoffAfterBaseDataChange, kickoffFingerprintFromRows, kickoffPlainTextFromVersion, kickoffReviewKeepsIntroduction, kickoffSheetHeading, kickoffSourceFromSoftware, kickoffStatusId, kickoffText, metricSupportsScope, missingIntroductionFields, nextSoftwarePhase, parseSourceRef, parseSourceRefs, readKickoffMeta, requirementSupportsBehavior, resolveDiscoveryEvidenceFromLookup, resolveKickoffSheetLang, resolveSheetLang, scopeDocumentFingerprint, scopeDocumentHeading, scopeItemKind, sheetBilingual, sheetDisplayLocale, sheetHeading, sheetUnknown, softwareDefinitionWorkflowDefinition, softwareManagementLocalEntityCatalog, softwarePhaseIndex, sourceRefIsTraceable, textPresent, useCaseSupportsBehavior, wrapSheetHtml };
1196
3749
  //# sourceMappingURL=acorex-platform-module-software-management-client-contracts.mjs.map