@transcend-io/cli 12.0.0 → 12.1.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.
- package/README.md +162 -149
- package/dist/{app-CR3U95JW.mjs → app-BAx2hvcN.mjs} +20 -18
- package/dist/app-BAx2hvcN.mjs.map +1 -0
- package/dist/{approvePrivacyRequests-BDG82nlp.mjs → approvePrivacyRequests-B-4o7QMG.mjs} +2 -2
- package/dist/{approvePrivacyRequests-BDG82nlp.mjs.map → approvePrivacyRequests-B-4o7QMG.mjs.map} +1 -1
- package/dist/bin/bash-complete.mjs +1 -1
- package/dist/bin/cli.mjs +1 -1
- package/dist/bin/deprecated-command.mjs +1 -1
- package/dist/buildExamples-kR5_7dkU.mjs +2 -0
- package/dist/buildExamples-kR5_7dkU.mjs.map +1 -0
- package/dist/{buildXdiSyncEndpoint-FExEagKc.mjs → buildXdiSyncEndpoint-BSYwJ2vc.mjs} +2 -2
- package/dist/{buildXdiSyncEndpoint-FExEagKc.mjs.map → buildXdiSyncEndpoint-BSYwJ2vc.mjs.map} +1 -1
- package/dist/{bulkRestartRequests-OKwKXc52.mjs → bulkRestartRequests-DhOfMz0S.mjs} +2 -2
- package/dist/{bulkRestartRequests-OKwKXc52.mjs.map → bulkRestartRequests-DhOfMz0S.mjs.map} +1 -1
- package/dist/{bulkRetryEnrichers-Dl-n8AFF.mjs → bulkRetryEnrichers-Cj94ftnY.mjs} +2 -2
- package/dist/{bulkRetryEnrichers-Dl-n8AFF.mjs.map → bulkRetryEnrichers-Cj94ftnY.mjs.map} +1 -1
- package/dist/{cancelPrivacyRequests-BIgX5SDz.mjs → cancelPrivacyRequests-DgAhfcmg.mjs} +2 -2
- package/dist/{cancelPrivacyRequests-BIgX5SDz.mjs.map → cancelPrivacyRequests-DgAhfcmg.mjs.map} +1 -1
- package/dist/{command-X7lkPELf.mjs → command-gwG8sQwM.mjs} +2 -2
- package/dist/{command-X7lkPELf.mjs.map → command-gwG8sQwM.mjs.map} +1 -1
- package/dist/{constants-BRsj50Nb.mjs → constants-BCmVqlrM.mjs} +2 -2
- package/dist/{constants-BRsj50Nb.mjs.map → constants-BCmVqlrM.mjs.map} +1 -1
- package/dist/constants-DlH2vWm_.mjs +2 -0
- package/dist/constants-DlH2vWm_.mjs.map +1 -0
- package/dist/{createPoolingCommandUi-CyPZ3GqN.mjs → createPoolingCommandUi-ByyTeJx5.mjs} +2 -2
- package/dist/{createPoolingCommandUi-CyPZ3GqN.mjs.map → createPoolingCommandUi-ByyTeJx5.mjs.map} +1 -1
- package/dist/{downloadPrivacyRequestFiles-EBySRnvd.mjs → downloadPrivacyRequestFiles-yiE6NzXz.mjs} +2 -2
- package/dist/{downloadPrivacyRequestFiles-EBySRnvd.mjs.map → downloadPrivacyRequestFiles-yiE6NzXz.mjs.map} +1 -1
- package/dist/{extractClientError-DUJxHv07.mjs → extractClientError-BQgmnp3e.mjs} +2 -2
- package/dist/{extractClientError-DUJxHv07.mjs.map → extractClientError-BQgmnp3e.mjs.map} +1 -1
- package/dist/{fuzzyMatchColumns-2NmQqCZI.mjs → fuzzyMatchColumns-D18n9Beu.mjs} +2 -2
- package/dist/{fuzzyMatchColumns-2NmQqCZI.mjs.map → fuzzyMatchColumns-D18n9Beu.mjs.map} +1 -1
- package/dist/{generateCrossAccountApiKeys-pWTrIUE6.mjs → generateCrossAccountApiKeys-CoSsZwSz.mjs} +2 -2
- package/dist/{generateCrossAccountApiKeys-pWTrIUE6.mjs.map → generateCrossAccountApiKeys-CoSsZwSz.mjs.map} +1 -1
- package/dist/{impl-Dr_l_SLd.mjs → impl-4WoLxjdU.mjs} +2 -2
- package/dist/{impl-Dr_l_SLd.mjs.map → impl-4WoLxjdU.mjs.map} +1 -1
- package/dist/{impl-D1f9mJL_.mjs → impl-BCP4X_zk.mjs} +2 -2
- package/dist/{impl-D1f9mJL_.mjs.map → impl-BCP4X_zk.mjs.map} +1 -1
- package/dist/{impl-DXbxO2VJ.mjs → impl-BFSZEQ2s.mjs} +2 -2
- package/dist/{impl-DXbxO2VJ.mjs.map → impl-BFSZEQ2s.mjs.map} +1 -1
- package/dist/{impl-BdTxFv63.mjs → impl-BJnxahnW.mjs} +2 -2
- package/dist/{impl-BdTxFv63.mjs.map → impl-BJnxahnW.mjs.map} +1 -1
- package/dist/{impl-iD6Fknfe.mjs → impl-BKKBmXv4.mjs} +2 -2
- package/dist/{impl-iD6Fknfe.mjs.map → impl-BKKBmXv4.mjs.map} +1 -1
- package/dist/{impl-DtpgD_as.mjs → impl-BM2SWSKF.mjs} +2 -2
- package/dist/{impl-DtpgD_as.mjs.map → impl-BM2SWSKF.mjs.map} +1 -1
- package/dist/{impl-CrdqsTUy.mjs → impl-BMX6B40F.mjs} +2 -2
- package/dist/{impl-CrdqsTUy.mjs.map → impl-BMX6B40F.mjs.map} +1 -1
- package/dist/{impl-7rdGuHOC.mjs → impl-BRCAL4RM.mjs} +2 -2
- package/dist/{impl-7rdGuHOC.mjs.map → impl-BRCAL4RM.mjs.map} +1 -1
- package/dist/{impl-DxQ9yj3H.mjs → impl-BaGN4J-w.mjs} +2 -2
- package/dist/{impl-DxQ9yj3H.mjs.map → impl-BaGN4J-w.mjs.map} +1 -1
- package/dist/impl-Bf2Qli6c2.mjs +421 -0
- package/dist/{impl-DQcgEx7V2.mjs.map → impl-Bf2Qli6c2.mjs.map} +1 -1
- package/dist/{impl-DJcNhpbx.mjs → impl-BrdCuU0I.mjs} +2 -2
- package/dist/{impl-DJcNhpbx.mjs.map → impl-BrdCuU0I.mjs.map} +1 -1
- package/dist/{impl-Cxprr2hw.mjs → impl-C0R2azuF.mjs} +2 -2
- package/dist/{impl-Cxprr2hw.mjs.map → impl-C0R2azuF.mjs.map} +1 -1
- package/dist/{impl-B7l4bLG5.mjs → impl-C1hh_5On.mjs} +2 -2
- package/dist/{impl-B7l4bLG5.mjs.map → impl-C1hh_5On.mjs.map} +1 -1
- package/dist/{impl-Do2TNA3-.mjs → impl-C1vn0Y7f.mjs} +2 -2
- package/dist/{impl-Do2TNA3-.mjs.map → impl-C1vn0Y7f.mjs.map} +1 -1
- package/dist/impl-C36c5NfN.mjs +2 -0
- package/dist/impl-C36c5NfN.mjs.map +1 -0
- package/dist/{impl-DcL-8NEa2.mjs → impl-C54oUOeM2.mjs} +2 -2
- package/dist/{impl-DcL-8NEa2.mjs.map → impl-C54oUOeM2.mjs.map} +1 -1
- package/dist/{impl-HUfaARep.mjs → impl-CKg5Xu-r.mjs} +2 -2
- package/dist/{impl-HUfaARep.mjs.map → impl-CKg5Xu-r.mjs.map} +1 -1
- package/dist/{impl-B440iuvL.mjs → impl-ClhMRgQZ.mjs} +3 -3
- package/dist/{impl-B440iuvL.mjs.map → impl-ClhMRgQZ.mjs.map} +1 -1
- package/dist/{impl-BWPPVXG3.mjs → impl-CoqCyj7e.mjs} +3 -3
- package/dist/{impl-BWPPVXG3.mjs.map → impl-CoqCyj7e.mjs.map} +1 -1
- package/dist/impl-CuDZY6y7.mjs +2 -0
- package/dist/impl-CuDZY6y7.mjs.map +1 -0
- package/dist/{impl-DQG1pMzD2.mjs → impl-Cvyc-iTI2.mjs} +2 -2
- package/dist/{impl-DQG1pMzD2.mjs.map → impl-Cvyc-iTI2.mjs.map} +1 -1
- package/dist/impl-CwBa15M42.mjs +3 -0
- package/dist/impl-CwBa15M42.mjs.map +1 -0
- package/dist/{impl-BLQDgwxL.mjs → impl-CxpGBeJ0.mjs} +2 -2
- package/dist/{impl-BLQDgwxL.mjs.map → impl-CxpGBeJ0.mjs.map} +1 -1
- package/dist/{impl-CWP6AXSb.mjs → impl-CyDdvH5a.mjs} +2 -2
- package/dist/{impl-CWP6AXSb.mjs.map → impl-CyDdvH5a.mjs.map} +1 -1
- package/dist/{impl-vmLq6HCI.mjs → impl-D0cf-epj.mjs} +2 -2
- package/dist/{impl-vmLq6HCI.mjs.map → impl-D0cf-epj.mjs.map} +1 -1
- package/dist/{impl-CieztjdM.mjs → impl-D3gqip90.mjs} +2 -2
- package/dist/{impl-CieztjdM.mjs.map → impl-D3gqip90.mjs.map} +1 -1
- package/dist/{impl-wBcVYHlA.mjs → impl-D8YS5Bge.mjs} +2 -2
- package/dist/{impl-wBcVYHlA.mjs.map → impl-D8YS5Bge.mjs.map} +1 -1
- package/dist/{impl-1SsreZWo.mjs → impl-DCF3CF3O.mjs} +2 -2
- package/dist/{impl-1SsreZWo.mjs.map → impl-DCF3CF3O.mjs.map} +1 -1
- package/dist/impl-DE_cRfz52.mjs +2 -0
- package/dist/impl-DE_cRfz52.mjs.map +1 -0
- package/dist/impl-DG-041kN.mjs +3 -0
- package/dist/impl-DG-041kN.mjs.map +1 -0
- package/dist/{impl-B2ZXtnpX.mjs → impl-DNRA5i0w.mjs} +2 -2
- package/dist/{impl-B2ZXtnpX.mjs.map → impl-DNRA5i0w.mjs.map} +1 -1
- package/dist/{impl-Ds-gQfdc.mjs → impl-DSPxdc-T.mjs} +2 -2
- package/dist/{impl-Ds-gQfdc.mjs.map → impl-DSPxdc-T.mjs.map} +1 -1
- package/dist/{impl-FerHBNJx2.mjs → impl-DbddBTRj2.mjs} +2 -2
- package/dist/{impl-FerHBNJx2.mjs.map → impl-DbddBTRj2.mjs.map} +1 -1
- package/dist/{impl-eeS2lVi5.mjs → impl-DdUe8ClA.mjs} +2 -2
- package/dist/{impl-eeS2lVi5.mjs.map → impl-DdUe8ClA.mjs.map} +1 -1
- package/dist/{impl-CudSYx-g.mjs → impl-Dl8xSx8K.mjs} +2 -2
- package/dist/{impl-CudSYx-g.mjs.map → impl-Dl8xSx8K.mjs.map} +1 -1
- package/dist/{impl-DRKPx_I9.mjs → impl-DqnzZv43.mjs} +2 -2
- package/dist/{impl-DRKPx_I9.mjs.map → impl-DqnzZv43.mjs.map} +1 -1
- package/dist/{impl-D-a5xGld.mjs → impl-DrlfmH8g.mjs} +3 -3
- package/dist/{impl-D-a5xGld.mjs.map → impl-DrlfmH8g.mjs.map} +1 -1
- package/dist/{impl-DTadLabu.mjs → impl-F2lRJEqw.mjs} +2 -2
- package/dist/{impl-DTadLabu.mjs.map → impl-F2lRJEqw.mjs.map} +1 -1
- package/dist/{impl-CU38kdj8.mjs → impl-LDY2dgtc.mjs} +2 -2
- package/dist/{impl-CU38kdj8.mjs.map → impl-LDY2dgtc.mjs.map} +1 -1
- package/dist/{impl-C_Ifcb00.mjs → impl-OXGlZyUo.mjs} +2 -2
- package/dist/{impl-C_Ifcb00.mjs.map → impl-OXGlZyUo.mjs.map} +1 -1
- package/dist/{impl-Cb42aI60.mjs → impl-WJBuS_0m.mjs} +2 -2
- package/dist/{impl-Cb42aI60.mjs.map → impl-WJBuS_0m.mjs.map} +1 -1
- package/dist/{impl-DqHEIzpj.mjs → impl-agm4lpyq.mjs} +5 -5
- package/dist/{impl-DqHEIzpj.mjs.map → impl-agm4lpyq.mjs.map} +1 -1
- package/dist/impl-defjX-97.mjs +3 -0
- package/dist/impl-defjX-97.mjs.map +1 -0
- package/dist/{impl-DtnYcktN.mjs → impl-f59q7WnK.mjs} +2 -2
- package/dist/{impl-DtnYcktN.mjs.map → impl-f59q7WnK.mjs.map} +1 -1
- package/dist/{impl-DiwxYcux.mjs → impl-pA1b-G6B.mjs} +2 -2
- package/dist/{impl-DiwxYcux.mjs.map → impl-pA1b-G6B.mjs.map} +1 -1
- package/dist/{impl-D1UogVAq.mjs → impl-tYHONQMu.mjs} +2 -2
- package/dist/{impl-D1UogVAq.mjs.map → impl-tYHONQMu.mjs.map} +1 -1
- package/dist/{impl-CspH2ZWx.mjs → impl-u1nIo2-E.mjs} +2 -2
- package/dist/{impl-CspH2ZWx.mjs.map → impl-u1nIo2-E.mjs.map} +1 -1
- package/dist/index.d.mts +7 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{inquirer-BU5IpgA8.mjs → inquirer-jzIQWAvq.mjs} +2 -2
- package/dist/{inquirer-BU5IpgA8.mjs.map → inquirer-jzIQWAvq.mjs.map} +1 -1
- package/dist/{markRequestDataSiloIdsCompleted-BYNMCkhy.mjs → markRequestDataSiloIdsCompleted-B-Dgme2r.mjs} +2 -2
- package/dist/{markRequestDataSiloIdsCompleted-BYNMCkhy.mjs.map → markRequestDataSiloIdsCompleted-B-Dgme2r.mjs.map} +1 -1
- package/dist/{markSilentPrivacyRequests-gKYivzH1.mjs → markSilentPrivacyRequests-CPU4Q2lF.mjs} +2 -2
- package/dist/{markSilentPrivacyRequests-gKYivzH1.mjs.map → markSilentPrivacyRequests-CPU4Q2lF.mjs.map} +1 -1
- package/dist/{mergeTranscendInputs-D1CvxQu0.mjs → mergeTranscendInputs-B7WjxYMN.mjs} +3 -3
- package/dist/{mergeTranscendInputs-D1CvxQu0.mjs.map → mergeTranscendInputs-B7WjxYMN.mjs.map} +1 -1
- package/dist/{notifyPrivacyRequestsAdditionalTime-DbERhQ1Q.mjs → notifyPrivacyRequestsAdditionalTime-BWsm5Y5K.mjs} +2 -2
- package/dist/{notifyPrivacyRequestsAdditionalTime-DbERhQ1Q.mjs.map → notifyPrivacyRequestsAdditionalTime-BWsm5Y5K.mjs.map} +1 -1
- package/dist/{policy-bundle-manifest-BZnBMZQq.mjs → policy-bundle-manifest-BDey6EBs.mjs} +3 -3
- package/dist/{policy-bundle-manifest-BZnBMZQq.mjs.map → policy-bundle-manifest-BDey6EBs.mjs.map} +1 -1
- package/dist/{policy-project-discovery-C29UxWwt.mjs → policy-project-discovery-DV5PnFJq.mjs} +71 -68
- package/dist/policy-project-discovery-DV5PnFJq.mjs.map +1 -0
- package/dist/policy-scaffold-config-DtRELUZx.mjs +76 -0
- package/dist/policy-scaffold-config-DtRELUZx.mjs.map +1 -0
- package/dist/printResult-Dmwv78e7.mjs +33 -0
- package/dist/printResult-Dmwv78e7.mjs.map +1 -0
- package/dist/{pullAllDatapoints-Bm-Orhse.mjs → pullAllDatapoints-CNqQSSmF.mjs} +3 -3
- package/dist/{pullAllDatapoints-Bm-Orhse.mjs.map → pullAllDatapoints-CNqQSSmF.mjs.map} +1 -1
- package/dist/pullChunkedCustomSiloOutstandingIdentifiers-BaHp-jxs.mjs +2 -0
- package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-DTGQOw--.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-BaHp-jxs.mjs.map} +1 -1
- package/dist/{pullManualEnrichmentIdentifiersToCsv-DMC5CQtE.mjs → pullManualEnrichmentIdentifiersToCsv-CiEFIvl_.mjs} +2 -2
- package/dist/{pullManualEnrichmentIdentifiersToCsv-DMC5CQtE.mjs.map → pullManualEnrichmentIdentifiersToCsv-CiEFIvl_.mjs.map} +1 -1
- package/dist/{pushCronIdentifiersFromCsv-DhS2z8IG.mjs → pushCronIdentifiersFromCsv-DeS78zyp.mjs} +2 -2
- package/dist/{pushCronIdentifiersFromCsv-DhS2z8IG.mjs.map → pushCronIdentifiersFromCsv-DeS78zyp.mjs.map} +1 -1
- package/dist/pushManualEnrichmentIdentifiersFromCsv-B3iVwuvs.mjs +2 -0
- package/dist/{pushManualEnrichmentIdentifiersFromCsv-BTJGOmdU.mjs.map → pushManualEnrichmentIdentifiersFromCsv-B3iVwuvs.mjs.map} +1 -1
- package/dist/{removeUnverifiedRequestIdentifiers-BkAcUZZN.mjs → removeUnverifiedRequestIdentifiers-qS5A_eRZ.mjs} +2 -2
- package/dist/{removeUnverifiedRequestIdentifiers-BkAcUZZN.mjs.map → removeUnverifiedRequestIdentifiers-qS5A_eRZ.mjs.map} +1 -1
- package/dist/resolveBundleIdByName-BPrMkU0w.mjs +2 -0
- package/dist/resolveBundleIdByName-BPrMkU0w.mjs.map +1 -0
- package/dist/resolvePolicyBundleVersion-BrVz4LKN.mjs +2 -0
- package/dist/resolvePolicyBundleVersion-BrVz4LKN.mjs.map +1 -0
- package/dist/{retryRequestDataSilos-BoPmcB8-.mjs → retryRequestDataSilos-Cxaka-kA.mjs} +2 -2
- package/dist/{retryRequestDataSilos-BoPmcB8-.mjs.map → retryRequestDataSilos-Cxaka-kA.mjs.map} +1 -1
- package/dist/{skipPreflightJobs-DkBdYw-r.mjs → skipPreflightJobs-FdIm_Imj.mjs} +2 -2
- package/dist/{skipPreflightJobs-DkBdYw-r.mjs.map → skipPreflightJobs-FdIm_Imj.mjs.map} +1 -1
- package/dist/{skipRequestDataSilos-BRFiokix.mjs → skipRequestDataSilos-MTbj-OfW.mjs} +2 -2
- package/dist/{skipRequestDataSilos-BRFiokix.mjs.map → skipRequestDataSilos-MTbj-OfW.mjs.map} +1 -1
- package/dist/{streamPrivacyRequestsToCsv-Bt-H5J-y.mjs → streamPrivacyRequestsToCsv-BVzYSXNY.mjs} +2 -2
- package/dist/{streamPrivacyRequestsToCsv-Bt-H5J-y.mjs.map → streamPrivacyRequestsToCsv-BVzYSXNY.mjs.map} +1 -1
- package/dist/{syncCodePackages-CPkEukDm.mjs → syncCodePackages-DJnrcX5l.mjs} +2 -2
- package/dist/{syncCodePackages-CPkEukDm.mjs.map → syncCodePackages-DJnrcX5l.mjs.map} +1 -1
- package/dist/updateConsentManagerVersionToLatest-Udi7Iazb.mjs +2 -0
- package/dist/{updateConsentManagerVersionToLatest-DWblAwus.mjs.map → updateConsentManagerVersionToLatest-Udi7Iazb.mjs.map} +1 -1
- package/dist/{uploadConsents-D7Vg8ZRW.mjs → uploadConsents-w7FE65Zg.mjs} +2 -2
- package/dist/{uploadConsents-D7Vg8ZRW.mjs.map → uploadConsents-w7FE65Zg.mjs.map} +1 -1
- package/dist/uploadPrivacyRequestsFromCsv-B__QsguT.mjs +2 -0
- package/dist/uploadPrivacyRequestsFromCsv-B__QsguT.mjs.map +1 -0
- package/package.json +5 -5
- package/dist/app-CR3U95JW.mjs.map +0 -1
- package/dist/buildExamples-B6BdW0FD.mjs +0 -2
- package/dist/buildExamples-B6BdW0FD.mjs.map +0 -1
- package/dist/constants-qvGk0wlN.mjs +0 -2
- package/dist/constants-qvGk0wlN.mjs.map +0 -1
- package/dist/impl-BqTMPbwc2.mjs +0 -2
- package/dist/impl-BqTMPbwc2.mjs.map +0 -1
- package/dist/impl-CAoIp9Nl2.mjs +0 -3
- package/dist/impl-CAoIp9Nl2.mjs.map +0 -1
- package/dist/impl-Cee7Q1Ne.mjs +0 -2
- package/dist/impl-Cee7Q1Ne.mjs.map +0 -1
- package/dist/impl-DQcgEx7V2.mjs +0 -298
- package/dist/impl-DezV3QMo.mjs +0 -3
- package/dist/impl-DezV3QMo.mjs.map +0 -1
- package/dist/impl-btKJ1-VJ.mjs +0 -3
- package/dist/impl-btKJ1-VJ.mjs.map +0 -1
- package/dist/impl-ijoNwhGI.mjs +0 -2
- package/dist/impl-ijoNwhGI.mjs.map +0 -1
- package/dist/policy-project-discovery-C29UxWwt.mjs.map +0 -1
- package/dist/policy-scaffold-config-BUKAyPad.mjs +0 -76
- package/dist/policy-scaffold-config-BUKAyPad.mjs.map +0 -1
- package/dist/printResult-C2K9ODeE.mjs +0 -33
- package/dist/printResult-C2K9ODeE.mjs.map +0 -1
- package/dist/pullChunkedCustomSiloOutstandingIdentifiers-DTGQOw--.mjs +0 -2
- package/dist/pushManualEnrichmentIdentifiersFromCsv-BTJGOmdU.mjs +0 -2
- package/dist/resolveBundleIdByName-Dm_o5_bg.mjs +0 -2
- package/dist/resolveBundleIdByName-Dm_o5_bg.mjs.map +0 -1
- package/dist/resolvePolicyBundleVersion-DRUwe7fA.mjs +0 -2
- package/dist/resolvePolicyBundleVersion-DRUwe7fA.mjs.map +0 -1
- package/dist/updateConsentManagerVersionToLatest-DWblAwus.mjs +0 -2
- package/dist/uploadPrivacyRequestsFromCsv-B_hQwIn6.mjs +0 -2
- package/dist/uploadPrivacyRequestsFromCsv-B_hQwIn6.mjs.map +0 -1
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import{g as e}from"./constants-BCmVqlrM.mjs";import{i as t,n,r,t as i}from"./project-plan-output-BHHlkLxe.mjs";import{c as a,d as o,f as s,l as c,t as l,u}from"./project-discovery-CWRjlFnC.mjs";import{b as d,d as f,r as p,t as m,u as h}from"./policy-project-discovery-DV5PnFJq.mjs";import{a as g,c as _,i as v,l as y,o as b,r as x,s as S,t as C}from"./policy-runtime-6jmkXlBk.mjs";import{t as w}from"./done-input-validation-LiTaCEzF.mjs";import{i as T,n as E,r as D,t as O}from"./prompts-BhXfYD6g.mjs";import{t as k}from"./run-captured-process-BjaSDWXG.mjs";import{t as A}from"./project-plan-apply-Bg_1eMX9.mjs";import{a as j,n as ee,o as te,r as ne,t as re}from"./policy-scaffold-config-DtRELUZx.mjs";import{isAbsolute as M,join as N,posix as P,relative as F,sep as I}from"node:path";import L from"colors";const R={Editor:`editor`,Skill:`skill`,Ci:`ci`};var z=`# Idiomatic Rego and document-tree authoring
|
|
2
|
+
|
|
3
|
+
## Start from the document tree
|
|
4
|
+
|
|
5
|
+
OPA evaluates queries against one document tree:
|
|
6
|
+
|
|
7
|
+
- \`input\` is the request-specific document supplied by the caller.
|
|
8
|
+
- \`data\` contains loaded policy packages and static data.
|
|
9
|
+
- A Rego \`package\` determines where a module contributes documents below \`data\`.
|
|
10
|
+
|
|
11
|
+
Choose package paths from the application's required query and ownership
|
|
12
|
+
boundaries. Keep directory and package names aligned
|
|
13
|
+
(\`directory-package-mismatch\`), and cover every publishable package with a
|
|
14
|
+
\`.manifest\` root.
|
|
15
|
+
|
|
16
|
+
### Multi-bundle template layout
|
|
17
|
+
|
|
18
|
+
Prefer a publish directory named \`{root}-bundle/\` so the package-root folder can
|
|
19
|
+
be \`{root}/\` without doubling names:
|
|
20
|
+
|
|
21
|
+
\`\`\`
|
|
22
|
+
example-bundle/ # transcend policy publish … <dir>
|
|
23
|
+
.manifest # roots + optional metadata.transcend.io.template / templateVersion
|
|
24
|
+
example/
|
|
25
|
+
result/… # package example.result
|
|
26
|
+
input.example.json
|
|
27
|
+
input.json # gitignored; VS Code / Regal Evaluate
|
|
28
|
+
input.schema.json # input JSON Schema for editors and opa --schema
|
|
29
|
+
\`\`\`
|
|
30
|
+
|
|
31
|
+
Permissions starters use the same layout. Upload does not branch on template
|
|
32
|
+
metadata; Permissions API still loads only the remote bundle named
|
|
33
|
+
\`permissions\` (publish with \`--remote-bundle-name=permissions\`). Local folder
|
|
34
|
+
(\`--bundle-dir\` / \`{root}-bundle/\`) and remote \`--remote-bundle-name\` are independent.
|
|
35
|
+
|
|
36
|
+
OPA \`.rego\` placement follows the \`package\` line; \`data.json\` paths follow the
|
|
37
|
+
filesystem and must sit under the manifest root prefix on disk.
|
|
38
|
+
|
|
39
|
+
Use Rego v1 explicitly:
|
|
40
|
+
|
|
41
|
+
\`\`\`rego
|
|
42
|
+
package example.result
|
|
43
|
+
|
|
44
|
+
import rego.v1
|
|
45
|
+
\`\`\`
|
|
46
|
+
|
|
47
|
+
When one publishable package reads another package under the same manifest root,
|
|
48
|
+
import it and use the local name:
|
|
49
|
+
|
|
50
|
+
\`\`\`rego
|
|
51
|
+
import data.example.facts
|
|
52
|
+
|
|
53
|
+
allow if facts.subject_is_trusted
|
|
54
|
+
\`\`\`
|
|
55
|
+
|
|
56
|
+
Do not use a fully qualified \`data.<root>…\` reference directly in a rule body.
|
|
57
|
+
Policy Engine re-namespaces package declarations and imports during activation,
|
|
58
|
+
and \`transcend policy lint\` rejects direct self-root references that would
|
|
59
|
+
change meaning.
|
|
60
|
+
|
|
61
|
+
## Define the contract before implementation
|
|
62
|
+
|
|
63
|
+
Find the actual caller and document:
|
|
64
|
+
|
|
65
|
+
1. the query path below \`data\`;
|
|
66
|
+
2. required and optional \`input\` fields;
|
|
67
|
+
3. the result document consumed by the caller;
|
|
68
|
+
4. fail-closed behavior for absent, malformed, or unknown input;
|
|
69
|
+
5. stable reason codes and any fields reserved for later extension.
|
|
70
|
+
|
|
71
|
+
Do not infer a product contract from the generated example. Replace its package
|
|
72
|
+
names and fields when the repository's contract is known.
|
|
73
|
+
|
|
74
|
+
Keep the input JSON Schema as \`input.schema.json\` in the publish directory.
|
|
75
|
+
Pass that file to \`opa check -s\` / \`transcend policy eval --schema\` when you want
|
|
76
|
+
OPA to type-check \`input\`.
|
|
77
|
+
|
|
78
|
+
## Prefer declarative result construction
|
|
79
|
+
|
|
80
|
+
String decisions inside an object remain readable and extensible. Keep one
|
|
81
|
+
result document shape and derive its fields from named rules:
|
|
82
|
+
|
|
83
|
+
\`\`\`rego
|
|
84
|
+
default decision := "deny"
|
|
85
|
+
|
|
86
|
+
decision := "allow" if {
|
|
87
|
+
input.subject.trusted == true
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
default reason_code := "untrusted_or_invalid_input"
|
|
91
|
+
|
|
92
|
+
reason_code := "trusted_subject" if {
|
|
93
|
+
decision == "allow"
|
|
94
|
+
}
|
|
95
|
+
\`\`\`
|
|
96
|
+
|
|
97
|
+
Rego rules define documents; they are not an imperative sequence of variable
|
|
98
|
+
assignments. Prefer small named predicates and one result constructor over
|
|
99
|
+
repeated branch-specific copies of the full output object.
|
|
100
|
+
|
|
101
|
+
## Fail closed
|
|
102
|
+
|
|
103
|
+
- Give the externally queried decision or result a deny/error default.
|
|
104
|
+
- Treat missing fields and unknown enum values as non-authorizing.
|
|
105
|
+
- Avoid broad truthiness checks when exact values are required.
|
|
106
|
+
- Add tests for malformed and incomplete inputs, not only expected allow cases.
|
|
107
|
+
- Add result fields compatibly so existing consumers can continue reading the
|
|
108
|
+
stable core.
|
|
109
|
+
`,B=`# Publishing
|
|
110
|
+
|
|
111
|
+
## Validate the upload contract
|
|
112
|
+
|
|
113
|
+
\`.manifest\` declares the document-tree roots included in the Policy Engine
|
|
114
|
+
bundle. Each non-test Rego package must equal a root or be nested below one.
|
|
115
|
+
Test modules remain local and are excluded from the upload archive.
|
|
116
|
+
|
|
117
|
+
In this template, the publish directory is \`{root}-bundle/\` (the folder that
|
|
118
|
+
contains \`.manifest\`), not the inner \`{root}/\` package tree alone.
|
|
119
|
+
|
|
120
|
+
Scaffolded manifests may include optional OPA \`metadata\`:
|
|
121
|
+
|
|
122
|
+
\`\`\`json
|
|
123
|
+
"metadata": {
|
|
124
|
+
"transcend.io": {
|
|
125
|
+
"template": "generic",
|
|
126
|
+
"templateVersion": "<@transcend-io/cli version>"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
\`\`\`
|
|
130
|
+
|
|
131
|
+
\`template\` (\`generic\` or \`permissions\`) and \`templateVersion\` (the
|
|
132
|
+
\`@transcend-io/cli\` version that generated the scaffold) are **authoring
|
|
133
|
+
hints**. Upload does not branch on them.
|
|
134
|
+
|
|
135
|
+
Before publishing:
|
|
136
|
+
|
|
137
|
+
1. confirm the intended package and query paths with the consuming application;
|
|
138
|
+
2. run \`transcend policy lint <bundle-directory> --noInteractive\` and tests;
|
|
139
|
+
3. review the generated bundle name, version, description, and target Transcend environment;
|
|
140
|
+
4. keep API keys in the environment or the repository's approved secret store.
|
|
141
|
+
|
|
142
|
+
The publish path validates strict Rego compatibility and bundle compilation
|
|
143
|
+
before creating the upload tarball.
|
|
144
|
+
|
|
145
|
+
## Bundle names: local folder vs remote name
|
|
146
|
+
|
|
147
|
+
Upload uses one create/version path for every bundle. Keep these distinct:
|
|
148
|
+
|
|
149
|
+
- **Local** publish directory (\`{root}-bundle/\` or \`--bundle-dir\`) — the
|
|
150
|
+
\`<bundle>\` positional on \`policy publish\` / \`policy eval\`
|
|
151
|
+
- **Remote** \`--remote-bundle-name\` — the Policy Engine resource name in Transcend
|
|
152
|
+
|
|
153
|
+
What makes a bundle “Permissions” is convention plus where Sombra queries it:
|
|
154
|
+
|
|
155
|
+
- **Permissions API** always loads the fixed remote bundle name
|
|
156
|
+
\`permissions\`. Publish that starter with \`--remote-bundle-name=permissions\`.
|
|
157
|
+
- **Generic / decide** bundles use any other \`--remote-bundle-name\` and the decide
|
|
158
|
+
path.
|
|
159
|
+
|
|
160
|
+
\`policy publish\` may warn when \`.manifest\` metadata/roots look Permissions-
|
|
161
|
+
oriented but \`--remote-bundle-name\` is not \`permissions\` (or the reverse). The warning
|
|
162
|
+
does not block upload.
|
|
163
|
+
|
|
164
|
+
## Publish deliberately
|
|
165
|
+
|
|
166
|
+
\`\`\`sh
|
|
167
|
+
# Generic / decide path
|
|
168
|
+
transcend policy publish --remote-bundle-name example --auth "$TRANSCEND_API_KEY" \\
|
|
169
|
+
transcend/policy/example-bundle
|
|
170
|
+
|
|
171
|
+
# Permissions API path (fixed remote name)
|
|
172
|
+
transcend policy publish --remote-bundle-name permissions --auth "$TRANSCEND_API_KEY" \\
|
|
173
|
+
transcend/policy/permissions-bundle
|
|
174
|
+
\`\`\`
|
|
175
|
+
|
|
176
|
+
Run \`transcend policy publish --help\` for current flags and scopes. Publishing
|
|
177
|
+
creates or updates remote Policy Engine bundle resources, so keep it out of
|
|
178
|
+
pull-request validation and require the repository's normal deployment approval.
|
|
179
|
+
|
|
180
|
+
Publish each \`{root}-bundle/\` separately with its own \`--remote-bundle-name\`. Do not
|
|
181
|
+
add publishing, Transcend API credentials, or environment activation to the
|
|
182
|
+
validation-only workflow generated by \`policy init\`.
|
|
183
|
+
`,V=`# Setup and tooling
|
|
184
|
+
|
|
185
|
+
## Install the CLI
|
|
186
|
+
|
|
187
|
+
Install the Transcend CLI **≥ 11**:
|
|
188
|
+
|
|
189
|
+
\`\`\`sh
|
|
190
|
+
npm install --global @transcend-io/cli@^11
|
|
191
|
+
transcend policy --help # should list init, new, lint [<directory>], …
|
|
192
|
+
\`\`\`
|
|
193
|
+
|
|
194
|
+
## Initialize safely
|
|
195
|
+
|
|
196
|
+
Run \`transcend policy init --help\` before choosing flags. The default target is
|
|
197
|
+
\`transcend/policy\`.
|
|
198
|
+
|
|
199
|
+
\`policy init\` creates an empty multi-bundle workspace — shared Regal config
|
|
200
|
+
(\`project.roots: []\`) and a README. No bundles or Rego are created.
|
|
201
|
+
|
|
202
|
+
Interactive initialization offers VS Code setup, this Agent Skill, and
|
|
203
|
+
validation-only GitHub Actions. Non-interactive automation enables only
|
|
204
|
+
explicitly supplied \`--editor\`, \`--skill\`, and \`--ci\` flags:
|
|
205
|
+
|
|
206
|
+
\`\`\`sh
|
|
207
|
+
transcend policy init ./transcend/policy --editor --skill --ci --noInteractive --yes
|
|
208
|
+
\`\`\`
|
|
209
|
+
|
|
210
|
+
Use \`--dryRun\` to inspect the complete transactional plan. Existing policy
|
|
211
|
+
files, manifests, Regal configuration, workflows, and customized managed
|
|
212
|
+
artifacts are preserved.
|
|
213
|
+
|
|
214
|
+
## Add bundles
|
|
215
|
+
|
|
216
|
+
After initializing the workspace, add bundles with \`transcend policy new\`:
|
|
217
|
+
|
|
218
|
+
\`\`\`sh
|
|
219
|
+
transcend policy new --template generic --name example --yes
|
|
220
|
+
transcend policy new --template permissions --name permissions --yes
|
|
221
|
+
# optional: different local folder than {name}-bundle
|
|
222
|
+
transcend policy new --template permissions --name permissions --bundle-dir my-bundle --yes
|
|
223
|
+
\`\`\`
|
|
224
|
+
|
|
225
|
+
Templates available:
|
|
226
|
+
|
|
227
|
+
- \`generic\` — A fail-closed teaching entrypoint (default root: \`example\`)
|
|
228
|
+
- \`permissions\` — A Permission API starter with purpose preferences (default root: \`permissions\`)
|
|
229
|
+
|
|
230
|
+
Naming triad (keep these distinct):
|
|
231
|
+
|
|
232
|
+
- \`--name\` — Rego / \`.manifest\` package root
|
|
233
|
+
- \`--bundle-dir\` — local publish folder basename under the workspace (default
|
|
234
|
+
\`{name}-bundle\`)
|
|
235
|
+
- \`--remote-bundle-name\` — remote Policy Engine name at upload time; unrelated to
|
|
236
|
+
the local folder
|
|
237
|
+
|
|
238
|
+
Each publish directory includes its own \`input.schema.json\` beside the input
|
|
239
|
+
fixtures.
|
|
240
|
+
|
|
241
|
+
\`policy new\` creates the publish directory, its \`.manifest\`, Rego tree,
|
|
242
|
+
input fixtures, and input schema. It also merges the root into Regal config and
|
|
243
|
+
updates VS Code settings/tasks when \`.vscode\` is present.
|
|
244
|
+
|
|
245
|
+
## Required tools
|
|
246
|
+
|
|
247
|
+
- Use OPA 1.x for Rego v1 parsing, formatting, checks, tests, and bundle compilation.
|
|
248
|
+
- Use Regal for idiomatic Rego linting and editor language-server features.
|
|
249
|
+
- Run \`opa version\` and \`regal version\` to confirm the active executables.
|
|
250
|
+
|
|
251
|
+
The generated Regal configuration targets OPA 1.18.2 capabilities. Generated CI
|
|
252
|
+
installs OPA 1.18.2 and Regal 0.42.0; local tools only need to satisfy the
|
|
253
|
+
compatible versions reported by \`policy init\` and \`policy lint\`. Follow their
|
|
254
|
+
official installation links when a compatible tool is missing.
|
|
255
|
+
|
|
256
|
+
## Editor and CI
|
|
257
|
+
|
|
258
|
+
Repository-level VS Code settings should include:
|
|
259
|
+
|
|
260
|
+
- \`opa.roots\` — one entry per \`{root}-bundle/\` publish directory
|
|
261
|
+
- \`opa.bundleMode: true\` — avoid loading fixture JSON as data
|
|
262
|
+
- \`json.schemas\` — validates \`input.json\` / \`input.example.json\`; Permissions
|
|
263
|
+
templates point at the published schema \`$id\`, generic bundles use the local
|
|
264
|
+
\`input.schema.json\`
|
|
265
|
+
|
|
266
|
+
Preserve custom settings and tasks when adapting generated editor files.
|
|
267
|
+
|
|
268
|
+
Generated GitHub Actions CI is read-only and credential-free: it installs pinned
|
|
269
|
+
tools and the pinned Transcend CLI, then runs \`transcend policy lint\` per
|
|
270
|
+
publish directory (matrix when multiple bundles exist). Locally, bare
|
|
271
|
+
\`transcend policy lint\` verifies every child under the workspace that contains
|
|
272
|
+
a \`.manifest\`:
|
|
273
|
+
|
|
274
|
+
\`\`\`sh
|
|
275
|
+
transcend policy lint --noInteractive --json
|
|
276
|
+
transcend policy lint transcend/policy/example-bundle --noInteractive --json
|
|
277
|
+
\`\`\`
|
|
278
|
+
|
|
279
|
+
Adapt triggers, runner labels, dependency installation, and caching to
|
|
280
|
+
established repository conventions without adding publish steps or secrets.
|
|
281
|
+
`,H=`# Testing and debugging
|
|
282
|
+
|
|
283
|
+
## Write executable tests
|
|
284
|
+
|
|
285
|
+
Place tests next to the package they exercise and suffix test modules with
|
|
286
|
+
\`_test.rego\`. A separate \`_test\` package makes the production API and test
|
|
287
|
+
helpers easy to distinguish. Keep the \`_test\` package under the same manifest
|
|
288
|
+
root (for example \`example.result_test\`, not a sibling root), so bundle-mode
|
|
289
|
+
loads accept it.
|
|
290
|
+
|
|
291
|
+
\`\`\`rego
|
|
292
|
+
package example.result_test
|
|
293
|
+
|
|
294
|
+
import data.example.result
|
|
295
|
+
import rego.v1
|
|
296
|
+
|
|
297
|
+
test_denies_missing_input if {
|
|
298
|
+
result.decision == "deny" with input as {}
|
|
299
|
+
result.reason_code == "untrusted_or_invalid_input" with input as {}
|
|
300
|
+
}
|
|
301
|
+
\`\`\`
|
|
302
|
+
|
|
303
|
+
Cover at least:
|
|
304
|
+
|
|
305
|
+
- the ordinary allow case;
|
|
306
|
+
- explicit deny cases;
|
|
307
|
+
- absent, malformed, and unknown input;
|
|
308
|
+
- important result fields and reason codes;
|
|
309
|
+
- interactions between packages when one policy reads another document.
|
|
310
|
+
|
|
311
|
+
\`transcend policy lint\` requires a non-empty test suite.
|
|
312
|
+
|
|
313
|
+
## Use local inputs safely
|
|
314
|
+
|
|
315
|
+
Keep a sanitized \`input.example.json\` in each publish directory. \`policy new\`
|
|
316
|
+
also writes a gitignored \`input.json\` beside it (same contents) so VS Code /
|
|
317
|
+
Regal Evaluate work immediately. Customize \`input.json\` locally; keep
|
|
318
|
+
\`input.example.json\` committed and free of credentials or personal data.
|
|
319
|
+
|
|
320
|
+
## Run the complete gate
|
|
321
|
+
|
|
322
|
+
With no directory argument, \`policy lint\` and \`policy test\` verify every
|
|
323
|
+
immediate child under the workspace (\`transcend/policy\`) that contains a
|
|
324
|
+
\`.manifest\`. Pass one bundle path to target a single unit:
|
|
325
|
+
|
|
326
|
+
\`\`\`sh
|
|
327
|
+
transcend policy lint --noInteractive
|
|
328
|
+
transcend policy test
|
|
329
|
+
transcend policy lint transcend/policy/permissions-bundle --noInteractive
|
|
330
|
+
transcend policy test transcend/policy/permissions-bundle
|
|
331
|
+
opa check --strict -b transcend/policy/permissions-bundle -s transcend/policy/permissions-bundle/input.schema.json
|
|
332
|
+
\`\`\`
|
|
333
|
+
|
|
334
|
+
\`policy lint\` and \`policy test\` run \`opa test -b\` (bundle mode) so a local
|
|
335
|
+
gitignored \`input.json\` beside \`input.example.json\` does not cause a merge
|
|
336
|
+
error. Prefer the CLI over raw directory-mode \`opa test\`. Strict OPA checks use
|
|
337
|
+
Rego v1 (no \`--v0-compatible\`).
|
|
338
|
+
|
|
339
|
+
Use \`transcend policy lint --help\` for formatter flags. Review Regal findings
|
|
340
|
+
deliberately instead of applying broad rewrites.
|
|
341
|
+
|
|
342
|
+
## Evaluate a query
|
|
343
|
+
|
|
344
|
+
\`policy eval\` requires an explicit local publish directory (\`<bundle>\`).
|
|
345
|
+
|
|
346
|
+
Generic example bundle:
|
|
347
|
+
|
|
348
|
+
\`\`\`sh
|
|
349
|
+
transcend policy eval transcend/policy/example-bundle \\
|
|
350
|
+
--package=data.example.result \\
|
|
351
|
+
--input=transcend/policy/example-bundle/input.json
|
|
352
|
+
\`\`\`
|
|
353
|
+
|
|
354
|
+
To simulate the Permissions API, pass the bundle, a purpose query (\`--package\`),
|
|
355
|
+
the local envelope (\`--input\`), and the bundle's input schema (\`--schema\`) so
|
|
356
|
+
OPA type-checks \`input\`:
|
|
357
|
+
|
|
358
|
+
\`\`\`sh
|
|
359
|
+
transcend policy eval transcend/policy/permissions-bundle \\
|
|
360
|
+
--package=data.permissions.purposes \\
|
|
361
|
+
--input=transcend/policy/permissions-bundle/input.json \\
|
|
362
|
+
--schema=transcend/policy/permissions-bundle/input.schema.json
|
|
363
|
+
\`\`\`
|
|
364
|
+
|
|
365
|
+
Or pipe the envelope with \`--stdin-input\`. \`policy eval\` ignores \`*_test.rego\`
|
|
366
|
+
(same as lint/publish — tests are not shipped). Use \`transcend policy eval --help\`
|
|
367
|
+
for curated \`opa eval\` pass-through flags (format, explain, metrics, and similar).
|
|
368
|
+
Exit-on-result flags like OPA \`--fail\` are not exposed — production Evaluate uses
|
|
369
|
+
the Data API (policy deny is a successful evaluation).
|
|
370
|
+
|
|
371
|
+
Or \`opa eval -b … -i …\` with the caller's query path. If the result differs from
|
|
372
|
+
expectations, inspect package paths, imports, defaults, input field presence,
|
|
373
|
+
and the selected bundle directory before changing policy logic.
|
|
374
|
+
`,U=`---
|
|
375
|
+
name: transcend-policy-engine
|
|
376
|
+
description: Sets up, authors, validates, tests, and publishes Transcend Policy Engine projects backed by OPA and Rego. Use for .manifest roots, Rego v1 policy trees, Regal configuration, local policy inputs, Policy Engine CI, or transcend policy CLI commands.
|
|
377
|
+
compatibility: Requires OPA 1.x, Regal, and Transcend CLI ≥ 11 for local validation.
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
# Transcend Policy Engine
|
|
381
|
+
|
|
382
|
+
Use the CLI for deterministic scaffolding and validation. Treat generated
|
|
383
|
+
examples as disposable teaching material and derive the real policy contract
|
|
384
|
+
from repository code and product requirements.
|
|
385
|
+
|
|
386
|
+
Requires **Transcend CLI ≥ 11** (\`transcend policy lint [<directory>]\`, with
|
|
387
|
+
\`init\` available).
|
|
388
|
+
|
|
389
|
+
## Workflow
|
|
390
|
+
|
|
391
|
+
1. Locate each publishable bundle directory (a directory with a \`.manifest\`;
|
|
392
|
+
\`policy new\` scaffolds these as \`{root}-bundle/\` by default (override with
|
|
393
|
+
\`--bundle-dir\`) with a \`{root}/\` package
|
|
394
|
+
tree inside).
|
|
395
|
+
2. For initialization, editor support, tools, or CI, read [references/setup-tooling.md](references/setup-tooling.md).
|
|
396
|
+
3. For package layout, document-tree design, decisions, and inputs, read [references/authoring.md](references/authoring.md).
|
|
397
|
+
4. For tests, local inputs, linting, and evaluation, read [references/testing-debugging.md](references/testing-debugging.md).
|
|
398
|
+
5. For bundle validation and publishing, read [references/publishing.md](references/publishing.md).
|
|
399
|
+
6. Preserve repository conventions and finish with:
|
|
400
|
+
|
|
401
|
+
\`\`\`sh
|
|
402
|
+
transcend policy lint --noInteractive
|
|
403
|
+
\`\`\`
|
|
404
|
+
|
|
405
|
+
## Documentation
|
|
406
|
+
|
|
407
|
+
- Every Transcend CLI command and subcommand provides contextual help with \`transcend <command> --help\`.
|
|
408
|
+
- Use the [Transcend CLI README](https://github.com/transcend-io/tools/tree/main/packages/cli#readme) for command documentation and examples.
|
|
409
|
+
- Use the [Transcend documentation index](https://docs.transcend.io/llms.txt) to find current product documentation.
|
|
410
|
+
|
|
411
|
+
## Guardrails
|
|
412
|
+
|
|
413
|
+
- Do not invent an input shape, output contract, package tree, or deployment convention.
|
|
414
|
+
- Keep decisions fail-closed and make result documents extensible.
|
|
415
|
+
- Never commit credentials or a real local \`input.json\`.
|
|
416
|
+
- Keep every publishable Rego package covered by a \`.manifest\` root.
|
|
417
|
+
- One publish directory = one Policy Engine bundle; do not merge unrelated
|
|
418
|
+
products into a single \`.manifest\` unless they share activation and callers.
|
|
419
|
+
`;const W=`transcend-policy-engine`,G=[{path:`SKILL.md`,contents:U},{path:`references/setup-tooling.md`,contents:V},{path:`references/authoring.md`,contents:z},{path:`references/testing-debugging.md`,contents:H},{path:`references/publishing.md`,contents:B}];function K(e){return`${e.hasSkill?`Use the \`${W}\` skill and run`:`Run`} ${e.newCommand} to add a bundle from a template, then adapt the policy document tree and input/output contract to the intended application.`}function q(e,n){return{version:e.version,command:e.command,applied:n.applied,dryRun:n.dryRun,targetDirectory:e.targetDirectory,manifestPath:e.manifestPath,changes:e.changes.map(e=>t(n.cwd,e)),warnings:e.warnings,nextSteps:e.nextSteps,features:[...e.features],aiHandoff:n.aiHandoff,tools:n.tools}}const J={name:W,displayName:`Policy Engine`,owner:`@transcend-io/cli`,files:G};function Y(e,t){let n=new Set(d().map(({path:t})=>N(e.targetDirectory,t))),r=new Set(t.features);return r.has(R.Editor)&&(n.add(N(e.projectRoot,`.vscode`,`settings.json`)),n.add(N(e.projectRoot,`.vscode`,`extensions.json`)),n.add(N(e.projectRoot,`.vscode`,`tasks.json`))),r.has(R.Skill)&&a(e.projectRoot,e.existingSkillDirectories,J).forEach(e=>n.add(e)),r.has(R.Ci)&&e.repositoryRoot&&e.usesGithub&&n.add(N(e.repositoryRoot,j)),[...n].sort((e,t)=>e.localeCompare(t))}function X(e,t){let n=F(e,t);if(n===`..`||n.startsWith(`..${I}`)||M(n))throw Error(`Refusing to modify path outside project root: ${t}`)}function ie(e){let t=new Set([`${h}/input.json`]);return e.forEach(({path:e})=>{t.add(e);let n=P.dirname(e);for(;n!==`.`;)t.add(n),n=P.dirname(n)}),t}function Z(e,t,n){let r=s({snapshot:u(t.snapshots,n.path),after:n.contents,description:n.description,...n.createOnly===void 0?{}:{createOnly:n.createOnly}});r?e.changes.push(r):e.unchanged.push(n.path)}function ae(e,t,n,r,a,o){Z(e,t,{path:n,contents:r.contents,description:a}),e.warnings.push(...r.warnings.map(e=>`${e} (${i(o,n)})`))}function oe(e,t){let{state:n}=e,r=d(),a=`transcend policy new`,s={version:3,command:`init`,rootDirectory:n.projectRoot,targetDirectory:n.targetDirectory,manifestPath:n.targetDirectory,changes:[],unchanged:[],warnings:[],nextSteps:[a],features:[...t.features]},l=Y(n,t);if(X(n.projectRoot,n.targetDirectory),l.forEach(e=>X(n.projectRoot,e)),n.relativeFilePaths.length===0)s.directoryPreconditions=[{path:n.targetDirectory,relativePaths:[...n.relativePaths]}],r.forEach(t=>{let r=N(n.targetDirectory,t.path);if(o(e.snapshots,r).kind!==`absent`)throw Error(`Expected an empty policy target, but found an entry at: ${r}`);Z(s,e,{path:r,contents:t.contents,description:t.description,createOnly:!0})});else{let t=!0;r.forEach(r=>{let a=N(n.targetDirectory,r.path),c=o(e.snapshots,a);if(c.kind===`file`&&c.contents===r.contents){s.unchanged.push(a);return}t=!1,c.kind!==`absent`&&(s.unchanged.push(a),s.warnings.push(`Existing policy scaffold path was left unchanged: ${i(n.invocationDirectory,a)}`))});let c=ie(r),l=n.relativeFilePaths.some(e=>!c.has(e));(!t||l)&&s.warnings.push(`Existing policy target contains custom or partial content, so no workspace files were added or overwritten. Review ${i(n.invocationDirectory,n.targetDirectory)} manually, then run \`${a}\`.`)}let u=new Set(t.features),f=n.projectRoot;if(u.has(R.Editor)){let t=N(f,`.vscode`,`settings.json`),r=N(f,`.vscode`,`extensions.json`),a=N(f,`.vscode`,`tasks.json`);[{path:t,description:`Merge strict target-scoped OPA and Rego editor settings`,merge:(e,t,n)=>ee(e,t,n)},{path:r,description:`Recommend the OPA extension and discourage its syntax-only conflict`,merge:e=>re(e)},{path:a,description:`Create the VS Code task configuration`,merge:(e,t,n)=>ne(e,t,n)}].forEach(({path:t,description:r,merge:a})=>{let c=o(e.snapshots,t);if(c.kind!==`absent`&&c.kind!==`file`){s.unchanged.push(t),s.warnings.push(`Existing VS Code artifact is not a regular file and was left unchanged: ${i(n.invocationDirectory,t)}`);return}ae(s,e,t,a(c.kind===`file`?c.contents:null,f,n.targetDirectory),r,n.invocationDirectory)})}if(u.has(R.Skill)){let t=c({rootDirectory:f,existingDirectories:n.existingSkillDirectories,snapshots:e.snapshots,skill:J,preserveModified:!0});s.changes.push(...t.changes),s.unchanged.push(...t.unchanged),s.warnings.push(...t.warnings.map(e=>t.unchanged.reduce((e,t)=>e.replace(t,i(n.invocationDirectory,t)),e)))}if(u.has(R.Ci))if(!n.repositoryRoot||!n.usesGithub)s.warnings.push(`GitHub Actions setup was selected, but this target is not inside a detected GitHub repository.`);else{let r=N(n.repositoryRoot,j),a=F(n.repositoryRoot,n.targetDirectory).split(I).join(`/`)||`.`,c=te({cliVersion:t.cliVersion,workspaceDirectory:a,bundleDirectories:[]}),l=o(e.snapshots,r);l.kind===`absent`?Z(s,e,{path:r,contents:c,description:`Add credential-free Policy Engine validation`,createOnly:!0}):l.kind===`file`&&l.contents===c?s.unchanged.push(r):(s.unchanged.push(r),s.warnings.push(`Existing GitHub Actions workflow was left unchanged: ${i(n.invocationDirectory,r)}. Adapt it manually to validate each policy bundle.`))}return s.changes.forEach(({path:e})=>X(n.projectRoot,e)),s}const se={[R.Editor]:`VS Code settings and lint task`,[R.Skill]:`Policy Engine Agent Skill`,[R.Ci]:`Validation-only GitHub Actions`},ce=Object.values(R);function Q(e,t){let n=[t.stdout.trim(),t.stderr.trim()].filter(Boolean).join(`
|
|
420
|
+
`),r=e===`OPA`?x:g;return`${e===`OPA`?`OPA 1.x`:`Regal ${C} or newer`} is required, but \`${e.toLowerCase()} version\` exited with code ${t.code}${n?`: ${n}`:`.`} Install or upgrade it using the official instructions: ${r}`}async function le(e,t,n){let r={opa:null,regal:null},i=[],a=await n(`opa`,[`version`],{cwd:t},e);if(a.error?.code===`ENOENT`)i.push(v);else{let e=`${a.stdout}\n${a.stderr}`,t=_(e);a.code===0?t?i.push(t):r.opa=S(e).version:i.push(t??Q(`OPA`,a))}let o=await n(`regal`,[`version`],{cwd:t},e);if(o.error?.code===`ENOENT`)i.push(b);else{let e=`${o.stdout}\n${o.stderr}`,t=y(e,C,`the generated OPA ${f} capabilities configuration`);o.code===0?t?i.push(t):r.regal=S(e).version:i.push(t??Q(`Regal`,o))}return{tools:r,warnings:i}}async function $(t,a=m,o=k){w(this.process);try{let s=await le(this,this.process.cwd(),o),c=p(this,a),u=new E(this),d=D(t,this.process.stdin.isTTY,this.process.stderr.isTTY),f=await T(u,{features:ce,labels:se,enabled:{[R.Editor]:t.editor,[R.Skill]:t.skill,[R.Ci]:t.ci},interactive:d}),m=Y(c,{features:f}),h=oe({state:c,snapshots:l(this,c.projectRoot,m)},{features:f,cliVersion:e});h.warnings.push(...s.warnings),t.json||this.logger.info(r(h,{cwd:this.process.cwd(),title:`Policy initialization plan`,details:[{label:`Target`,path:h.targetDirectory}]}));let g=h.changes.length===0||t.dryRun;if(h.changes.length>0&&!t.dryRun)if(t.yes)g=!0;else if(d)g=await u.confirm(`Apply this complete plan?`,!0);else throw Error(`The plan requires approval in a non-interactive invocation. Review with --dryRun, then pass --yes.`);g&&!t.dryRun&&h.changes.length>0&&await A(this,h);let _=g&&!t.dryRun&&h.changes.length>0,v=g&&!t.dryRun,y=K({projectPath:n(i(this.process.cwd(),c.targetDirectory)),hasSkill:v&&f.includes(R.Skill),newCommand:h.nextSteps[0]}),b=q(h,{applied:_,dryRun:t.dryRun,cwd:this.process.cwd(),aiHandoff:y,tools:s.tools});if(t.json){this.process.stdout.write(`${JSON.stringify(b)}\n`);return}if(t.dryRun){this.logger.info(L.yellow(`Dry run complete. No changes were written.`));return}if(!g){this.logger.info(L.yellow(`No changes applied.`));return}if(h.changes.length===0){let e=h.warnings.length===s.warnings.length?`Policy project is already initialized.`:`Existing policy project was left unchanged.`;this.logger.info(L.green(e))}else this.logger.info(L.green(`Policy project initialized.`));h.nextSteps.length>0&&(this.logger.info(`\n${L.bold(`Next steps`)}`),h.nextSteps.forEach(e=>this.logger.info(e))),this.logger.info(`\n${L.bold(`AI handoff — paste into your coding agent`)}`),this.logger.info(y)}catch(e){if(e instanceof O)return this.process.exit(130);throw e}}export{$ as init};
|
|
421
|
+
//# sourceMappingURL=impl-Bf2Qli6c2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-DQcgEx7V2.mjs","names":["POLICY_SKILL_MD","POLICY_SETUP_TOOLING_REFERENCE_MD","POLICY_AUTHORING_REFERENCE_MD","POLICY_TESTING_DEBUGGING_REFERENCE_MD","POLICY_PUBLISHING_REFERENCE_MD","CLI_VERSION"],"sources":["../src/lib/policy/policy-scaffold-model.ts","../../../skills/transcend-policy-engine/references/authoring.md","../../../skills/transcend-policy-engine/references/publishing.md","../../../skills/transcend-policy-engine/references/setup-tooling.md","../../../skills/transcend-policy-engine/references/testing-debugging.md","../../../skills/transcend-policy-engine/SKILL.md","../src/lib/policy/policy-skill.ts","../src/lib/policy/policy-scaffold-output.ts","../src/lib/policy/policy-scaffold-planning.ts","../src/commands/policy/init/impl.ts"],"sourcesContent":["import type { ExistingProjectSkillDirectory } from '../scaffolding/agent-skill.js';\nimport type { ProjectPlan } from '../scaffolding/project-plan.js';\n\n/** Version of the stable policy initialization JSON result. */\nexport const POLICY_INIT_RESULT_VERSION = 3 as const;\n\n/** Optional repository integrations for policy authoring. */\nexport const PolicySetupFeature = {\n /** Repository-level editor configuration. */\n Editor: 'editor',\n /** Managed policy authoring skill. */\n Skill: 'skill',\n /** Credential-free continuous integration. */\n Ci: 'ci',\n} as const;\n\n/** Optional repository integration for policy authoring. */\nexport type PolicySetupFeature = (typeof PolicySetupFeature)[keyof typeof PolicySetupFeature];\n\n/** Repository and target state collected before policy planning. */\nexport interface PolicyProjectState {\n /** Directory from which the CLI was invoked. */\n invocationDirectory: string;\n /** Absolute user-selected policy directory. */\n targetDirectory: string;\n /** Repository or invocation root that owns setup artifacts. */\n projectRoot: string;\n /** Nearest repository root, when present. */\n repositoryRoot?: string;\n /** Existing project-level skill directories. */\n existingSkillDirectories: ExistingProjectSkillDirectory[];\n /** Whether the repository appears to use GitHub. */\n usesGithub: boolean;\n /** Case-preserving relative paths below the policy directory. */\n relativePaths: string[];\n /** Relative file and link paths below the policy directory. */\n relativeFilePaths: string[];\n}\n\n/** A complete, validated policy initialization plan. */\nexport interface PolicyInitProjectPlan extends ProjectPlan {\n /** JSON contract version. */\n version: typeof POLICY_INIT_RESULT_VERSION;\n /** Command that produced the plan. */\n command: 'init';\n /** Absolute policy project directory. */\n targetDirectory: string;\n /** Absolute policy manifest path. */\n manifestPath: string;\n /** Files inspected and deliberately left unchanged. */\n unchanged: string[];\n /** Non-fatal plan warnings. */\n warnings: string[];\n /** Raw commands shown after a successful apply. */\n nextSteps: string[];\n /** Exact generated example that remains safe to replace. */\n disposableExamplePath?: string;\n /** Selected repository integrations. */\n features: PolicySetupFeature[];\n}\n",null,null,null,null,null,"import POLICY_AUTHORING_REFERENCE_MD from '../../../../../skills/transcend-policy-engine/references/authoring.md';\nimport POLICY_PUBLISHING_REFERENCE_MD from '../../../../../skills/transcend-policy-engine/references/publishing.md';\nimport POLICY_SETUP_TOOLING_REFERENCE_MD from '../../../../../skills/transcend-policy-engine/references/setup-tooling.md';\nimport POLICY_TESTING_DEBUGGING_REFERENCE_MD from '../../../../../skills/transcend-policy-engine/references/testing-debugging.md';\nimport POLICY_SKILL_MD from '../../../../../skills/transcend-policy-engine/SKILL.md';\nimport type { AgentSkillFile } from '../scaffolding/agent-skill.js';\n\n/** Namespaced directory and frontmatter name for the installed Agent Skill. */\nexport const POLICY_SKILL_NAME = 'transcend-policy-engine';\n\nexport {\n POLICY_AUTHORING_REFERENCE_MD,\n POLICY_PUBLISHING_REFERENCE_MD,\n POLICY_SETUP_TOOLING_REFERENCE_MD,\n POLICY_SKILL_MD,\n POLICY_TESTING_DEBUGGING_REFERENCE_MD,\n};\n\n/** Complete portable Policy Engine Agent Skill file set. */\nexport const POLICY_SKILL_FILES: readonly AgentSkillFile[] = [\n { path: 'SKILL.md', contents: POLICY_SKILL_MD },\n { path: 'references/setup-tooling.md', contents: POLICY_SETUP_TOOLING_REFERENCE_MD },\n { path: 'references/authoring.md', contents: POLICY_AUTHORING_REFERENCE_MD },\n { path: 'references/testing-debugging.md', contents: POLICY_TESTING_DEBUGGING_REFERENCE_MD },\n { path: 'references/publishing.md', contents: POLICY_PUBLISHING_REFERENCE_MD },\n];\n","import {\n toPublicPlannedChange,\n type PublicPlannedChange,\n} from '../scaffolding/project-plan-output.js';\nimport type { PolicyInitProjectPlan, PolicySetupFeature } from './policy-scaffold-model.js';\nimport { POLICY_SKILL_NAME } from './policy-skill.js';\n\n/** Detected local policy tool versions. */\nexport interface PolicyInitToolVersions {\n /** OPA version, or null when missing or incompatible. */\n opa: string | null;\n /** Regal version, or null when missing or incompatible. */\n regal: string | null;\n}\n\n/** Stable machine-readable policy initialization result. */\nexport interface PolicyInitPlanResult {\n /** JSON contract version. */\n version: number;\n /** Command that produced the result. */\n command: 'init';\n /** Whether the plan was applied. */\n applied: boolean;\n /** Whether this was a dry run. */\n dryRun: boolean;\n /** Absolute policy target directory. */\n targetDirectory: string;\n /** Absolute policy manifest path. */\n manifestPath: string;\n /** Planned mutations without file contents. */\n changes: PublicPlannedChange[];\n /** Non-fatal preservation and runtime warnings. */\n warnings: string[];\n /** Suggested raw one-line follow-up commands. */\n nextSteps: string[];\n /** Explicitly selected repository integrations. */\n features: PolicySetupFeature[];\n /** Compact prompt for continuing with a coding agent. */\n aiHandoff: string;\n /** Compatible local policy tool versions. */\n tools: PolicyInitToolVersions;\n}\n\n/**\n * Build the compact policy implementation and CI handoff.\n *\n * @param options - Portable project path and next step\n * @returns Raw one-line prompt\n */\nexport function buildPolicyInitAiHandoff(options: {\n /** Display path to the policy project. */\n projectPath: string;\n /** Whether the policy authoring skill was installed. */\n hasSkill: boolean;\n /** Copyable new-bundle command. */\n newCommand: string;\n}): string {\n const instruction = options.hasSkill ? `Use the \\`${POLICY_SKILL_NAME}\\` skill and run` : 'Run';\n return (\n `${instruction} ${options.newCommand} to add a bundle from a template, ` +\n `then adapt the policy document tree and input/output contract to the intended application.`\n );\n}\n\n/**\n * Build the stable machine-readable initialization result.\n *\n * @param plan - Policy project plan\n * @param options - Apply and runtime state\n * @returns Public JSON result\n */\nexport function buildPolicyInitPlanResult(\n plan: PolicyInitProjectPlan,\n options: {\n /** Whether the plan was applied. */\n applied: boolean;\n /** Whether this was a dry run. */\n dryRun: boolean;\n /** Working directory for portable paths. */\n cwd: string;\n /** Compact coding-agent prompt. */\n aiHandoff: string;\n /** Compatible local policy tool versions. */\n tools: PolicyInitToolVersions;\n },\n): PolicyInitPlanResult {\n return {\n version: plan.version,\n command: plan.command,\n applied: options.applied,\n dryRun: options.dryRun,\n targetDirectory: plan.targetDirectory,\n manifestPath: plan.manifestPath,\n changes: plan.changes.map((change) => toPublicPlannedChange(options.cwd, change)),\n warnings: plan.warnings,\n nextSteps: plan.nextSteps,\n features: [...plan.features],\n aiHandoff: options.aiHandoff,\n tools: options.tools,\n };\n}\n","import { isAbsolute, join, posix, relative, sep } from 'node:path';\n\nimport {\n getManagedAgentSkillCandidatePaths,\n planManagedAgentSkill,\n type ManagedAgentSkillDefinition,\n} from '../scaffolding/agent-skill.js';\nimport { displayProjectPath } from '../scaffolding/project-plan-output.js';\nimport {\n getPlanningPathSnapshot,\n getPlanningFileSnapshot,\n planFileChange,\n type PlanningPathSnapshot,\n} from '../scaffolding/project-plan.js';\nimport {\n generatePolicyGithubActionsWorkflow,\n POLICY_CI_WORKFLOW_PATH,\n} from './policy-scaffold-artifacts.js';\nimport {\n mergePolicyEditorExtensions,\n mergePolicyEditorSettings,\n mergePolicyEditorTasks,\n type PolicyEditorMergeResult,\n} from './policy-scaffold-config.js';\nimport {\n POLICY_INIT_RESULT_VERSION,\n PolicySetupFeature,\n type PolicyInitProjectPlan,\n type PolicyProjectState,\n type PolicySetupFeature as PolicySetupFeatureType,\n} from './policy-scaffold-model.js';\nimport {\n generatePolicyWorkspaceFiles,\n POLICY_STARTER_BUNDLE_DIRECTORY,\n type PolicyStarterFile,\n} from './policy-scaffold-templates.js';\nimport { POLICY_SKILL_FILES, POLICY_SKILL_NAME } from './policy-skill.js';\n\n/** Managed Policy Engine Agent Skill definition. */\nconst POLICY_MANAGED_SKILL: ManagedAgentSkillDefinition = {\n name: POLICY_SKILL_NAME,\n displayName: 'Policy Engine',\n owner: '@transcend-io/cli',\n files: POLICY_SKILL_FILES,\n};\n\n/** In-memory input consumed by the pure policy initializer. */\nexport interface PolicyInitPlanningInput {\n /** Project discovery state. */\n state: PolicyProjectState;\n /** Potential mutation paths keyed by absolute path. */\n snapshots: Readonly<Record<string, PlanningPathSnapshot>>;\n}\n\n/** Optional repository setup selected for policy initialization. */\nexport interface PolicyInitPlanOptions {\n /** Selected setup features. */\n features: readonly PolicySetupFeatureType[];\n /** Exact released Transcend CLI version for generated CI. */\n cliVersion: string;\n}\n\n/**\n * Enumerate all core starter paths that could be created.\n *\n * @param state - Policy project state\n * @param options - Selected repository setup\n * @returns Absolute candidate paths\n */\nexport function getPolicyInitPlanningCandidatePaths(\n state: PolicyProjectState,\n options: Pick<PolicyInitPlanOptions, 'features'>,\n): string[] {\n const paths = new Set(\n generatePolicyWorkspaceFiles().map(({ path }) => join(state.targetDirectory, path)),\n );\n const selected = new Set(options.features);\n if (selected.has(PolicySetupFeature.Editor)) {\n paths.add(join(state.projectRoot, '.vscode', 'settings.json'));\n paths.add(join(state.projectRoot, '.vscode', 'extensions.json'));\n paths.add(join(state.projectRoot, '.vscode', 'tasks.json'));\n }\n if (selected.has(PolicySetupFeature.Skill)) {\n getManagedAgentSkillCandidatePaths(\n state.projectRoot,\n state.existingSkillDirectories,\n POLICY_MANAGED_SKILL,\n ).forEach((path) => paths.add(path));\n }\n if (selected.has(PolicySetupFeature.Ci) && state.repositoryRoot && state.usesGithub) {\n paths.add(join(state.repositoryRoot, POLICY_CI_WORKFLOW_PATH));\n }\n return [...paths].sort((left, right) => left.localeCompare(right));\n}\n\n/**\n * Ensure a destination stays below an approved project root.\n *\n * @param root - Approved root\n * @param path - Candidate path\n */\nfunction assertContained(root: string, path: string): void {\n const child = relative(root, path);\n if (child === '..' || child.startsWith(`..${sep}`) || isAbsolute(child)) {\n throw new Error(`Refusing to modify path outside project root: ${path}`);\n }\n}\n\n/**\n * Enumerate generated file and directory paths allowed in an exact starter.\n *\n * @param files - Starter files\n * @returns POSIX relative paths\n */\nfunction starterRelativePaths(files: readonly PolicyStarterFile[]): Set<string> {\n const paths = new Set<string>([`${POLICY_STARTER_BUNDLE_DIRECTORY}/input.json`]);\n files.forEach(({ path }) => {\n paths.add(path);\n let parent = posix.dirname(path);\n while (parent !== '.') {\n paths.add(parent);\n parent = posix.dirname(parent);\n }\n });\n return paths;\n}\n\n/**\n * Add or classify one regular-file mutation.\n *\n * @param plan - Policy plan being assembled\n * @param input - Collected snapshots\n * @param options - Desired file\n */\nfunction addFileChange(\n plan: PolicyInitProjectPlan,\n input: PolicyInitPlanningInput,\n options: {\n /** Absolute destination path. */\n path: string;\n /** Complete desired contents. */\n contents: string;\n /** Human-readable plan description. */\n description: string;\n /** Refuse existing contents. */\n createOnly?: boolean;\n },\n): void {\n const change = planFileChange({\n snapshot: getPlanningFileSnapshot(input.snapshots, options.path),\n after: options.contents,\n description: options.description,\n ...(options.createOnly === undefined ? {} : { createOnly: options.createOnly }),\n });\n if (change) {\n plan.changes.push(change);\n } else {\n plan.unchanged.push(options.path);\n }\n}\n\n/**\n * Add one safe editor merge and its preservation warnings.\n *\n * @param plan - Policy plan being assembled\n * @param input - Collected snapshots\n * @param path - Absolute editor artifact path\n * @param result - Pure JSONC merge result\n * @param description - Human-readable plan description\n * @param cwd - Invocation directory for portable warning paths\n */\nfunction addEditorMerge(\n plan: PolicyInitProjectPlan,\n input: PolicyInitPlanningInput,\n path: string,\n result: PolicyEditorMergeResult,\n description: string,\n cwd: string,\n): void {\n addFileChange(plan, input, {\n path,\n contents: result.contents,\n description,\n });\n plan.warnings.push(\n ...result.warnings.map((warning) => `${warning} (${displayProjectPath(cwd, path)})`),\n );\n}\n\n/**\n * Build a safe policy project plan without reading the filesystem.\n *\n * Empty targets receive the complete starter. Existing targets are classified\n * only; no domain file is added, merged, or overwritten.\n *\n * @param input - Collected project state and path snapshots\n * @param options - Selected setup and pinned CLI version\n * @returns Validated policy initialization plan\n */\nexport function buildPolicyInitPlan(\n input: PolicyInitPlanningInput,\n options: PolicyInitPlanOptions,\n): PolicyInitProjectPlan {\n const { state } = input;\n const files = generatePolicyWorkspaceFiles();\n const newCommand = 'transcend policy new';\n const plan: PolicyInitProjectPlan = {\n version: POLICY_INIT_RESULT_VERSION,\n command: 'init',\n rootDirectory: state.projectRoot,\n targetDirectory: state.targetDirectory,\n // Init creates a workspace only; bundles (and their .manifest) come from `policy new`.\n manifestPath: state.targetDirectory,\n changes: [],\n unchanged: [],\n warnings: [],\n nextSteps: [newCommand],\n features: [...options.features],\n };\n\n const candidatePaths = getPolicyInitPlanningCandidatePaths(state, options);\n assertContained(state.projectRoot, state.targetDirectory);\n candidatePaths.forEach((path) => assertContained(state.projectRoot, path));\n\n if (state.relativeFilePaths.length === 0) {\n plan.directoryPreconditions = [\n {\n path: state.targetDirectory,\n relativePaths: [...state.relativePaths],\n },\n ];\n files.forEach((file) => {\n const path = join(state.targetDirectory, file.path);\n const snapshot = getPlanningPathSnapshot(input.snapshots, path);\n if (snapshot.kind !== 'absent') {\n throw new Error(`Expected an empty policy target, but found an entry at: ${path}`);\n }\n addFileChange(plan, input, {\n path,\n contents: file.contents,\n description: file.description,\n createOnly: true,\n });\n });\n } else {\n let allWorkspaceFilesMatch = true;\n files.forEach((file) => {\n const path = join(state.targetDirectory, file.path);\n const snapshot = getPlanningPathSnapshot(input.snapshots, path);\n if (snapshot.kind === 'file' && snapshot.contents === file.contents) {\n plan.unchanged.push(path);\n return;\n }\n allWorkspaceFilesMatch = false;\n if (snapshot.kind !== 'absent') {\n plan.unchanged.push(path);\n plan.warnings.push(\n `Existing policy scaffold path was left unchanged: ${displayProjectPath(\n state.invocationDirectory,\n path,\n )}`,\n );\n }\n });\n\n const allowedPaths = starterRelativePaths(files);\n const hasCustomPaths = state.relativeFilePaths.some((path) => !allowedPaths.has(path));\n if (!allWorkspaceFilesMatch || hasCustomPaths) {\n plan.warnings.push(\n `Existing policy target contains custom or partial content, so no workspace files were added or overwritten. ` +\n `Review ${displayProjectPath(\n state.invocationDirectory,\n state.targetDirectory,\n )} manually, then run \\`${newCommand}\\`.`,\n );\n }\n }\n\n const selected = new Set(options.features);\n const root = state.projectRoot;\n if (selected.has(PolicySetupFeature.Editor)) {\n const settingsPath = join(root, '.vscode', 'settings.json');\n const extensionsPath = join(root, '.vscode', 'extensions.json');\n const tasksPath = join(root, '.vscode', 'tasks.json');\n\n type EditorMergeFn = (\n contents: string | null,\n repositoryRoot: string,\n targetDirectory: string,\n ) => PolicyEditorMergeResult;\n const editorArtifacts: {\n /** Absolute path. */\n path: string;\n /** Plan description. */\n description: string;\n /** Merge function. */\n merge: EditorMergeFn;\n }[] = [\n {\n path: settingsPath,\n description: 'Merge strict target-scoped OPA and Rego editor settings',\n merge: (contents, repositoryRoot, targetDirectory) =>\n mergePolicyEditorSettings(contents, repositoryRoot, targetDirectory),\n },\n {\n path: extensionsPath,\n description: 'Recommend the OPA extension and discourage its syntax-only conflict',\n merge: (contents) => mergePolicyEditorExtensions(contents),\n },\n {\n path: tasksPath,\n description: 'Create the VS Code task configuration',\n merge: (contents, repositoryRoot, targetDirectory) =>\n mergePolicyEditorTasks(contents, repositoryRoot, targetDirectory),\n },\n ];\n editorArtifacts.forEach(({ path, description, merge }) => {\n const snapshot = getPlanningPathSnapshot(input.snapshots, path);\n if (snapshot.kind !== 'absent' && snapshot.kind !== 'file') {\n plan.unchanged.push(path);\n plan.warnings.push(\n `Existing VS Code artifact is not a regular file and was left unchanged: ${displayProjectPath(\n state.invocationDirectory,\n path,\n )}`,\n );\n return;\n }\n addEditorMerge(\n plan,\n input,\n path,\n merge(snapshot.kind === 'file' ? snapshot.contents : null, root, state.targetDirectory),\n description,\n state.invocationDirectory,\n );\n });\n }\n\n if (selected.has(PolicySetupFeature.Skill)) {\n const skillPlan = planManagedAgentSkill({\n rootDirectory: root,\n existingDirectories: state.existingSkillDirectories,\n snapshots: input.snapshots,\n skill: POLICY_MANAGED_SKILL,\n preserveModified: true,\n });\n plan.changes.push(...skillPlan.changes);\n plan.unchanged.push(...skillPlan.unchanged);\n plan.warnings.push(\n ...skillPlan.warnings.map((warning) => {\n return skillPlan.unchanged.reduce(\n (rendered, path) =>\n rendered.replace(path, displayProjectPath(state.invocationDirectory, path)),\n warning,\n );\n }),\n );\n }\n\n if (selected.has(PolicySetupFeature.Ci)) {\n if (!state.repositoryRoot || !state.usesGithub) {\n plan.warnings.push(\n 'GitHub Actions setup was selected, but this target is not inside a detected GitHub repository.',\n );\n } else {\n const workflowPath = join(state.repositoryRoot, POLICY_CI_WORKFLOW_PATH);\n const workspaceDirectory =\n relative(state.repositoryRoot, state.targetDirectory).split(sep).join('/') || '.';\n const workflowContents = generatePolicyGithubActionsWorkflow({\n cliVersion: options.cliVersion,\n workspaceDirectory,\n bundleDirectories: [],\n });\n const workflowSnapshot = getPlanningPathSnapshot(input.snapshots, workflowPath);\n if (workflowSnapshot.kind === 'absent') {\n addFileChange(plan, input, {\n path: workflowPath,\n contents: workflowContents,\n description: 'Add credential-free Policy Engine validation',\n createOnly: true,\n });\n } else if (\n workflowSnapshot.kind === 'file' &&\n workflowSnapshot.contents === workflowContents\n ) {\n plan.unchanged.push(workflowPath);\n } else {\n plan.unchanged.push(workflowPath);\n plan.warnings.push(\n `Existing GitHub Actions workflow was left unchanged: ${displayProjectPath(\n state.invocationDirectory,\n workflowPath,\n )}. Adapt it manually to validate each policy bundle.`,\n );\n }\n }\n }\n\n plan.changes.forEach(({ path }) => assertContained(state.projectRoot, path));\n return plan;\n}\n","import colors from 'colors';\n\nimport { version as CLI_VERSION } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport {\n runCapturedProcess,\n type CapturedProcessResult,\n type CapturedProcessRunner,\n} from '../../../lib/cli/run-captured-process.js';\nimport {\n DEFAULT_POLICY_PROJECT_DIRECTORY,\n discoverPolicyProject,\n} from '../../../lib/policy/policy-project-discovery.js';\nimport {\n OPA_INSTALL_URL,\n OPA_MISSING_MESSAGE,\n parsePolicyToolVersion,\n MINIMUM_POLICY_STARTER_REGAL_VERSION,\n REGAL_INSTALL_URL,\n REGAL_MISSING_MESSAGE,\n unsupportedOpaVersionMessage,\n unsupportedRegalVersionMessage,\n} from '../../../lib/policy/policy-runtime.js';\nimport {\n PolicySetupFeature,\n type PolicySetupFeature as PolicySetupFeatureType,\n} from '../../../lib/policy/policy-scaffold-model.js';\nimport {\n buildPolicyInitAiHandoff,\n buildPolicyInitPlanResult,\n type PolicyInitToolVersions,\n} from '../../../lib/policy/policy-scaffold-output.js';\nimport {\n buildPolicyInitPlan,\n getPolicyInitPlanningCandidatePaths,\n} from '../../../lib/policy/policy-scaffold-planning.js';\nimport { POLICY_STARTER_OPA_VERSION } from '../../../lib/policy/policy-scaffold-templates.js';\nimport { collectPlanningSnapshots } from '../../../lib/scaffolding/project-discovery.js';\nimport { applyProjectPlan } from '../../../lib/scaffolding/project-plan-apply.js';\nimport {\n displayProjectPath,\n quoteShellArgument,\n renderProjectPlan,\n} from '../../../lib/scaffolding/project-plan-output.js';\nimport {\n isInteractivePromptInvocation,\n PromptCancelledError,\n resolveSetupFeatures,\n ScaffoldPrompts,\n} from '../../../lib/scaffolding/prompts.js';\n\n/** Flags for `transcend policy init`. */\nexport interface PolicyInitFlags {\n /** Install repository-level VS Code setup. */\n editor?: boolean;\n /** Install the Policy Engine Agent Skill. */\n skill?: boolean;\n /** Install validation-only GitHub Actions CI. */\n ci?: boolean;\n /** Disable prompts. */\n noInteractive: boolean;\n /** Render but do not apply the plan. */\n dryRun: boolean;\n /** Approve the final displayed plan. */\n yes: boolean;\n /** Emit one stable JSON result on stdout. */\n json: boolean;\n}\n\n/** User-facing optional setup labels. */\nconst SETUP_LABELS: Readonly<Record<PolicySetupFeatureType, string>> = {\n [PolicySetupFeature.Editor]: 'VS Code settings and lint task',\n [PolicySetupFeature.Skill]: 'Policy Engine Agent Skill',\n [PolicySetupFeature.Ci]: 'Validation-only GitHub Actions',\n};\n\n/** All optional setup features in stable prompt order. */\nconst ALL_SETUP_FEATURES = Object.values(PolicySetupFeature);\n\n/** Runtime compatibility detected before policy planning. */\ninterface PolicyRuntimeProbe {\n /** Compatible tool versions. */\n tools: PolicyInitToolVersions;\n /** Missing or incompatible runtime guidance. */\n warnings: string[];\n}\n\n/**\n * Explain a failed version subprocess with official installation guidance.\n *\n * @param tool - Policy tool name\n * @param result - Failed captured process\n * @returns Actionable warning\n */\nfunction failedVersionProbeMessage(tool: 'OPA' | 'Regal', result: CapturedProcessResult): string {\n const detail = [result.stdout.trim(), result.stderr.trim()].filter(Boolean).join('\\n');\n const url = tool === 'OPA' ? OPA_INSTALL_URL : REGAL_INSTALL_URL;\n const requirement =\n tool === 'OPA' ? 'OPA 1.x' : `Regal ${MINIMUM_POLICY_STARTER_REGAL_VERSION} or newer`;\n return (\n `${requirement} is required, but \\`${tool.toLowerCase()} version\\` exited with code ` +\n `${result.code}${detail ? `: ${detail}` : '.'} ` +\n `Install or upgrade it using the official instructions: ${url}`\n );\n}\n\n/**\n * Probe both local policy runtimes without installing or modifying them.\n *\n * @param context - CLI context\n * @param cwd - Invocation working directory\n * @param runner - Captured subprocess runner\n * @returns Compatible versions and exact runtime guidance\n */\nasync function probePolicyRuntimes(\n context: LocalContext,\n cwd: string,\n runner: CapturedProcessRunner,\n): Promise<PolicyRuntimeProbe> {\n const tools: PolicyInitToolVersions = { opa: null, regal: null };\n const warnings: string[] = [];\n\n const opaResult = await runner('opa', ['version'], { cwd }, context);\n if (opaResult.error?.code === 'ENOENT') {\n warnings.push(OPA_MISSING_MESSAGE);\n } else {\n const output = `${opaResult.stdout}\\n${opaResult.stderr}`;\n const unsupported = unsupportedOpaVersionMessage(output);\n if (opaResult.code !== 0) {\n warnings.push(unsupported ?? failedVersionProbeMessage('OPA', opaResult));\n } else if (unsupported) {\n warnings.push(unsupported);\n } else {\n tools.opa = parsePolicyToolVersion(output)!.version;\n }\n }\n\n const regalResult = await runner('regal', ['version'], { cwd }, context);\n if (regalResult.error?.code === 'ENOENT') {\n warnings.push(REGAL_MISSING_MESSAGE);\n } else {\n const output = `${regalResult.stdout}\\n${regalResult.stderr}`;\n const unsupported = unsupportedRegalVersionMessage(\n output,\n MINIMUM_POLICY_STARTER_REGAL_VERSION,\n `the generated OPA ${POLICY_STARTER_OPA_VERSION} capabilities configuration`,\n );\n if (regalResult.code !== 0) {\n warnings.push(unsupported ?? failedVersionProbeMessage('Regal', regalResult));\n } else if (unsupported) {\n warnings.push(unsupported);\n } else {\n tools.regal = parsePolicyToolVersion(output)!.version;\n }\n }\n\n return { tools, warnings };\n}\n\n/**\n * Initialize a credential-free local Policy Engine project.\n *\n * @param this - CLI context\n * @param flags - Scaffold and interaction flags\n * @param directory - Target policy directory\n * @param runner - Captured policy tool runner\n */\nexport async function init(\n this: LocalContext,\n flags: PolicyInitFlags,\n directory: string = DEFAULT_POLICY_PROJECT_DIRECTORY,\n runner: CapturedProcessRunner = runCapturedProcess,\n): Promise<void> {\n doneInputValidation(this.process);\n try {\n const runtime = await probePolicyRuntimes(this, this.process.cwd(), runner);\n const state = discoverPolicyProject(this, directory);\n const prompts = new ScaffoldPrompts(this);\n const interactive = isInteractivePromptInvocation(\n flags,\n this.process.stdin.isTTY,\n this.process.stderr.isTTY,\n );\n const features = await resolveSetupFeatures(prompts, {\n features: ALL_SETUP_FEATURES,\n labels: SETUP_LABELS,\n enabled: {\n [PolicySetupFeature.Editor]: flags.editor,\n [PolicySetupFeature.Skill]: flags.skill,\n [PolicySetupFeature.Ci]: flags.ci,\n },\n interactive,\n });\n const candidatePaths = getPolicyInitPlanningCandidatePaths(state, { features });\n const snapshots = collectPlanningSnapshots(this, state.projectRoot, candidatePaths);\n\n const plan = buildPolicyInitPlan(\n { state, snapshots },\n {\n features,\n cliVersion: CLI_VERSION,\n },\n );\n plan.warnings.push(...runtime.warnings);\n\n if (!flags.json) {\n this.logger.info(\n renderProjectPlan(plan, {\n cwd: this.process.cwd(),\n title: 'Policy initialization plan',\n details: [{ label: 'Target', path: plan.targetDirectory }],\n }),\n );\n }\n\n let approved = plan.changes.length === 0 || flags.dryRun;\n if (plan.changes.length > 0 && !flags.dryRun) {\n if (flags.yes) {\n approved = true;\n } else if (interactive) {\n approved = await prompts.confirm('Apply this complete plan?', true);\n } else {\n throw new Error(\n 'The plan requires approval in a non-interactive invocation. Review with --dryRun, then pass --yes.',\n );\n }\n }\n\n if (approved && !flags.dryRun && plan.changes.length > 0) {\n await applyProjectPlan(this, plan);\n }\n const applied = approved && !flags.dryRun && plan.changes.length > 0;\n const setupAvailable = approved && !flags.dryRun;\n const aiHandoff = buildPolicyInitAiHandoff({\n projectPath: quoteShellArgument(\n displayProjectPath(this.process.cwd(), state.targetDirectory),\n ),\n hasSkill: setupAvailable && features.includes(PolicySetupFeature.Skill),\n newCommand: plan.nextSteps[0]!,\n });\n const result = buildPolicyInitPlanResult(plan, {\n applied,\n dryRun: flags.dryRun,\n cwd: this.process.cwd(),\n aiHandoff,\n tools: runtime.tools,\n });\n if (flags.json) {\n this.process.stdout.write(`${JSON.stringify(result)}\\n`);\n return;\n }\n if (flags.dryRun) {\n this.logger.info(colors.yellow('Dry run complete. No changes were written.'));\n return;\n }\n if (!approved) {\n this.logger.info(colors.yellow('No changes applied.'));\n return;\n }\n if (plan.changes.length === 0) {\n const message =\n plan.warnings.length === runtime.warnings.length\n ? 'Policy project is already initialized.'\n : 'Existing policy project was left unchanged.';\n this.logger.info(colors.green(message));\n } else {\n this.logger.info(colors.green('Policy project initialized.'));\n }\n if (plan.nextSteps.length > 0) {\n this.logger.info(`\\n${colors.bold('Next steps')}`);\n plan.nextSteps.forEach((step) => this.logger.info(step));\n }\n this.logger.info(`\\n${colors.bold('AI handoff — paste into your coding agent')}`);\n this.logger.info(aiHandoff);\n } catch (error) {\n if (error instanceof PromptCancelledError) {\n return this.process.exit(130);\n }\n throw error;\n }\n}\n"],"mappings":"syBAOA,MAAa,EAAqB,CAEhC,OAAQ,SAER,MAAO,QAEP,GAAI,KACL,OCdD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ICAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ICAA,guGCAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ICAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ECQA,MAAa,EAAoB,0BAWpB,EAAgD,CAC3D,CAAE,KAAM,WAAY,SAAUA,EAAiB,CAC/C,CAAE,KAAM,8BAA+B,SAAUC,EAAmC,CACpF,CAAE,KAAM,0BAA2B,SAAUC,EAA+B,CAC5E,CAAE,KAAM,kCAAmC,SAAUC,EAAuC,CAC5F,CAAE,KAAM,2BAA4B,SAAUC,EAAgC,CAC/E,CCwBD,S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,KAAK,OAAO,KAAK,EAAO,MAAM,EAAQ,CAAC,MAEvC,KAAK,OAAO,KAAK,EAAO,MAAM,8BAA8B,CAAC,CAE3D,EAAK,UAAU,OAAS,IAC1B,KAAK,OAAO,KAAK,KAAK,EAAO,KAAK,aAAa,GAAG,CAClD,EAAK,UAAU,QAAS,GAAS,KAAK,OAAO,KAAK,EAAK,CAAC,EAE1D,KAAK,OAAO,KAAK,KAAK,EAAO,KAAK,4CAA4C,GAAG,CACjF,KAAK,OAAO,KAAK,EAAU,OACpB,EAAO,CACd,GAAI,aAAiB,EACnB,OAAO,KAAK,QAAQ,KAAK,IAAI,CAE/B,MAAM"}
|
|
1
|
+
{"version":3,"file":"impl-Bf2Qli6c2.mjs","names":["POLICY_SKILL_MD","POLICY_SETUP_TOOLING_REFERENCE_MD","POLICY_AUTHORING_REFERENCE_MD","POLICY_TESTING_DEBUGGING_REFERENCE_MD","POLICY_PUBLISHING_REFERENCE_MD","CLI_VERSION"],"sources":["../src/lib/policy/policy-scaffold-model.ts","../../../skills/transcend-policy-engine/references/authoring.md","../../../skills/transcend-policy-engine/references/publishing.md","../../../skills/transcend-policy-engine/references/setup-tooling.md","../../../skills/transcend-policy-engine/references/testing-debugging.md","../../../skills/transcend-policy-engine/SKILL.md","../src/lib/policy/policy-skill.ts","../src/lib/policy/policy-scaffold-output.ts","../src/lib/policy/policy-scaffold-planning.ts","../src/commands/policy/init/impl.ts"],"sourcesContent":["import type { ExistingProjectSkillDirectory } from '../scaffolding/agent-skill.js';\nimport type { ProjectPlan } from '../scaffolding/project-plan.js';\n\n/** Version of the stable policy initialization JSON result. */\nexport const POLICY_INIT_RESULT_VERSION = 3 as const;\n\n/** Optional repository integrations for policy authoring. */\nexport const PolicySetupFeature = {\n /** Repository-level editor configuration. */\n Editor: 'editor',\n /** Managed policy authoring skill. */\n Skill: 'skill',\n /** Credential-free continuous integration. */\n Ci: 'ci',\n} as const;\n\n/** Optional repository integration for policy authoring. */\nexport type PolicySetupFeature = (typeof PolicySetupFeature)[keyof typeof PolicySetupFeature];\n\n/** Repository and target state collected before policy planning. */\nexport interface PolicyProjectState {\n /** Directory from which the CLI was invoked. */\n invocationDirectory: string;\n /** Absolute user-selected policy directory. */\n targetDirectory: string;\n /** Repository or invocation root that owns setup artifacts. */\n projectRoot: string;\n /** Nearest repository root, when present. */\n repositoryRoot?: string;\n /** Existing project-level skill directories. */\n existingSkillDirectories: ExistingProjectSkillDirectory[];\n /** Whether the repository appears to use GitHub. */\n usesGithub: boolean;\n /** Case-preserving relative paths below the policy directory. */\n relativePaths: string[];\n /** Relative file and link paths below the policy directory. */\n relativeFilePaths: string[];\n}\n\n/** A complete, validated policy initialization plan. */\nexport interface PolicyInitProjectPlan extends ProjectPlan {\n /** JSON contract version. */\n version: typeof POLICY_INIT_RESULT_VERSION;\n /** Command that produced the plan. */\n command: 'init';\n /** Absolute policy project directory. */\n targetDirectory: string;\n /** Absolute policy manifest path. */\n manifestPath: string;\n /** Files inspected and deliberately left unchanged. */\n unchanged: string[];\n /** Non-fatal plan warnings. */\n warnings: string[];\n /** Raw commands shown after a successful apply. */\n nextSteps: string[];\n /** Exact generated example that remains safe to replace. */\n disposableExamplePath?: string;\n /** Selected repository integrations. */\n features: PolicySetupFeature[];\n}\n",null,null,null,null,null,"import POLICY_AUTHORING_REFERENCE_MD from '../../../../../skills/transcend-policy-engine/references/authoring.md';\nimport POLICY_PUBLISHING_REFERENCE_MD from '../../../../../skills/transcend-policy-engine/references/publishing.md';\nimport POLICY_SETUP_TOOLING_REFERENCE_MD from '../../../../../skills/transcend-policy-engine/references/setup-tooling.md';\nimport POLICY_TESTING_DEBUGGING_REFERENCE_MD from '../../../../../skills/transcend-policy-engine/references/testing-debugging.md';\nimport POLICY_SKILL_MD from '../../../../../skills/transcend-policy-engine/SKILL.md';\nimport type { AgentSkillFile } from '../scaffolding/agent-skill.js';\n\n/** Namespaced directory and frontmatter name for the installed Agent Skill. */\nexport const POLICY_SKILL_NAME = 'transcend-policy-engine';\n\nexport {\n POLICY_AUTHORING_REFERENCE_MD,\n POLICY_PUBLISHING_REFERENCE_MD,\n POLICY_SETUP_TOOLING_REFERENCE_MD,\n POLICY_SKILL_MD,\n POLICY_TESTING_DEBUGGING_REFERENCE_MD,\n};\n\n/** Complete portable Policy Engine Agent Skill file set. */\nexport const POLICY_SKILL_FILES: readonly AgentSkillFile[] = [\n { path: 'SKILL.md', contents: POLICY_SKILL_MD },\n { path: 'references/setup-tooling.md', contents: POLICY_SETUP_TOOLING_REFERENCE_MD },\n { path: 'references/authoring.md', contents: POLICY_AUTHORING_REFERENCE_MD },\n { path: 'references/testing-debugging.md', contents: POLICY_TESTING_DEBUGGING_REFERENCE_MD },\n { path: 'references/publishing.md', contents: POLICY_PUBLISHING_REFERENCE_MD },\n];\n","import {\n toPublicPlannedChange,\n type PublicPlannedChange,\n} from '../scaffolding/project-plan-output.js';\nimport type { PolicyInitProjectPlan, PolicySetupFeature } from './policy-scaffold-model.js';\nimport { POLICY_SKILL_NAME } from './policy-skill.js';\n\n/** Detected local policy tool versions. */\nexport interface PolicyInitToolVersions {\n /** OPA version, or null when missing or incompatible. */\n opa: string | null;\n /** Regal version, or null when missing or incompatible. */\n regal: string | null;\n}\n\n/** Stable machine-readable policy initialization result. */\nexport interface PolicyInitPlanResult {\n /** JSON contract version. */\n version: number;\n /** Command that produced the result. */\n command: 'init';\n /** Whether the plan was applied. */\n applied: boolean;\n /** Whether this was a dry run. */\n dryRun: boolean;\n /** Absolute policy target directory. */\n targetDirectory: string;\n /** Absolute policy manifest path. */\n manifestPath: string;\n /** Planned mutations without file contents. */\n changes: PublicPlannedChange[];\n /** Non-fatal preservation and runtime warnings. */\n warnings: string[];\n /** Suggested raw one-line follow-up commands. */\n nextSteps: string[];\n /** Explicitly selected repository integrations. */\n features: PolicySetupFeature[];\n /** Compact prompt for continuing with a coding agent. */\n aiHandoff: string;\n /** Compatible local policy tool versions. */\n tools: PolicyInitToolVersions;\n}\n\n/**\n * Build the compact policy implementation and CI handoff.\n *\n * @param options - Portable project path and next step\n * @returns Raw one-line prompt\n */\nexport function buildPolicyInitAiHandoff(options: {\n /** Display path to the policy project. */\n projectPath: string;\n /** Whether the policy authoring skill was installed. */\n hasSkill: boolean;\n /** Copyable new-bundle command. */\n newCommand: string;\n}): string {\n const instruction = options.hasSkill ? `Use the \\`${POLICY_SKILL_NAME}\\` skill and run` : 'Run';\n return (\n `${instruction} ${options.newCommand} to add a bundle from a template, ` +\n `then adapt the policy document tree and input/output contract to the intended application.`\n );\n}\n\n/**\n * Build the stable machine-readable initialization result.\n *\n * @param plan - Policy project plan\n * @param options - Apply and runtime state\n * @returns Public JSON result\n */\nexport function buildPolicyInitPlanResult(\n plan: PolicyInitProjectPlan,\n options: {\n /** Whether the plan was applied. */\n applied: boolean;\n /** Whether this was a dry run. */\n dryRun: boolean;\n /** Working directory for portable paths. */\n cwd: string;\n /** Compact coding-agent prompt. */\n aiHandoff: string;\n /** Compatible local policy tool versions. */\n tools: PolicyInitToolVersions;\n },\n): PolicyInitPlanResult {\n return {\n version: plan.version,\n command: plan.command,\n applied: options.applied,\n dryRun: options.dryRun,\n targetDirectory: plan.targetDirectory,\n manifestPath: plan.manifestPath,\n changes: plan.changes.map((change) => toPublicPlannedChange(options.cwd, change)),\n warnings: plan.warnings,\n nextSteps: plan.nextSteps,\n features: [...plan.features],\n aiHandoff: options.aiHandoff,\n tools: options.tools,\n };\n}\n","import { isAbsolute, join, posix, relative, sep } from 'node:path';\n\nimport {\n getManagedAgentSkillCandidatePaths,\n planManagedAgentSkill,\n type ManagedAgentSkillDefinition,\n} from '../scaffolding/agent-skill.js';\nimport { displayProjectPath } from '../scaffolding/project-plan-output.js';\nimport {\n getPlanningPathSnapshot,\n getPlanningFileSnapshot,\n planFileChange,\n type PlanningPathSnapshot,\n} from '../scaffolding/project-plan.js';\nimport {\n generatePolicyGithubActionsWorkflow,\n POLICY_CI_WORKFLOW_PATH,\n} from './policy-scaffold-artifacts.js';\nimport {\n mergePolicyEditorExtensions,\n mergePolicyEditorSettings,\n mergePolicyEditorTasks,\n type PolicyEditorMergeResult,\n} from './policy-scaffold-config.js';\nimport {\n POLICY_INIT_RESULT_VERSION,\n PolicySetupFeature,\n type PolicyInitProjectPlan,\n type PolicyProjectState,\n type PolicySetupFeature as PolicySetupFeatureType,\n} from './policy-scaffold-model.js';\nimport {\n generatePolicyWorkspaceFiles,\n POLICY_STARTER_BUNDLE_DIRECTORY,\n type PolicyStarterFile,\n} from './policy-scaffold-templates.js';\nimport { POLICY_SKILL_FILES, POLICY_SKILL_NAME } from './policy-skill.js';\n\n/** Managed Policy Engine Agent Skill definition. */\nconst POLICY_MANAGED_SKILL: ManagedAgentSkillDefinition = {\n name: POLICY_SKILL_NAME,\n displayName: 'Policy Engine',\n owner: '@transcend-io/cli',\n files: POLICY_SKILL_FILES,\n};\n\n/** In-memory input consumed by the pure policy initializer. */\nexport interface PolicyInitPlanningInput {\n /** Project discovery state. */\n state: PolicyProjectState;\n /** Potential mutation paths keyed by absolute path. */\n snapshots: Readonly<Record<string, PlanningPathSnapshot>>;\n}\n\n/** Optional repository setup selected for policy initialization. */\nexport interface PolicyInitPlanOptions {\n /** Selected setup features. */\n features: readonly PolicySetupFeatureType[];\n /** Exact released Transcend CLI version for generated CI. */\n cliVersion: string;\n}\n\n/**\n * Enumerate all core starter paths that could be created.\n *\n * @param state - Policy project state\n * @param options - Selected repository setup\n * @returns Absolute candidate paths\n */\nexport function getPolicyInitPlanningCandidatePaths(\n state: PolicyProjectState,\n options: Pick<PolicyInitPlanOptions, 'features'>,\n): string[] {\n const paths = new Set(\n generatePolicyWorkspaceFiles().map(({ path }) => join(state.targetDirectory, path)),\n );\n const selected = new Set(options.features);\n if (selected.has(PolicySetupFeature.Editor)) {\n paths.add(join(state.projectRoot, '.vscode', 'settings.json'));\n paths.add(join(state.projectRoot, '.vscode', 'extensions.json'));\n paths.add(join(state.projectRoot, '.vscode', 'tasks.json'));\n }\n if (selected.has(PolicySetupFeature.Skill)) {\n getManagedAgentSkillCandidatePaths(\n state.projectRoot,\n state.existingSkillDirectories,\n POLICY_MANAGED_SKILL,\n ).forEach((path) => paths.add(path));\n }\n if (selected.has(PolicySetupFeature.Ci) && state.repositoryRoot && state.usesGithub) {\n paths.add(join(state.repositoryRoot, POLICY_CI_WORKFLOW_PATH));\n }\n return [...paths].sort((left, right) => left.localeCompare(right));\n}\n\n/**\n * Ensure a destination stays below an approved project root.\n *\n * @param root - Approved root\n * @param path - Candidate path\n */\nfunction assertContained(root: string, path: string): void {\n const child = relative(root, path);\n if (child === '..' || child.startsWith(`..${sep}`) || isAbsolute(child)) {\n throw new Error(`Refusing to modify path outside project root: ${path}`);\n }\n}\n\n/**\n * Enumerate generated file and directory paths allowed in an exact starter.\n *\n * @param files - Starter files\n * @returns POSIX relative paths\n */\nfunction starterRelativePaths(files: readonly PolicyStarterFile[]): Set<string> {\n const paths = new Set<string>([`${POLICY_STARTER_BUNDLE_DIRECTORY}/input.json`]);\n files.forEach(({ path }) => {\n paths.add(path);\n let parent = posix.dirname(path);\n while (parent !== '.') {\n paths.add(parent);\n parent = posix.dirname(parent);\n }\n });\n return paths;\n}\n\n/**\n * Add or classify one regular-file mutation.\n *\n * @param plan - Policy plan being assembled\n * @param input - Collected snapshots\n * @param options - Desired file\n */\nfunction addFileChange(\n plan: PolicyInitProjectPlan,\n input: PolicyInitPlanningInput,\n options: {\n /** Absolute destination path. */\n path: string;\n /** Complete desired contents. */\n contents: string;\n /** Human-readable plan description. */\n description: string;\n /** Refuse existing contents. */\n createOnly?: boolean;\n },\n): void {\n const change = planFileChange({\n snapshot: getPlanningFileSnapshot(input.snapshots, options.path),\n after: options.contents,\n description: options.description,\n ...(options.createOnly === undefined ? {} : { createOnly: options.createOnly }),\n });\n if (change) {\n plan.changes.push(change);\n } else {\n plan.unchanged.push(options.path);\n }\n}\n\n/**\n * Add one safe editor merge and its preservation warnings.\n *\n * @param plan - Policy plan being assembled\n * @param input - Collected snapshots\n * @param path - Absolute editor artifact path\n * @param result - Pure JSONC merge result\n * @param description - Human-readable plan description\n * @param cwd - Invocation directory for portable warning paths\n */\nfunction addEditorMerge(\n plan: PolicyInitProjectPlan,\n input: PolicyInitPlanningInput,\n path: string,\n result: PolicyEditorMergeResult,\n description: string,\n cwd: string,\n): void {\n addFileChange(plan, input, {\n path,\n contents: result.contents,\n description,\n });\n plan.warnings.push(\n ...result.warnings.map((warning) => `${warning} (${displayProjectPath(cwd, path)})`),\n );\n}\n\n/**\n * Build a safe policy project plan without reading the filesystem.\n *\n * Empty targets receive the complete starter. Existing targets are classified\n * only; no domain file is added, merged, or overwritten.\n *\n * @param input - Collected project state and path snapshots\n * @param options - Selected setup and pinned CLI version\n * @returns Validated policy initialization plan\n */\nexport function buildPolicyInitPlan(\n input: PolicyInitPlanningInput,\n options: PolicyInitPlanOptions,\n): PolicyInitProjectPlan {\n const { state } = input;\n const files = generatePolicyWorkspaceFiles();\n const newCommand = 'transcend policy new';\n const plan: PolicyInitProjectPlan = {\n version: POLICY_INIT_RESULT_VERSION,\n command: 'init',\n rootDirectory: state.projectRoot,\n targetDirectory: state.targetDirectory,\n // Init creates a workspace only; bundles (and their .manifest) come from `policy new`.\n manifestPath: state.targetDirectory,\n changes: [],\n unchanged: [],\n warnings: [],\n nextSteps: [newCommand],\n features: [...options.features],\n };\n\n const candidatePaths = getPolicyInitPlanningCandidatePaths(state, options);\n assertContained(state.projectRoot, state.targetDirectory);\n candidatePaths.forEach((path) => assertContained(state.projectRoot, path));\n\n if (state.relativeFilePaths.length === 0) {\n plan.directoryPreconditions = [\n {\n path: state.targetDirectory,\n relativePaths: [...state.relativePaths],\n },\n ];\n files.forEach((file) => {\n const path = join(state.targetDirectory, file.path);\n const snapshot = getPlanningPathSnapshot(input.snapshots, path);\n if (snapshot.kind !== 'absent') {\n throw new Error(`Expected an empty policy target, but found an entry at: ${path}`);\n }\n addFileChange(plan, input, {\n path,\n contents: file.contents,\n description: file.description,\n createOnly: true,\n });\n });\n } else {\n let allWorkspaceFilesMatch = true;\n files.forEach((file) => {\n const path = join(state.targetDirectory, file.path);\n const snapshot = getPlanningPathSnapshot(input.snapshots, path);\n if (snapshot.kind === 'file' && snapshot.contents === file.contents) {\n plan.unchanged.push(path);\n return;\n }\n allWorkspaceFilesMatch = false;\n if (snapshot.kind !== 'absent') {\n plan.unchanged.push(path);\n plan.warnings.push(\n `Existing policy scaffold path was left unchanged: ${displayProjectPath(\n state.invocationDirectory,\n path,\n )}`,\n );\n }\n });\n\n const allowedPaths = starterRelativePaths(files);\n const hasCustomPaths = state.relativeFilePaths.some((path) => !allowedPaths.has(path));\n if (!allWorkspaceFilesMatch || hasCustomPaths) {\n plan.warnings.push(\n `Existing policy target contains custom or partial content, so no workspace files were added or overwritten. ` +\n `Review ${displayProjectPath(\n state.invocationDirectory,\n state.targetDirectory,\n )} manually, then run \\`${newCommand}\\`.`,\n );\n }\n }\n\n const selected = new Set(options.features);\n const root = state.projectRoot;\n if (selected.has(PolicySetupFeature.Editor)) {\n const settingsPath = join(root, '.vscode', 'settings.json');\n const extensionsPath = join(root, '.vscode', 'extensions.json');\n const tasksPath = join(root, '.vscode', 'tasks.json');\n\n type EditorMergeFn = (\n contents: string | null,\n repositoryRoot: string,\n targetDirectory: string,\n ) => PolicyEditorMergeResult;\n const editorArtifacts: {\n /** Absolute path. */\n path: string;\n /** Plan description. */\n description: string;\n /** Merge function. */\n merge: EditorMergeFn;\n }[] = [\n {\n path: settingsPath,\n description: 'Merge strict target-scoped OPA and Rego editor settings',\n merge: (contents, repositoryRoot, targetDirectory) =>\n mergePolicyEditorSettings(contents, repositoryRoot, targetDirectory),\n },\n {\n path: extensionsPath,\n description: 'Recommend the OPA extension and discourage its syntax-only conflict',\n merge: (contents) => mergePolicyEditorExtensions(contents),\n },\n {\n path: tasksPath,\n description: 'Create the VS Code task configuration',\n merge: (contents, repositoryRoot, targetDirectory) =>\n mergePolicyEditorTasks(contents, repositoryRoot, targetDirectory),\n },\n ];\n editorArtifacts.forEach(({ path, description, merge }) => {\n const snapshot = getPlanningPathSnapshot(input.snapshots, path);\n if (snapshot.kind !== 'absent' && snapshot.kind !== 'file') {\n plan.unchanged.push(path);\n plan.warnings.push(\n `Existing VS Code artifact is not a regular file and was left unchanged: ${displayProjectPath(\n state.invocationDirectory,\n path,\n )}`,\n );\n return;\n }\n addEditorMerge(\n plan,\n input,\n path,\n merge(snapshot.kind === 'file' ? snapshot.contents : null, root, state.targetDirectory),\n description,\n state.invocationDirectory,\n );\n });\n }\n\n if (selected.has(PolicySetupFeature.Skill)) {\n const skillPlan = planManagedAgentSkill({\n rootDirectory: root,\n existingDirectories: state.existingSkillDirectories,\n snapshots: input.snapshots,\n skill: POLICY_MANAGED_SKILL,\n preserveModified: true,\n });\n plan.changes.push(...skillPlan.changes);\n plan.unchanged.push(...skillPlan.unchanged);\n plan.warnings.push(\n ...skillPlan.warnings.map((warning) => {\n return skillPlan.unchanged.reduce(\n (rendered, path) =>\n rendered.replace(path, displayProjectPath(state.invocationDirectory, path)),\n warning,\n );\n }),\n );\n }\n\n if (selected.has(PolicySetupFeature.Ci)) {\n if (!state.repositoryRoot || !state.usesGithub) {\n plan.warnings.push(\n 'GitHub Actions setup was selected, but this target is not inside a detected GitHub repository.',\n );\n } else {\n const workflowPath = join(state.repositoryRoot, POLICY_CI_WORKFLOW_PATH);\n const workspaceDirectory =\n relative(state.repositoryRoot, state.targetDirectory).split(sep).join('/') || '.';\n const workflowContents = generatePolicyGithubActionsWorkflow({\n cliVersion: options.cliVersion,\n workspaceDirectory,\n bundleDirectories: [],\n });\n const workflowSnapshot = getPlanningPathSnapshot(input.snapshots, workflowPath);\n if (workflowSnapshot.kind === 'absent') {\n addFileChange(plan, input, {\n path: workflowPath,\n contents: workflowContents,\n description: 'Add credential-free Policy Engine validation',\n createOnly: true,\n });\n } else if (\n workflowSnapshot.kind === 'file' &&\n workflowSnapshot.contents === workflowContents\n ) {\n plan.unchanged.push(workflowPath);\n } else {\n plan.unchanged.push(workflowPath);\n plan.warnings.push(\n `Existing GitHub Actions workflow was left unchanged: ${displayProjectPath(\n state.invocationDirectory,\n workflowPath,\n )}. Adapt it manually to validate each policy bundle.`,\n );\n }\n }\n }\n\n plan.changes.forEach(({ path }) => assertContained(state.projectRoot, path));\n return plan;\n}\n","import colors from 'colors';\n\nimport { version as CLI_VERSION } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport {\n runCapturedProcess,\n type CapturedProcessResult,\n type CapturedProcessRunner,\n} from '../../../lib/cli/run-captured-process.js';\nimport {\n DEFAULT_POLICY_PROJECT_DIRECTORY,\n discoverPolicyProject,\n} from '../../../lib/policy/policy-project-discovery.js';\nimport {\n OPA_INSTALL_URL,\n OPA_MISSING_MESSAGE,\n parsePolicyToolVersion,\n MINIMUM_POLICY_STARTER_REGAL_VERSION,\n REGAL_INSTALL_URL,\n REGAL_MISSING_MESSAGE,\n unsupportedOpaVersionMessage,\n unsupportedRegalVersionMessage,\n} from '../../../lib/policy/policy-runtime.js';\nimport {\n PolicySetupFeature,\n type PolicySetupFeature as PolicySetupFeatureType,\n} from '../../../lib/policy/policy-scaffold-model.js';\nimport {\n buildPolicyInitAiHandoff,\n buildPolicyInitPlanResult,\n type PolicyInitToolVersions,\n} from '../../../lib/policy/policy-scaffold-output.js';\nimport {\n buildPolicyInitPlan,\n getPolicyInitPlanningCandidatePaths,\n} from '../../../lib/policy/policy-scaffold-planning.js';\nimport { POLICY_STARTER_OPA_VERSION } from '../../../lib/policy/policy-scaffold-templates.js';\nimport { collectPlanningSnapshots } from '../../../lib/scaffolding/project-discovery.js';\nimport { applyProjectPlan } from '../../../lib/scaffolding/project-plan-apply.js';\nimport {\n displayProjectPath,\n quoteShellArgument,\n renderProjectPlan,\n} from '../../../lib/scaffolding/project-plan-output.js';\nimport {\n isInteractivePromptInvocation,\n PromptCancelledError,\n resolveSetupFeatures,\n ScaffoldPrompts,\n} from '../../../lib/scaffolding/prompts.js';\n\n/** Flags for `transcend policy init`. */\nexport interface PolicyInitFlags {\n /** Install repository-level VS Code setup. */\n editor?: boolean;\n /** Install the Policy Engine Agent Skill. */\n skill?: boolean;\n /** Install validation-only GitHub Actions CI. */\n ci?: boolean;\n /** Disable prompts. */\n noInteractive: boolean;\n /** Render but do not apply the plan. */\n dryRun: boolean;\n /** Approve the final displayed plan. */\n yes: boolean;\n /** Emit one stable JSON result on stdout. */\n json: boolean;\n}\n\n/** User-facing optional setup labels. */\nconst SETUP_LABELS: Readonly<Record<PolicySetupFeatureType, string>> = {\n [PolicySetupFeature.Editor]: 'VS Code settings and lint task',\n [PolicySetupFeature.Skill]: 'Policy Engine Agent Skill',\n [PolicySetupFeature.Ci]: 'Validation-only GitHub Actions',\n};\n\n/** All optional setup features in stable prompt order. */\nconst ALL_SETUP_FEATURES = Object.values(PolicySetupFeature);\n\n/** Runtime compatibility detected before policy planning. */\ninterface PolicyRuntimeProbe {\n /** Compatible tool versions. */\n tools: PolicyInitToolVersions;\n /** Missing or incompatible runtime guidance. */\n warnings: string[];\n}\n\n/**\n * Explain a failed version subprocess with official installation guidance.\n *\n * @param tool - Policy tool name\n * @param result - Failed captured process\n * @returns Actionable warning\n */\nfunction failedVersionProbeMessage(tool: 'OPA' | 'Regal', result: CapturedProcessResult): string {\n const detail = [result.stdout.trim(), result.stderr.trim()].filter(Boolean).join('\\n');\n const url = tool === 'OPA' ? OPA_INSTALL_URL : REGAL_INSTALL_URL;\n const requirement =\n tool === 'OPA' ? 'OPA 1.x' : `Regal ${MINIMUM_POLICY_STARTER_REGAL_VERSION} or newer`;\n return (\n `${requirement} is required, but \\`${tool.toLowerCase()} version\\` exited with code ` +\n `${result.code}${detail ? `: ${detail}` : '.'} ` +\n `Install or upgrade it using the official instructions: ${url}`\n );\n}\n\n/**\n * Probe both local policy runtimes without installing or modifying them.\n *\n * @param context - CLI context\n * @param cwd - Invocation working directory\n * @param runner - Captured subprocess runner\n * @returns Compatible versions and exact runtime guidance\n */\nasync function probePolicyRuntimes(\n context: LocalContext,\n cwd: string,\n runner: CapturedProcessRunner,\n): Promise<PolicyRuntimeProbe> {\n const tools: PolicyInitToolVersions = { opa: null, regal: null };\n const warnings: string[] = [];\n\n const opaResult = await runner('opa', ['version'], { cwd }, context);\n if (opaResult.error?.code === 'ENOENT') {\n warnings.push(OPA_MISSING_MESSAGE);\n } else {\n const output = `${opaResult.stdout}\\n${opaResult.stderr}`;\n const unsupported = unsupportedOpaVersionMessage(output);\n if (opaResult.code !== 0) {\n warnings.push(unsupported ?? failedVersionProbeMessage('OPA', opaResult));\n } else if (unsupported) {\n warnings.push(unsupported);\n } else {\n tools.opa = parsePolicyToolVersion(output)!.version;\n }\n }\n\n const regalResult = await runner('regal', ['version'], { cwd }, context);\n if (regalResult.error?.code === 'ENOENT') {\n warnings.push(REGAL_MISSING_MESSAGE);\n } else {\n const output = `${regalResult.stdout}\\n${regalResult.stderr}`;\n const unsupported = unsupportedRegalVersionMessage(\n output,\n MINIMUM_POLICY_STARTER_REGAL_VERSION,\n `the generated OPA ${POLICY_STARTER_OPA_VERSION} capabilities configuration`,\n );\n if (regalResult.code !== 0) {\n warnings.push(unsupported ?? failedVersionProbeMessage('Regal', regalResult));\n } else if (unsupported) {\n warnings.push(unsupported);\n } else {\n tools.regal = parsePolicyToolVersion(output)!.version;\n }\n }\n\n return { tools, warnings };\n}\n\n/**\n * Initialize a credential-free local Policy Engine project.\n *\n * @param this - CLI context\n * @param flags - Scaffold and interaction flags\n * @param directory - Target policy directory\n * @param runner - Captured policy tool runner\n */\nexport async function init(\n this: LocalContext,\n flags: PolicyInitFlags,\n directory: string = DEFAULT_POLICY_PROJECT_DIRECTORY,\n runner: CapturedProcessRunner = runCapturedProcess,\n): Promise<void> {\n doneInputValidation(this.process);\n try {\n const runtime = await probePolicyRuntimes(this, this.process.cwd(), runner);\n const state = discoverPolicyProject(this, directory);\n const prompts = new ScaffoldPrompts(this);\n const interactive = isInteractivePromptInvocation(\n flags,\n this.process.stdin.isTTY,\n this.process.stderr.isTTY,\n );\n const features = await resolveSetupFeatures(prompts, {\n features: ALL_SETUP_FEATURES,\n labels: SETUP_LABELS,\n enabled: {\n [PolicySetupFeature.Editor]: flags.editor,\n [PolicySetupFeature.Skill]: flags.skill,\n [PolicySetupFeature.Ci]: flags.ci,\n },\n interactive,\n });\n const candidatePaths = getPolicyInitPlanningCandidatePaths(state, { features });\n const snapshots = collectPlanningSnapshots(this, state.projectRoot, candidatePaths);\n\n const plan = buildPolicyInitPlan(\n { state, snapshots },\n {\n features,\n cliVersion: CLI_VERSION,\n },\n );\n plan.warnings.push(...runtime.warnings);\n\n if (!flags.json) {\n this.logger.info(\n renderProjectPlan(plan, {\n cwd: this.process.cwd(),\n title: 'Policy initialization plan',\n details: [{ label: 'Target', path: plan.targetDirectory }],\n }),\n );\n }\n\n let approved = plan.changes.length === 0 || flags.dryRun;\n if (plan.changes.length > 0 && !flags.dryRun) {\n if (flags.yes) {\n approved = true;\n } else if (interactive) {\n approved = await prompts.confirm('Apply this complete plan?', true);\n } else {\n throw new Error(\n 'The plan requires approval in a non-interactive invocation. Review with --dryRun, then pass --yes.',\n );\n }\n }\n\n if (approved && !flags.dryRun && plan.changes.length > 0) {\n await applyProjectPlan(this, plan);\n }\n const applied = approved && !flags.dryRun && plan.changes.length > 0;\n const setupAvailable = approved && !flags.dryRun;\n const aiHandoff = buildPolicyInitAiHandoff({\n projectPath: quoteShellArgument(\n displayProjectPath(this.process.cwd(), state.targetDirectory),\n ),\n hasSkill: setupAvailable && features.includes(PolicySetupFeature.Skill),\n newCommand: plan.nextSteps[0]!,\n });\n const result = buildPolicyInitPlanResult(plan, {\n applied,\n dryRun: flags.dryRun,\n cwd: this.process.cwd(),\n aiHandoff,\n tools: runtime.tools,\n });\n if (flags.json) {\n this.process.stdout.write(`${JSON.stringify(result)}\\n`);\n return;\n }\n if (flags.dryRun) {\n this.logger.info(colors.yellow('Dry run complete. No changes were written.'));\n return;\n }\n if (!approved) {\n this.logger.info(colors.yellow('No changes applied.'));\n return;\n }\n if (plan.changes.length === 0) {\n const message =\n plan.warnings.length === runtime.warnings.length\n ? 'Policy project is already initialized.'\n : 'Existing policy project was left unchanged.';\n this.logger.info(colors.green(message));\n } else {\n this.logger.info(colors.green('Policy project initialized.'));\n }\n if (plan.nextSteps.length > 0) {\n this.logger.info(`\\n${colors.bold('Next steps')}`);\n plan.nextSteps.forEach((step) => this.logger.info(step));\n }\n this.logger.info(`\\n${colors.bold('AI handoff — paste into your coding agent')}`);\n this.logger.info(aiHandoff);\n } catch (error) {\n if (error instanceof PromptCancelledError) {\n return this.process.exit(130);\n }\n throw error;\n }\n}\n"],"mappings":"uyBAOA,MAAa,EAAqB,CAEhC,OAAQ,SAER,MAAO,QAEP,GAAI,KACL,OCdD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ICAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ICAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ICAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ICAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ECQA,MAAa,EAAoB,0BAWpB,EAAgD,CAC3D,CAAE,KAAM,WAAY,SAAUA,EAAiB,CAC/C,CAAE,KAAM,8BAA+B,SAAUC,EAAmC,CACpF,CAAE,KAAM,0BAA2B,SAAUC,EAA+B,CAC5E,CAAE,KAAM,kCAAmC,SAAUC,EAAuC,CAC5F,CAAE,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K,SAAS,SAAW,EAAQ,SAAS,OACtC,yCACA,8CACN,KAAK,OAAO,KAAK,EAAO,MAAM,EAAQ,CAAC,MAEvC,KAAK,OAAO,KAAK,EAAO,MAAM,8BAA8B,CAAC,CAE3D,EAAK,UAAU,OAAS,IAC1B,KAAK,OAAO,KAAK,KAAK,EAAO,KAAK,aAAa,GAAG,CAClD,EAAK,UAAU,QAAS,GAAS,KAAK,OAAO,KAAK,EAAK,CAAC,EAE1D,KAAK,OAAO,KAAK,KAAK,EAAO,KAAK,4CAA4C,GAAG,CACjF,KAAK,OAAO,KAAK,EAAU,OACpB,EAAO,CACd,GAAI,aAAiB,EACnB,OAAO,KAAK,QAAQ,KAAK,IAAI,CAE/B,MAAM"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{l as e}from"./constants-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import{l as e}from"./constants-BCmVqlrM.mjs";import{t}from"./generateCrossAccountApiKeys-CoSsZwSz.mjs";import{t as n}from"./done-input-validation-LiTaCEzF.mjs";async function r({email:r,password:i,apiKeyTitle:a,file:o,scopes:s,deleteExistingApiKey:c,createNewApiKey:l,parentOrganizationId:u,transcendUrl:d}){n(this.process);let{errors:f,apiKeys:p}=await t({transcendUrl:d,password:i,email:r,parentOrganizationId:u,deleteExistingApiKey:c,createNewApiKey:l,apiKeyTitle:a,scopes:s.map(t=>e[t].name)});this.fs.writeFileSync(o,`${JSON.stringify(p,null,2)}\n`),f.length>0&&this.process.exit(1)}export{r as generateApiKeys};
|
|
2
|
+
//# sourceMappingURL=impl-BrdCuU0I.mjs.map
|