fix(git-master): inject watermark only when enabled instead of overriding defaults
The watermark (commit footer and co-author) was inconsistently applied because: 1. The skill tool didn't receive gitMasterConfig 2. The approach was 'default ON, inject DISABLED override' which LLMs sometimes ignored This refactors to 'inject only when enabled' approach: - Remove hardcoded watermark section from base templates - Dynamically inject section 5.5 based on config values - Default is still ON (both true when no config) - When both disabled, no injection occurs (clean prompt) Also fixes missing config propagation to skill tool and createBuiltinAgents.
This commit is contained in:
@@ -4,6 +4,7 @@ import { TOOL_DESCRIPTION_NO_SKILLS, TOOL_DESCRIPTION_PREFIX } from "./constants
|
||||
import type { SkillArgs, SkillInfo, SkillLoadOptions } from "./types"
|
||||
import type { LoadedSkill } from "../../features/opencode-skill-loader"
|
||||
import { getAllSkills, extractSkillTemplate } from "../../features/opencode-skill-loader/skill-content"
|
||||
import { injectGitMasterConfig } from "../../features/opencode-skill-loader/skill-content"
|
||||
import type { SkillMcpManager, SkillMcpClientInfo, SkillMcpServerContext } from "../../features/skill-mcp-manager"
|
||||
import type { Tool, Resource, Prompt } from "@modelcontextprotocol/sdk/types.js"
|
||||
|
||||
@@ -164,7 +165,12 @@ export function createSkillTool(options: SkillLoadOptions = {}): ToolDefinition
|
||||
throw new Error(`Skill "${args.name}" not found. Available skills: ${available || "none"}`)
|
||||
}
|
||||
|
||||
const body = await extractSkillBody(skill)
|
||||
let body = await extractSkillBody(skill)
|
||||
|
||||
if (args.name === "git-master") {
|
||||
body = injectGitMasterConfig(body, options.gitMasterConfig)
|
||||
}
|
||||
|
||||
const dir = skill.path ? dirname(skill.path) : skill.resolvedPath || process.cwd()
|
||||
|
||||
const output = [
|
||||
|
||||
Reference in New Issue
Block a user