Merge pull request #693 from cmosgh/fix/gemini-template-toml-bug
fix(gemini): prevent workflows and templates from being incorrectly converted to TOML
This commit is contained in:
@@ -680,7 +680,7 @@ function copyFlattenedCommands(srcDir, destDir, prefix, pathPrefix, runtime) {
|
|||||||
* @param {string} pathPrefix - Path prefix for file references
|
* @param {string} pathPrefix - Path prefix for file references
|
||||||
* @param {string} runtime - Target runtime ('claude', 'opencode', 'gemini')
|
* @param {string} runtime - Target runtime ('claude', 'opencode', 'gemini')
|
||||||
*/
|
*/
|
||||||
function copyWithPathReplacement(srcDir, destDir, pathPrefix, runtime) {
|
function copyWithPathReplacement(srcDir, destDir, pathPrefix, runtime, isCommand = false) {
|
||||||
const isOpencode = runtime === 'opencode';
|
const isOpencode = runtime === 'opencode';
|
||||||
const dirName = getDirName(runtime);
|
const dirName = getDirName(runtime);
|
||||||
|
|
||||||
@@ -697,7 +697,7 @@ function copyWithPathReplacement(srcDir, destDir, pathPrefix, runtime) {
|
|||||||
const destPath = path.join(destDir, entry.name);
|
const destPath = path.join(destDir, entry.name);
|
||||||
|
|
||||||
if (entry.isDirectory()) {
|
if (entry.isDirectory()) {
|
||||||
copyWithPathReplacement(srcPath, destPath, pathPrefix, runtime);
|
copyWithPathReplacement(srcPath, destPath, pathPrefix, runtime, isCommand);
|
||||||
} else if (entry.name.endsWith('.md')) {
|
} else if (entry.name.endsWith('.md')) {
|
||||||
// Replace ~/.claude/ and ./.claude/ with runtime-appropriate paths
|
// Replace ~/.claude/ and ./.claude/ with runtime-appropriate paths
|
||||||
let content = fs.readFileSync(srcPath, 'utf8');
|
let content = fs.readFileSync(srcPath, 'utf8');
|
||||||
@@ -712,12 +712,16 @@ function copyWithPathReplacement(srcDir, destDir, pathPrefix, runtime) {
|
|||||||
content = convertClaudeToOpencodeFrontmatter(content);
|
content = convertClaudeToOpencodeFrontmatter(content);
|
||||||
fs.writeFileSync(destPath, content);
|
fs.writeFileSync(destPath, content);
|
||||||
} else if (runtime === 'gemini') {
|
} else if (runtime === 'gemini') {
|
||||||
// Convert to TOML for Gemini (strip <sub> tags — terminals can't render subscript)
|
if (isCommand) {
|
||||||
content = stripSubTags(content);
|
// Convert to TOML for Gemini (strip <sub> tags — terminals can't render subscript)
|
||||||
const tomlContent = convertClaudeToGeminiToml(content);
|
content = stripSubTags(content);
|
||||||
// Replace extension with .toml
|
const tomlContent = convertClaudeToGeminiToml(content);
|
||||||
const tomlPath = destPath.replace(/\.md$/, '.toml');
|
// Replace extension with .toml
|
||||||
fs.writeFileSync(tomlPath, tomlContent);
|
const tomlPath = destPath.replace(/\.md$/, '.toml');
|
||||||
|
fs.writeFileSync(tomlPath, tomlContent);
|
||||||
|
} else {
|
||||||
|
fs.writeFileSync(destPath, content);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fs.writeFileSync(destPath, content);
|
fs.writeFileSync(destPath, content);
|
||||||
}
|
}
|
||||||
@@ -1386,7 +1390,7 @@ function install(isGlobal, runtime = 'claude') {
|
|||||||
|
|
||||||
const gsdSrc = path.join(src, 'commands', 'gsd');
|
const gsdSrc = path.join(src, 'commands', 'gsd');
|
||||||
const gsdDest = path.join(commandsDir, 'gsd');
|
const gsdDest = path.join(commandsDir, 'gsd');
|
||||||
copyWithPathReplacement(gsdSrc, gsdDest, pathPrefix, runtime);
|
copyWithPathReplacement(gsdSrc, gsdDest, pathPrefix, runtime, true);
|
||||||
if (verifyInstalled(gsdDest, 'commands/gsd')) {
|
if (verifyInstalled(gsdDest, 'commands/gsd')) {
|
||||||
console.log(` ${green}✓${reset} Installed commands/gsd`);
|
console.log(` ${green}✓${reset} Installed commands/gsd`);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user