-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: Add Gemini CLI support with TOML-based slash commands #256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
TabishB
merged 6 commits into
Fission-AI:main
from
sno-ai:feature/add-gemini-cli-support
Nov 11, 2025
+169
−1
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1ec30f6
feat: add Gemini CLI support with TOML-based slash commands
LarHope 22e60c0
Merge branch 'main' into feature/add-gemini-cli-support
TabishB ea27d72
Merge branch 'main' into feature/add-gemini-cli-support
TabishB f2999ab
[add]
LarHope 5b4d652
feat: address PR feedback - remove changeset and add update test
LarHope fd1d0d1
Merge branch 'main' into feature/add-gemini-cli-support
LarHope File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| ## Repository Updates Log | ||
|
|
||
| ### 2025-10-29 - Gemini CLI Support PR Created | ||
|
|
||
| **PR #256**: feat: Add Gemini CLI support with TOML-based slash commands | ||
| - Status: Open, awaiting review from @TabishB | ||
| - Branch: `feature/add-gemini-cli-support` (commit 1ec30f6) | ||
| - Forked to: https://github.com/snoai/OpenSpec | ||
| - PR URL: https://github.com/Fission-AI/OpenSpec/pull/256 | ||
| - Changes: Added `GeminiSlashCommandConfigurator` with TOML-based slash commands (`/openspec:proposal`, `/openspec:apply`, `/openspec:archive`) | ||
| - Testing: All 244 tests passing, build successful | ||
| - Changeset: Added minor version bump | ||
| - Closes: #248 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| import { FileSystemUtils } from '../../../utils/file-system.js'; | ||
| import { SlashCommandConfigurator } from './base.js'; | ||
| import { SlashCommandId, TemplateManager } from '../../templates/index.js'; | ||
| import { OPENSPEC_MARKERS } from '../../config.js'; | ||
|
|
||
| const FILE_PATHS: Record<SlashCommandId, string> = { | ||
| proposal: '.gemini/commands/openspec/proposal.toml', | ||
| apply: '.gemini/commands/openspec/apply.toml', | ||
| archive: '.gemini/commands/openspec/archive.toml' | ||
| }; | ||
|
|
||
| const DESCRIPTIONS: Record<SlashCommandId, string> = { | ||
| proposal: 'Scaffold a new OpenSpec change and validate strictly.', | ||
| apply: 'Implement an approved OpenSpec change and keep tasks in sync.', | ||
| archive: 'Archive a deployed OpenSpec change and update specs.' | ||
| }; | ||
|
|
||
| export class GeminiSlashCommandConfigurator extends SlashCommandConfigurator { | ||
| readonly toolId = 'gemini'; | ||
| readonly isAvailable = true; | ||
|
|
||
| protected getRelativePath(id: SlashCommandId): string { | ||
| return FILE_PATHS[id]; | ||
| } | ||
|
|
||
| protected getFrontmatter(_id: SlashCommandId): string | undefined { | ||
| // TOML doesn't use separate frontmatter - it's all in one structure | ||
| return undefined; | ||
| } | ||
|
|
||
| // Override to generate TOML format with markers inside the prompt field | ||
| async generateAll(projectPath: string, _openspecDir: string): Promise<string[]> { | ||
| const createdOrUpdated: string[] = []; | ||
|
|
||
| for (const target of this.getTargets()) { | ||
| const body = this.getBody(target.id); | ||
| const filePath = FileSystemUtils.joinPath(projectPath, target.path); | ||
|
|
||
| if (await FileSystemUtils.fileExists(filePath)) { | ||
| await this.updateBody(filePath, body); | ||
| } else { | ||
| const tomlContent = this.generateTOML(target.id, body); | ||
| await FileSystemUtils.writeFile(filePath, tomlContent); | ||
| } | ||
|
|
||
| createdOrUpdated.push(target.path); | ||
| } | ||
|
|
||
| return createdOrUpdated; | ||
| } | ||
|
|
||
| private generateTOML(id: SlashCommandId, body: string): string { | ||
| const description = DESCRIPTIONS[id]; | ||
|
|
||
| // TOML format with triple-quoted string for multi-line prompt | ||
| // Markers are inside the prompt value | ||
| return `description = "${description}" | ||
|
|
||
| prompt = """ | ||
| ${OPENSPEC_MARKERS.start} | ||
| ${body} | ||
| ${OPENSPEC_MARKERS.end} | ||
| """ | ||
| `; | ||
| } | ||
|
|
||
| // Override updateBody to handle TOML format | ||
| protected async updateBody(filePath: string, body: string): Promise<void> { | ||
| const content = await FileSystemUtils.readFile(filePath); | ||
| const startIndex = content.indexOf(OPENSPEC_MARKERS.start); | ||
| const endIndex = content.indexOf(OPENSPEC_MARKERS.end); | ||
|
|
||
| if (startIndex === -1 || endIndex === -1 || endIndex <= startIndex) { | ||
| throw new Error(`Missing OpenSpec markers in ${filePath}`); | ||
| } | ||
|
|
||
| const before = content.slice(0, startIndex + OPENSPEC_MARKERS.start.length); | ||
| const after = content.slice(endIndex); | ||
| const updatedContent = `${before}\n${body}\n${after}`; | ||
|
|
||
| await FileSystemUtils.writeFile(filePath, updatedContent); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to track this, this can be dropped