Skip to content

Commit 81f3220

Browse files
authored
chore: add missing altimate_change markers for upstream merge safety (#322)
Wraps custom code in upstream-shared files with `altimate_change` markers so the marker guard CI catches them during future upstream merges: - `skill/skill.ts`: `gray-matter` import, `OPENCODE_BUILTIN_SKILLS` global, builtin skill loading logic, `builtin:` protocol in `fmt()` - `tool/bash.ts`: `ALTIMATE_BIN_DIR` PATH prepend logic - `tool/skill.ts`: `isBuiltin` branch for embedded skill file resolution Closes #321
1 parent 550bd39 commit 81f3220

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

packages/opencode/src/skill/skill.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import z from "zod"
22
import path from "path"
33
import os from "os"
4+
// altimate_change start — gray-matter for parsing embedded builtin skill frontmatter
45
import matter from "gray-matter"
6+
// altimate_change end
57
import { Config } from "../config/config"
68
import { Instance } from "../project/instance"
79
import { NamedError } from "@opencode-ai/util/error"
@@ -18,12 +20,11 @@ import { pathToFileURL } from "url"
1820
import type { Agent } from "@/agent/agent"
1921
import { PermissionNext } from "@/permission/next"
2022

21-
// Builtin skills embedded at build time — available in ALL distribution channels
22-
// (npm, Homebrew, AUR, Docker) without relying on postinstall filesystem copies.
23-
// Falls back to filesystem scan in dev mode when the global is undefined.
23+
// altimate_change start — builtin skills embedded at build time for all distribution channels
2424
declare const OPENCODE_BUILTIN_SKILLS:
2525
| { name: string; content: string }[]
2626
| undefined
27+
// altimate_change end
2728

2829
export namespace Skill {
2930
const log = Log.create({ service: "skill" })
@@ -112,8 +113,7 @@ export namespace Skill {
112113
})
113114
}
114115

115-
// Load builtin skills — prefer filesystem (supports @references), fall back
116-
// to binary-embedded data (works without postinstall for Homebrew/AUR/Docker).
116+
// altimate_change start — load builtin skills from filesystem or binary-embedded data
117117
if (!Flag.OPENCODE_DISABLE_EXTERNAL_SKILLS) {
118118
let loadedFromFs = false
119119

@@ -155,6 +155,7 @@ export namespace Skill {
155155
log.info("loaded embedded builtin skills", { count: OPENCODE_BUILTIN_SKILLS.length })
156156
}
157157
}
158+
// altimate_change end
158159

159160
// Scan external skill directories (.claude/skills/, .agents/skills/, etc.)
160161
// Load global (home) first, then project-level (so project-level overwrites)
@@ -259,7 +260,9 @@ export namespace Skill {
259260
` <skill>`,
260261
` <name>${skill.name}</name>`,
261262
` <description>${skill.description}</description>`,
263+
// altimate_change start — handle builtin: protocol for embedded skills
262264
` <location>${skill.location.startsWith("builtin:") ? skill.location : pathToFileURL(skill.location).href}</location>`,
265+
// altimate_change end
263266
` </skill>`,
264267
]),
265268
"</available_skills>",

packages/opencode/src/tool/bash.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ export const BashTool = Tool.define("bash", async () => {
165165
{ env: {} },
166166
)
167167

168-
// Merge process.env + shell plugin env, then prepend bundled tools dir.
169-
// shellEnv.env may contain PATH additions from user's shell profile.
168+
// altimate_change start — prepend bundled tools dir (ALTIMATE_BIN_DIR) to PATH
170169
const mergedEnv: Record<string, string | undefined> = { ...process.env, ...shellEnv.env }
171170
const binDir = process.env.ALTIMATE_BIN_DIR
172171
if (binDir) {
@@ -177,6 +176,7 @@ export const BashTool = Tool.define("bash", async () => {
177176
mergedEnv.PATH = basePath ? `${binDir}${sep}${basePath}` : binDir
178177
}
179178
}
179+
// altimate_change end
180180

181181
const proc = spawn(params.command, {
182182
shell,

packages/opencode/src/tool/skill.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ export const SkillTool = Tool.define("skill", async (ctx) => {
112112
metadata: {},
113113
})
114114

115+
// altimate_change start — handle builtin: skills that have no filesystem directory
115116
const isBuiltin = skill.location.startsWith("builtin:")
116117
const dir = isBuiltin ? "" : path.dirname(skill.location)
117118
const base = isBuiltin ? skill.location : pathToFileURL(dir).href
@@ -137,6 +138,7 @@ export const SkillTool = Tool.define("skill", async (ctx) => {
137138
}
138139
return arr
139140
}).then((f) => f.map((file) => `<file>${file}</file>`).join("\n"))
141+
// altimate_change end
140142

141143
// altimate_change start — telemetry instrumentation for skill loading
142144
try {

0 commit comments

Comments
 (0)