@@ -52,7 +52,7 @@ export const Info = Schema.Struct({
5252export type Info = Schema . Schema . Type < typeof Info >
5353
5454export function userAgent ( client = "cli" ) {
55- return `opencode /${ InstallationChannel } /${ InstallationVersion } /${ client } `
55+ return `gruntcode /${ InstallationChannel } /${ InstallationVersion } /${ client } `
5656}
5757
5858export const USER_AGENT = userAgent ( )
@@ -136,11 +136,10 @@ export const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProce
136136 )
137137
138138 const getBrewFormula = Effect . fnUntraced ( function * ( ) {
139- const tapFormula = yield * text ( [ "brew" , "list" , "--formula" , "anomalyco/tap/opencode" ] )
140- if ( tapFormula . includes ( "opencode" ) ) return "anomalyco/tap/opencode"
141- const coreFormula = yield * text ( [ "brew" , "list" , "--formula" , "opencode" ] )
142- if ( coreFormula . includes ( "opencode" ) ) return "opencode"
143- return "opencode"
139+ // grunt-it/tap/gruntcode is the canonical tap for the grunt-it soft-fork.
140+ const tapFormula = yield * text ( [ "brew" , "list" , "--formula" , "grunt-it/tap/gruntcode" ] )
141+ if ( tapFormula . includes ( "gruntcode" ) ) return "grunt-it/tap/gruntcode"
142+ return "grunt-it/tap/gruntcode"
144143 } )
145144
146145 const upgradeFailure = ( method : Method , result ?: { code : number ; stdout : string ; stderr : string } ) => {
@@ -150,24 +149,16 @@ export const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProce
150149 }
151150
152151 const upgradeCurl = Effect . fnUntraced (
153- function * ( target : string ) {
154- const response = yield * httpOk . execute ( HttpClientRequest . get ( "https://opencode.ai/install" ) )
155- const body = yield * response . text
156- const bodyBytes = new TextEncoder ( ) . encode ( body )
157- const result = yield * appProcess . run (
158- ChildProcess . make ( "bash" , [ ] , {
159- stdin : Stream . make ( bodyBytes ) ,
160- env : { VERSION : target } ,
161- extendEnv : true ,
162- } ) ,
163- )
164- return {
165- code : result . exitCode ,
166- stdout : result . stdout . toString ( "utf8" ) ,
167- stderr : result . stderr . toString ( "utf8" ) ,
168- }
152+ function * ( _target : string ) {
153+ // grunt-it soft-fork: we don't host a curl-install script. Anyone who landed in this
154+ // path installed gruntcode via something other than brew (e.g. by manually downloading
155+ // a release tarball into ~/.opencode/bin or ~/.local/bin). Point them at the canonical
156+ // upgrade path instead of attempting a bash install pipeline.
157+ return yield * new UpgradeFailedError ( {
158+ stderr :
159+ "curl-install upgrade is not supported for gruntcode. Install via `brew install grunt-it/tap/gruntcode` and run `brew upgrade gruntcode` to update, or manually download the latest release from https://github.com/grunt-it/gruntcode/releases." ,
160+ } )
169161 } ,
170- Effect . mapError ( ( ) => new UpgradeFailedError ( { stderr : upgradeFailure ( "curl" ) } ) ) ,
171162 )
172163
173164 const result : Interface = {
@@ -187,9 +178,9 @@ export const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProce
187178 { name : "yarn" , command : ( ) => text ( [ "yarn" , "global" , "list" ] ) } ,
188179 { name : "pnpm" , command : ( ) => text ( [ "pnpm" , "list" , "-g" , "--depth=0" ] ) } ,
189180 { name : "bun" , command : ( ) => text ( [ "bun" , "pm" , "ls" , "-g" ] ) } ,
190- { name : "brew" , command : ( ) => text ( [ "brew" , "list" , "--formula" , "opencode " ] ) } ,
191- { name : "scoop" , command : ( ) => text ( [ "scoop" , "list" , "opencode " ] ) } ,
192- { name : "choco" , command : ( ) => text ( [ "choco" , "list" , "--limit-output" , "opencode " ] ) } ,
181+ { name : "brew" , command : ( ) => text ( [ "brew" , "list" , "--formula" , "grunt-it/tap/gruntcode " ] ) } ,
182+ { name : "scoop" , command : ( ) => text ( [ "scoop" , "list" , "gruntcode " ] ) } ,
183+ { name : "choco" , command : ( ) => text ( [ "choco" , "list" , "--limit-output" , "gruntcode " ] ) } ,
193184 ]
194185
195186 checks . sort ( ( a , b ) => {
@@ -202,8 +193,12 @@ export const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProce
202193
203194 for ( const check of checks ) {
204195 const output = yield * check . command ( )
196+ // grunt-it soft-fork: brew is the canonical install method (grunt-it/tap/gruntcode).
197+ // npm/bun/pnpm/yarn/scoop/choco paths are unsupported \u2014 we don't publish there \u2014
198+ // but kept for shape compat with upstream. Match 'gruntcode' so the brew path
199+ // detects our install correctly.
205200 const installedName =
206- check . name === "brew" || check . name === "choco" || check . name === "scoop" ? "opencode " : "opencode-ai"
201+ check . name === "brew" || check . name === "choco" || check . name === "scoop" ? "gruntcode " : "opencode-ai"
207202 if ( output . includes ( installedName ) ) {
208203 return check . name
209204 }
@@ -215,19 +210,14 @@ export const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProce
215210 const detectedMethod = installMethod || ( yield * result . method ( ) )
216211
217212 if ( detectedMethod === "brew" ) {
213+ // grunt-it soft-fork: always use tap formula (grunt-it/tap/gruntcode). No upstream
214+ // core-formula fallback — we're not in homebrew-core, and a query to formulae.brew.sh
215+ // for 'gruntcode' would 404. The tap path uses 'brew info --json=v2' which works for
216+ // any formula format (tap or core), so it stays correct.
218217 const formula = yield * getBrewFormula ( )
219- if ( formula . includes ( "/" ) ) {
220- const infoJson = yield * text ( [ "brew" , "info" , "--json=v2" , formula ] )
221- const info = yield * Schema . decodeUnknownEffect ( Schema . fromJsonString ( BrewInfoV2 ) ) ( infoJson )
222- return info . formulae [ 0 ] . versions . stable
223- }
224- const response = yield * httpOk . execute (
225- HttpClientRequest . get ( "https://formulae.brew.sh/api/formula/opencode.json" ) . pipe (
226- HttpClientRequest . acceptJson ,
227- ) ,
228- )
229- const data = yield * HttpClientResponse . schemaBodyJson ( BrewFormula ) ( response )
230- return data . versions . stable
218+ const infoJson = yield * text ( [ "brew" , "info" , "--json=v2" , formula ] )
219+ const info = yield * Schema . decodeUnknownEffect ( Schema . fromJsonString ( BrewInfoV2 ) ) ( infoJson )
220+ return info . formulae [ 0 ] . versions . stable
231221 }
232222
233223 if ( detectedMethod === "npm" || detectedMethod === "bun" || detectedMethod === "pnpm" ) {
@@ -260,8 +250,11 @@ export const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProce
260250 return data . version
261251 }
262252
253+ // grunt-it soft-fork: GitHub releases live at grunt-it/gruntcode, not anomalyco/opencode.
254+ // Release tags follow vX.Y.Z-grunt.N (e.g. v1.15.10-grunt.4) — strip the leading 'v'
255+ // and we report the full grunt-suffixed version string back to the caller.
263256 const response = yield * httpOk . execute (
264- HttpClientRequest . get ( "https://api.github.com/repos/anomalyco/opencode /releases/latest" ) . pipe (
257+ HttpClientRequest . get ( "https://api.github.com/repos/grunt-it/gruntcode /releases/latest" ) . pipe (
265258 HttpClientRequest . acceptJson ,
266259 ) ,
267260 )
@@ -284,23 +277,22 @@ export const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProce
284277 upgradeResult = yield * run ( [ "bun" , "install" , "-g" , `opencode-ai@${ target } ` ] )
285278 break
286279 case "brew" : {
280+ // grunt-it soft-fork: tap is grunt-it/tap.
287281 const formula = yield * getBrewFormula ( )
288282 const env = { HOMEBREW_NO_AUTO_UPDATE : "1" }
289- if ( formula . includes ( "/" ) ) {
290- const tap = yield * run ( [ "brew" , "tap" , "anomalyco/tap" ] , { env } )
291- if ( tap . code !== 0 ) {
292- upgradeResult = tap
283+ const tap = yield * run ( [ "brew" , "tap" , "grunt-it/tap" ] , { env } )
284+ if ( tap . code !== 0 ) {
285+ upgradeResult = tap
286+ break
287+ }
288+ const repo = yield * text ( [ "brew" , "--repo" , "grunt-it/tap" ] )
289+ const dir = repo . trim ( )
290+ if ( dir ) {
291+ const pull = yield * run ( [ "git" , "pull" , "--ff-only" ] , { cwd : dir , env } )
292+ if ( pull . code !== 0 ) {
293+ upgradeResult = pull
293294 break
294295 }
295- const repo = yield * text ( [ "brew" , "--repo" , "anomalyco/tap" ] )
296- const dir = repo . trim ( )
297- if ( dir ) {
298- const pull = yield * run ( [ "git" , "pull" , "--ff-only" ] , { cwd : dir , env } )
299- if ( pull . code !== 0 ) {
300- upgradeResult = pull
301- break
302- }
303- }
304296 }
305297 upgradeResult = yield * run ( [ "brew" , "upgrade" , formula ] , { env } )
306298 break
0 commit comments