@stacksjs/buddy 0.75.225 → 0.75.226

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.
@@ -17,8 +17,9 @@ export declare function automatedDeploymentRevision(environment: string, variabl
17
17
  * production already runs one of those.
18
18
  *
19
19
  * The branch is fetched without updating any ref (FETCH_HEAD only). A shallow
20
- * CI checkout receives exactly the commits between it and the head, which is
21
- * all the ancestry question needs.
20
+ * CI checkout usually receives exactly the commits between it and the head,
21
+ * which is all the ancestry question needs; one that already held the head
22
+ * as a separate shallow root is deepened until the two meet.
22
23
  */
23
24
  export declare function assertCurrentDeploymentRevision(revision: AutomatedDeploymentRevision | undefined, cwd?: unknown): Promise<DeploymentRevisionCheck | undefined>;
24
25
  /**
@@ -1,3 +1,3 @@
1
1
  import{execFile}from"node:child_process";import process from"node:process";import{promisify}from"node:util";const execute=promisify(execFile);export function automatedDeploymentRevision(environment,variables=process.env){if(environment!=="production")return;const prefix=variables.REVIEWOS==="true"?"REVIEWOS":variables.GITHUB_ACTIONS==="true"?"GITHUB":void 0;if(!prefix)return;const ref=variables[`${prefix}_REF`],sha=variables[`${prefix}_SHA`];if(!ref?.startsWith("refs/heads/")||!sha||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/i.test(sha))throw Error("Automated production deployment requires a branch ref and full commit SHA from the CI provider.");return Object.freeze({ref,sha:sha.toLowerCase()})}export async function assertCurrentDeploymentRevision(revision,cwd=process.cwd()){if(!revision)return;const git=async(args,options={})=>{try{return(await execute("git",args,{cwd,timeout:60000,maxBuffer:16777216,env:{...process.env,GIT_TERMINAL_PROMPT:"0",GCM_INTERACTIVE:"never"}})).stdout.trim()}catch{if(options.allowFailure)return null;throw Error("Cannot verify the automated deployment revision against origin; production deployment stopped.")}};await git(["check-ref-format",revision.ref]);if((await git(["rev-parse","--verify","HEAD"]))?.toLowerCase()!==revision.sha)throw Error("The deployment checkout does not match the CI commit; production deployment stopped.");const remote=await git(["ls-remote","--exit-code","--refs","origin",revision.ref]),lines=String(remote).split(`
2
- `).map((line)=>line.split(/\s+/));if(lines.length!==1||lines[0]?.[1]!==revision.ref||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/i.test(lines[0]?.[0]??""))throw Error("Origin did not return one authoritative branch head; production deployment stopped.");if(lines[0][0].toLowerCase()===revision.sha)return Object.freeze({revision,newer:[]});await git(["fetch","--quiet","--no-tags","origin",revision.ref]);const tip=String(await git(["rev-parse","--verify","FETCH_HEAD^{commit}"])).toLowerCase();if(await git(["merge-base","--is-ancestor",revision.sha,tip],{allowFailure:!0})===null)throw Error("This CI commit is no longer on the origin branch; production deployment stopped. Deploy the current branch head.");const newer=String(await git(["rev-list",`${revision.sha}..${tip}`])).split(`
2
+ `).map((line)=>line.split(/\s+/));if(lines.length!==1||lines[0]?.[1]!==revision.ref||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/i.test(lines[0]?.[0]??""))throw Error("Origin did not return one authoritative branch head; production deployment stopped.");if(lines[0][0].toLowerCase()===revision.sha)return Object.freeze({revision,newer:[]});await git(["fetch","--quiet","--no-tags","origin",revision.ref]);const tip=String(await git(["rev-parse","--verify","FETCH_HEAD^{commit}"])).toLowerCase(),isAncestor=async()=>await git(["merge-base","--is-ancestor",revision.sha,tip],{allowFailure:!0})!==null;let onBranch=await isAncestor();for(const depth of[64,512,4096]){if(onBranch||await git(["rev-parse","--is-shallow-repository"])!=="true")break;await git(["fetch","--quiet","--no-tags",`--deepen=${depth}`,"origin",revision.ref]);onBranch=await isAncestor()}if(!onBranch&&await git(["rev-parse","--is-shallow-repository"])==="true"){await git(["fetch","--quiet","--no-tags","--unshallow","origin",revision.ref]);onBranch=await isAncestor()}if(!onBranch)throw Error("This CI commit is no longer on the origin branch; production deployment stopped. Deploy the current branch head.");const newer=String(await git(["rev-list",`${revision.sha}..${tip}`])).split(`
3
3
  `).map((line)=>line.trim().toLowerCase()).filter(Boolean);return Object.freeze({revision,newer})}export function assertNotBehindLiveRelease(check,liveReleases){if(!check||check.newer.length===0)return;for(const raw of liveReleases){const id=String(raw??"").trim().toLowerCase();if(!/^[a-f0-9]{7,64}$/.test(id))continue;if(check.newer.some((sha)=>sha.startsWith(id)))throw Error(`Production already runs ${id}, which is newer than this CI commit; production deployment stopped. Deploy the current branch head.`)}}export function liveReleasesCommand(slug){if(!/^[a-z0-9][a-z0-9-]*$/i.test(slug))throw Error("A project slug is letters, digits and dashes.");return`for d in /var/www/${slug}-*/current; do [ -L "$d" ] && basename "$(readlink -f "$d")"; done; true`}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/buddy",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.225",
5
+ "version": "0.75.226",
6
6
  "description": "Meet Buddy. The Stacks runtime.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -96,68 +96,68 @@
96
96
  },
97
97
  "dependencies": {
98
98
  "@stacksjs/bumpx": "^0.2.21",
99
- "@stacksjs/actions": "0.75.225",
100
- "@stacksjs/ai": "0.75.225",
101
- "@stacksjs/alias": "0.75.225",
102
- "@stacksjs/analytics": "0.75.225",
103
- "@stacksjs/api": "0.75.225",
104
- "@stacksjs/arrays": "0.75.225",
105
- "@stacksjs/auth": "0.75.225",
106
- "@stacksjs/browser-extension": "0.75.225",
107
- "@stacksjs/build": "0.75.225",
108
- "@stacksjs/cache": "0.75.225",
109
- "@stacksjs/chat": "0.75.225",
99
+ "@stacksjs/actions": "0.75.226",
100
+ "@stacksjs/ai": "0.75.226",
101
+ "@stacksjs/alias": "0.75.226",
102
+ "@stacksjs/analytics": "0.75.226",
103
+ "@stacksjs/api": "0.75.226",
104
+ "@stacksjs/arrays": "0.75.226",
105
+ "@stacksjs/auth": "0.75.226",
106
+ "@stacksjs/browser-extension": "0.75.226",
107
+ "@stacksjs/build": "0.75.226",
108
+ "@stacksjs/cache": "0.75.226",
109
+ "@stacksjs/chat": "0.75.226",
110
110
  "@stacksjs/clapp": "^0.2.16",
111
- "@stacksjs/cli": "0.75.225",
112
- "@stacksjs/cloud": "0.75.225",
113
- "@stacksjs/cms": "0.75.225",
114
- "@stacksjs/collections": "0.75.225",
115
- "@stacksjs/commerce": "0.75.225",
116
- "@stacksjs/config": "0.75.225",
117
- "@stacksjs/database": "0.75.225",
118
- "@stacksjs/desktop-build": "0.75.225",
119
- "@stacksjs/dns": "0.75.225",
111
+ "@stacksjs/cli": "0.75.226",
112
+ "@stacksjs/cloud": "0.75.226",
113
+ "@stacksjs/cms": "0.75.226",
114
+ "@stacksjs/collections": "0.75.226",
115
+ "@stacksjs/commerce": "0.75.226",
116
+ "@stacksjs/config": "0.75.226",
117
+ "@stacksjs/database": "0.75.226",
118
+ "@stacksjs/desktop-build": "0.75.226",
119
+ "@stacksjs/dns": "0.75.226",
120
120
  "@stacksjs/dnsx": "^0.2.3",
121
- "@stacksjs/email": "0.75.225",
122
- "@stacksjs/enums": "0.75.225",
123
- "@stacksjs/env": "0.75.225",
124
- "@stacksjs/error-handling": "0.75.225",
125
- "@stacksjs/events": "0.75.225",
126
- "@stacksjs/features": "0.75.225",
127
- "@stacksjs/git": "0.75.225",
121
+ "@stacksjs/email": "0.75.226",
122
+ "@stacksjs/enums": "0.75.226",
123
+ "@stacksjs/env": "0.75.226",
124
+ "@stacksjs/error-handling": "0.75.226",
125
+ "@stacksjs/events": "0.75.226",
126
+ "@stacksjs/features": "0.75.226",
127
+ "@stacksjs/git": "0.75.226",
128
128
  "@stacksjs/gitit": "^0.2.5",
129
- "@stacksjs/health": "0.75.225",
129
+ "@stacksjs/health": "0.75.226",
130
130
  "@stacksjs/httx": "^0.1.10",
131
- "@stacksjs/image": "0.75.225",
132
- "@stacksjs/lint": "0.75.225",
133
- "@stacksjs/logging": "0.75.225",
134
- "@stacksjs/notifications": "0.75.225",
135
- "@stacksjs/objects": "0.75.225",
136
- "@stacksjs/orm": "0.75.225",
137
- "@stacksjs/path": "0.75.225",
138
- "@stacksjs/payments": "0.75.225",
139
- "@stacksjs/realtime": "0.75.225",
140
- "@stacksjs/router": "0.75.225",
131
+ "@stacksjs/image": "0.75.226",
132
+ "@stacksjs/lint": "0.75.226",
133
+ "@stacksjs/logging": "0.75.226",
134
+ "@stacksjs/notifications": "0.75.226",
135
+ "@stacksjs/objects": "0.75.226",
136
+ "@stacksjs/orm": "0.75.226",
137
+ "@stacksjs/path": "0.75.226",
138
+ "@stacksjs/payments": "0.75.226",
139
+ "@stacksjs/realtime": "0.75.226",
140
+ "@stacksjs/router": "0.75.226",
141
141
  "@stacksjs/rpx": "^0.11.54",
142
- "@stacksjs/scheduler": "0.75.225",
143
- "@stacksjs/search-engine": "0.75.225",
144
- "@stacksjs/security": "0.75.225",
145
- "@stacksjs/server": "0.75.225",
146
- "@stacksjs/sites": "0.75.225",
147
- "@stacksjs/skills": "0.75.225",
148
- "@stacksjs/socials": "0.75.225",
149
- "@stacksjs/storage": "0.75.225",
150
- "@stacksjs/strings": "0.75.225",
142
+ "@stacksjs/scheduler": "0.75.226",
143
+ "@stacksjs/search-engine": "0.75.226",
144
+ "@stacksjs/security": "0.75.226",
145
+ "@stacksjs/server": "0.75.226",
146
+ "@stacksjs/sites": "0.75.226",
147
+ "@stacksjs/skills": "0.75.226",
148
+ "@stacksjs/socials": "0.75.226",
149
+ "@stacksjs/storage": "0.75.226",
150
+ "@stacksjs/strings": "0.75.226",
151
151
  "@stacksjs/stx": "^0.2.567",
152
- "@stacksjs/testing": "0.75.225",
153
- "@stacksjs/tinker": "0.75.225",
152
+ "@stacksjs/testing": "0.75.226",
153
+ "@stacksjs/tinker": "0.75.226",
154
154
  "@stacksjs/tlsx": "^0.13.19",
155
155
  "@stacksjs/ts-cloud": "^0.16.58",
156
- "@stacksjs/tunnel": "0.75.225",
157
- "@stacksjs/types": "0.75.225",
158
- "@stacksjs/ui": "0.75.225",
159
- "@stacksjs/utils": "0.75.225",
160
- "@stacksjs/validation": "0.75.225",
156
+ "@stacksjs/tunnel": "0.75.226",
157
+ "@stacksjs/types": "0.75.226",
158
+ "@stacksjs/ui": "0.75.226",
159
+ "@stacksjs/utils": "0.75.226",
160
+ "@stacksjs/validation": "0.75.226",
161
161
  "ajv": "^8.20.0",
162
162
  "ajv-formats": "^3.0.1",
163
163
  "bun-plugin-stx": "^0.2.567",