Compare commits

..
Author SHA1 Message Date
Tabish Bidiwale 4afafcb2a3 Document Gemini CLI slash updates 2025-11-11 21:33:41 +11:00
11 changed files with 52 additions and 82 deletions
+1 -1
View File
@@ -94,7 +94,7 @@ These tools have built-in OpenSpec commands. Select the OpenSpec integration whe
| **CodeBuddy Code (CLI)** | `/openspec:proposal`, `/openspec:apply`, `/openspec:archive` (`.codebuddy/commands/`) — see [docs](https://www.codebuddy.ai/cli) |
| **CoStrict** | `/openspec-proposal`, `/openspec-apply`, `/openspec-archive` (`.cospec/openspec/commands/`) — see [docs](https://costrict.ai)|
| **Cursor** | `/openspec-proposal`, `/openspec-apply`, `/openspec-archive` |
| **Cline** | Workflows in `.clinerules/workflows/` directory (`.clinerules/workflows/openspec-*.md`) |
| **Cline** | Rules in `.clinerules/` directory (`.clinerules/openspec-*.md`) |
| **Crush** | `/openspec-proposal`, `/openspec-apply`, `/openspec-archive` (`.crush/commands/openspec/`) |
| **Factory Droid** | `/openspec-proposal`, `/openspec-apply`, `/openspec-archive` (`.factory/commands/`) |
| **Gemini CLI** | `/openspec:proposal`, `/openspec:apply`, `/openspec:archive` (`.gemini/commands/openspec/`) |
@@ -1,13 +0,0 @@
## Why
The Cline implementation was architecturally incorrect. According to Cline's official documentation, Cline uses workflows for on-demand automation and rules for behavioral guidelines. The OpenSpec slash commands are procedural workflows (scaffold → implement → archive), not behavioral rules, so they should be placed in `.clinerules/workflows/` instead of `.clinerules/`.
## What Changes
- Update ClineSlashCommandConfigurator to use `.clinerules/workflows/` paths instead of `.clinerules/` paths
- Update all tests to expect the correct workflow file locations
- Update README.md documentation to reflect workflows instead of rules
- **BREAKING**: Existing Cline users will need to re-run `openspec init` to get the corrected workflow files
## Impact
- Affected specs: cli-init (corrected Cline workflow paths)
- Affected code: `src/core/configurators/slash/cline.ts`, test files, README.md
- Modified files: `.clinerules/workflows/openspec-*.md` (moved from `.clinerules/openspec-*.md`)
@@ -1,11 +0,0 @@
# Delta for CLI Init
## MODIFIED Requirements
### Requirement: Slash Command Configuration
#### Scenario: Generating slash commands for Cline
- **WHEN** the user selects Cline during initialization
- **THEN** create `.clinerules/workflows/openspec-proposal.md`, `.clinerules/workflows/openspec-apply.md`, and `.clinerules/workflows/openspec-archive.md`
- **AND** populate each file from shared templates so command text matches other tools
- **AND** include Cline-specific Markdown heading frontmatter
- **AND** each template includes instructions for the relevant OpenSpec workflow stage
@@ -1,13 +0,0 @@
## 1. Update ClineSlashCommandConfigurator
- [x] Change FILE_PATHS in `src/core/configurators/slash/cline.ts` from `.clinerules/openspec-*.md` to `.clinerules/workflows/openspec-*.md`
## 2. Update Tests
- [x] Update "should refresh existing Cline rule files" test in `test/core/update.test.ts` to use workflow paths
- [x] Update "should create Cline rule files with templates" test in `test/core/init.test.ts` to use workflow paths
## 3. Update Documentation
- [x] Update README.md table to show "Workflows in `.clinerules/workflows/` directory" for Cline
## 4. Validate Changes
- [x] Ensure all tests pass with the new paths
- [x] Verify the change follows OpenSpec conventions
+2 -2
View File
@@ -73,7 +73,7 @@ The command SHALL properly configure selected AI tools with OpenSpec-specific in
#### Scenario: Configuring Cline
- **WHEN** Cline is selected
- **THEN** create or update `.clinerules/openspec-rules.md` (following Cline's convention for rules files)
- **THEN** create or update `CLINE.md` in the project root directory (not inside openspec/)
- **AND** populate the managed block with a short stub that points teammates to `@/openspec/AGENTS.md`
#### Scenario: Creating new CLAUDE.md
@@ -174,7 +174,7 @@ The init command SHALL generate slash command files for supported editors using
#### Scenario: Generating slash commands for Cline
- **WHEN** the user selects Cline during initialization
- **THEN** create `.clinerules/workflows/openspec-proposal.md`, `.clinerules/workflows/openspec-apply.md`, and `.clinerules/workflows/openspec-archive.md`
- **THEN** create `.clinerules/openspec-proposal.md`, `.clinerules/openspec-apply.md`, and `.clinerules/openspec-archive.md`
- **AND** populate each file from shared templates so command text matches other tools
- **AND** include Cline-specific Markdown heading frontmatter
- **AND** each template includes instructions for the relevant OpenSpec workflow stage
+1 -6
View File
@@ -63,16 +63,11 @@ The update command SHALL refresh existing slash command files for configured too
- **AND** ensure templates include instructions for the relevant workflow stage
#### Scenario: Updating slash commands for Cline
- **WHEN** `.clinerules/workflows/` contains `openspec-proposal.md`, `openspec-apply.md`, and `openspec-archive.md`
- **WHEN** `.clinerules/` contains `openspec-proposal.md`, `openspec-apply.md`, and `openspec-archive.md`
- **THEN** refresh each file using shared templates
- **AND** include Cline-specific Markdown heading frontmatter
- **AND** ensure templates include instructions for the relevant workflow stage
#### Scenario: Updating Cline rules file
- **WHEN** `.clinerules/openspec-rules.md` exists
- **THEN** refresh the managed block to point teammates to `@/openspec/AGENTS.md`
- **AND** preserve any content outside the managed markers
#### Scenario: Updating slash commands for Crush
- **WHEN** `.crush/commands/` contains `openspec/proposal.md`, `openspec/apply.md`, and `openspec/archive.md`
- **THEN** refresh each file using shared templates
+3 -3
View File
@@ -6,13 +6,13 @@ import { OPENSPEC_MARKERS } from '../config.js';
export class ClineConfigurator implements ToolConfigurator {
name = 'Cline';
configFileName = '.clinerules/openspec-rules.md';
configFileName = 'CLINE.md';
isAvailable = true;
async configure(projectPath: string, openspecDir: string): Promise<void> {
const filePath = path.join(projectPath, this.configFileName);
const content = TemplateManager.getAgentsStandardTemplate();
const content = TemplateManager.getClineTemplate();
await FileSystemUtils.updateFileWithMarkers(
filePath,
content,
+3 -3
View File
@@ -2,9 +2,9 @@ import { SlashCommandConfigurator } from './base.js';
import { SlashCommandId } from '../../templates/index.js';
const FILE_PATHS: Record<SlashCommandId, string> = {
proposal: '.clinerules/workflows/openspec-proposal.md',
apply: '.clinerules/workflows/openspec-apply.md',
archive: '.clinerules/workflows/openspec-archive.md'
proposal: '.clinerules/openspec-proposal.md',
apply: '.clinerules/openspec-apply.md',
archive: '.clinerules/openspec-archive.md'
};
export class ClineSlashCommandConfigurator extends SlashCommandConfigurator {
-4
View File
@@ -126,10 +126,6 @@ export class FileSystemUtils {
return await fs.readFile(filePath, 'utf-8');
}
static async deleteFile(filePath: string): Promise<void> {
await fs.unlink(filePath);
}
static async updateFileWithMarkers(
filePath: string,
content: string,
+27 -10
View File
@@ -10,7 +10,7 @@ type SelectionQueue = string[][];
let selectionQueue: SelectionQueue = [];
const mockPrompt = vi.fn(async (options: any) => {
const mockPrompt = vi.fn(async () => {
if (selectionQueue.length === 0) {
throw new Error('No queued selections provided to init prompt.');
}
@@ -136,21 +136,38 @@ describe('InitCommand', () => {
expect(updatedContent).toContain('Custom instructions here');
});
it('should create .clinerules/openspec-rules.md when Cline is selected', async () => {
it('should create CLINE.md when Cline is selected', async () => {
queueSelections('cline', DONE);
await initCommand.execute(testDir);
const clineRulesPath = path.join(testDir, '.clinerules', 'openspec-rules.md');
expect(await fileExists(clineRulesPath)).toBe(true);
const clinePath = path.join(testDir, 'CLINE.md');
expect(await fileExists(clinePath)).toBe(true);
const content = await fs.readFile(clineRulesPath, 'utf-8');
const content = await fs.readFile(clinePath, 'utf-8');
expect(content).toContain('<!-- OPENSPEC:START -->');
expect(content).toContain('OpenSpec Instructions');
expect(content).toContain("@/openspec/AGENTS.md");
expect(content).toContain('openspec update');
expect(content).toContain('<!-- OPENSPEC:END -->');
});
it('should update existing CLINE.md with markers', async () => {
queueSelections('cline', DONE);
const clinePath = path.join(testDir, 'CLINE.md');
const existingContent =
'# My Cline Rules\nCustom Cline instructions here';
await fs.writeFile(clinePath, existingContent);
await initCommand.execute(testDir);
const updatedContent = await fs.readFile(clinePath, 'utf-8');
expect(updatedContent).toContain('<!-- OPENSPEC:START -->');
expect(updatedContent).toContain("@/openspec/AGENTS.md");
expect(updatedContent).toContain('openspec update');
expect(updatedContent).toContain('<!-- OPENSPEC:END -->');
expect(updatedContent).toContain('Custom Cline instructions here');
});
it('should create Windsurf workflows when Windsurf is selected', async () => {
queueSelections('windsurf', DONE);
@@ -464,22 +481,22 @@ describe('InitCommand', () => {
expect(updatedContent).toContain('Custom instructions here');
});
it('should create Cline workflow files with templates', async () => {
it('should create Cline rule files with templates', async () => {
queueSelections('cline', DONE);
await initCommand.execute(testDir);
const clineProposal = path.join(
testDir,
'.clinerules/workflows/openspec-proposal.md'
'.clinerules/openspec-proposal.md'
);
const clineApply = path.join(
testDir,
'.clinerules/workflows/openspec-apply.md'
'.clinerules/openspec-apply.md'
);
const clineArchive = path.join(
testDir,
'.clinerules/workflows/openspec-archive.md'
'.clinerules/openspec-archive.md'
);
expect(await fileExists(clineProposal)).toBe(true);
+15 -16
View File
@@ -248,10 +248,9 @@ Old content
await expect(FileSystemUtils.fileExists(qwenPath)).resolves.toBe(false);
});
it('should update only existing .clinerules/openspec-rules.md file', async () => {
// Create .clinerules/openspec-rules.md file with initial content
const clineRulesPath = path.join(testDir, '.clinerules', 'openspec-rules.md');
await fs.mkdir(path.dirname(clineRulesPath), { recursive: true });
it('should update only existing CLINE.md file', async () => {
// Create CLINE.md file with initial content
const clinePath = path.join(testDir, 'CLINE.md');
const initialContent = `# Cline Rules
Some existing Cline rules here.
@@ -261,15 +260,15 @@ Old OpenSpec content
<!-- OPENSPEC:END -->
More rules after.`;
await fs.writeFile(clineRulesPath, initialContent);
await fs.writeFile(clinePath, initialContent);
const consoleSpy = vi.spyOn(console, 'log');
// Execute update command
await updateCommand.execute(testDir);
// Check that .clinerules/openspec-rules.md was updated
const updatedContent = await fs.readFile(clineRulesPath, 'utf-8');
// Check that CLINE.md was updated
const updatedContent = await fs.readFile(clinePath, 'utf-8');
expect(updatedContent).toContain('<!-- OPENSPEC:START -->');
expect(updatedContent).toContain('<!-- OPENSPEC:END -->');
expect(updatedContent).toContain("@/openspec/AGENTS.md");
@@ -283,26 +282,26 @@ More rules after.`;
'Updated OpenSpec instructions (openspec/AGENTS.md'
);
expect(logMessage).toContain('AGENTS.md (created)');
expect(logMessage).toContain('Updated AI tool files: .clinerules/openspec-rules.md');
expect(logMessage).toContain('Updated AI tool files: CLINE.md');
consoleSpy.mockRestore();
});
it('should not create .clinerules/openspec-rules.md if it does not exist', async () => {
// Ensure .clinerules/openspec-rules.md does not exist
const clineRulesPath = path.join(testDir, '.clinerules', 'openspec-rules.md');
it('should not create CLINE.md if it does not exist', async () => {
// Ensure CLINE.md does not exist
const clinePath = path.join(testDir, 'CLINE.md');
// Execute update command
await updateCommand.execute(testDir);
// Check that .clinerules/openspec-rules.md was not created
const fileExists = await FileSystemUtils.fileExists(clineRulesPath);
// Check that CLINE.md was not created
const fileExists = await FileSystemUtils.fileExists(clinePath);
expect(fileExists).toBe(false);
});
it('should refresh existing Cline workflow files', async () => {
it('should refresh existing Cline rule files', async () => {
const proposalPath = path.join(
testDir,
'.clinerules/workflows/openspec-proposal.md'
'.clinerules/openspec-proposal.md'
);
await fs.mkdir(path.dirname(proposalPath), { recursive: true });
const initialContent = `# OpenSpec: Proposal
@@ -332,7 +331,7 @@ Old slash content
);
expect(logMessage).toContain('AGENTS.md (created)');
expect(logMessage).toContain(
'Updated slash commands: .clinerules/workflows/openspec-proposal.md'
'Updated slash commands: .clinerules/openspec-proposal.md'
);
consoleSpy.mockRestore();