Skip to content
This repository was archived by the owner on Aug 17, 2026. It is now read-only.

Commit 602d415

Browse files
committed
feat(grunt): rewire autoupdate to grunt-it/gruntcode + tap, brand user-facing CLI strings (#8)
Two coupled changes, one ticket-class (this is what 'making the fork ours' means). ## Autoupdate rewire Upstream's Installation module checks anomalyco/opencode GitHub releases, opencode-ai npm package, and 'opencode' brew formula. Rewired for grunt-it distribution: - detectedMethod=brew probes 'grunt-it/tap/gruntcode' (the canonical tap) - Installation.latest() for brew reads 'brew info --json=v2 grunt-it/tap/gruntcode' - Installation.latest() default path hits api.github.com/repos/grunt-it/gruntcode/releases/latest - 'brew upgrade' path taps 'grunt-it/tap' (not anomalyco/tap), pulls --ff-only, then 'brew upgrade grunt-it/tap/gruntcode' - curl-install upgrade now returns a clear error pointing users at the brew formula or the GitHub releases page (we don't host a curl install script) - npm/bun/pnpm/yarn/scoop/choco paths kept structurally but are dead targets (we don't publish there) — they'll fail noisily if anyone hits them, which is correct since grunt-it/tap is the only supported install method ## Branding (user-facing CLI strings only — not internal namespaces) - 'opencode tui' / 'opencode in' / 'opencode server' descriptions → 'gruntcode' - '`opencode version: ...`' debug output → 'gruntcode version' - 'opencode is installed to ...' upgrade error → 'gruntcode is installed to' - userAgent() returns 'gruntcode/...' (was 'opencode/...') Untouched (intentionally): - The ASCII splash logo (would need new G/R/U/N/T glyphs — separate task) - @opencode/Foo class namespaces, ~/.config/opencode/ path, opencode.ai/config schema URL, MCP message keys like 'opencode.status' (changing these breaks config back-compat) - packages/opencode/ npm package name (internal monorepo identifier) Closes the grunt-feat/branding-and-autoupdate slice of hivemind anomalyco#222 Phase 1. bun typecheck clean.
1 parent a88017e commit 602d415

6 files changed

Lines changed: 51 additions & 59 deletions

File tree

‎packages/opencode/src/cli/cmd/debug/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const InfoCommand = effectCmd({
5858
: undefined
5959
const terminal = [termProgram, process.env.TERM].filter((item): item is string => Boolean(item)).join(" / ")
6060

61-
console.log(`opencode version: ${InstallationVersion}`)
61+
console.log(`gruntcode version: ${InstallationVersion}`)
6262
console.log(`os: ${os.type()} ${os.release()} ${os.arch()}`)
6363
console.log(`terminal: ${terminal || "unknown"}`)
6464
console.log("plugins:")

‎packages/opencode/src/cli/cmd/serve.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Flag } from "@opencode-ai/core/flag/flag"
77
export const ServeCommand = effectCmd({
88
command: "serve",
99
builder: (yargs) => withNetworkOptions(yargs),
10-
describe: "starts a headless opencode server",
10+
describe: "starts a headless gruntcode server",
1111
// Server loads instances per-request via x-opencode-directory header — no
1212
// need for an ambient project InstanceContext at startup.
1313
instance: false,

‎packages/opencode/src/cli/cmd/tui/thread.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ export function resolveThreadDirectory(project?: string, envPWD = process.env.PW
103103

104104
export const TuiThreadCommand = cmd({
105105
command: "$0 [project]",
106-
describe: "start opencode tui",
106+
describe: "start gruntcode tui",
107107
builder: (yargs) =>
108108
withNetworkOptions(yargs)
109109
.positional("project", {
110110
type: "string",
111-
describe: "path to start opencode in",
111+
describe: "path to start gruntcode in",
112112
})
113113
.option("model", {
114114
type: "string",

‎packages/opencode/src/cli/cmd/upgrade.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const UpgradeCommand = {
2828
const detectedMethod = await Installation.method()
2929
const method = (args.method as Installation.Method) ?? detectedMethod
3030
if (method === "unknown") {
31-
prompts.log.error(`opencode is installed to ${process.execPath} and may be managed by a package manager`)
31+
prompts.log.error(`gruntcode is installed to ${process.execPath} and may be managed by a package manager`)
3232
const install = await prompts.select({
3333
message: "Install anyways?",
3434
options: [

‎packages/opencode/src/cli/cmd/web.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function getNetworkIPs() {
3232
export const WebCommand = effectCmd({
3333
command: "web",
3434
builder: (yargs) => withNetworkOptions(yargs),
35-
describe: "start opencode server and open web interface",
35+
describe: "start gruntcode server and open web interface",
3636
// Server loads instances per-request via x-opencode-directory header — no
3737
// ambient project InstanceContext needed at startup.
3838
instance: false,

‎packages/opencode/src/installation/index.ts‎

Lines changed: 45 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const Info = Schema.Struct({
5252
export type Info = Schema.Schema.Type<typeof Info>
5353

5454
export function userAgent(client = "cli") {
55-
return `opencode/${InstallationChannel}/${InstallationVersion}/${client}`
55+
return `gruntcode/${InstallationChannel}/${InstallationVersion}/${client}`
5656
}
5757

5858
export 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

Comments
 (0)