@stacksjs/actions 0.75.468 → 0.75.473
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/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/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.473",
|
|
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.473",
|
|
70
|
+
"@stacksjs/ai": "0.75.473",
|
|
71
|
+
"@stacksjs/analytics": "0.75.473",
|
|
72
|
+
"@stacksjs/api": "0.75.473",
|
|
73
|
+
"@stacksjs/auth": "0.75.473",
|
|
74
|
+
"@stacksjs/build": "0.75.473",
|
|
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.473",
|
|
78
|
+
"@stacksjs/cloud": "0.75.473",
|
|
79
|
+
"@stacksjs/cms": "0.75.473",
|
|
80
|
+
"@stacksjs/components": "0.2.800",
|
|
81
|
+
"@stacksjs/config": "0.75.473",
|
|
82
|
+
"@stacksjs/database": "0.75.473",
|
|
83
|
+
"@stacksjs/desktop-build": "0.75.473",
|
|
84
|
+
"@stacksjs/dns": "0.75.473",
|
|
85
|
+
"@stacksjs/enums": "0.75.473",
|
|
86
|
+
"@stacksjs/env": "0.75.473",
|
|
87
|
+
"@stacksjs/error-handling": "0.75.473",
|
|
88
|
+
"@stacksjs/github": "0.75.473",
|
|
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.473",
|
|
91
|
+
"@stacksjs/image": "0.75.473",
|
|
92
|
+
"@stacksjs/logging": "0.75.473",
|
|
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.473",
|
|
95
|
+
"@stacksjs/orm": "0.75.473",
|
|
96
|
+
"@stacksjs/path": "0.75.473",
|
|
97
|
+
"@stacksjs/payments": "0.75.473",
|
|
98
|
+
"@stacksjs/queue": "0.75.473",
|
|
99
|
+
"@stacksjs/registry": "0.75.473",
|
|
100
|
+
"@stacksjs/router": "0.75.473",
|
|
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.473",
|
|
103
|
+
"@stacksjs/search-engine": "0.75.473",
|
|
104
|
+
"@stacksjs/security": "0.75.473",
|
|
105
|
+
"@stacksjs/server": "0.75.473",
|
|
106
|
+
"@stacksjs/sites": "0.75.473",
|
|
107
|
+
"@stacksjs/storage": "0.75.473",
|
|
108
|
+
"@stacksjs/strings": "0.75.473",
|
|
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.473",
|
|
114
|
+
"@stacksjs/types": "0.75.473",
|
|
115
|
+
"@stacksjs/utils": "0.75.473",
|
|
116
|
+
"@stacksjs/whois": "0.75.473",
|
|
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.473",
|
|
133
133
|
"better-dx": "^0.2.24"
|
|
134
134
|
}
|
|
135
135
|
}
|