fix: strip unsupported Gemini agent skills frontmatter (#971)

This commit is contained in:
Frank
2026-03-12 10:36:43 -07:00
committed by GitHub
parent 14f9637538
commit 0f38e3467e
2 changed files with 63 additions and 0 deletions

View File

@@ -757,6 +757,7 @@ function stripSubTags(content) {
* - tools: must be a YAML array (not comma-separated string)
* - tool names: must use Gemini built-in names (read_file, not Read)
* - color: must be removed (causes validation error)
* - skills: must be removed (causes validation error)
* - mcp__* tools: must be excluded (auto-discovered at runtime)
*/
function convertClaudeToGeminiAgent(content) {
@@ -771,11 +772,19 @@ function convertClaudeToGeminiAgent(content) {
const lines = frontmatter.split('\n');
const newLines = [];
let inAllowedTools = false;
let inSkippedArrayField = false;
const tools = [];
for (const line of lines) {
const trimmed = line.trim();
if (inSkippedArrayField) {
if (!trimmed || trimmed.startsWith('- ')) {
continue;
}
inSkippedArrayField = false;
}
// Convert allowed-tools YAML array to tools list
if (trimmed.startsWith('allowed-tools:')) {
inAllowedTools = true;
@@ -801,6 +810,12 @@ function convertClaudeToGeminiAgent(content) {
// Strip color field (not supported by Gemini CLI, causes validation error)
if (trimmed.startsWith('color:')) continue;
// Strip skills field (not supported by Gemini CLI, causes validation error)
if (trimmed.startsWith('skills:')) {
inSkippedArrayField = true;
continue;
}
// Collect allowed-tools/tools array items
if (inAllowedTools) {
if (trimmed.startsWith('- ')) {
@@ -2414,6 +2429,7 @@ function installAllRuntimes(runtimes, isGlobal, isInteractive) {
if (process.env.GSD_TEST_MODE) {
module.exports = {
getCodexSkillAdapterHeader,
convertClaudeToGeminiAgent,
convertClaudeAgentToCodexAgent,
generateCodexAgentToml,
generateCodexConfigBlock,