Skip to content

Commit 5163c82

Browse files
anandgupta42claude
andcommitted
fix: address CodeRabbit review findings
- Fail-fast on zero embedded skills in release builds (`Script.release` guard) - Surface `altimate-dbt` setup failures with `console.warn` instead of silently swallowing errors - Use exact PATH-segment matching (`split(sep).some(e => e === binDir)`) instead of substring `includes()` to avoid false-positive dedup Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 084a95a commit 5163c82

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎packages/opencode/script/build.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ for (const entry of skillEntries) {
8080
builtinSkills.push({ name: entry.name, content })
8181
}
8282
console.log(`Loaded ${builtinSkills.length} builtin skills`)
83+
if (Script.release && builtinSkills.length === 0) {
84+
console.error("No builtin skills were loaded from ../../.opencode/skills; aborting release build.")
85+
process.exit(1)
86+
}
8387

8488
const singleFlag = process.argv.includes("--single")
8589
const baselineFlag = process.argv.includes("--baseline")

‎packages/opencode/script/postinstall.mjs‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,10 @@ function copyDirRecursive(src, dst) {
136136
function setupDbtTools() {
137137
try {
138138
const dbtBinSrc = path.join(__dirname, "dbt-tools", "bin", "altimate-dbt")
139-
if (!fs.existsSync(dbtBinSrc)) return
139+
if (!fs.existsSync(dbtBinSrc)) {
140+
console.warn(`Bundled altimate-dbt entrypoint missing: ${dbtBinSrc}`)
141+
return
142+
}
140143

141144
const binDir = path.join(__dirname, "bin")
142145
if (!fs.existsSync(binDir)) fs.mkdirSync(binDir, { recursive: true })
@@ -160,8 +163,8 @@ function setupDbtTools() {
160163
const cmdTarget = path.join(binDir, "altimate-dbt.cmd")
161164
fs.writeFileSync(cmdTarget, '@echo off\r\nnode "%~dp0\\..\\dbt-tools\\dist\\index.js" %*\r\n')
162165
}
163-
} catch {
164-
// Non-fatal — dbt-tools is optional
166+
} catch (error) {
167+
console.warn("Failed to setup bundled altimate-dbt:", error)
165168
}
166169
}
167170

‎packages/opencode/src/tool/bash.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ export const BashTool = Tool.define("bash", async () => {
172172
if (binDir) {
173173
const sep = process.platform === "win32" ? ";" : ":"
174174
const basePath = mergedEnv.PATH ?? mergedEnv.Path ?? ""
175-
if (!basePath.includes(binDir)) {
175+
const pathEntries = basePath.split(sep).filter(Boolean)
176+
if (!pathEntries.some((entry) => entry === binDir)) {
176177
mergedEnv.PATH = `${binDir}${sep}${basePath}`
177178
}
178179
}

0 commit comments

Comments
 (0)