@stacksjs/actions 0.75.468 → 0.75.475
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/dist/build/ios-config.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/reviewos-evidence.d.ts +19 -0
- package/dist/reviewos-evidence.js +1 -0
- package/package.json +44 -44
package/dist/build/ios-config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{assertCraftSupportsNativeSensors,nativeSensorCapabilityKeys}from"./native-sensors";import{existsSync,readFileSync,writeFileSync}from"node:fs";import{isAbsolute,join,relative,resolve}from"node:path";import{spotlightActivityTypes}from"@stacksjs/mobile";import{nativeScreenRoutes}from"./native-screens";export const NATIVE_APP_ROUTE="__app";const CAPABILITY_KEYS={speechRecognition:"enableSpeechRecognition",haptics:"enableHaptics",share:"enableShare",camera:"enableCamera",biometric:"enableBiometric",pushNotifications:"enablePushNotifications",secureStorage:"enableSecureStorage",geolocation:"enableGeolocation",backgroundLocation:"enableBackgroundLocation",clipboard:"enableClipboard",contacts:"enableContacts",calendar:"enableCalendar",localNotifications:"enableLocalNotifications",inAppPurchase:"enableInAppPurchase",keepAwake:"enableKeepAwake",orientationLock:"enableOrientationLock",deepLinks:"enableDeepLinks",qrScanner:"enableQRScanner",localNetwork:"enableLocalNetwork",filePicker:"enableFilePicker",fileDownload:"enableFileDownload",socialAuth:"enableSocialAuth",audioRecording:"enableAudioRecording",videoRecording:"enableVideoRecording",motionSensors:"enableMotionSensors",shakeGesture:"enableShakeGesture",wallet:"enableWallet",localDatabase:"enableLocalDatabase",bluetooth:"enableBluetooth",nfc:"enableNFC",healthKit:"enableHealthKit",appleMusic:"enableAppleMusic",heartRate:"enableHeartRate",backgroundAudio:"enableBackgroundAudio",scheduledWorkouts:"enableScheduledWorkouts",liveActivities:"enableLiveActivities",watchApp:"enableWatchApp",backgroundTasks:"enableBackgroundTasks",screenCapture:"enableScreenCapture",pdfViewer:"enablePDFViewer",augmentedReality:"enableAR",machineLearning:"enableMLKit"};export{CAPABILITY_KEYS as IOS_CAPABILITY_KEYS};export function iosCapabilityKeys(nativeSensorCapabilities){return{...CAPABILITY_KEYS,...nativeSensorCapabilityKeys("ios",nativeSensorCapabilities)}}export const IOS_UNMAPPED_CRAFT_FLAGS={enablePasskeys:"no native-screen API calls it yet (stacksjs/stx#2151)"},CRAFT_CAPABILITY_FLOORS={audioRecording:"0.0.324",appleMusic:"0.0.144",heartRate:"0.0.152",backgroundAudio:"0.0.162",scheduledWorkouts:"0.0.163",shakeGesture:"0.0.435"};export function unsupportedCraftCapabilities(capabilities,version){const missing=[];for(const[capability,needs]of Object.entries(CRAFT_CAPABILITY_FLOORS))if(capabilities?.[capability]&&!Bun.semver.satisfies(version,`>=${needs}`))missing.push({capability,needs});return missing}export function assertCraftSupportsCapabilities(capabilities,version,source){const missing=unsupportedCraftCapabilities(capabilities,version);if(missing.length===0)return;const needed=missing.reduce((max,{needs})=>Bun.semver.order(needs,max)>0?needs:max,"0.0.0");throw Error(`The Craft iOS builder is craft-native ${version} (${source}), which would build the app without ${missing.map(({capability,needs})=>`ios.capabilities.${capability} (needs >= ${needs})`).join(", ")}. Install craft-native >= ${needed}: look for an older copy nested under @stacksjs/mobile in bun.lock, or raise the app's own craft-native pin.`)}export const CRAFT_CRASH_REPORTING_FLOOR="0.0.179";export function resolveCrashReporting(shared,platform){const set=(config)=>Object.fromEntries(Object.entries(config??{}).filter(([,value])=>value!==void 0&&value!=="")),merged={...set(shared),...set(platform)};if(!merged.key?.trim())return;if(merged.host){const url=new URL(normalizeMobileUrl(merged.host)),local=["localhost","127.0.0.1","::1","10.0.2.2"].includes(url.hostname);if(url.protocol!=="https:"&&!local)throw Error("crashReporting.host must use HTTPS outside local development");merged.host=url.origin}return merged}export function toCraftCrashReporting(config){if(!config?.key)return;const craft={key:config.key,host:config.host,environment:config.environment,release:config.release,sessions:config.sessions};for(const key of Object.keys(craft))if(craft[key]===void 0)delete craft[key];return craft}export function assertCraftSupportsCrashReporting(config,version,source){if(!config?.key||Bun.semver.satisfies(version,`>=${CRAFT_CRASH_REPORTING_FLOOR}`))return;throw Error(`The Craft builder is craft-native ${version} (${source}), which would build the app without crash reporting (crashReporting needs >= ${CRAFT_CRASH_REPORTING_FLOOR}). Install craft-native >= ${CRAFT_CRASH_REPORTING_FLOOR}: look for an older copy nested under @stacksjs/mobile in bun.lock, or raise the app's own craft-native pin.`)}export function normalizeMobileUrl(value){const input=value?.trim();if(!input)return;return new URL(/^https?:\/\//i.test(input)?input:`https://${input}`).toString().replace(/\/$/,"")}export function portablePaths(value,projectDir,appRoot){if(typeof value==="string")return isAbsolute(value)&&!relative(appRoot,value).startsWith("..")?relative(projectDir,value)||".":value;if(Array.isArray(value))return value.map((item)=>portablePaths(item,projectDir,appRoot));if(value&&typeof value==="object"){const out={};for(const[key,item]of Object.entries(value))out[key]=typeof item==="string"&&!/(?:path(?:dark)?|bundle)$|^(?:src|license)$/i.test(key)?item:portablePaths(item,projectDir,appRoot);return out}return value}export function resolveMobilePath(root,value){if(!value)return;return isAbsolute(value)?value:resolve(root,value)}export function resolveSwipeNavigation(config){if(config.swipeNavigation!==void 0)return config.swipeNavigation;return config.swipeBack==="webview"}export function toCraftIosConfig(config,nativeSensorCapabilities){assertCraftSupportsNativeSensors("ios",config.capabilities,nativeSensorCapabilities);const devServerURL=normalizeMobileUrl(config.url),trustedOrigins=new Set(config.trustedOrigins??[]);if(devServerURL)trustedOrigins.add(new URL(devServerURL).origin);const declaresAppBoundDomains=(config.appBoundDomains?.length??0)>0,craft={nativeFonts:config.nativeFonts,appName:config.appName,bundleId:config.bundleId,version:config.version,buildNumber:config.buildNumber,darkMode:config.darkMode,appearance:config.appearance,backgroundColor:config.backgroundColor,tintColor:config.tintColor,backgroundColorDark:config.backgroundColorDark,fontFamily:config.fontFamily,headingFontFamily:config.headingFontFamily,swipeNavigation:resolveSwipeNavigation(config),allowsLinkPreview:config.allowsLinkPreview,keyboardAccessory:config.keyboardAccessory,disableZoom:config.disableZoom,splashMaxSeconds:config.splashMaxSeconds,requestTimeoutSeconds:config.requestTimeoutSeconds,backgroundRefresh:config.backgroundRefresh,iosVersion:config.deploymentTarget,watchosVersion:config.watchDeploymentTarget,teamId:config.teamId,devServerURL,urlSchemes:config.urlSchemes,appShortcuts:config.appShortcuts,trustedOrigins:[...trustedOrigins],appBoundDomains:config.appBoundDomains,limitNavigationsToAppBoundDomains:config.limitNavigationsToAppBoundDomains??(declaresAppBoundDomains||void 0),associatedDomains:config.associatedDomains,renderer:config.renderer,nativeScreens:nativeScreenRoutes(config),nativeScreenConstraints:config.nativeScreenConstraints,nativeApp:config.nativeApp?NATIVE_APP_ROUTE:void 0,nativeScriptThread:config.nativeScriptThread,tabs:config.tabs,shareStorage:config.shareStorage,appGroups:config.appGroups,appIconPath:config.appIcon,privacy:config.privacy,usageDescriptions:config.usageDescriptions,healthKitBackgroundTypes:config.healthKitBackgroundTypes,healthKitBackgroundFrequency:config.healthKitBackgroundFrequency,orientations:config.orientations,deviceFamilies:config.deviceFamilies,crashReporting:toCraftCrashReporting(config.crashReporting)};for(const[key,nativeKey]of Object.entries(iosCapabilityKeys(nativeSensorCapabilities))){const enabled=config.capabilities?.[key];if(enabled!==void 0)craft[nativeKey]=enabled}if(config.capabilities?.backgroundLocation)craft.enableGeolocation=!0;for(const key of Object.keys(craft))if(craft[key]===void 0)delete craft[key];return craft}export function validateIosMobileConfig(config){if(config.tintColor!==void 0&&!/^#[0-9a-f]{6}$/i.test(config.tintColor))throw Error("ios.tintColor must be a #RRGGBB color");if(!config.appName?.trim())throw Error("config/mobile.ts must define ios.appName");if(!/^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+$/.test(config.bundleId))throw Error(`Invalid iOS bundle identifier: ${config.bundleId}`);if(config.url&&config.webAssets)throw Error("Choose either ios.url or ios.webAssets in config/mobile.ts, not both");if(!config.url&&!config.webAssets)throw Error("config/mobile.ts must define ios.url or ios.webAssets");if(config.renderer!==void 0&&config.renderer!=="web"&&config.renderer!=="native")throw Error(`ios.renderer must be 'web' or 'native', not ${String(config.renderer)}`);if(config.renderer==="native"){if(!Object.keys(config.nativeScreens??{}).length)throw Error("ios.renderer 'native' draws every screen natively: list them in ios.nativeScreens");if(config.webAssets)throw Error("ios.renderer 'native' has no web view to show ios.webAssets in: set ios.url to the app's site instead");if(config.fallbackWebAssets)throw Error("ios.fallbackWebAssets is the web view's offline page; ios.renderer 'native' has no web view")}if(config.fallbackWebAssets&&!config.url)throw Error("ios.fallbackWebAssets requires ios.url");if(config.deviceFamilies&&(config.deviceFamilies.length===0||config.deviceFamilies.some((family)=>family!=="iphone"&&family!=="ipad")))throw Error("ios.deviceFamilies must contain iphone and/or ipad");if(config.url){const url=new URL(normalizeMobileUrl(config.url)),isLocal=["localhost","127.0.0.1","::1"].includes(url.hostname);if(url.protocol!=="https:"&&!isLocal)throw Error("ios.url must use HTTPS outside local development")}for(const domain of config.associatedDomains??[])if(!/^(applinks|webcredentials|activitycontinuation):[^/\s]+$/.test(domain))throw Error(`Invalid iOS associated domain: ${domain}`);for(const key of["splashMaxSeconds","requestTimeoutSeconds"]){const value=config[key];if(value!==void 0&&(!Number.isFinite(value)||value<=0))throw Error(`ios.${key} must be a positive number of seconds`)}const refresh=config.backgroundRefresh;if(refresh){if(refresh.identifier!==void 0&&!/^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+$/.test(refresh.identifier))throw Error(`Invalid iOS background refresh identifier: ${refresh.identifier}`);if(refresh.minimumIntervalMinutes!==void 0&&(!Number.isFinite(refresh.minimumIntervalMinutes)||refresh.minimumIntervalMinutes<=0))throw Error("ios.backgroundRefresh.minimumIntervalMinutes must be a positive number of minutes")}if(config.capabilities?.watchApp){const target=Number.parseFloat(config.watchDeploymentTarget??"9.0");if(!Number.isFinite(target)||target<9)throw Error("ios.watchDeploymentTarget must be watchOS 9.0 or newer")}}const ACTIVITY_TYPES_BLOCK=/[ \t]*<key>NSUserActivityTypes<\/key>\s*<array>[\s\S]*?<\/array>\n?/;export function withActivityTypes(plist,types){const entries=types.map((type)=>` <string>${escapeXml(type)}</string>`).join(`
|
|
1
|
+
import{assertCraftSupportsNativeSensors,nativeSensorCapabilityKeys}from"./native-sensors";import{existsSync,readFileSync,writeFileSync}from"node:fs";import{isAbsolute,join,relative,resolve}from"node:path";import{spotlightActivityTypes}from"@stacksjs/mobile";import{nativeScreenRoutes}from"./native-screens";export const NATIVE_APP_ROUTE="__app";const CAPABILITY_KEYS={speechRecognition:"enableSpeechRecognition",haptics:"enableHaptics",share:"enableShare",camera:"enableCamera",biometric:"enableBiometric",passkeys:"enablePasskeys",pushNotifications:"enablePushNotifications",secureStorage:"enableSecureStorage",geolocation:"enableGeolocation",backgroundLocation:"enableBackgroundLocation",clipboard:"enableClipboard",contacts:"enableContacts",calendar:"enableCalendar",localNotifications:"enableLocalNotifications",inAppPurchase:"enableInAppPurchase",keepAwake:"enableKeepAwake",orientationLock:"enableOrientationLock",deepLinks:"enableDeepLinks",qrScanner:"enableQRScanner",localNetwork:"enableLocalNetwork",filePicker:"enableFilePicker",fileDownload:"enableFileDownload",socialAuth:"enableSocialAuth",audioRecording:"enableAudioRecording",videoRecording:"enableVideoRecording",motionSensors:"enableMotionSensors",shakeGesture:"enableShakeGesture",wallet:"enableWallet",localDatabase:"enableLocalDatabase",bluetooth:"enableBluetooth",nfc:"enableNFC",healthKit:"enableHealthKit",appleMusic:"enableAppleMusic",heartRate:"enableHeartRate",backgroundAudio:"enableBackgroundAudio",scheduledWorkouts:"enableScheduledWorkouts",liveActivities:"enableLiveActivities",watchApp:"enableWatchApp",backgroundTasks:"enableBackgroundTasks",screenCapture:"enableScreenCapture",pdfViewer:"enablePDFViewer",augmentedReality:"enableAR",machineLearning:"enableMLKit"};export{CAPABILITY_KEYS as IOS_CAPABILITY_KEYS};export function iosCapabilityKeys(nativeSensorCapabilities){return{...CAPABILITY_KEYS,...nativeSensorCapabilityKeys("ios",nativeSensorCapabilities)}}export const IOS_UNMAPPED_CRAFT_FLAGS={},CRAFT_CAPABILITY_FLOORS={passkeys:"0.0.451",audioRecording:"0.0.324",appleMusic:"0.0.144",heartRate:"0.0.152",backgroundAudio:"0.0.162",scheduledWorkouts:"0.0.163",shakeGesture:"0.0.435"};export function unsupportedCraftCapabilities(capabilities,version){const missing=[];for(const[capability,needs]of Object.entries(CRAFT_CAPABILITY_FLOORS))if(capabilities?.[capability]&&!Bun.semver.satisfies(version,`>=${needs}`))missing.push({capability,needs});return missing}export function assertCraftSupportsCapabilities(capabilities,version,source){const missing=unsupportedCraftCapabilities(capabilities,version);if(missing.length===0)return;const needed=missing.reduce((max,{needs})=>Bun.semver.order(needs,max)>0?needs:max,"0.0.0");throw Error(`The Craft iOS builder is craft-native ${version} (${source}), which would build the app without ${missing.map(({capability,needs})=>`ios.capabilities.${capability} (needs >= ${needs})`).join(", ")}. Install craft-native >= ${needed}: look for an older copy nested under @stacksjs/mobile in bun.lock, or raise the app's own craft-native pin.`)}export const CRAFT_CRASH_REPORTING_FLOOR="0.0.179";export function resolveCrashReporting(shared,platform){const set=(config)=>Object.fromEntries(Object.entries(config??{}).filter(([,value])=>value!==void 0&&value!=="")),merged={...set(shared),...set(platform)};if(!merged.key?.trim())return;if(merged.host){const url=new URL(normalizeMobileUrl(merged.host)),local=["localhost","127.0.0.1","::1","10.0.2.2"].includes(url.hostname);if(url.protocol!=="https:"&&!local)throw Error("crashReporting.host must use HTTPS outside local development");merged.host=url.origin}return merged}export function toCraftCrashReporting(config){if(!config?.key)return;const craft={key:config.key,host:config.host,environment:config.environment,release:config.release,sessions:config.sessions};for(const key of Object.keys(craft))if(craft[key]===void 0)delete craft[key];return craft}export function assertCraftSupportsCrashReporting(config,version,source){if(!config?.key||Bun.semver.satisfies(version,`>=${CRAFT_CRASH_REPORTING_FLOOR}`))return;throw Error(`The Craft builder is craft-native ${version} (${source}), which would build the app without crash reporting (crashReporting needs >= ${CRAFT_CRASH_REPORTING_FLOOR}). Install craft-native >= ${CRAFT_CRASH_REPORTING_FLOOR}: look for an older copy nested under @stacksjs/mobile in bun.lock, or raise the app's own craft-native pin.`)}export function normalizeMobileUrl(value){const input=value?.trim();if(!input)return;return new URL(/^https?:\/\//i.test(input)?input:`https://${input}`).toString().replace(/\/$/,"")}export function portablePaths(value,projectDir,appRoot){if(typeof value==="string")return isAbsolute(value)&&!relative(appRoot,value).startsWith("..")?relative(projectDir,value)||".":value;if(Array.isArray(value))return value.map((item)=>portablePaths(item,projectDir,appRoot));if(value&&typeof value==="object"){const out={};for(const[key,item]of Object.entries(value))out[key]=typeof item==="string"&&!/(?:path(?:dark)?|bundle)$|^(?:src|license)$/i.test(key)?item:portablePaths(item,projectDir,appRoot);return out}return value}export function resolveMobilePath(root,value){if(!value)return;return isAbsolute(value)?value:resolve(root,value)}export function resolveSwipeNavigation(config){if(config.swipeNavigation!==void 0)return config.swipeNavigation;return config.swipeBack==="webview"}export function toCraftIosConfig(config,nativeSensorCapabilities){assertCraftSupportsNativeSensors("ios",config.capabilities,nativeSensorCapabilities);const devServerURL=normalizeMobileUrl(config.url),trustedOrigins=new Set(config.trustedOrigins??[]);if(devServerURL)trustedOrigins.add(new URL(devServerURL).origin);const declaresAppBoundDomains=(config.appBoundDomains?.length??0)>0,craft={nativeFonts:config.nativeFonts,appName:config.appName,bundleId:config.bundleId,version:config.version,buildNumber:config.buildNumber,darkMode:config.darkMode,appearance:config.appearance,backgroundColor:config.backgroundColor,tintColor:config.tintColor,backgroundColorDark:config.backgroundColorDark,fontFamily:config.fontFamily,headingFontFamily:config.headingFontFamily,swipeNavigation:resolveSwipeNavigation(config),allowsLinkPreview:config.allowsLinkPreview,keyboardAccessory:config.keyboardAccessory,disableZoom:config.disableZoom,splashMaxSeconds:config.splashMaxSeconds,requestTimeoutSeconds:config.requestTimeoutSeconds,backgroundRefresh:config.backgroundRefresh,iosVersion:config.deploymentTarget,watchosVersion:config.watchDeploymentTarget,teamId:config.teamId,devServerURL,urlSchemes:config.urlSchemes,appShortcuts:config.appShortcuts,trustedOrigins:[...trustedOrigins],appBoundDomains:config.appBoundDomains,limitNavigationsToAppBoundDomains:config.limitNavigationsToAppBoundDomains??(declaresAppBoundDomains||void 0),associatedDomains:config.associatedDomains,renderer:config.renderer,nativeScreens:nativeScreenRoutes(config),nativeScreenConstraints:config.nativeScreenConstraints,nativeApp:config.nativeApp?NATIVE_APP_ROUTE:void 0,nativeScriptThread:config.nativeScriptThread,tabs:config.tabs,shareStorage:config.shareStorage,appGroups:config.appGroups,appIconPath:config.appIcon,privacy:config.privacy,usageDescriptions:config.usageDescriptions,healthKitBackgroundTypes:config.healthKitBackgroundTypes,healthKitBackgroundFrequency:config.healthKitBackgroundFrequency,orientations:config.orientations,deviceFamilies:config.deviceFamilies,crashReporting:toCraftCrashReporting(config.crashReporting)};for(const[key,nativeKey]of Object.entries(iosCapabilityKeys(nativeSensorCapabilities))){const enabled=config.capabilities?.[key];if(enabled!==void 0)craft[nativeKey]=enabled}if(config.capabilities?.backgroundLocation)craft.enableGeolocation=!0;for(const key of Object.keys(craft))if(craft[key]===void 0)delete craft[key];return craft}export function validateIosMobileConfig(config){if(config.tintColor!==void 0&&!/^#[0-9a-f]{6}$/i.test(config.tintColor))throw Error("ios.tintColor must be a #RRGGBB color");if(!config.appName?.trim())throw Error("config/mobile.ts must define ios.appName");if(!/^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+$/.test(config.bundleId))throw Error(`Invalid iOS bundle identifier: ${config.bundleId}`);if(config.url&&config.webAssets)throw Error("Choose either ios.url or ios.webAssets in config/mobile.ts, not both");if(!config.url&&!config.webAssets)throw Error("config/mobile.ts must define ios.url or ios.webAssets");if(config.renderer!==void 0&&config.renderer!=="web"&&config.renderer!=="native")throw Error(`ios.renderer must be 'web' or 'native', not ${String(config.renderer)}`);if(config.renderer==="native"){if(!Object.keys(config.nativeScreens??{}).length)throw Error("ios.renderer 'native' draws every screen natively: list them in ios.nativeScreens");if(config.webAssets)throw Error("ios.renderer 'native' has no web view to show ios.webAssets in: set ios.url to the app's site instead");if(config.fallbackWebAssets)throw Error("ios.fallbackWebAssets is the web view's offline page; ios.renderer 'native' has no web view")}if(config.fallbackWebAssets&&!config.url)throw Error("ios.fallbackWebAssets requires ios.url");if(config.deviceFamilies&&(config.deviceFamilies.length===0||config.deviceFamilies.some((family)=>family!=="iphone"&&family!=="ipad")))throw Error("ios.deviceFamilies must contain iphone and/or ipad");if(config.url){const url=new URL(normalizeMobileUrl(config.url)),isLocal=["localhost","127.0.0.1","::1"].includes(url.hostname);if(url.protocol!=="https:"&&!isLocal)throw Error("ios.url must use HTTPS outside local development")}for(const domain of config.associatedDomains??[])if(!/^(applinks|webcredentials|activitycontinuation):[^/\s]+$/.test(domain))throw Error(`Invalid iOS associated domain: ${domain}`);for(const key of["splashMaxSeconds","requestTimeoutSeconds"]){const value=config[key];if(value!==void 0&&(!Number.isFinite(value)||value<=0))throw Error(`ios.${key} must be a positive number of seconds`)}const refresh=config.backgroundRefresh;if(refresh){if(refresh.identifier!==void 0&&!/^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+$/.test(refresh.identifier))throw Error(`Invalid iOS background refresh identifier: ${refresh.identifier}`);if(refresh.minimumIntervalMinutes!==void 0&&(!Number.isFinite(refresh.minimumIntervalMinutes)||refresh.minimumIntervalMinutes<=0))throw Error("ios.backgroundRefresh.minimumIntervalMinutes must be a positive number of minutes")}if(config.capabilities?.watchApp){const target=Number.parseFloat(config.watchDeploymentTarget??"9.0");if(!Number.isFinite(target)||target<9)throw Error("ios.watchDeploymentTarget must be watchOS 9.0 or newer")}}const ACTIVITY_TYPES_BLOCK=/[ \t]*<key>NSUserActivityTypes<\/key>\s*<array>[\s\S]*?<\/array>\n?/;export function withActivityTypes(plist,types){const entries=types.map((type)=>` <string>${escapeXml(type)}</string>`).join(`
|
|
2
2
|
`),block=types.length===0?"":` <key>NSUserActivityTypes</key>
|
|
3
3
|
<array>
|
|
4
4
|
${entries}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type { GitHubReleaseResult, PublishGitHubReleaseOptions } from './github-release';
|
|
2
|
+
export type { ReviewOsEvidencePlan } from './reviewos-evidence';
|
|
2
3
|
export type { ReleaseEvidenceOptions, ReleaseEvidencePlan, ReleaseEvidenceReceipt, ReleaseSource } from './release-evidence';
|
|
3
4
|
export type { PublicationChannel } from './publication-preflight';
|
|
4
5
|
export type { PantryTool } from './build/ios-toolchain';
|
|
@@ -41,6 +42,7 @@ export { formatProject, lintFix, lintProject } from './lint/lint';
|
|
|
41
42
|
// pushed tag gets, and the Pantry-managed tools behind `build:ios`.
|
|
42
43
|
export { describeGitHubRelease, parseGitHubRemote, publishGitHubRelease } from './github-release';
|
|
43
44
|
export { validateReleaseEvidencePlan, verifyReleaseEvidence } from './release-evidence';
|
|
45
|
+
export { evaluateReviewOsEvidence, inspectReviewOsEvidence } from './reviewos-evidence';
|
|
44
46
|
export { assertPublicationAllowed, PUBLICATION_CHECK_SCRIPT, publicationChannels } from './publication-preflight';
|
|
45
47
|
export { DEFAULT_IOS_DEPENDENCIES, IosToolchainError, loadIosDependencies, pantryExecutable, pantryInstallArgs, resolveXcodegen, XCODE_NOTE, xcodeDeveloperDir } from './build/ios-toolchain';
|
|
46
48
|
export { craftSupportsWebkit, macosAgentActionFiles, macosAgentDevFiles, macosAgentDevManifest, macosAgentEntry, macosAgentRouteFiles, prepareMacosAgent, prepareMacosNative } from './build/macos-native';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{setActionRunner}from"@stacksjs/action-runner";import{runAction}from"./helpers";setActionRunner((action,options)=>runAction(action,options));export*from"./action";export{add as runAdd}from"./add";export{BlogAdminError,deleteBlogPost,getBlogPost,listBlogPosts,saveBlogPost,slugify as blogSlugify}from"./blog-admin";export{commit as runCommit}from"./commit";export*from"./dev";export*from"./generate";export*from"./helpers";export*from"./library";export{formatProject,lintFix,lintProject}from"./lint/lint";export{describeGitHubRelease,parseGitHubRemote,publishGitHubRelease}from"./github-release";export{validateReleaseEvidencePlan,verifyReleaseEvidence}from"./release-evidence";export{assertPublicationAllowed,PUBLICATION_CHECK_SCRIPT,publicationChannels}from"./publication-preflight";export{DEFAULT_IOS_DEPENDENCIES,IosToolchainError,loadIosDependencies,pantryExecutable,pantryInstallArgs,resolveXcodegen,XCODE_NOTE,xcodeDeveloperDir}from"./build/ios-toolchain";export{craftSupportsWebkit,macosAgentActionFiles,macosAgentDevFiles,macosAgentDevManifest,macosAgentEntry,macosAgentRouteFiles,prepareMacosAgent,prepareMacosNative}from"./build/macos-native";export{DEFAULT_STX_LINT_CONFIG,loadStxLintConfig,runStxLint}from"./lint/stx-gate";export{measureDefaultsDrift,summarizeStructureChanges}from"./upgrade/package-project";export{describeDanglingRouteActions,findDanglingRouteActions}from"./upgrade/route-actions";export*from"./setup";export{createComponent,createDatabase,createFactory,createFunction,createLanguage,createMiddleware,createMigration,createModel,createMail,createNotification,createPage,isDryRunActive,makeAction,makeCertificate,makeComponent,makeDatabase,makeFunction,makeLanguage,makeMail,makeNotification,makePage,makeQueueTable,makeStack,make as runMake,setDryRun}from"./make";export{discoverPackages,ensureDiscoveredPackages}from"./discover-packages";export{parseFields,scaffoldCrud}from"./scaffold-crud";export{installStack,uninstallStack,listStacks}from"./stacks";export{makeJob}from"./make-job";export{makeCommand}from"./make-command";export{makePolicy}from"./make-policy";export{makeResource}from"./make-resource";export{resolveStxSource}from"./stx-source";
|
|
1
|
+
import{setActionRunner}from"@stacksjs/action-runner";import{runAction}from"./helpers";setActionRunner((action,options)=>runAction(action,options));export*from"./action";export{add as runAdd}from"./add";export{BlogAdminError,deleteBlogPost,getBlogPost,listBlogPosts,saveBlogPost,slugify as blogSlugify}from"./blog-admin";export{commit as runCommit}from"./commit";export*from"./dev";export*from"./generate";export*from"./helpers";export*from"./library";export{formatProject,lintFix,lintProject}from"./lint/lint";export{describeGitHubRelease,parseGitHubRemote,publishGitHubRelease}from"./github-release";export{validateReleaseEvidencePlan,verifyReleaseEvidence}from"./release-evidence";export{evaluateReviewOsEvidence,inspectReviewOsEvidence}from"./reviewos-evidence";export{assertPublicationAllowed,PUBLICATION_CHECK_SCRIPT,publicationChannels}from"./publication-preflight";export{DEFAULT_IOS_DEPENDENCIES,IosToolchainError,loadIosDependencies,pantryExecutable,pantryInstallArgs,resolveXcodegen,XCODE_NOTE,xcodeDeveloperDir}from"./build/ios-toolchain";export{craftSupportsWebkit,macosAgentActionFiles,macosAgentDevFiles,macosAgentDevManifest,macosAgentEntry,macosAgentRouteFiles,prepareMacosAgent,prepareMacosNative}from"./build/macos-native";export{DEFAULT_STX_LINT_CONFIG,loadStxLintConfig,runStxLint}from"./lint/stx-gate";export{measureDefaultsDrift,summarizeStructureChanges}from"./upgrade/package-project";export{describeDanglingRouteActions,findDanglingRouteActions}from"./upgrade/route-actions";export*from"./setup";export{createComponent,createDatabase,createFactory,createFunction,createLanguage,createMiddleware,createMigration,createModel,createMail,createNotification,createPage,isDryRunActive,makeAction,makeCertificate,makeComponent,makeDatabase,makeFunction,makeLanguage,makeMail,makeNotification,makePage,makeQueueTable,makeStack,make as runMake,setDryRun}from"./make";export{discoverPackages,ensureDiscoveredPackages}from"./discover-packages";export{parseFields,scaffoldCrud}from"./scaffold-crud";export{installStack,uninstallStack,listStacks}from"./stacks";export{makeJob}from"./make-job";export{makeCommand}from"./make-command";export{makePolicy}from"./make-policy";export{makeResource}from"./make-resource";export{resolveStxSource}from"./stx-source";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Verify execution, rather than treating a completed/cancelled run as proof. */
|
|
2
|
+
export declare function evaluateReviewOsEvidence(plan: ReviewOsEvidencePlan, value: unknown): Decision;
|
|
3
|
+
/** Read public execution metadata through the forge API; no runner or admin credential. */
|
|
4
|
+
export declare function inspectReviewOsEvidence(plan: ReviewOsEvidencePlan, options?: {
|
|
5
|
+
fetch?: typeof fetch
|
|
6
|
+
signal?: AbortSignal
|
|
7
|
+
}): Promise<Decision>;
|
|
8
|
+
export declare interface ReviewOsEvidencePlan {
|
|
9
|
+
origin: string
|
|
10
|
+
owner: string
|
|
11
|
+
repository: string
|
|
12
|
+
commit: string
|
|
13
|
+
workflow: string
|
|
14
|
+
workflowDigest: string
|
|
15
|
+
job: string
|
|
16
|
+
labels: string[]
|
|
17
|
+
steps: string[]
|
|
18
|
+
}
|
|
19
|
+
declare type Decision = { state: 'pending' } | { state: 'accepted', number: number, url: string }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function blocked(reason){throw Error(`ReviewOS evidence blocked: ${reason}`)}function validate(plan){const origin=new URL(plan.origin);if(origin.protocol!=="https:"||origin.username||origin.password||origin.pathname!=="/"||origin.search||origin.hash||!/^[\w.-]+$/.test(plan.owner)||!/^[\w.-]+$/.test(plan.repository)||!/^[a-f0-9]{40}$/.test(plan.commit)||!/^[a-f0-9]{64}$/.test(plan.workflowDigest)||!/^\.reviewos\/workflows\/[\w.-]+\.ya?ml$/.test(plan.workflow)||!plan.job||!plan.labels.length||!plan.steps.length||[...plan.labels,...plan.steps].some((value)=>typeof value!=="string"||!value)||new Set(plan.steps).size!==plan.steps.length)blocked("Expected an HTTPS forge, exact source and workflow identities, job, labels and steps");return origin}export function evaluateReviewOsEvidence(plan,value){const origin=validate(plan),run=value?.workflow_run;if(!run||!Number.isSafeInteger(run.number)||run.number<=0||run.head_sha!==plan.commit||run.trusted!==!0||run.ref!=="refs/heads/main"||!["push","workflow_dispatch"].includes(run.event)||run.workflow?.path!==plan.workflow||run.workflow?.owner_defined!==!1||run.version?.path!==plan.workflow||run.version?.digest!==plan.workflowDigest)blocked("The run does not identify the trusted main source and committed workflow");if(["queued","running","waiting","paused"].includes(run.state))return{state:"pending"};if(run.state!=="succeeded")blocked(`Run ${run.number} concluded ${String(run.state)}`);if(!Array.isArray(run.jobs))blocked("The run has no job evidence");const jobs=run.jobs.filter((job)=>job.job_id===plan.job),job=jobs[0];if(jobs.length!==1||job.state!=="succeeded"||!job.runner||!job.started_at||!job.finished_at||job.resume_from_step!==null||!Array.isArray(job.runs_on)||plan.labels.some((label)=>!job.runs_on.includes(label))||!Array.isArray(job.steps))blocked("The required job did not execute fully on the declared runner");for(const name of plan.steps){const steps=job.steps.filter((step)=>step.name===name),step=steps[0];if(steps.length!==1||step.state!=="succeeded"||step.exit_code!==0||!step.started_at||!step.finished_at||step.reused_from_attempt!=null)blocked(`Required step did not execute successfully: ${name}`)}return{state:"accepted",number:run.number,url:new URL(`/${plan.owner}/${plan.repository}/run/${run.number}`,origin).href}}export async function inspectReviewOsEvidence(plan,options={}){const origin=validate(plan),request=options.fetch??fetch;async function read(path,values){const url=new URL(`/api/repos/${path}`,origin);for(const[name,value]of Object.entries({owner:plan.owner,repo:plan.repository,...values}))url.searchParams.set(name,value);const response=await request(url.href,{redirect:"error",headers:{accept:"application/json"},signal:options.signal?AbortSignal.any([options.signal,AbortSignal.timeout(30000)]):AbortSignal.timeout(30000)});if(!response.ok)blocked(`Metadata API returned HTTP ${response.status}`);if(!response.body)blocked("Metadata API returned no body");const reader=response.body.getReader(),chunks=[];let size=0;try{while(!0){const part=await reader.read();if(part.done)break;size+=part.value.byteLength;if(size>1048576)blocked("Metadata exceeds its byte budget");chunks.push(part.value)}return JSON.parse(Buffer.concat(chunks).toString("utf8"))}finally{await reader.cancel().catch(()=>{});reader.releaseLock()}}async function pages(path,field,values){const rows=[],cursors=new Set;let cursor="";for(let page=0;page<10;page++){const data=await read(path,{...values,per_page:"100",...cursor?{cursor}:{}});if(!Array.isArray(data[field]))blocked("Metadata API returned an invalid collection");rows.push(...data[field]);if(data.next===null)return rows;if(typeof data.next!=="string"||!data.next||cursors.has(data.next))blocked("Invalid metadata pagination");cursors.add(data.next);cursor=data.next}return blocked("Metadata exceeds its page budget")}const workflows=(await pages("workflows","workflows",{})).filter((row)=>row.path===plan.workflow);if(!workflows.length)return{state:"pending"};if(workflows.length!==1||!Number.isSafeInteger(workflows[0].id)||workflows[0].id<=0)blocked("Workflow identity is ambiguous");const runs=await pages("workflow-runs","workflow_runs",{workflow:String(workflows[0].id),sha:plan.commit,branch:"main"});if(runs.some((row)=>row.head_sha!==plan.commit||!Number.isSafeInteger(row.number)||row.number<=0))blocked("Run collection has an invalid source identity");const newest=runs.sort((a,b)=>b.number-a.number)[0];if(!newest)return{state:"pending"};const detail=await read("workflow-runs/show",{number:String(newest.number)});if(detail?.workflow_run?.number!==newest.number)blocked("Run detail does not match the selected run");return evaluateReviewOsEvidence(plan,detail)}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/actions",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.475",
|
|
6
6
|
"description": "The Stacks actions.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -66,55 +66,55 @@
|
|
|
66
66
|
"prepublishOnly": "bun run build"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@stacksjs/action-runner": "0.75.
|
|
70
|
-
"@stacksjs/ai": "0.75.
|
|
71
|
-
"@stacksjs/analytics": "0.75.
|
|
72
|
-
"@stacksjs/api": "0.75.
|
|
73
|
-
"@stacksjs/auth": "0.75.
|
|
74
|
-
"@stacksjs/build": "0.75.
|
|
69
|
+
"@stacksjs/action-runner": "0.75.475",
|
|
70
|
+
"@stacksjs/ai": "0.75.475",
|
|
71
|
+
"@stacksjs/analytics": "0.75.475",
|
|
72
|
+
"@stacksjs/api": "0.75.475",
|
|
73
|
+
"@stacksjs/auth": "0.75.475",
|
|
74
|
+
"@stacksjs/build": "0.75.475",
|
|
75
75
|
"@stacksjs/bumpx": "^0.2.26",
|
|
76
76
|
"@stacksjs/bunpress": "^0.2.15",
|
|
77
|
-
"@stacksjs/cli": "0.75.
|
|
78
|
-
"@stacksjs/cloud": "0.75.
|
|
79
|
-
"@stacksjs/cms": "0.75.
|
|
80
|
-
"@stacksjs/components": "0.2.
|
|
81
|
-
"@stacksjs/config": "0.75.
|
|
82
|
-
"@stacksjs/database": "0.75.
|
|
83
|
-
"@stacksjs/desktop-build": "0.75.
|
|
84
|
-
"@stacksjs/dns": "0.75.
|
|
85
|
-
"@stacksjs/enums": "0.75.
|
|
86
|
-
"@stacksjs/env": "0.75.
|
|
87
|
-
"@stacksjs/error-handling": "0.75.
|
|
88
|
-
"@stacksjs/github": "0.75.
|
|
77
|
+
"@stacksjs/cli": "0.75.475",
|
|
78
|
+
"@stacksjs/cloud": "0.75.475",
|
|
79
|
+
"@stacksjs/cms": "0.75.475",
|
|
80
|
+
"@stacksjs/components": "0.2.800",
|
|
81
|
+
"@stacksjs/config": "0.75.475",
|
|
82
|
+
"@stacksjs/database": "0.75.475",
|
|
83
|
+
"@stacksjs/desktop-build": "0.75.475",
|
|
84
|
+
"@stacksjs/dns": "0.75.475",
|
|
85
|
+
"@stacksjs/enums": "0.75.475",
|
|
86
|
+
"@stacksjs/env": "0.75.475",
|
|
87
|
+
"@stacksjs/error-handling": "0.75.475",
|
|
88
|
+
"@stacksjs/github": "0.75.475",
|
|
89
89
|
"@stacksjs/gitit": "^0.2.5",
|
|
90
|
-
"@stacksjs/i18n": "0.75.
|
|
91
|
-
"@stacksjs/image": "0.75.
|
|
92
|
-
"@stacksjs/logging": "0.75.
|
|
90
|
+
"@stacksjs/i18n": "0.75.475",
|
|
91
|
+
"@stacksjs/image": "0.75.475",
|
|
92
|
+
"@stacksjs/logging": "0.75.475",
|
|
93
93
|
"@stacksjs/logsmith": "^0.2.11",
|
|
94
|
-
"@stacksjs/mobile": "0.75.
|
|
95
|
-
"@stacksjs/orm": "0.75.
|
|
96
|
-
"@stacksjs/path": "0.75.
|
|
97
|
-
"@stacksjs/payments": "0.75.
|
|
98
|
-
"@stacksjs/queue": "0.75.
|
|
99
|
-
"@stacksjs/registry": "0.75.
|
|
100
|
-
"@stacksjs/router": "0.75.
|
|
94
|
+
"@stacksjs/mobile": "0.75.475",
|
|
95
|
+
"@stacksjs/orm": "0.75.475",
|
|
96
|
+
"@stacksjs/path": "0.75.475",
|
|
97
|
+
"@stacksjs/payments": "0.75.475",
|
|
98
|
+
"@stacksjs/queue": "0.75.475",
|
|
99
|
+
"@stacksjs/registry": "0.75.475",
|
|
100
|
+
"@stacksjs/router": "0.75.475",
|
|
101
101
|
"@stacksjs/rpx": "^0.11.54",
|
|
102
|
-
"@stacksjs/scheduler": "0.75.
|
|
103
|
-
"@stacksjs/search-engine": "0.75.
|
|
104
|
-
"@stacksjs/security": "0.75.
|
|
105
|
-
"@stacksjs/server": "0.75.
|
|
106
|
-
"@stacksjs/sites": "0.75.
|
|
107
|
-
"@stacksjs/storage": "0.75.
|
|
108
|
-
"@stacksjs/strings": "0.75.
|
|
109
|
-
"@stacksjs/stx": "0.2.
|
|
102
|
+
"@stacksjs/scheduler": "0.75.475",
|
|
103
|
+
"@stacksjs/search-engine": "0.75.475",
|
|
104
|
+
"@stacksjs/security": "0.75.475",
|
|
105
|
+
"@stacksjs/server": "0.75.475",
|
|
106
|
+
"@stacksjs/sites": "0.75.475",
|
|
107
|
+
"@stacksjs/storage": "0.75.475",
|
|
108
|
+
"@stacksjs/strings": "0.75.475",
|
|
109
|
+
"@stacksjs/stx": "0.2.800",
|
|
110
110
|
"@stacksjs/tlsx": "^0.13.19",
|
|
111
|
-
"@stacksjs/ts-cloud": "^0.16.
|
|
111
|
+
"@stacksjs/ts-cloud": "^0.16.92",
|
|
112
112
|
"@stacksjs/ts-md": "^0.1.1",
|
|
113
|
-
"@stacksjs/tunnel": "0.75.
|
|
114
|
-
"@stacksjs/types": "0.75.
|
|
115
|
-
"@stacksjs/utils": "0.75.
|
|
116
|
-
"@stacksjs/whois": "0.75.
|
|
117
|
-
"bun-plugin-stx": "0.2.
|
|
113
|
+
"@stacksjs/tunnel": "0.75.475",
|
|
114
|
+
"@stacksjs/types": "0.75.475",
|
|
115
|
+
"@stacksjs/utils": "0.75.475",
|
|
116
|
+
"@stacksjs/whois": "0.75.475",
|
|
117
|
+
"bun-plugin-stx": "0.2.800"
|
|
118
118
|
},
|
|
119
119
|
"peerDependencies": {
|
|
120
120
|
"craft-native": ">=0.0.443",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
131
|
"devDependencies": {
|
|
132
|
-
"@stacksjs/validation": "0.75.
|
|
132
|
+
"@stacksjs/validation": "0.75.475",
|
|
133
133
|
"better-dx": "^0.2.24"
|
|
134
134
|
}
|
|
135
135
|
}
|