@transcend-io/cli 12.0.0 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/README.md +160 -149
  2. package/dist/{app-CR3U95JW.mjs → app-CfJlhIn8.mjs} +18 -18
  3. package/dist/app-CfJlhIn8.mjs.map +1 -0
  4. package/dist/{approvePrivacyRequests-BDG82nlp.mjs → approvePrivacyRequests-BWj6SsgX.mjs} +2 -2
  5. package/dist/{approvePrivacyRequests-BDG82nlp.mjs.map → approvePrivacyRequests-BWj6SsgX.mjs.map} +1 -1
  6. package/dist/bin/bash-complete.mjs +1 -1
  7. package/dist/bin/cli.mjs +1 -1
  8. package/dist/bin/deprecated-command.mjs +1 -1
  9. package/dist/buildExamples-1I3xKR1X.mjs +2 -0
  10. package/dist/buildExamples-1I3xKR1X.mjs.map +1 -0
  11. package/dist/{buildXdiSyncEndpoint-FExEagKc.mjs → buildXdiSyncEndpoint-CAal3Xc4.mjs} +2 -2
  12. package/dist/{buildXdiSyncEndpoint-FExEagKc.mjs.map → buildXdiSyncEndpoint-CAal3Xc4.mjs.map} +1 -1
  13. package/dist/{bulkRestartRequests-OKwKXc52.mjs → bulkRestartRequests-B3wupylo.mjs} +2 -2
  14. package/dist/{bulkRestartRequests-OKwKXc52.mjs.map → bulkRestartRequests-B3wupylo.mjs.map} +1 -1
  15. package/dist/{bulkRetryEnrichers-Dl-n8AFF.mjs → bulkRetryEnrichers-D801tBcB.mjs} +2 -2
  16. package/dist/{bulkRetryEnrichers-Dl-n8AFF.mjs.map → bulkRetryEnrichers-D801tBcB.mjs.map} +1 -1
  17. package/dist/{cancelPrivacyRequests-BIgX5SDz.mjs → cancelPrivacyRequests-CAKTZF47.mjs} +2 -2
  18. package/dist/{cancelPrivacyRequests-BIgX5SDz.mjs.map → cancelPrivacyRequests-CAKTZF47.mjs.map} +1 -1
  19. package/dist/{command-X7lkPELf.mjs → command-BDQOL_MQ.mjs} +2 -2
  20. package/dist/{command-X7lkPELf.mjs.map → command-BDQOL_MQ.mjs.map} +1 -1
  21. package/dist/{constants-BRsj50Nb.mjs → constants-BlKpAm3R.mjs} +2 -2
  22. package/dist/{constants-BRsj50Nb.mjs.map → constants-BlKpAm3R.mjs.map} +1 -1
  23. package/dist/{createPoolingCommandUi-CyPZ3GqN.mjs → createPoolingCommandUi-JBOW5UxY.mjs} +2 -2
  24. package/dist/{createPoolingCommandUi-CyPZ3GqN.mjs.map → createPoolingCommandUi-JBOW5UxY.mjs.map} +1 -1
  25. package/dist/{downloadPrivacyRequestFiles-EBySRnvd.mjs → downloadPrivacyRequestFiles-Cf14MQR4.mjs} +2 -2
  26. package/dist/{downloadPrivacyRequestFiles-EBySRnvd.mjs.map → downloadPrivacyRequestFiles-Cf14MQR4.mjs.map} +1 -1
  27. package/dist/{generateCrossAccountApiKeys-pWTrIUE6.mjs → generateCrossAccountApiKeys-CVdsJFOe.mjs} +2 -2
  28. package/dist/{generateCrossAccountApiKeys-pWTrIUE6.mjs.map → generateCrossAccountApiKeys-CVdsJFOe.mjs.map} +1 -1
  29. package/dist/{impl-1SsreZWo.mjs → impl-2sYR_UFO.mjs} +2 -2
  30. package/dist/{impl-1SsreZWo.mjs.map → impl-2sYR_UFO.mjs.map} +1 -1
  31. package/dist/impl-B-Oe7DcE2.mjs +421 -0
  32. package/dist/{impl-DQcgEx7V2.mjs.map → impl-B-Oe7DcE2.mjs.map} +1 -1
  33. package/dist/{impl-CspH2ZWx.mjs → impl-BD03bzB-.mjs} +2 -2
  34. package/dist/{impl-CspH2ZWx.mjs.map → impl-BD03bzB-.mjs.map} +1 -1
  35. package/dist/{impl-CrdqsTUy.mjs → impl-BGtup1F9.mjs} +2 -2
  36. package/dist/{impl-CrdqsTUy.mjs.map → impl-BGtup1F9.mjs.map} +1 -1
  37. package/dist/impl-BQRP9NIv.mjs +2 -0
  38. package/dist/impl-BQRP9NIv.mjs.map +1 -0
  39. package/dist/{impl-CWP6AXSb.mjs → impl-BQe6vddz.mjs} +2 -2
  40. package/dist/{impl-CWP6AXSb.mjs.map → impl-BQe6vddz.mjs.map} +1 -1
  41. package/dist/{impl-B440iuvL.mjs → impl-BQj1Ien4.mjs} +3 -3
  42. package/dist/{impl-B440iuvL.mjs.map → impl-BQj1Ien4.mjs.map} +1 -1
  43. package/dist/{impl-CU38kdj8.mjs → impl-BRFL8xp7.mjs} +2 -2
  44. package/dist/{impl-CU38kdj8.mjs.map → impl-BRFL8xp7.mjs.map} +1 -1
  45. package/dist/{impl-eeS2lVi5.mjs → impl-BTvZxws5.mjs} +2 -2
  46. package/dist/{impl-eeS2lVi5.mjs.map → impl-BTvZxws5.mjs.map} +1 -1
  47. package/dist/{impl-D1UogVAq.mjs → impl-BVcy_GYa.mjs} +2 -2
  48. package/dist/{impl-D1UogVAq.mjs.map → impl-BVcy_GYa.mjs.map} +1 -1
  49. package/dist/{impl-vmLq6HCI.mjs → impl-B_CRtRo8.mjs} +2 -2
  50. package/dist/{impl-vmLq6HCI.mjs.map → impl-B_CRtRo8.mjs.map} +1 -1
  51. package/dist/{impl-7rdGuHOC.mjs → impl-BgD7TeMD.mjs} +2 -2
  52. package/dist/{impl-7rdGuHOC.mjs.map → impl-BgD7TeMD.mjs.map} +1 -1
  53. package/dist/{impl-BdTxFv63.mjs → impl-BgkovGOz.mjs} +2 -2
  54. package/dist/{impl-BdTxFv63.mjs.map → impl-BgkovGOz.mjs.map} +1 -1
  55. package/dist/{impl-Do2TNA3-.mjs → impl-Bh02zrTq.mjs} +2 -2
  56. package/dist/{impl-Do2TNA3-.mjs.map → impl-Bh02zrTq.mjs.map} +1 -1
  57. package/dist/{impl-HUfaARep.mjs → impl-BopWGXnH.mjs} +2 -2
  58. package/dist/{impl-HUfaARep.mjs.map → impl-BopWGXnH.mjs.map} +1 -1
  59. package/dist/{impl-iD6Fknfe.mjs → impl-BxvKe9_7.mjs} +2 -2
  60. package/dist/{impl-iD6Fknfe.mjs.map → impl-BxvKe9_7.mjs.map} +1 -1
  61. package/dist/{impl-DtnYcktN.mjs → impl-BzIyVAg_.mjs} +2 -2
  62. package/dist/{impl-DtnYcktN.mjs.map → impl-BzIyVAg_.mjs.map} +1 -1
  63. package/dist/{impl-Cxprr2hw.mjs → impl-C-PvYlFE.mjs} +2 -2
  64. package/dist/{impl-Cxprr2hw.mjs.map → impl-C-PvYlFE.mjs.map} +1 -1
  65. package/dist/impl-C36c5NfN.mjs +2 -0
  66. package/dist/impl-C36c5NfN.mjs.map +1 -0
  67. package/dist/{impl-B7l4bLG5.mjs → impl-CC-yFYWt.mjs} +2 -2
  68. package/dist/{impl-B7l4bLG5.mjs.map → impl-CC-yFYWt.mjs.map} +1 -1
  69. package/dist/{impl-CudSYx-g.mjs → impl-CFB_508q.mjs} +2 -2
  70. package/dist/{impl-CudSYx-g.mjs.map → impl-CFB_508q.mjs.map} +1 -1
  71. package/dist/{impl-DxQ9yj3H.mjs → impl-CG3f4B6u.mjs} +2 -2
  72. package/dist/{impl-DxQ9yj3H.mjs.map → impl-CG3f4B6u.mjs.map} +1 -1
  73. package/dist/{impl-DqHEIzpj.mjs → impl-CVUD-7mJ.mjs} +5 -5
  74. package/dist/{impl-DqHEIzpj.mjs.map → impl-CVUD-7mJ.mjs.map} +1 -1
  75. package/dist/{impl-BWPPVXG3.mjs → impl-CoqCyj7e.mjs} +3 -3
  76. package/dist/{impl-BWPPVXG3.mjs.map → impl-CoqCyj7e.mjs.map} +1 -1
  77. package/dist/{impl-BLQDgwxL.mjs → impl-Cq-GARM1.mjs} +2 -2
  78. package/dist/{impl-BLQDgwxL.mjs.map → impl-Cq-GARM1.mjs.map} +1 -1
  79. package/dist/{impl-DQG1pMzD2.mjs → impl-Cvyc-iTI2.mjs} +2 -2
  80. package/dist/{impl-DQG1pMzD2.mjs.map → impl-Cvyc-iTI2.mjs.map} +1 -1
  81. package/dist/impl-CwBa15M42.mjs +3 -0
  82. package/dist/impl-CwBa15M42.mjs.map +1 -0
  83. package/dist/{impl-CieztjdM.mjs → impl-D3gqip90.mjs} +2 -2
  84. package/dist/{impl-CieztjdM.mjs.map → impl-D3gqip90.mjs.map} +1 -1
  85. package/dist/{impl-DcL-8NEa2.mjs → impl-D6Lzwd-R2.mjs} +2 -2
  86. package/dist/{impl-DcL-8NEa2.mjs.map → impl-D6Lzwd-R2.mjs.map} +1 -1
  87. package/dist/impl-DG-041kN.mjs +3 -0
  88. package/dist/impl-DG-041kN.mjs.map +1 -0
  89. package/dist/{impl-DXbxO2VJ.mjs → impl-DTvnDByz.mjs} +2 -2
  90. package/dist/{impl-DXbxO2VJ.mjs.map → impl-DTvnDByz.mjs.map} +1 -1
  91. package/dist/{impl-Ds-gQfdc.mjs → impl-DUg1sDwg.mjs} +2 -2
  92. package/dist/{impl-Ds-gQfdc.mjs.map → impl-DUg1sDwg.mjs.map} +1 -1
  93. package/dist/{impl-B2ZXtnpX.mjs → impl-DldrBJEa.mjs} +2 -2
  94. package/dist/{impl-B2ZXtnpX.mjs.map → impl-DldrBJEa.mjs.map} +1 -1
  95. package/dist/{impl-D-a5xGld.mjs → impl-Dmn1CWts.mjs} +3 -3
  96. package/dist/{impl-D-a5xGld.mjs.map → impl-Dmn1CWts.mjs.map} +1 -1
  97. package/dist/impl-Dr9Jezjh2.mjs +2 -0
  98. package/dist/impl-Dr9Jezjh2.mjs.map +1 -0
  99. package/dist/{impl-DRKPx_I9.mjs → impl-DtTfsHtL.mjs} +2 -2
  100. package/dist/{impl-DRKPx_I9.mjs.map → impl-DtTfsHtL.mjs.map} +1 -1
  101. package/dist/{impl-FerHBNJx2.mjs → impl-DzNEfRoS2.mjs} +2 -2
  102. package/dist/{impl-FerHBNJx2.mjs.map → impl-DzNEfRoS2.mjs.map} +1 -1
  103. package/dist/{impl-wBcVYHlA.mjs → impl-HnrcGt_T.mjs} +2 -2
  104. package/dist/{impl-wBcVYHlA.mjs.map → impl-HnrcGt_T.mjs.map} +1 -1
  105. package/dist/{impl-D1f9mJL_.mjs → impl-QdSegO65.mjs} +2 -2
  106. package/dist/{impl-D1f9mJL_.mjs.map → impl-QdSegO65.mjs.map} +1 -1
  107. package/dist/{impl-C_Ifcb00.mjs → impl-S90NUBGm.mjs} +2 -2
  108. package/dist/{impl-C_Ifcb00.mjs.map → impl-S90NUBGm.mjs.map} +1 -1
  109. package/dist/{impl-DtpgD_as.mjs → impl-Tr08dgdk.mjs} +2 -2
  110. package/dist/{impl-DtpgD_as.mjs.map → impl-Tr08dgdk.mjs.map} +1 -1
  111. package/dist/{impl-Cb42aI60.mjs → impl-WJBuS_0m.mjs} +2 -2
  112. package/dist/{impl-Cb42aI60.mjs.map → impl-WJBuS_0m.mjs.map} +1 -1
  113. package/dist/{impl-DiwxYcux.mjs → impl-b4KAEVci.mjs} +2 -2
  114. package/dist/{impl-DiwxYcux.mjs.map → impl-b4KAEVci.mjs.map} +1 -1
  115. package/dist/impl-defjX-97.mjs +3 -0
  116. package/dist/impl-defjX-97.mjs.map +1 -0
  117. package/dist/{impl-DTadLabu.mjs → impl-fg0UZYw6.mjs} +2 -2
  118. package/dist/{impl-DTadLabu.mjs.map → impl-fg0UZYw6.mjs.map} +1 -1
  119. package/dist/{impl-Dr_l_SLd.mjs → impl-hRK54juc.mjs} +2 -2
  120. package/dist/{impl-Dr_l_SLd.mjs.map → impl-hRK54juc.mjs.map} +1 -1
  121. package/dist/{impl-DJcNhpbx.mjs → impl-mjDxMEDR.mjs} +2 -2
  122. package/dist/{impl-DJcNhpbx.mjs.map → impl-mjDxMEDR.mjs.map} +1 -1
  123. package/dist/index.d.mts +1 -1
  124. package/dist/index.mjs +2 -2
  125. package/dist/{markRequestDataSiloIdsCompleted-BYNMCkhy.mjs → markRequestDataSiloIdsCompleted-C6lV_My-.mjs} +2 -2
  126. package/dist/{markRequestDataSiloIdsCompleted-BYNMCkhy.mjs.map → markRequestDataSiloIdsCompleted-C6lV_My-.mjs.map} +1 -1
  127. package/dist/{markSilentPrivacyRequests-gKYivzH1.mjs → markSilentPrivacyRequests-D3bFOMLh.mjs} +2 -2
  128. package/dist/{markSilentPrivacyRequests-gKYivzH1.mjs.map → markSilentPrivacyRequests-D3bFOMLh.mjs.map} +1 -1
  129. package/dist/{mergeTranscendInputs-D1CvxQu0.mjs → mergeTranscendInputs-B7WjxYMN.mjs} +3 -3
  130. package/dist/{mergeTranscendInputs-D1CvxQu0.mjs.map → mergeTranscendInputs-B7WjxYMN.mjs.map} +1 -1
  131. package/dist/{notifyPrivacyRequestsAdditionalTime-DbERhQ1Q.mjs → notifyPrivacyRequestsAdditionalTime-BGUxsWLN.mjs} +2 -2
  132. package/dist/{notifyPrivacyRequestsAdditionalTime-DbERhQ1Q.mjs.map → notifyPrivacyRequestsAdditionalTime-BGUxsWLN.mjs.map} +1 -1
  133. package/dist/{policy-bundle-manifest-BZnBMZQq.mjs → policy-bundle-manifest-RgsjPnfI.mjs} +3 -3
  134. package/dist/{policy-bundle-manifest-BZnBMZQq.mjs.map → policy-bundle-manifest-RgsjPnfI.mjs.map} +1 -1
  135. package/dist/{policy-project-discovery-C29UxWwt.mjs → policy-project-discovery-B4cFXUlA.mjs} +71 -68
  136. package/dist/policy-project-discovery-B4cFXUlA.mjs.map +1 -0
  137. package/dist/policy-scaffold-config-CwlygiTz.mjs +76 -0
  138. package/dist/policy-scaffold-config-CwlygiTz.mjs.map +1 -0
  139. package/dist/printResult-Dmwv78e7.mjs +33 -0
  140. package/dist/printResult-Dmwv78e7.mjs.map +1 -0
  141. package/dist/{pullAllDatapoints-Bm-Orhse.mjs → pullAllDatapoints-CNqQSSmF.mjs} +3 -3
  142. package/dist/{pullAllDatapoints-Bm-Orhse.mjs.map → pullAllDatapoints-CNqQSSmF.mjs.map} +1 -1
  143. package/dist/pullChunkedCustomSiloOutstandingIdentifiers-BfNNWqeI.mjs +2 -0
  144. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-DTGQOw--.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-BfNNWqeI.mjs.map} +1 -1
  145. package/dist/{pullManualEnrichmentIdentifiersToCsv-DMC5CQtE.mjs → pullManualEnrichmentIdentifiersToCsv-B_lWa6Yg.mjs} +2 -2
  146. package/dist/{pullManualEnrichmentIdentifiersToCsv-DMC5CQtE.mjs.map → pullManualEnrichmentIdentifiersToCsv-B_lWa6Yg.mjs.map} +1 -1
  147. package/dist/{pushCronIdentifiersFromCsv-DhS2z8IG.mjs → pushCronIdentifiersFromCsv-CDhlEf6n.mjs} +2 -2
  148. package/dist/{pushCronIdentifiersFromCsv-DhS2z8IG.mjs.map → pushCronIdentifiersFromCsv-CDhlEf6n.mjs.map} +1 -1
  149. package/dist/pushManualEnrichmentIdentifiersFromCsv-Bn_028w5.mjs +2 -0
  150. package/dist/{pushManualEnrichmentIdentifiersFromCsv-BTJGOmdU.mjs.map → pushManualEnrichmentIdentifiersFromCsv-Bn_028w5.mjs.map} +1 -1
  151. package/dist/{removeUnverifiedRequestIdentifiers-BkAcUZZN.mjs → removeUnverifiedRequestIdentifiers-DcI9ut4q.mjs} +2 -2
  152. package/dist/{removeUnverifiedRequestIdentifiers-BkAcUZZN.mjs.map → removeUnverifiedRequestIdentifiers-DcI9ut4q.mjs.map} +1 -1
  153. package/dist/resolveBundleIdByName-BPrMkU0w.mjs +2 -0
  154. package/dist/resolveBundleIdByName-BPrMkU0w.mjs.map +1 -0
  155. package/dist/resolvePolicyBundleVersion-BrVz4LKN.mjs +2 -0
  156. package/dist/resolvePolicyBundleVersion-BrVz4LKN.mjs.map +1 -0
  157. package/dist/{retryRequestDataSilos-BoPmcB8-.mjs → retryRequestDataSilos-ZdY2PM0S.mjs} +2 -2
  158. package/dist/{retryRequestDataSilos-BoPmcB8-.mjs.map → retryRequestDataSilos-ZdY2PM0S.mjs.map} +1 -1
  159. package/dist/{skipPreflightJobs-DkBdYw-r.mjs → skipPreflightJobs-KdcSw8Td.mjs} +2 -2
  160. package/dist/{skipPreflightJobs-DkBdYw-r.mjs.map → skipPreflightJobs-KdcSw8Td.mjs.map} +1 -1
  161. package/dist/{skipRequestDataSilos-BRFiokix.mjs → skipRequestDataSilos-Cy2NfP47.mjs} +2 -2
  162. package/dist/{skipRequestDataSilos-BRFiokix.mjs.map → skipRequestDataSilos-Cy2NfP47.mjs.map} +1 -1
  163. package/dist/{streamPrivacyRequestsToCsv-Bt-H5J-y.mjs → streamPrivacyRequestsToCsv-ByRBG8Mb.mjs} +2 -2
  164. package/dist/{streamPrivacyRequestsToCsv-Bt-H5J-y.mjs.map → streamPrivacyRequestsToCsv-ByRBG8Mb.mjs.map} +1 -1
  165. package/dist/{syncCodePackages-CPkEukDm.mjs → syncCodePackages-DJnrcX5l.mjs} +2 -2
  166. package/dist/{syncCodePackages-CPkEukDm.mjs.map → syncCodePackages-DJnrcX5l.mjs.map} +1 -1
  167. package/dist/updateConsentManagerVersionToLatest-KwMaAkwh.mjs +2 -0
  168. package/dist/{updateConsentManagerVersionToLatest-DWblAwus.mjs.map → updateConsentManagerVersionToLatest-KwMaAkwh.mjs.map} +1 -1
  169. package/dist/{uploadConsents-D7Vg8ZRW.mjs → uploadConsents-C5LmI-9T.mjs} +2 -2
  170. package/dist/{uploadConsents-D7Vg8ZRW.mjs.map → uploadConsents-C5LmI-9T.mjs.map} +1 -1
  171. package/dist/{uploadPrivacyRequestsFromCsv-B_hQwIn6.mjs → uploadPrivacyRequestsFromCsv-BsYnCgbl.mjs} +2 -2
  172. package/dist/{uploadPrivacyRequestsFromCsv-B_hQwIn6.mjs.map → uploadPrivacyRequestsFromCsv-BsYnCgbl.mjs.map} +1 -1
  173. package/package.json +4 -4
  174. package/dist/app-CR3U95JW.mjs.map +0 -1
  175. package/dist/buildExamples-B6BdW0FD.mjs +0 -2
  176. package/dist/buildExamples-B6BdW0FD.mjs.map +0 -1
  177. package/dist/impl-BqTMPbwc2.mjs +0 -2
  178. package/dist/impl-BqTMPbwc2.mjs.map +0 -1
  179. package/dist/impl-CAoIp9Nl2.mjs +0 -3
  180. package/dist/impl-CAoIp9Nl2.mjs.map +0 -1
  181. package/dist/impl-Cee7Q1Ne.mjs +0 -2
  182. package/dist/impl-Cee7Q1Ne.mjs.map +0 -1
  183. package/dist/impl-DQcgEx7V2.mjs +0 -298
  184. package/dist/impl-DezV3QMo.mjs +0 -3
  185. package/dist/impl-DezV3QMo.mjs.map +0 -1
  186. package/dist/impl-btKJ1-VJ.mjs +0 -3
  187. package/dist/impl-btKJ1-VJ.mjs.map +0 -1
  188. package/dist/impl-ijoNwhGI.mjs +0 -2
  189. package/dist/impl-ijoNwhGI.mjs.map +0 -1
  190. package/dist/policy-project-discovery-C29UxWwt.mjs.map +0 -1
  191. package/dist/policy-scaffold-config-BUKAyPad.mjs +0 -76
  192. package/dist/policy-scaffold-config-BUKAyPad.mjs.map +0 -1
  193. package/dist/printResult-C2K9ODeE.mjs +0 -33
  194. package/dist/printResult-C2K9ODeE.mjs.map +0 -1
  195. package/dist/pullChunkedCustomSiloOutstandingIdentifiers-DTGQOw--.mjs +0 -2
  196. package/dist/pushManualEnrichmentIdentifiersFromCsv-BTJGOmdU.mjs +0 -2
  197. package/dist/resolveBundleIdByName-Dm_o5_bg.mjs +0 -2
  198. package/dist/resolveBundleIdByName-Dm_o5_bg.mjs.map +0 -1
  199. package/dist/resolvePolicyBundleVersion-DRUwe7fA.mjs +0 -2
  200. package/dist/resolvePolicyBundleVersion-DRUwe7fA.mjs.map +0 -1
  201. package/dist/updateConsentManagerVersionToLatest-DWblAwus.mjs +0 -2
@@ -1,36 +1,37 @@
1
- import{n as e,r as t}from"./project-discovery-CWRjlFnC.mjs";import{join as n,resolve as r}from"node:path";import i from"js-yaml";var a=`https://raw.githubusercontent.com/transcend-io/tools/main/packages/cli/schema/permissions-policy-input.json`,o=[{preferences:[{name:`Analytics`,choice:!0,days_since_choice:42},{name:`SaleOfInfo`,choice:null}],context:{region:`US-CA`}}],s={$schema:`http://json-schema.org/draft-07/schema#`,$id:a,title:`Permissions API policy input`,description:"JSON document Sombra posts as `{ input }` when evaluating a Permissions policy bundle via the OPA Data API.",type:`object`,additionalProperties:!1,required:[`preferences`,`context`],properties:{preferences:{type:`array`,description:`Purpose preference rows from Preference Store for the current subject.`,items:{type:`object`,additionalProperties:!1,required:[`name`,`choice`],properties:{name:{type:`string`,description:`Purpose slug (for example Analytics or SaleOfInfo).`},choice:{type:[`boolean`,`null`],description:`true when opted in, false when opted out, or null when unset.`},days_since_choice:{type:`integer`,minimum:0,description:`Whole days since the preference was last set. Omitted when no timestamp is available.`}}}},context:{type:`object`,description:`Caller-supplied context for the decision (for example region). Use an empty object when none is provided.`,additionalProperties:!0}},examples:o};const c=`1.18.2`,l=`example`,u=`${l}-bundle`,d=`.manifest`,f=`permissions`,p=`transcend.io`,m=[`generic`,`permissions`];function h(e,t=`generic`){return`{
1
+ import{g as e}from"./constants-BlKpAm3R.mjs";import{n as t,r as n}from"./project-discovery-CWRjlFnC.mjs";import{join as r,resolve as i}from"node:path";import a from"js-yaml";var o=`https://raw.githubusercontent.com/transcend-io/tools/main/packages/cli/schema/permissions-policy-input.json`,s=[{preferences:[{name:`Analytics`,choice:!0,days_since_choice:42},{name:`SaleOfInfo`,choice:null}],context:{region:`US-CA`}}],c={$schema:`http://json-schema.org/draft-07/schema#`,$id:o,title:`Permissions API policy input`,description:"JSON document Sombra posts as `{ input }` when evaluating a Permissions policy bundle via the OPA Data API.",type:`object`,additionalProperties:!1,required:[`preferences`,`context`],properties:{preferences:{type:`array`,description:`Purpose preference rows from Preference Store for the current subject.`,items:{type:`object`,additionalProperties:!1,required:[`name`,`choice`],properties:{name:{type:`string`,description:`Purpose slug (for example Analytics or SaleOfInfo).`},choice:{type:[`boolean`,`null`],description:`true when opted in, false when opted out, or null when unset.`},days_since_choice:{type:`integer`,minimum:0,description:`Whole days since the preference was last set. Omitted when no timestamp is available.`}}}},context:{type:`object`,description:`Caller-supplied context for the decision (for example region). Use an empty object when none is provided.`,additionalProperties:!0}},examples:s};const l=o,u=`1.18.2`,d=`example`,f=`${d}-bundle`,p=`input.schema.json`,m=`.manifest`,h=`permissions`,g=`transcend.io`,_={Generic:`generic`,Permissions:`permissions`},v=[_.Generic,_.Permissions];function y(t,n=_.Generic){return`{
2
2
  "$schema": "https://openpolicyagent.org/schemas/bundle/v1/manifest.schema.json",
3
3
  "revision": "",
4
- "roots": ["${e}"],
4
+ "roots": ["${t}"],
5
5
  "rego_version": 1,
6
6
  "metadata": {
7
- "${p}": {
8
- "template": "${t}"
7
+ "${g}": {
8
+ "template": "${n}",
9
+ "templateVersion": "${e}"
9
10
  }
10
11
  }
11
12
  }
12
- `}h(l,`generic`);function g(e){return`# Workspace-level Regal config for both publishable bundles under this tree.
13
+ `}y(d,_.Generic);function b(e){return`# Workspace-level Regal config for both publishable bundles under this tree.
13
14
  # \`project.roots\` are package-path prefixes (same meaning as OPA \`.manifest\`
14
15
  # roots), not filesystem folders. Each bundle also has its own \`.manifest\`.
15
16
  capabilities:
16
17
  from:
17
18
  engine: opa
18
- version: v${c}
19
+ version: v${u}
19
20
  project:
20
21
  ${e.length===0?` roots: []`:` roots:\n${e.map(e=>` - ${e}`).join(`
21
22
  `)}`}
22
23
  rego-version: 1
23
- `}function _(e,t){if(e.trim().length===0){let e=[t];return{contents:g(e),roots:e}}let n;try{n=i.load(e)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`.regal/config.yaml is not valid YAML: ${t}`)}if(n==null){let e=[t];return{contents:g(e),roots:e}}if(typeof n!=`object`||Array.isArray(n))throw Error(`.regal/config.yaml must be a YAML mapping at the top level.`);let r={...n},a=r.project;if(a!=null&&(typeof a!=`object`||Array.isArray(a)))throw Error(`.regal/config.yaml project must be a YAML mapping when present.`);let o={...a??{}},s=o.roots,l;if(s===void 0)l=[t];else if(Array.isArray(s)&&s.every(e=>typeof e==`string`))l=[...new Set([...s,t])].sort((e,t)=>e.localeCompare(t));else throw Error(".regal/config.yaml project.roots must be an array of strings. Fix the Regal config before running `transcend policy new`.");o.roots=l,o[`rego-version`]===void 0&&(o[`rego-version`]=1),r.project=o,r.capabilities===void 0&&(r.capabilities={from:{engine:`opa`,version:`v${c}`}});let u=i.dump(r,{lineWidth:-1,noRefs:!0,sortKeys:!1});return{contents:u.endsWith(`
24
- `)?u:`${u}\n`,roots:l}}g([l]);const v=g([]);`${l}${l}`,`${l}${l}`;const y=`{
24
+ `}function x(e,t){if(e.trim().length===0){let e=[t];return{contents:b(e),roots:e}}let n;try{n=a.load(e)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`.regal/config.yaml is not valid YAML: ${t}`)}if(n==null){let e=[t];return{contents:b(e),roots:e}}if(typeof n!=`object`||Array.isArray(n))throw Error(`.regal/config.yaml must be a YAML mapping at the top level.`);let r={...n},i=r.project;if(i!=null&&(typeof i!=`object`||Array.isArray(i)))throw Error(`.regal/config.yaml project must be a YAML mapping when present.`);let o={...i??{}},s=o.roots,c;if(s===void 0)c=[t];else if(Array.isArray(s)&&s.every(e=>typeof e==`string`))c=[...new Set([...s,t])].sort((e,t)=>e.localeCompare(t));else throw Error(".regal/config.yaml project.roots must be an array of strings. Fix the Regal config before running `transcend policy new`.");o.roots=c,o[`rego-version`]===void 0&&(o[`rego-version`]=1),r.project=o,r.capabilities===void 0&&(r.capabilities={from:{engine:`opa`,version:`v${u}`}});let l=a.dump(r,{lineWidth:-1,noRefs:!0,sortKeys:!1});return{contents:l.endsWith(`
25
+ `)?l:`${l}\n`,roots:c}}b([d]);const S=b([]);`${d}`,`${d}${d}`;const C=`{
25
26
  "subject": {
26
27
  "trusted": false
27
28
  }
28
29
  }
29
- `;`${l}`;const b=`# Local policy evaluation input (VS Code / Regal look for input.json here).
30
+ `;`${d}`;const w=`# Local policy evaluation input (VS Code / Regal look for input.json here).
30
31
  /input.json
31
- `,x=`# Transcend Policy
32
+ `,T=`# Transcend Policy
32
33
 
33
- Multi-bundle workspace for [Transcend Policy Engine](https://docs.transcend.io) bundles
34
+ Multi-bundle workspace for Transcend Policy Engine bundles
34
35
  (OPA / Rego v1). Requires **Transcend CLI ≥ 11** (\`transcend policy --help\`
35
36
  should list \`init\`, \`new\`, and positional \`[directory]\` args).
36
37
 
@@ -50,8 +51,8 @@ transcend policy new --template generic # add a bundle from a template
50
51
  transcend policy lint --noInteractive
51
52
  transcend policy test
52
53
  transcend policy eval transcend/policy/example-bundle \\
53
- --package data.example.result \\
54
- --input transcend/policy/example-bundle/input.json
54
+ --package=data.example.result \\
55
+ --input=transcend/policy/example-bundle/input.json
55
56
  \`\`\`
56
57
 
57
58
  \`policy new\` also writes a gitignored \`input.json\` (copy of \`input.example.json\`)
@@ -67,28 +68,44 @@ transcend/policy/
67
68
  example/ # package root (matches .manifest roots)
68
69
  input.example.json
69
70
  input.json # local only (gitignored)
70
- schemas/ # input JSON Schemas (editor + opa check -s)
71
+ input.schema.json # input JSON Schema (editor + opa --schema)
71
72
  .regal/config.yaml
72
73
  \`\`\`
73
74
 
74
75
  Replace or delete example bundles when you have a real policy. Publish each
75
- bundle separately (\`transcend policy publish --bundle-name … <dir>\`).
76
+ bundle separately (\`transcend policy publish --remote-bundle-name … <dir>\`).
76
77
 
77
- ## Bundle names and Permissions
78
+ ## Permissions API
79
+
80
+ Scaffold the Permissions starter, then simulate the query Sombra runs:
81
+
82
+ \`\`\`sh
83
+ transcend policy new \\
84
+ --template permissions \\
85
+ --name ${h} \\
86
+ --bundle-dir ${h}-bundle \\
87
+ --yes
88
+
89
+ transcend policy eval transcend/policy/${h}-bundle \\
90
+ --package=data.${h}.purposes \\
91
+ --input=transcend/policy/${h}-bundle/input.json \\
92
+ --schema=transcend/policy/${h}-bundle/input.schema.json
93
+ \`\`\`
78
94
 
79
95
  Upload does **not** distinguish bundle kinds. What makes a bundle “Permissions”
80
96
  is the remote name plus where Sombra queries it:
81
97
 
82
98
  - **Permissions API** always loads the fixed remote bundle name
83
- \`${f}\`. Publish that starter with
84
- \`--bundle-name=${f}\`.
85
- - **Generic / decide** bundles use any other \`--bundle-name\` and the decide
99
+ \`${h}\`. Publish that starter with
100
+ \`--remote-bundle-name=${h}\`.
101
+ - **Generic / decide** bundles use any other \`--remote-bundle-name\` and the decide
86
102
  path.
87
103
 
88
104
  Scaffolded \`.manifest\` files may include \`metadata.transcend.io.template\`
89
- (\`generic\` or \`permissions\`) as an authoring hint. Upload ignores it;
90
- \`policy publish\` may warn when the hint and \`--bundle-name\` disagree.
91
- `;`${u}${l}`,`${u}${l}`,`${u}${d}`,`${c}`,`${l}`,`${u}`,`${u}`;const S=[{path:`.regal/config.yaml`,contents:v,description:`Pin strict Rego v1 linting to OPA ${c} capabilities`},{path:`README.md`,contents:x,description:`Create the concise multi-bundle workspace guide`}];function C(){return S.map(e=>({...e}))}const w={generic:`Generic example`,permissions:`Permission API starter`},T={generic:`example`,permissions:f};function E(e){return`${e}-bundle`}function D(e){let t=E(e);return[{path:`${t}/${d}`,contents:h(e,`generic`),description:`Create the OPA bundle .manifest`},{path:`schemas/${e}/input.json`,contents:`{
105
+ (\`generic\` or \`permissions\`) and \`templateVersion\` (the \`@transcend-io/cli\`
106
+ version that generated the scaffold) as authoring hints. Upload ignores them;
107
+ \`policy publish\` may warn when the template hint and \`--remote-bundle-name\` disagree.
108
+ `;`${f}${d}`,`${f}${d}`,`${f}${m}`,`${u}`,`${f}${p}`,`${f}`,`${f}`;const E=[{path:`.regal/config.yaml`,contents:S,description:`Pin strict Rego v1 linting to OPA ${u} capabilities`},{path:`README.md`,contents:T,description:`Create the concise multi-bundle workspace guide`}];function D(){return E.map(e=>({...e}))}const O={[_.Generic]:`Generic example`,[_.Permissions]:`Permission API starter`},k={[_.Generic]:`example`,[_.Permissions]:h};function A(e){return`${e}-bundle`}function j(e){return e?e===`.`||e===`..`||e.includes(`/`)||e.includes(`\\`)?`Bundle directory must be a single path segment (no slashes).`:/^[A-Za-z0-9][A-Za-z0-9._-]*$/u.test(e)?e.length>128?`Bundle directory cannot exceed 128 characters.`:!0:`Bundle directory must be alphanumeric (plus ., _, -), e.g. "my-bundle".`:`Enter a bundle directory name.`}function M(e,t=A(e)){let n=t;return[{path:`${n}/${m}`,contents:y(e,_.Generic),description:`Create the OPA bundle .manifest`},{path:`${n}/${p}`,contents:`{
92
109
  "$schema": "http://json-schema.org/draft-07/schema#",
93
110
  "$id": "https://transcend.io/policy-schemas/${e}/input.json",
94
111
  "title": "${e===`example`?`Example policy input`:`${e} policy input`}",
@@ -108,14 +125,12 @@ Scaffolded \`.manifest\` files may include \`metadata.transcend.io.template\`
108
125
  }
109
126
  }
110
127
  }
111
- `,description:`Create the input JSON Schema for the ${e} bundle`},{path:`${t}/${e}/result/result.rego`,contents:`# METADATA
128
+ `,description:`Create the input JSON Schema for the ${e} bundle`},{path:`${n}/${e}/result/result.rego`,contents:`# METADATA
112
129
  # title: ${e===`example`?`Disposable example result`:`${e} result`}
113
130
  # description: |
114
131
  # A fail-closed ${e===`example`?`teaching `:``}entrypoint. Replace this ${e===`example`?`example `:``}with the document
115
132
  # tree and result contract required by your application.
116
133
  # scope: package
117
- # schemas:
118
- # - input: schema.${e}.input
119
134
  # entrypoint: true
120
135
  package ${e}.result
121
136
 
@@ -132,7 +147,7 @@ default reason_code := "untrusted_or_invalid_input"
132
147
  reason_code := "trusted_subject" if {
133
148
  \tdecision == "allow"
134
149
  }
135
- `,description:`Create a documented fail-closed result entrypoint`},{path:`${t}/${e}/result/result_test.rego`,contents:`package ${e}.result_test
150
+ `,description:`Create a documented fail-closed result entrypoint`},{path:`${n}/${e}/result/result_test.rego`,contents:`package ${e}.result_test
136
151
 
137
152
  import data.${e}.result
138
153
  import rego.v1
@@ -151,24 +166,22 @@ test_allows_trusted_subject if {
151
166
  \tresult.decision == "allow" with input as {"subject": {"trusted": true}}
152
167
  \tresult.reason_code == "trusted_subject" with input as {"subject": {"trusted": true}}
153
168
  }
154
- `,description:`Create executable tests for allow and fail-closed decisions`},{path:`${t}/input.example.json`,contents:y,description:`Create a sanitized local evaluation input example`},{path:`${t}/input.json`,contents:y,description:`Create a local evaluation input (gitignored copy of the example)`},{path:`${t}/.gitignore`,contents:b,description:`Ignore only the private local input file`}]}function O(){return`${JSON.stringify(s,null,2)}\n`}function k(){let[e]=o;if(!e)throw Error(`permissions-policy-input.json must declare at least one example`);return`${JSON.stringify(e,null,2)}\n`}function A(e){let t=E(e),n=k();return[{path:`${t}/${d}`,contents:h(e,`permissions`),description:`Create the OPA bundle .manifest`},{path:`schemas/${e}/input.json`,contents:O(),description:`Create the input JSON Schema for the ${e} bundle (from published permissions-policy-input.json)`},{path:`${t}/${e}/config/config.rego`,contents:`# METADATA
169
+ `,description:`Create executable tests for allow and fail-closed decisions`},{path:`${n}/input.example.json`,contents:C,description:`Create a sanitized local evaluation input example`},{path:`${n}/input.json`,contents:C,description:`Create a local evaluation input (gitignored copy of the example)`},{path:`${n}/.gitignore`,contents:w,description:`Ignore only the private local input file`}]}function N(){return`${JSON.stringify(c,null,2)}\n`}function P(){let[e]=s;if(!e)throw Error(`permissions-policy-input.json must declare at least one example`);return`${JSON.stringify(e,null,2)}\n`}function F(e,t=A(e)){let n=t,r=P();return[{path:`${n}/${m}`,contents:y(e,_.Permissions),description:`Create the OPA bundle .manifest`},{path:`${n}/${p}`,contents:N(),description:`Create the input JSON Schema for the ${e} bundle (from published permissions-policy-input.json)`},{path:`${n}/${e}/config/config.rego`,contents:`# METADATA
155
170
  # title: Permissions config
156
171
  # description: |
157
172
  # Static bundle configuration. Values come from data.json in this directory.
158
173
  package ${e}.config
159
174
 
160
175
  import rego.v1
161
- `,description:`Create the static bundle configuration package`},{path:`${t}/${e}/config/data.json`,contents:`{
176
+ `,description:`Create the static bundle configuration package`},{path:`${n}/${e}/config/data.json`,contents:`{
162
177
  "default_consent_allowed": true,
163
178
  "purposes": [
164
179
  "Analytics",
165
- "SaleOfInfo",
166
- "Marketing",
167
- "Personalization"
180
+ "SaleOfInfo"
168
181
  ],
169
182
  "default_consent": {}
170
183
  }
171
- `,description:`Create the static purpose configuration data`},{path:`${t}/${e}/helpers/preference/preference.rego`,contents:`# METADATA
184
+ `,description:`Create the static purpose configuration data`},{path:`${n}/${e}/helpers/preference/preference.rego`,contents:`# METADATA
172
185
  # title: Purpose preference resolution
173
186
  # description: |
174
187
  # Resolves the subject's recorded choice for one purpose from the OPA
@@ -218,7 +231,7 @@ undecided(name) if {
218
231
  \tnot enabled(name)
219
232
  \tnot disabled(name)
220
233
  }
221
- `,description:`Create purpose preference resolution helpers`},{path:`${t}/${e}/helpers/preference/preference_test.rego`,contents:`# Mechanical tests for purpose preference resolution.
234
+ `,description:`Create purpose preference resolution helpers`},{path:`${n}/${e}/helpers/preference/preference_test.rego`,contents:`# Mechanical tests for purpose preference resolution.
222
235
  # Policy outcomes are tested beside the public entrypoint.
223
236
  package ${e}.helpers.preference_test
224
237
 
@@ -232,18 +245,18 @@ test_treats_an_absent_preferences_array_as_no_recorded_choices if {
232
245
  \tfixture := {}
233
246
 
234
247
  \tpreference.source_available with input as fixture
235
- \tpreference.undecided("Marketing") with input as fixture
248
+ \tpreference.undecided("Analytics") with input as fixture
236
249
  }
237
250
 
238
251
  test_accepts_an_empty_preferences_array if {
239
252
  \tfixture := given([])
240
253
 
241
254
  \tpreference.source_available with input as fixture
242
- \tpreference.undecided("Marketing") with input as fixture
255
+ \tpreference.undecided("Analytics") with input as fixture
243
256
  }
244
257
 
245
258
  test_reports_a_non_array_preferences_as_unavailable if {
246
- \tnot preference.source_available with input as {"preferences": {"Marketing": true}}
259
+ \tnot preference.source_available with input as {"preferences": {"Analytics": true}}
247
260
  }
248
261
 
249
262
  test_reports_entries_without_a_usable_name_as_unavailable if {
@@ -254,35 +267,35 @@ test_reports_entries_without_a_usable_name_as_unavailable if {
254
267
 
255
268
  test_distinguishes_enabled_and_disabled_choices if {
256
269
  \tfixture := given([
257
- \t\t{"name": "Marketing", "choice": true},
258
- \t\t{"name": "Analytics", "choice": false},
270
+ \t\t{"name": "Analytics", "choice": true},
271
+ \t\t{"name": "SaleOfInfo", "choice": false},
259
272
  \t])
260
273
 
261
- \tpreference.enabled("Marketing") with input as fixture
262
- \tpreference.disabled("Analytics") with input as fixture
263
- \tpreference.decided("Marketing") with input as fixture
274
+ \tpreference.enabled("Analytics") with input as fixture
275
+ \tpreference.disabled("SaleOfInfo") with input as fixture
264
276
  \tpreference.decided("Analytics") with input as fixture
265
- \tnot preference.undecided("Marketing") with input as fixture
277
+ \tpreference.decided("SaleOfInfo") with input as fixture
278
+ \tnot preference.undecided("Analytics") with input as fixture
266
279
  }
267
280
 
268
281
  test_treats_a_null_choice_as_undecided if {
269
- \tfixture := given([{"name": "Marketing", "choice": null}])
282
+ \tfixture := given([{"name": "Analytics", "choice": null}])
270
283
 
271
- \tpreference.undecided("Marketing") with input as fixture
272
- \tnot preference.decided("Marketing") with input as fixture
284
+ \tpreference.undecided("Analytics") with input as fixture
285
+ \tnot preference.decided("Analytics") with input as fixture
273
286
  }
274
287
 
275
288
  test_treats_an_absent_choice_key_as_undecided if {
276
- \tfixture := given([{"name": "Marketing", "channel": "email"}])
289
+ \tfixture := given([{"name": "Analytics", "channel": "email"}])
277
290
 
278
- \tpreference.undecided("Marketing") with input as fixture
291
+ \tpreference.undecided("Analytics") with input as fixture
279
292
  }
280
293
 
281
294
  test_treats_a_non_boolean_choice_as_undecided if {
282
- \tfixture := given([{"name": "Personalization", "choice": "Daily"}])
295
+ \tfixture := given([{"name": "SaleOfInfo", "choice": "Daily"}])
283
296
 
284
- \tpreference.undecided("Personalization") with input as fixture
285
- \tnot preference.decided("Personalization") with input as fixture
297
+ \tpreference.undecided("SaleOfInfo") with input as fixture
298
+ \tnot preference.decided("SaleOfInfo") with input as fixture
286
299
  }
287
300
 
288
301
  # Sombra dedupes by purpose before sending; last-wins keeps the bundle correct
@@ -301,27 +314,16 @@ test_last_wins_on_duplicate_entries if {
301
314
  # rather than treated as a choice.
302
315
  test_ignores_fields_beyond_the_recorded_choice if {
303
316
  \tfixture := given([{
304
- \t\t"name": "Marketing",
317
+ \t\t"name": "Analytics",
305
318
  \t\t"choice": true,
306
319
  \t\t"evidence": "consent_banner",
307
320
  \t\t"days_since_choice": 45,
308
321
  \t\t"channel": "email",
309
322
  \t}])
310
323
 
311
- \tpreference.enabled("Marketing") with input as fixture
324
+ \tpreference.enabled("Analytics") with input as fixture
312
325
  }
313
- `,description:`Create preference resolution tests`},{path:`${t}/${e}/main.rego`,contents:`# METADATA
314
- # title: Permissions bundle root
315
- # description: |
316
- # Declares the Permissions envelope schema for this package and all
317
- # subpackages (helpers, purposes, and static config data).
318
- # scope: subpackages
319
- # schemas:
320
- # - input: schema.${e}.input
321
- package ${e}
322
-
323
- import rego.v1
324
- `,description:`Create the bundle root package with schema declaration`},{path:`${t}/${e}/purposes/analytics/analytics.rego`,contents:`# METADATA
326
+ `,description:`Create preference resolution tests`},{path:`${n}/${e}/purposes/analytics/analytics.rego`,contents:`# METADATA
325
327
  # title: Analytics purpose decision
326
328
  # description: |
327
329
  # The Analytics purpose's verdict as a \`result\` document
@@ -357,7 +359,7 @@ result := {
357
359
  } if {
358
360
  \tpreference.undecided("Analytics")
359
361
  }
360
- `,description:`Create the analytics purpose decision rule`},{path:`${t}/${e}/purposes/analytics/analytics_test.rego`,contents:`# Policy outcomes for the Analytics purpose (the queried document).
362
+ `,description:`Create the analytics purpose decision rule`},{path:`${n}/${e}/purposes/analytics/analytics_test.rego`,contents:`# Policy outcomes for the Analytics purpose (the queried document).
361
363
  package ${e}.purposes.analytics_test
362
364
 
363
365
  import rego.v1
@@ -415,7 +417,7 @@ test_malformed_preferences_are_treated_as_undecided if {
415
417
  \t\t"reason_code": "default_allow",
416
418
  \t}
417
419
  }
418
- `,description:`Create analytics purpose decision tests`},{path:`${t}/${e}/purposes/entrypoint.rego`,contents:`# METADATA
420
+ `,description:`Create analytics purpose decision tests`},{path:`${n}/${e}/purposes/entrypoint.rego`,contents:`# METADATA
419
421
  # title: Purpose decisions
420
422
  # description: Returns each purpose's decision and reason code.
421
423
  # scope: package
@@ -423,5 +425,6 @@ test_malformed_preferences_are_treated_as_undecided if {
423
425
  package ${e}.purposes
424
426
 
425
427
  import rego.v1
426
- `,description:`Create the purposes entrypoint`},{path:`${t}/input.example.json`,contents:n,description:`Create a sanitized permissions evaluation input example`},{path:`${t}/input.json`,contents:n,description:`Create a local evaluation input (gitignored copy of the example)`},{path:`${t}/.gitignore`,contents:b,description:`Ignore only the private local input file`}]}function j(e,t){switch(e){case`generic`:return D(t);case`permissions`:return A(t);default:throw Error(`Unknown policy template: ${String(e)}`)}}const M=`transcend/policy`;function N(e,t=M){return r(e,t)}function P(e,t){if(!e.fs.existsSync(t)||!e.fs.statSync(t).isDirectory())return[];let r=n(t,d);return e.fs.existsSync(r)&&e.fs.statSync(r).isFile()?[t]:e.fs.readdirSync(t,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>n(t,e.name)).filter(t=>{let r=n(t,d);return e.fs.existsSync(r)&&e.fs.statSync(r).isFile()}).sort((e,t)=>e.localeCompare(t))}function F(n,r=M){let i=n.process.cwd(),a=N(i,r);if(n.fs.existsSync(a)&&!n.fs.statSync(a).isDirectory())throw Error(`Policy target is not a directory: ${a}`);return{invocationDirectory:i,targetDirectory:a,...t(n,{invocationDirectory:i,targetDirectory:a,standaloneProjectRoot:i}),relativePaths:e(n,a),relativeFilePaths:e(n,a,{includeDirectories:!1})}}export{_,f as a,u as c,T as d,m as f,C as g,j as h,N as i,c as l,E as m,P as n,d as o,w as p,F as r,p as s,M as t,l as u};
427
- //# sourceMappingURL=policy-project-discovery-C29UxWwt.mjs.map
428
+ `,description:`Create the purposes entrypoint`},{path:`${n}/input.example.json`,contents:r,description:`Create a sanitized permissions evaluation input example`},{path:`${n}/input.json`,contents:r,description:`Create a local evaluation input (gitignored copy of the example)`},{path:`${n}/.gitignore`,contents:w,description:`Ignore only the private local input file`}]}function I(e,t,n=A(t)){switch(e){case _.Generic:return M(t,n);case _.Permissions:return F(t,n);default:throw Error(`Unknown policy template: ${String(e)}`)}}function L(e){let{bundleDirectory:t,root:n,template:r}=e,i=r===_.Permissions?`data.${n}.purposes`:`data.${n}.result`;return[`transcend policy eval ${t} \\`,` --package=${i} \\`,` --input=${t}/input.json \\`,` --schema=${t}/${p}`].join(`
429
+ `)}const R=`transcend/policy`;function z(e,t=R){return i(e,t)}function B(e,t){if(!e.fs.existsSync(t)||!e.fs.statSync(t).isDirectory())return[];let n=r(t,m);return e.fs.existsSync(n)&&e.fs.statSync(n).isFile()?[t]:e.fs.readdirSync(t,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>r(t,e.name)).filter(t=>{let n=r(t,m);return e.fs.existsSync(n)&&e.fs.statSync(n).isFile()}).sort((e,t)=>e.localeCompare(t))}function V(e,r=R){let i=e.process.cwd(),a=z(i,r);if(e.fs.existsSync(a)&&!e.fs.statSync(a).isDirectory())throw Error(`Policy target is not a directory: ${a}`);return{invocationDirectory:i,targetDirectory:a,...n(e,{invocationDirectory:i,targetDirectory:a,standaloneProjectRoot:i}),relativePaths:t(e,a),relativeFilePaths:t(e,a,{includeDirectories:!1})}}export{j as S,A as _,h as a,D as b,m as c,u as d,d as f,_ as g,O as h,z as i,g as l,v as m,B as n,l as o,k as p,V as r,p as s,R as t,f as u,L as v,x,I as y};
430
+ //# sourceMappingURL=policy-project-discovery-B4cFXUlA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy-project-discovery-B4cFXUlA.mjs","names":["permissionsPolicyInputSchema.$id","CLI_VERSION","permissionsPolicyInputSchema","permissionsPolicyInputSchema.examples"],"sources":["../schema/permissions-policy-input.json","../src/lib/policy/policy-scaffold-templates.ts","../src/lib/policy/policy-project-discovery.ts"],"sourcesContent":["","import yaml from 'js-yaml';\n\nimport permissionsPolicyInputSchema from '../../../schema/permissions-policy-input.json' with { type: 'json' };\nimport { version as CLI_VERSION } from '../../constants.js';\n\n/** Published Permissions API OPA input schema `$id` (raw GitHub URL). */\nexport const PERMISSIONS_POLICY_INPUT_SCHEMA_ID = permissionsPolicyInputSchema.$id;\n\n/** OPA version targeted by generated policy authoring configuration. */\nexport const POLICY_STARTER_OPA_VERSION = '1.18.2';\n\n/**\n * Package-path prefix for the disposable starter bundle.\n *\n * Matches OPA `.manifest` `roots` and Regal `project.roots` (not a filesystem\n * folder name by itself). The default publish directory is `{root}-bundle/`;\n * `policy new --bundle-dir` can override that basename.\n */\nexport const POLICY_STARTER_ROOT = 'example';\n\n/** Publish directory name for the disposable starter (`{root}-bundle`). */\nexport const POLICY_STARTER_BUNDLE_DIRECTORY = `${POLICY_STARTER_ROOT}-bundle`;\n\n/** Input JSON Schema filename written beside each publish directory's fixtures. */\nexport const POLICY_INPUT_SCHEMA_FILENAME = 'input.schema.json';\n\n/** One deterministic file in the safe policy starter. */\nexport interface PolicyStarterFile {\n /** POSIX-style path relative to the policy workspace directory. */\n path: string;\n /** Complete UTF-8 file contents. */\n contents: string;\n /** Human-readable reason shown in the plan. */\n description: string;\n}\n\n/** OPA bundle manifest filename used for local authoring and upload. */\nexport const POLICY_MANIFEST_FILENAME = '.manifest';\n\n/**\n * Remote bundle name reserved for Permissions API.\n *\n * Upload treats every bundle the same; Sombra's Permissions API always queries\n * this fixed name (never taken from the request body).\n */\nexport const PERMISSIONS_POLICY_BUNDLE_NAME = 'permissions';\n\n/** OPA `.manifest` `metadata` key for Transcend authoring hints. */\nexport const POLICY_MANIFEST_TRANSCEND_METADATA_KEY = 'transcend.io';\n\n/** Supported policy bundle templates (enum-style constants). */\nexport const PolicyTemplate = {\n Generic: 'generic',\n Permissions: 'permissions',\n} as const;\n\n/** Supported policy bundle template names. */\nexport const POLICY_TEMPLATE_NAMES = [PolicyTemplate.Generic, PolicyTemplate.Permissions] as const;\n\n/** A supported policy bundle template name. */\nexport type PolicyTemplateName = (typeof PolicyTemplate)[keyof typeof PolicyTemplate];\n\n/**\n * OPA `.manifest` `metadata.transcend.io` key for the CLI version that\n * generated the scaffold template.\n */\nexport const POLICY_MANIFEST_TEMPLATE_VERSION_KEY = 'templateVersion';\n\n/**\n * Build an OPA bundle manifest for a given root and scaffold template.\n *\n * `metadata.transcend.io.template` and `templateVersion` are authoring hints\n * only — Policy Engine upload does not branch on them. Permissions API still\n * keys off the remote bundle name {@link PERMISSIONS_POLICY_BUNDLE_NAME}.\n * `templateVersion` records the `@transcend-io/cli` package version used to\n * generate the scaffold.\n *\n * @param root - Package root\n * @param template - Scaffold template that produced this bundle\n * @returns Manifest JSON\n */\nexport function buildPolicyManifestTemplate(\n root: string,\n template: PolicyTemplateName = PolicyTemplate.Generic,\n): string {\n return `{\n \"$schema\": \"https://openpolicyagent.org/schemas/bundle/v1/manifest.schema.json\",\n \"revision\": \"\",\n \"roots\": [\"${root}\"],\n \"rego_version\": 1,\n \"metadata\": {\n \"${POLICY_MANIFEST_TRANSCEND_METADATA_KEY}\": {\n \"template\": \"${template}\",\n \"${POLICY_MANIFEST_TEMPLATE_VERSION_KEY}\": \"${CLI_VERSION}\"\n }\n }\n}\n`;\n}\n\n/** OPA bundle manifest for the disposable starter publish directory. */\nexport const POLICY_MANIFEST_TEMPLATE = buildPolicyManifestTemplate(\n POLICY_STARTER_ROOT,\n PolicyTemplate.Generic,\n);\n\n/**\n * Build workspace-level Regal configuration for given roots.\n *\n * `project.roots` are package-path prefixes (same meaning as OPA `.manifest`\n * roots), not filesystem folders.\n *\n * @param roots - Package-path roots\n * @returns YAML configuration\n */\nexport function buildPolicyRegalConfigTemplate(roots: readonly string[]): string {\n const rootsSection =\n roots.length === 0\n ? ' roots: []'\n : ` roots:\\n${roots.map((root) => ` - ${root}`).join('\\n')}`;\n return `# Workspace-level Regal config for both publishable bundles under this tree.\n# \\`project.roots\\` are package-path prefixes (same meaning as OPA \\`.manifest\\`\n# roots), not filesystem folders. Each bundle also has its own \\`.manifest\\`.\ncapabilities:\n from:\n engine: opa\n version: v${POLICY_STARTER_OPA_VERSION}\nproject:\n${rootsSection}\n rego-version: 1\n`;\n}\n\n/**\n * Merge one package-path root into an existing Regal config without wiping\n * unrelated keys (custom rules, ignores, etc.).\n *\n * Comments and key order may be reformatted by the YAML serializer. Invalid\n * `project.roots` shapes throw instead of silently dropping prior roots.\n *\n * @param existingContents - Current `.regal/config.yaml` contents\n * @param rootToAdd - Package-path root to include\n * @returns Updated file contents and the full roots list\n */\nexport function mergePolicyRegalConfigRoots(\n existingContents: string,\n rootToAdd: string,\n): { contents: string; roots: string[] } {\n const trimmed = existingContents.trim();\n if (trimmed.length === 0) {\n const roots = [rootToAdd];\n return { contents: buildPolicyRegalConfigTemplate(roots), roots };\n }\n\n let parsed: unknown;\n try {\n parsed = yaml.load(existingContents);\n } catch (error) {\n const detail = error instanceof Error ? error.message : String(error);\n throw new Error(`.regal/config.yaml is not valid YAML: ${detail}`);\n }\n\n if (parsed === null || parsed === undefined) {\n const roots = [rootToAdd];\n return { contents: buildPolicyRegalConfigTemplate(roots), roots };\n }\n if (typeof parsed !== 'object' || Array.isArray(parsed)) {\n throw new Error('.regal/config.yaml must be a YAML mapping at the top level.');\n }\n\n const config = { ...(parsed as Record<string, unknown>) };\n const existingProject = config.project;\n if (\n existingProject !== undefined &&\n existingProject !== null &&\n (typeof existingProject !== 'object' || Array.isArray(existingProject))\n ) {\n throw new Error('.regal/config.yaml project must be a YAML mapping when present.');\n }\n\n const project: Record<string, unknown> = {\n ...((existingProject as Record<string, unknown> | undefined) ?? {}),\n };\n const existingRoots = project.roots;\n let roots: string[];\n if (existingRoots === undefined) {\n roots = [rootToAdd];\n } else if (\n Array.isArray(existingRoots) &&\n existingRoots.every((root): root is string => typeof root === 'string')\n ) {\n roots = [...new Set([...existingRoots, rootToAdd])].sort((left, right) =>\n left.localeCompare(right),\n );\n } else {\n throw new Error(\n '.regal/config.yaml project.roots must be an array of strings. ' +\n 'Fix the Regal config before running `transcend policy new`.',\n );\n }\n\n project.roots = roots;\n if (project['rego-version'] === undefined) {\n project['rego-version'] = 1;\n }\n config.project = project;\n\n if (config.capabilities === undefined) {\n config.capabilities = {\n from: {\n engine: 'opa',\n version: `v${POLICY_STARTER_OPA_VERSION}`,\n },\n };\n }\n\n const dumped = yaml.dump(config, {\n lineWidth: -1,\n noRefs: true,\n sortKeys: false,\n });\n return {\n contents: dumped.endsWith('\\n') ? dumped : `${dumped}\\n`,\n roots,\n };\n}\n\n/**\n * Workspace-level Regal configuration.\n *\n * `project.roots` are package-path prefixes (same meaning as OPA `.manifest`\n * roots), not filesystem folders.\n */\nexport const POLICY_REGAL_CONFIG_TEMPLATE = buildPolicyRegalConfigTemplate([POLICY_STARTER_ROOT]);\n\n/** Regal config for an empty workspace with no bundles yet. */\nexport const POLICY_REGAL_CONFIG_EMPTY_TEMPLATE = buildPolicyRegalConfigTemplate([]);\n\n/** Disposable, fail-closed example policy. */\nexport const POLICY_RESULT_REGO_TEMPLATE = `# METADATA\n# title: Disposable example result\n# description: |\n# A fail-closed teaching entrypoint. Replace this example with the document\n# tree and result contract required by your application.\n# scope: package\n# entrypoint: true\npackage ${POLICY_STARTER_ROOT}.result\n\nimport rego.v1\n\ndefault decision := \"deny\"\n\ndecision := \"allow\" if {\n\tinput.subject.trusted == true\n}\n\ndefault reason_code := \"untrusted_or_invalid_input\"\n\nreason_code := \"trusted_subject\" if {\n\tdecision == \"allow\"\n}\n`;\n\n/** Executable tests adjacent to the disposable example policy. */\nexport const POLICY_RESULT_TEST_REGO_TEMPLATE = `package ${POLICY_STARTER_ROOT}.result_test\n\nimport data.${POLICY_STARTER_ROOT}.result\nimport rego.v1\n\ntest_denies_untrusted_subject if {\n\tresult.decision == \"deny\" with input as {\"subject\": {\"trusted\": false}}\n\tresult.reason_code == \"untrusted_or_invalid_input\" with input as {\"subject\": {\"trusted\": false}}\n}\n\ntest_fails_closed_for_missing_subject if {\n\tresult.decision == \"deny\" with input as {}\n\tresult.reason_code == \"untrusted_or_invalid_input\" with input as {}\n}\n\ntest_allows_trusted_subject if {\n\tresult.decision == \"allow\" with input as {\"subject\": {\"trusted\": true}}\n\tresult.reason_code == \"trusted_subject\" with input as {\"subject\": {\"trusted\": true}}\n}\n`;\n\n/** Sanitized local input example containing no credentials or personal data. */\nexport const POLICY_INPUT_EXAMPLE_TEMPLATE = `{\n \"subject\": {\n \"trusted\": false\n }\n}\n`;\n\n/** Input JSON Schema for the disposable starter (editor + \\`opa check -s\\`). */\nexport const POLICY_INPUT_SCHEMA_TEMPLATE = `{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": \"https://transcend.io/policy-schemas/${POLICY_STARTER_ROOT}/input.json\",\n \"title\": \"Example policy input\",\n \"description\": \"Disposable teaching envelope for the example bundle.\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"subject\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"trusted\": {\n \"type\": \"boolean\",\n \"description\": \"When true, the example policy allows; otherwise it denies.\"\n }\n }\n }\n }\n}\n`;\n\n/** Target-local ignore rules for private evaluation input only. */\nexport const POLICY_GITIGNORE_TEMPLATE = `# Local policy evaluation input (VS Code / Regal look for input.json here).\n/input.json\n`;\n\n/** Concise workspace-local authoring guide (multi-bundle, empty workspace). */\nexport const POLICY_README_TEMPLATE = `# Transcend Policy\n\nMulti-bundle workspace for Transcend Policy Engine bundles\n(OPA / Rego v1). Requires **Transcend CLI ≥ 11** (\\`transcend policy --help\\`\nshould list \\`init\\`, \\`new\\`, and positional \\`[directory]\\` args).\n\nEach \\`*-bundle/\\` directory is a separate publishable unit (own \\`.manifest\\`,\ninput, and query path). Add a new bundle with:\n\n\\`\\`\\`sh\ntranscend policy new\n\\`\\`\\`\n\n## Quick start\n\n\\`\\`\\`sh\ntranscend policy init # create the workspace\ntranscend policy new --template generic # add a bundle from a template\n\ntranscend policy lint --noInteractive\ntranscend policy test\ntranscend policy eval transcend/policy/example-bundle \\\\\n --package=data.example.result \\\\\n --input=transcend/policy/example-bundle/input.json\n\\`\\`\\`\n\n\\`policy new\\` also writes a gitignored \\`input.json\\` (copy of \\`input.example.json\\`)\nfor local Evaluate. \\`policy lint\\` / \\`policy test\\` default to every child with a\n\\`.manifest\\` and use bundle-mode \\`opa test -b\\`, so both input files can coexist\nwithout a merge error.\n\n## Layout\n\n\\`\\`\\`\ntranscend/policy/\n example-bundle/ # publish directory (added by policy new)\n example/ # package root (matches .manifest roots)\n input.example.json\n input.json # local only (gitignored)\n input.schema.json # input JSON Schema (editor + opa --schema)\n .regal/config.yaml\n\\`\\`\\`\n\nReplace or delete example bundles when you have a real policy. Publish each\nbundle separately (\\`transcend policy publish --remote-bundle-name … <dir>\\`).\n\n## Permissions API\n\nScaffold the Permissions starter, then simulate the query Sombra runs:\n\n\\`\\`\\`sh\ntranscend policy new \\\\\n --template permissions \\\\\n --name ${PERMISSIONS_POLICY_BUNDLE_NAME} \\\\\n --bundle-dir ${PERMISSIONS_POLICY_BUNDLE_NAME}-bundle \\\\\n --yes\n\ntranscend policy eval transcend/policy/${PERMISSIONS_POLICY_BUNDLE_NAME}-bundle \\\\\n --package=data.${PERMISSIONS_POLICY_BUNDLE_NAME}.purposes \\\\\n --input=transcend/policy/${PERMISSIONS_POLICY_BUNDLE_NAME}-bundle/input.json \\\\\n --schema=transcend/policy/${PERMISSIONS_POLICY_BUNDLE_NAME}-bundle/input.schema.json\n\\`\\`\\`\n\nUpload does **not** distinguish bundle kinds. What makes a bundle “Permissions”\nis the remote name plus where Sombra queries it:\n\n- **Permissions API** always loads the fixed remote bundle name\n \\`${PERMISSIONS_POLICY_BUNDLE_NAME}\\`. Publish that starter with\n \\`--remote-bundle-name=${PERMISSIONS_POLICY_BUNDLE_NAME}\\`.\n- **Generic / decide** bundles use any other \\`--remote-bundle-name\\` and the decide\n path.\n\nScaffolded \\`.manifest\\` files may include \\`metadata.transcend.io.template\\`\n(\\`generic\\` or \\`permissions\\`) and \\`templateVersion\\` (the \\`@transcend-io/cli\\`\nversion that generated the scaffold) as authoring hints. Upload ignores them;\n\\`policy publish\\` may warn when the template hint and \\`--remote-bundle-name\\` disagree.\n`;\n\n/** Workspace-relative path to the disposable example entrypoint. */\nexport const POLICY_STARTER_RESULT_REGO_PATH = `${POLICY_STARTER_BUNDLE_DIRECTORY}/${POLICY_STARTER_ROOT}/result/result.rego`;\n\n/** Workspace-relative path to the disposable example tests. */\nexport const POLICY_STARTER_RESULT_TEST_REGO_PATH = `${POLICY_STARTER_BUNDLE_DIRECTORY}/${POLICY_STARTER_ROOT}/result/result_test.rego`;\n\n/** Complete safe starter in deterministic plan order. */\nconst POLICY_STARTER_FILES: readonly PolicyStarterFile[] = [\n {\n path: `${POLICY_STARTER_BUNDLE_DIRECTORY}/${POLICY_MANIFEST_FILENAME}`,\n contents: POLICY_MANIFEST_TEMPLATE,\n description: 'Create the OPA bundle .manifest',\n },\n {\n path: '.regal/config.yaml',\n contents: POLICY_REGAL_CONFIG_TEMPLATE,\n description: `Pin strict Rego v1 linting to OPA ${POLICY_STARTER_OPA_VERSION} capabilities`,\n },\n {\n path: `${POLICY_STARTER_BUNDLE_DIRECTORY}/${POLICY_INPUT_SCHEMA_FILENAME}`,\n contents: POLICY_INPUT_SCHEMA_TEMPLATE,\n description: 'Create the input JSON Schema for the example bundle',\n },\n {\n path: POLICY_STARTER_RESULT_REGO_PATH,\n contents: POLICY_RESULT_REGO_TEMPLATE,\n description: 'Create a documented fail-closed result entrypoint',\n },\n {\n path: POLICY_STARTER_RESULT_TEST_REGO_PATH,\n contents: POLICY_RESULT_TEST_REGO_TEMPLATE,\n description: 'Create executable tests for allow and fail-closed decisions',\n },\n {\n path: `${POLICY_STARTER_BUNDLE_DIRECTORY}/input.example.json`,\n contents: POLICY_INPUT_EXAMPLE_TEMPLATE,\n description: 'Create a sanitized local evaluation input',\n },\n {\n path: `${POLICY_STARTER_BUNDLE_DIRECTORY}/.gitignore`,\n contents: POLICY_GITIGNORE_TEMPLATE,\n description: 'Ignore only the private local input file',\n },\n {\n path: 'README.md',\n contents: POLICY_README_TEMPLATE,\n description: 'Create the concise policy project guide',\n },\n];\n\n/**\n * Generate an independent copy of the safe policy starter.\n *\n * @returns Deterministic relative files\n */\nexport function generatePolicyStarterFiles(): PolicyStarterFile[] {\n return POLICY_STARTER_FILES.map((file) => ({ ...file }));\n}\n\n// ---------------------------------------------------------------------------\n// Workspace-only init files (no bundles)\n// ---------------------------------------------------------------------------\n\n/** Files created by `policy init` — empty workspace only. */\nconst POLICY_INIT_WORKSPACE_FILES: readonly PolicyStarterFile[] = [\n {\n path: '.regal/config.yaml',\n contents: POLICY_REGAL_CONFIG_EMPTY_TEMPLATE,\n description: `Pin strict Rego v1 linting to OPA ${POLICY_STARTER_OPA_VERSION} capabilities`,\n },\n {\n path: 'README.md',\n contents: POLICY_README_TEMPLATE,\n description: 'Create the concise multi-bundle workspace guide',\n },\n];\n\n/**\n * Generate files for an empty workspace (init without bundles).\n *\n * @returns Deterministic workspace files\n */\nexport function generatePolicyWorkspaceFiles(): PolicyStarterFile[] {\n return POLICY_INIT_WORKSPACE_FILES.map((file) => ({ ...file }));\n}\n\n// ---------------------------------------------------------------------------\n// Policy bundle templates (used by `policy new`)\n// ---------------------------------------------------------------------------\n\n/** Interactive labels for each policy template. */\nexport const POLICY_TEMPLATE_PROMPT_LABELS: Record<PolicyTemplateName, string> = {\n [PolicyTemplate.Generic]: 'Generic example',\n [PolicyTemplate.Permissions]: 'Permission API starter',\n};\n\n/** Default root names for each template. */\nexport const POLICY_TEMPLATE_DEFAULT_ROOTS: Record<PolicyTemplateName, string> = {\n [PolicyTemplate.Generic]: 'example',\n [PolicyTemplate.Permissions]: PERMISSIONS_POLICY_BUNDLE_NAME,\n};\n\n/**\n * Build the bundle directory name from a root.\n *\n * @param root - Package root\n * @returns Bundle directory name\n */\nexport function buildBundleDirectoryName(root: string): string {\n return `${root}-bundle`;\n}\n\n/**\n * Validate a local bundle directory basename (under the policy workspace).\n *\n * @param value - Proposed directory basename\n * @returns True or error message\n */\nexport function validateBundleDirectoryName(value: string): true | string {\n if (!value) {\n return 'Enter a bundle directory name.';\n }\n if (value === '.' || value === '..' || value.includes('/') || value.includes('\\\\')) {\n return 'Bundle directory must be a single path segment (no slashes).';\n }\n if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/u.test(value)) {\n return 'Bundle directory must be alphanumeric (plus ., _, -), e.g. \"my-bundle\".';\n }\n if (value.length > 128) {\n return 'Bundle directory cannot exceed 128 characters.';\n }\n return true;\n}\n\n/**\n * Generate bundle files for the generic template.\n *\n * @param root - Package root name\n * @param bundleDir - Publish directory basename under the workspace\n * @returns Bundle files relative to the workspace\n */\nexport function generateGenericBundleFiles(\n root: string,\n bundleDir: string = buildBundleDirectoryName(root),\n): PolicyStarterFile[] {\n const bundle = bundleDir;\n return [\n {\n path: `${bundle}/${POLICY_MANIFEST_FILENAME}`,\n contents: buildPolicyManifestTemplate(root, PolicyTemplate.Generic),\n description: 'Create the OPA bundle .manifest',\n },\n {\n path: `${bundle}/${POLICY_INPUT_SCHEMA_FILENAME}`,\n contents: `{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": \"https://transcend.io/policy-schemas/${root}/input.json\",\n \"title\": \"${root === 'example' ? 'Example policy input' : `${root} policy input`}\",\n \"description\": \"${root === 'example' ? 'Disposable teaching envelope for the example bundle.' : `Input envelope for the ${root} bundle.`}\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"subject\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"trusted\": {\n \"type\": \"boolean\",\n \"description\": \"When true, the ${root === 'example' ? 'example' : root} policy allows; otherwise it denies.\"\n }\n }\n }\n }\n}\n`,\n description: `Create the input JSON Schema for the ${root} bundle`,\n },\n {\n path: `${bundle}/${root}/result/result.rego`,\n contents: `# METADATA\n# title: ${root === 'example' ? 'Disposable example result' : `${root} result`}\n# description: |\n# A fail-closed ${root === 'example' ? 'teaching ' : ''}entrypoint. Replace this ${root === 'example' ? 'example ' : ''}with the document\n# tree and result contract required by your application.\n# scope: package\n# entrypoint: true\npackage ${root}.result\n\nimport rego.v1\n\ndefault decision := \"deny\"\n\ndecision := \"allow\" if {\n\\tinput.subject.trusted == true\n}\n\ndefault reason_code := \"untrusted_or_invalid_input\"\n\nreason_code := \"trusted_subject\" if {\n\\tdecision == \"allow\"\n}\n`,\n description: 'Create a documented fail-closed result entrypoint',\n },\n {\n path: `${bundle}/${root}/result/result_test.rego`,\n contents: `package ${root}.result_test\n\nimport data.${root}.result\nimport rego.v1\n\ntest_denies_untrusted_subject if {\n\\tresult.decision == \"deny\" with input as {\"subject\": {\"trusted\": false}}\n\\tresult.reason_code == \"untrusted_or_invalid_input\" with input as {\"subject\": {\"trusted\": false}}\n}\n\ntest_fails_closed_for_missing_subject if {\n\\tresult.decision == \"deny\" with input as {}\n\\tresult.reason_code == \"untrusted_or_invalid_input\" with input as {}\n}\n\ntest_allows_trusted_subject if {\n\\tresult.decision == \"allow\" with input as {\"subject\": {\"trusted\": true}}\n\\tresult.reason_code == \"trusted_subject\" with input as {\"subject\": {\"trusted\": true}}\n}\n`,\n description: 'Create executable tests for allow and fail-closed decisions',\n },\n {\n path: `${bundle}/input.example.json`,\n contents: POLICY_INPUT_EXAMPLE_TEMPLATE,\n description: 'Create a sanitized local evaluation input example',\n },\n {\n path: `${bundle}/input.json`,\n contents: POLICY_INPUT_EXAMPLE_TEMPLATE,\n description: 'Create a local evaluation input (gitignored copy of the example)',\n },\n {\n path: `${bundle}/.gitignore`,\n contents: POLICY_GITIGNORE_TEMPLATE,\n description: 'Ignore only the private local input file',\n },\n ];\n}\n\n/**\n * Generate bundle files for the permissions template.\n *\n * @param root - Package root name\n * @returns Bundle files relative to the workspace\n */\n/**\n * Serialize the published Permissions input schema for the local bundle path.\n *\n * Written as `{bundle}/input.schema.json` so editors and `opa --schema` can\n * type-check the envelope offline without a workspace `schemas/` directory.\n *\n * @returns Schema file contents ending in a trailing newline\n */\nexport function buildPermissionsInputSchemaContents(): string {\n return `${JSON.stringify(permissionsPolicyInputSchema, null, 2)}\\n`;\n}\n\n/**\n * Serialize the published Permissions input example for local evaluation.\n *\n * @returns Example input JSON ending in a trailing newline\n */\nexport function buildPermissionsInputExampleContents(): string {\n const [example] = permissionsPolicyInputSchema.examples;\n if (!example) {\n throw new Error('permissions-policy-input.json must declare at least one example');\n }\n return `${JSON.stringify(example, null, 2)}\\n`;\n}\n\n/**\n * Generate bundle files for the permissions template.\n *\n * @param root - Package root name\n * @param bundleDir - Publish directory basename under the workspace\n * @returns Bundle files relative to the workspace\n */\nexport function generatePermissionsBundleFiles(\n root: string,\n bundleDir: string = buildBundleDirectoryName(root),\n): PolicyStarterFile[] {\n const bundle = bundleDir;\n const inputExample = buildPermissionsInputExampleContents();\n return [\n {\n path: `${bundle}/${POLICY_MANIFEST_FILENAME}`,\n contents: buildPolicyManifestTemplate(root, PolicyTemplate.Permissions),\n description: 'Create the OPA bundle .manifest',\n },\n {\n path: `${bundle}/${POLICY_INPUT_SCHEMA_FILENAME}`,\n contents: buildPermissionsInputSchemaContents(),\n description: `Create the input JSON Schema for the ${root} bundle (from published permissions-policy-input.json)`,\n },\n {\n path: `${bundle}/${root}/config/config.rego`,\n contents: `# METADATA\n# title: Permissions config\n# description: |\n# Static bundle configuration. Values come from data.json in this directory.\npackage ${root}.config\n\nimport rego.v1\n`,\n description: 'Create the static bundle configuration package',\n },\n {\n path: `${bundle}/${root}/config/data.json`,\n contents: `{\n \"default_consent_allowed\": true,\n \"purposes\": [\n \"Analytics\",\n \"SaleOfInfo\"\n ],\n \"default_consent\": {}\n}\n`,\n description: 'Create the static purpose configuration data',\n },\n {\n path: `${bundle}/${root}/helpers/preference/preference.rego`,\n contents: `# METADATA\n# title: Purpose preference resolution\n# description: |\n# Resolves the subject's recorded choice for one purpose from the OPA\n# \\`input.preferences\\` array Sombra injects (one \\`{name, choice,\n# days_since_choice?}\\` entry per purpose; \\`choice\\` may be null when unset).\npackage ${root}.helpers.preference\n\nimport rego.v1\n\nimport data.${root}.config\n\nraw_preferences := object.get(input, \"preferences\", [])\n\nsource_available if {\n\\tis_array(raw_preferences)\n\\tevery entry in raw_preferences {\n\\t\\tis_object(entry)\n\\t\\tis_string(entry.name)\n\\t\\tentry.name != \"\"\n\\t}\n}\n\n# Boolean choice for a purpose, last-wins across duplicate entries (matching\n# Sombra's own dedup semantics). Returns the boolean only when a usable choice\n# exists; otherwise the rule is undefined and the purpose is undecided.\nchoice(name) := choice if {\n\\tsource_available\n\\tmatching := [entry | some entry in raw_preferences; entry.name == name]\n\\tcount(matching) > 0\n\\tlast := matching[count(matching) - 1]\n\\tchoice := object.get(last, \"choice\", null)\n\\tis_boolean(choice)\n}\n\nenabled(name) if choice(name) == true\n\ndisabled(name) if choice(name) == false\n\ndecided(name) if enabled(name)\n\ndecided(name) if disabled(name)\n\n# A configured purpose with no usable boolean choice is undecided: the subject\n# never chose, so the resolved default applies (not an opt-out).\nundecided(name) if {\n\\tname in config.purposes\n\\tnot enabled(name)\n\\tnot disabled(name)\n}\n`,\n description: 'Create purpose preference resolution helpers',\n },\n {\n path: `${bundle}/${root}/helpers/preference/preference_test.rego`,\n contents: `# Mechanical tests for purpose preference resolution.\n# Policy outcomes are tested beside the public entrypoint.\npackage ${root}.helpers.preference_test\n\nimport rego.v1\n\nimport data.${root}.helpers.preference\n\ngiven(preferences) := {\"preferences\": preferences}\n\ntest_treats_an_absent_preferences_array_as_no_recorded_choices if {\n\\tfixture := {}\n\n\\tpreference.source_available with input as fixture\n\\tpreference.undecided(\"Analytics\") with input as fixture\n}\n\ntest_accepts_an_empty_preferences_array if {\n\\tfixture := given([])\n\n\\tpreference.source_available with input as fixture\n\\tpreference.undecided(\"Analytics\") with input as fixture\n}\n\ntest_reports_a_non_array_preferences_as_unavailable if {\n\\tnot preference.source_available with input as {\"preferences\": {\"Analytics\": true}}\n}\n\ntest_reports_entries_without_a_usable_name_as_unavailable if {\n\\tnot preference.source_available with input as {\"preferences\": [{}]}\n\\tnot preference.source_available with input as {\"preferences\": [{\"name\": \"\"}]}\n\\tnot preference.source_available with input as {\"preferences\": [{\"choice\": true}]}\n}\n\ntest_distinguishes_enabled_and_disabled_choices if {\n\\tfixture := given([\n\\t\\t{\"name\": \"Analytics\", \"choice\": true},\n\\t\\t{\"name\": \"SaleOfInfo\", \"choice\": false},\n\\t])\n\n\\tpreference.enabled(\"Analytics\") with input as fixture\n\\tpreference.disabled(\"SaleOfInfo\") with input as fixture\n\\tpreference.decided(\"Analytics\") with input as fixture\n\\tpreference.decided(\"SaleOfInfo\") with input as fixture\n\\tnot preference.undecided(\"Analytics\") with input as fixture\n}\n\ntest_treats_a_null_choice_as_undecided if {\n\\tfixture := given([{\"name\": \"Analytics\", \"choice\": null}])\n\n\\tpreference.undecided(\"Analytics\") with input as fixture\n\\tnot preference.decided(\"Analytics\") with input as fixture\n}\n\ntest_treats_an_absent_choice_key_as_undecided if {\n\\tfixture := given([{\"name\": \"Analytics\", \"channel\": \"email\"}])\n\n\\tpreference.undecided(\"Analytics\") with input as fixture\n}\n\ntest_treats_a_non_boolean_choice_as_undecided if {\n\\tfixture := given([{\"name\": \"SaleOfInfo\", \"choice\": \"Daily\"}])\n\n\\tpreference.undecided(\"SaleOfInfo\") with input as fixture\n\\tnot preference.decided(\"SaleOfInfo\") with input as fixture\n}\n\n# Sombra dedupes by purpose before sending; last-wins keeps the bundle correct\n# against hand-crafted input that names the same purpose twice.\ntest_last_wins_on_duplicate_entries if {\n\\tfixture := given([\n\\t\\t{\"name\": \"SaleOfInfo\", \"choice\": true},\n\\t\\t{\"name\": \"SaleOfInfo\", \"choice\": false},\n\\t])\n\n\\tpreference.disabled(\"SaleOfInfo\") with input as fixture\n\\tnot preference.enabled(\"SaleOfInfo\") with input as fixture\n}\n\n# Extra fields on an entry (evidence, days_since_choice, channel) are ignored\n# rather than treated as a choice.\ntest_ignores_fields_beyond_the_recorded_choice if {\n\\tfixture := given([{\n\\t\\t\"name\": \"Analytics\",\n\\t\\t\"choice\": true,\n\\t\\t\"evidence\": \"consent_banner\",\n\\t\\t\"days_since_choice\": 45,\n\\t\\t\"channel\": \"email\",\n\\t}])\n\n\\tpreference.enabled(\"Analytics\") with input as fixture\n}\n`,\n description: 'Create preference resolution tests',\n },\n {\n path: `${bundle}/${root}/purposes/analytics/analytics.rego`,\n contents: `# METADATA\n# title: Analytics purpose decision\n# description: |\n# The Analytics purpose's verdict as a \\`result\\` document\n# (\\`data.${root}.purposes.analytics.result\\`).\npackage ${root}.purposes.analytics\n\nimport rego.v1\n\nimport data.${root}.helpers.preference\n\ndefault result := {\n\\t\"decision\": \"deny\",\n\\t\"reason_code\": \"default_deny\",\n}\n\nresult := {\n\\t\"decision\": \"allow\",\n\\t\"reason_code\": \"explicit_allow\",\n} if {\n\\tpreference.enabled(\"Analytics\")\n}\n\nresult := {\n\\t\"decision\": \"deny\",\n\\t\"reason_code\": \"explicit_deny\",\n} if {\n\\tpreference.disabled(\"Analytics\")\n}\n\nresult := {\n\\t\"decision\": \"allow\",\n\\t\"reason_code\": \"default_allow\",\n} if {\n\\tpreference.undecided(\"Analytics\")\n}\n`,\n description: 'Create the analytics purpose decision rule',\n },\n {\n path: `${bundle}/${root}/purposes/analytics/analytics_test.rego`,\n contents: `# Policy outcomes for the Analytics purpose (the queried document).\npackage ${root}.purposes.analytics_test\n\nimport rego.v1\n\nimport data.${root}.purposes.analytics\n\ngiven(preferences) := {\"preferences\": preferences}\n\ntest_explicit_allow if {\n\\tresult := analytics.result with input as given([{\"name\": \"Analytics\", \"choice\": true}])\n\\tresult == {\n\\t\\t\"decision\": \"allow\",\n\\t\\t\"reason_code\": \"explicit_allow\",\n\\t}\n}\n\ntest_explicit_deny if {\n\\tresult := analytics.result with input as given([{\"name\": \"Analytics\", \"choice\": false}])\n\\tresult == {\n\\t\\t\"decision\": \"deny\",\n\\t\\t\"reason_code\": \"explicit_deny\",\n\\t}\n}\n\ntest_undecided_resolves_to_default_allow if {\n\\tresult := analytics.result with input as given([])\n\\tresult == {\n\\t\\t\"decision\": \"allow\",\n\\t\\t\"reason_code\": \"default_allow\",\n\\t}\n}\n\ntest_missing_preferences_resolves_to_default_allow if {\n\\tresult := analytics.result with input as {}\n\\tresult == {\n\\t\\t\"decision\": \"allow\",\n\\t\\t\"reason_code\": \"default_allow\",\n\\t}\n}\n\ntest_non_boolean_choice_falls_back_to_default_allow if {\n\\tresult := analytics.result with input as given([{\"name\": \"Analytics\", \"choice\": \"yes\"}])\n\\tresult == {\n\\t\\t\"decision\": \"allow\",\n\\t\\t\"reason_code\": \"default_allow\",\n\\t}\n}\n\ntest_malformed_preferences_are_treated_as_undecided if {\n\\t# source_available is false, so enabled/disabled never fire; undecided still\n\\t# holds for configured purposes (not enabled and not disabled).\n\\tresult := analytics.result with input as {\"preferences\": {\"Analytics\": true}}\n\\tresult == {\n\\t\\t\"decision\": \"allow\",\n\\t\\t\"reason_code\": \"default_allow\",\n\\t}\n}\n`,\n description: 'Create analytics purpose decision tests',\n },\n {\n path: `${bundle}/${root}/purposes/entrypoint.rego`,\n contents: `# METADATA\n# title: Purpose decisions\n# description: Returns each purpose's decision and reason code.\n# scope: package\n# entrypoint: true\npackage ${root}.purposes\n\nimport rego.v1\n`,\n description: 'Create the purposes entrypoint',\n },\n {\n path: `${bundle}/input.example.json`,\n contents: inputExample,\n description: 'Create a sanitized permissions evaluation input example',\n },\n {\n path: `${bundle}/input.json`,\n contents: inputExample,\n description: 'Create a local evaluation input (gitignored copy of the example)',\n },\n {\n path: `${bundle}/.gitignore`,\n contents: POLICY_GITIGNORE_TEMPLATE,\n description: 'Ignore only the private local input file',\n },\n ];\n}\n\n/**\n * Generate bundle files for a given template and root.\n *\n * @param template - Template name\n * @param root - Package root name\n * @param bundleDir - Publish directory basename under the workspace\n * @returns Bundle files relative to the workspace\n */\nexport function generatePolicyBundleFiles(\n template: PolicyTemplateName,\n root: string,\n bundleDir: string = buildBundleDirectoryName(root),\n): PolicyStarterFile[] {\n switch (template) {\n case PolicyTemplate.Generic:\n return generateGenericBundleFiles(root, bundleDir);\n case PolicyTemplate.Permissions:\n return generatePermissionsBundleFiles(root, bundleDir);\n default:\n throw new Error(`Unknown policy template: ${String(template)}`);\n }\n}\n\n/**\n * Build the suggested `policy eval` follow-up after `policy new`.\n *\n * @param options - Bundle display path, package root, and template\n * @returns Multi-line shell command ready to paste\n */\nexport function buildPolicyBundleEvalNextStep(options: {\n /** Workspace-relative publish directory (e.g. `transcend/policy/permissions-bundle`). */\n bundleDirectory: string;\n /** Rego / `.manifest` package root. */\n root: string;\n /** Scaffold template that determined the query path. */\n template: PolicyTemplateName;\n}): string {\n const { bundleDirectory, root, template } = options;\n const packagePath =\n template === PolicyTemplate.Permissions ? `data.${root}.purposes` : `data.${root}.result`;\n return [\n `transcend policy eval ${bundleDirectory} \\\\`,\n ` --package=${packagePath} \\\\`,\n ` --input=${bundleDirectory}/input.json \\\\`,\n ` --schema=${bundleDirectory}/${POLICY_INPUT_SCHEMA_FILENAME}`,\n ].join('\\n');\n}\n","import { join, resolve } from 'node:path';\n\nimport type { LocalContext } from '../../context.js';\nimport {\n collectProjectRelativePaths,\n discoverProjectRepository,\n} from '../scaffolding/project-discovery.js';\nimport type { PolicyProjectState } from './policy-scaffold-model.js';\nimport {\n POLICY_MANIFEST_FILENAME,\n POLICY_STARTER_BUNDLE_DIRECTORY,\n} from './policy-scaffold-templates.js';\n\n/** Default local policy workspace directory (shared Regal config + bundles). */\nexport const DEFAULT_POLICY_PROJECT_DIRECTORY = 'transcend/policy';\n\n/**\n * Resolve a selected policy project relative to the invocation directory.\n *\n * @param invocationDirectory - CLI working directory\n * @param directory - User-selected project directory\n * @returns Absolute policy project directory\n */\nexport function resolvePolicyProjectDirectory(\n invocationDirectory: string,\n directory: string = DEFAULT_POLICY_PROJECT_DIRECTORY,\n): string {\n return resolve(invocationDirectory, directory);\n}\n\n/**\n * Absolute path to the disposable starter publish directory under a workspace.\n *\n * @param workspaceDirectory - Absolute policy workspace directory\n * @returns Absolute starter bundle directory\n */\nexport function getPolicyStarterBundleDirectory(workspaceDirectory: string): string {\n return join(workspaceDirectory, POLICY_STARTER_BUNDLE_DIRECTORY);\n}\n\n/**\n * Resolve publishable bundle directories under a path.\n *\n * - If `directory` itself contains a `.manifest`, it is treated as one bundle.\n * - Otherwise immediate child directories that contain a `.manifest` are\n * returned in sorted order (multi-bundle workspace). Folder names are not\n * required to end in `-bundle`; that suffix is only the `policy new`\n * scaffolding convention.\n *\n * @param context - Filesystem-bearing CLI context\n * @param directory - Absolute workspace or bundle directory\n * @returns Absolute bundle directories to lint / test\n */\nexport function discoverPolicyBundleDirectories(\n context: Pick<LocalContext, 'fs'>,\n directory: string,\n): string[] {\n if (!context.fs.existsSync(directory) || !context.fs.statSync(directory).isDirectory()) {\n return [];\n }\n const manifestAtRoot = join(directory, POLICY_MANIFEST_FILENAME);\n if (context.fs.existsSync(manifestAtRoot) && context.fs.statSync(manifestAtRoot).isFile()) {\n return [directory];\n }\n return context.fs\n .readdirSync(directory, { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .map((entry) => join(directory, entry.name))\n .filter((bundleDirectory) => {\n const manifestPath = join(bundleDirectory, POLICY_MANIFEST_FILENAME);\n return context.fs.existsSync(manifestPath) && context.fs.statSync(manifestPath).isFile();\n })\n .sort((left, right) => left.localeCompare(right));\n}\n\n/**\n * Collect repository state required by the pure policy planner.\n *\n * @param context - CLI context\n * @param directory - User-selected target directory\n * @returns Policy project discovery state\n */\nexport function discoverPolicyProject(\n context: LocalContext,\n directory: string = DEFAULT_POLICY_PROJECT_DIRECTORY,\n): PolicyProjectState {\n const invocationDirectory = context.process.cwd();\n const targetDirectory = resolvePolicyProjectDirectory(invocationDirectory, directory);\n if (\n context.fs.existsSync(targetDirectory) &&\n !context.fs.statSync(targetDirectory).isDirectory()\n ) {\n throw new Error(`Policy target is not a directory: ${targetDirectory}`);\n }\n const repository = discoverProjectRepository(context, {\n invocationDirectory,\n targetDirectory,\n standaloneProjectRoot: invocationDirectory,\n });\n return {\n invocationDirectory,\n targetDirectory,\n ...repository,\n relativePaths: collectProjectRelativePaths(context, targetDirectory),\n relativeFilePaths: collectProjectRelativePaths(context, targetDirectory, {\n includeDirectories: false,\n }),\n };\n}\n\n/**\n * Resolve the starter bundle manifest path for a discovered workspace.\n *\n * @param state - Policy project state\n * @returns Absolute manifest path under the starter `{root}-bundle/`\n */\nexport function getPolicyManifestPath(state: PolicyProjectState): string {\n return join(getPolicyStarterBundleDirectory(state.targetDirectory), POLICY_MANIFEST_FILENAME);\n}\n"],"mappings":"g6CCMA,MAAa,EAAqCA,EAGrC,EAA6B,SAS7B,EAAsB,UAGtB,EAAkC,GAAG,EAAoB,SAGzD,EAA+B,oBAa/B,EAA2B,YAQ3B,EAAiC,cAGjC,EAAyC,eAGzC,EAAiB,CAC5B,QAAS,UACT,YAAa,cACd,CAGY,EAAwB,CAAC,EAAe,QAAS,EAAe,YAAY,CAwBzF,SAAgB,EACd,EACA,EAA+B,EAAe,QACtC,CACR,MAAO;;;eAGM,EAAK;;;OAGb,EAAuC;qBACzB,EAAS;4BACsBC,EAAY;;;;EAQxB,EACtC,EACA,EAAe,QAChB,CAWD,SAAgB,EAA+B,EAAkC,CAK/E,MAAO;;;;;;gBAMO,EAA2B;;EATvC,EAAM,SAAW,EACb,cACA,aAAa,EAAM,IAAK,GAAS,SAAS,IAAO,CAAC,KAAK;EAAK,GASrD;;EAgBf,SAAgB,EACd,EACA,EACuC,CAEvC,GADgB,EAAiB,MACtB,CAAC,SAAW,EAAG,CACxB,IAAM,EAAQ,CAAC,EAAU,CACzB,MAAO,CAAE,SAAU,EAA+B,EAAM,CAAE,QAAO,CAGnE,IAAI,EACJ,GAAI,CACF,EAAS,EAAK,KAAK,EAAiB,OAC7B,EAAO,CACd,IAAM,EAAS,aAAiB,MAAQ,EAAM,QAAU,OAAO,EAAM,CACrE,MAAU,MAAM,yCAAyC,IAAS,CAGpE,GAAI,GAAW,KAA8B,CAC3C,IAAM,EAAQ,CAAC,EAAU,CACzB,MAAO,CAAE,SAAU,EAA+B,EAAM,CAAE,QAAO,CAEnE,GAAI,OAAO,GAAW,UAAY,MAAM,QAAQ,EAAO,CACrD,MAAU,MAAM,8DAA8D,CAGhF,IAAM,EAAS,CAAE,GAAI,EAAoC,CACnD,EAAkB,EAAO,QAC/B,GACE,G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c,r as l,t as u}from"./jsonc-CdTubr53.mjs";import{posix as d,relative as f,sep as p}from"node:path";const m=`0.42.0`,h=`.github/workflows/transcend-policy.yml`,g=`d23441a48e516b6c34aea4fa41551a30e30af803`,_=`b2b258e089860efaadaaf71bf6e3aecb4a3eeff1`,v=`761188c3b435761fa254beca508a44875619648f`;function y(e,t){return e===`.`?t:d.join(e,t)}function b(e){let t=e.bundleDirectories??[y(e.workspaceDirectory,s)],r=[y(e.workspaceDirectory,`**/*.rego`),y(e.workspaceDirectory,`**/*.json`),y(e.workspaceDirectory,`**/*.yaml`),y(e.workspaceDirectory,`**/*.yml`),y(e.workspaceDirectory,`**/.manifest`),y(e.workspaceDirectory,`.regal/config.yaml`),y(e.workspaceDirectory,`.regal.yaml`),h].map(e=>` - ${JSON.stringify(e)}`).join(`
2
+ `),i;return i=t.length===0?` lint:
3
+ runs-on: ubuntu-latest
4
+ steps:
5
+ - uses: actions/checkout@${g} # v6
6
+ - name: No publishable bundles yet
7
+ run: >-
8
+ echo "Run transcend policy new to add a bundle;
9
+ policy new refreshes this workflow automatically."
10
+ `:t.length===1?` lint:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@${g} # v6
14
+ - name: Set up OPA
15
+ uses: open-policy-agent/setup-opa@${_} # v2.4.0
16
+ with:
17
+ version: ${JSON.stringify(n)}
18
+ - name: Set up Regal
19
+ uses: open-policy-agent/setup-regal@${v} # v2.0.0
20
+ with:
21
+ version: ${JSON.stringify(m)}
22
+ - name: Install the Transcend CLI
23
+ run: npm install --global @transcend-io/cli@${e.cliVersion}
24
+ - name: Validate Policy Engine project
25
+ env:
26
+ POLICY_DIRECTORY: ${JSON.stringify(t[0])}
27
+ run: >-
28
+ transcend policy lint
29
+ "$POLICY_DIRECTORY"
30
+ --noInteractive
31
+ --json
32
+ `:` lint:
33
+ runs-on: ubuntu-latest
34
+ strategy:
35
+ fail-fast: false
36
+ matrix:
37
+ policy_directory:
38
+ ${t.map(e=>` - ${JSON.stringify(e)}`).join(`
39
+ `)}
40
+ steps:
41
+ - uses: actions/checkout@${g} # v6
42
+ - name: Set up OPA
43
+ uses: open-policy-agent/setup-opa@${_} # v2.4.0
44
+ with:
45
+ version: ${JSON.stringify(n)}
46
+ - name: Set up Regal
47
+ uses: open-policy-agent/setup-regal@${v} # v2.0.0
48
+ with:
49
+ version: ${JSON.stringify(m)}
50
+ - name: Install the Transcend CLI
51
+ run: npm install --global @transcend-io/cli@${e.cliVersion}
52
+ - name: Validate Policy Engine project
53
+ env:
54
+ POLICY_DIRECTORY: \${{ matrix.policy_directory }}
55
+ run: transcend policy lint "$POLICY_DIRECTORY" --noInteractive --json
56
+ `,`# Generated by transcend policy init.
57
+ name: Transcend Policy
58
+
59
+ on:
60
+ pull_request:
61
+ paths:
62
+ ${r}
63
+ push:
64
+ paths:
65
+ ${r}
66
+
67
+ permissions:
68
+ contents: read
69
+
70
+ jobs:
71
+ ${i}`}const x=`tsandall.opa`,S=`glebbash.opa-highlight-only`;function C(t,n){return n===void 0?{root:t,bundleDir:e(t)}:{root:t,bundleDir:e(t),template:n}}function w(e,t){return JSON.stringify(e)===JSON.stringify(t)}function T(e,t){try{return{current:l(e??`{}
72
+ `,t)}}catch(t){return{contents:e??`{}
73
+ `,warning:`${t instanceof Error?t.message:String(t)} Existing content was left unchanged.`}}}function E(e,t,n,r){if(t.length===0)return{contents:e??`{}
74
+ `,warnings:r};try{return{contents:u(e,t,n),warnings:r}}catch(t){return{contents:e??`{}
75
+ `,warnings:[...r,`${t instanceof Error?t.message:String(t)} Existing content was left unchanged.`]}}}function D(e,t,n,r){t.forEach(({path:t,value:i,label:a})=>{let o=t.reduce((e,t)=>e&&typeof e==`object`&&!Array.isArray(e)?e[t]:void 0,e);o===void 0?n.push({path:t,value:i}):w(o,i)||r.push(`VS Code setting "${a}" has a repository-specific value and was left unchanged.`)})}function O(e){return e===`.`?"${workspaceFolder}":`\${workspaceFolder}/${e}`}function k(e,t){return f(e,t).split(p).join(`/`)||`.`}function A(e,t,n=C(r)){let i=k(e,t);return O(i===`.`?n.bundleDir:`${i}/${n.bundleDir}`)}function j(e,n){let r=k(e,n);return r===`.`?`**/${t}`:`**/${r}/**/${t}`}function M(e,t,n=C(r)){let s=k(e,t),c=s===`.`?`/${n.bundleDir}`:`/${s}/${n.bundleDir}`,l=n.template===i.Permissions?a:s===`.`?`./${n.bundleDir}/${o}`:`./${s}/${n.bundleDir}/${o}`;return{fileMatch:[`${c}/input.json`,`${c}/input.example.json`],url:l}}function N(e,t,n,r){let i=T(e,`VS Code policy settings`);if(`warning`in i)return{contents:i.contents,warnings:[i.warning]};let{current:a}=i,o=[],s=[];if(r&&r.length>0){let e=a[`opa.roots`],i=r.map(e=>A(t,n,e));if(e===void 0)o.push({path:[`opa.roots`],value:i});else if(Array.isArray(e)&&e.every(e=>typeof e==`string`)){let t=c(e,i);w(t,e)||o.push({path:[`opa.roots`],value:t})}else s.push(`VS Code setting "opa.roots" is customized and was left unchanged.`)}D(a,[{path:[`opa.checkOnSave`],value:!0,label:`opa.checkOnSave`},{path:[`opa.strictMode`],value:!0,label:`opa.strictMode`},{path:[`opa.bundleMode`],value:!0,label:`opa.bundleMode`},{path:[`opa.formatter`],value:`opa-fmt-rego-v1`,label:`opa.formatter`}],o,s);let l=a[`files.associations`],u=j(t,n);if(l===void 0?o.push({path:[`files.associations`],value:{[u]:`json`}}):typeof l==`object`&&l&&!Array.isArray(l)?D(a,[{path:[`files.associations`,u],value:`json`,label:`files.associations."${u}"`}],o,s):s.push(`VS Code setting "files.associations" is customized and was left unchanged.`),r&&r.length>0){let e=r.map(e=>M(t,n,e)),i=a[`json.schemas`];if(i===void 0)o.push({path:[`json.schemas`],value:e});else if(Array.isArray(i)){let t=[...i];e.forEach(e=>{if(t.some(t=>typeof t==`object`&&!!t&&!Array.isArray(t)&&w(t,e)))return;let n=t.findIndex(t=>typeof t==`object`&&!!t&&!Array.isArray(t)&&typeof t.url==`string`&&t.url===e.url);if(n===-1){t=[...t,e];return}let r=t[n],i=r.fileMatch;if(!Array.isArray(i)||!i.every(e=>typeof e==`string`)){s.push(`VS Code setting "json.schemas" has a repository-specific entry for the ${e.url} schema and was left unchanged.`);return}let a=c(i,e.fileMatch);w(a,i)||(t=t.map((e,t)=>t===n?{...r,fileMatch:a}:e))}),w(t,i)||o.push({path:[`json.schemas`],value:t})}else s.push(`VS Code setting "json.schemas" is customized and was left unchanged.`)}let d=a[`[rego]`];return d===void 0?o.push({path:[`[rego]`],value:{"editor.defaultFormatter":x,"editor.formatOnSave":!0,"editor.insertSpaces":!1,"editor.tabSize":4}}):typeof d==`object`&&d&&!Array.isArray(d)?D(a,[{path:[`[rego]`,`editor.defaultFormatter`],value:x,label:`[rego].editor.defaultFormatter`},{path:[`[rego]`,`editor.formatOnSave`],value:!0,label:`[rego].editor.formatOnSave`},{path:[`[rego]`,`editor.insertSpaces`],value:!1,label:`[rego].editor.insertSpaces`},{path:[`[rego]`,`editor.tabSize`],value:4,label:`[rego].editor.tabSize`}],o,s):s.push(`VS Code language setting "[rego]" is customized and was left unchanged.`),E(e,o,`VS Code policy settings`,s)}function P(e){let t=T(e,`VS Code policy extension recommendations`);if(`warning`in t)return{contents:t.contents,warnings:[t.warning]};let{current:n}=t,r=[],i=[],a=n.recommendations;if(a===void 0||Array.isArray(a)&&a.every(e=>typeof e==`string`)){let e=a??[],t=c(e,[x]).filter(e=>e!==S);w(e,t)||r.push({path:[`recommendations`],value:t})}else i.push(`VS Code extension recommendations use an unknown shape and were left unchanged.`);let o=n.unwantedRecommendations;if(o===void 0||Array.isArray(o)&&o.every(e=>typeof e==`string`)){let e=o??[],t=c(e,[S]);w(e,t)||r.push({path:[`unwantedRecommendations`],value:t})}else i.push(`VS Code unwanted extension recommendations use an unknown shape and were left unchanged.`);return E(e,r,`VS Code policy extension recommendations`,i)}function F(e,t,n=C(r)){let i=k(e,t),a=i===`.`?n.bundleDir:`${i}/${n.bundleDir}`;return{label:`policy: lint ${n.root}`,type:`process`,command:`transcend`,args:[`policy`,`lint`,a,`--noInteractive`],group:{kind:`test`,isDefault:!1},problemMatcher:[]}}function I(e){return{label:`policy: lint`,dependsOn:e.map(e=>`policy: lint ${e.root}`),dependsOrder:`sequence`,group:{kind:`test`,isDefault:!0},problemMatcher:[]}}function L(e,t,n,r){let i=T(e,`VS Code policy tasks`);if(`warning`in i)return{contents:i.contents,warnings:[i.warning]};let{current:a}=i,o=[],s=[],c=a.version;if(c===void 0?o.push({path:[`version`],value:`2.0.0`}):c!==`2.0.0`&&s.push(`VS Code task schema version is customized and was left unchanged.`),!r||r.length===0)return E(e,o,`VS Code policy tasks`,s);let l=r.map(e=>F(t,n,e)),u=I(r),d=[...l,u],f=new Set(d.map(e=>e.label)),p=a.tasks;if(p===void 0)o.push({path:[`tasks`],value:d});else if(Array.isArray(p)){let e=[...p],t=!1;d.forEach(n=>{let r=n.label,i=e.findIndex(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&e.label===r);if(i===-1){e=[...e,n],t=!0;return}w(e[i],n)||(f.has(r)?(e=e.map((e,t)=>t===i?n:e),t=!0):s.push(`VS Code task "${r}" has repository-specific customization and was left unchanged.`))}),t&&o.push({path:[`tasks`],value:e})}else s.push(`VS Code tasks use an unknown shape and were left unchanged.`);return E(e,o,`VS Code policy tasks`,s)}export{h as a,C as i,N as n,b as o,L as r,P as t};
76
+ //# sourceMappingURL=policy-scaffold-config-CwlygiTz.mjs.map