Skip to content

Commit 537e607

Browse files
B2FdidierTabishB
authored
Fix Cline: use workflows instead of rules for slash commands (#283)
* fix(cline): use workflows instead of rules for slash commands - Update ClineSlashCommandConfigurator to use .clinerules/workflows/ paths - Update tests to expect correct workflow file locations - Update README.md to reflect workflows instead of rules - Fixes Cline integration to match Cline's architecture per their blog post * Adds spec for fix-cline-workflows-implementation --------- Co-authored-by: didier <[email protected]> Co-authored-by: Tabish Bidiwale <[email protected]>
1 parent 5439ab0 commit 537e607

File tree

7 files changed

+48
-11
lines changed

7 files changed

+48
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ These tools have built-in OpenSpec commands. Select the OpenSpec integration whe
9494
| **CodeBuddy Code (CLI)** | `/openspec:proposal`, `/openspec:apply`, `/openspec:archive` (`.codebuddy/commands/`) — see [docs](https://www.codebuddy.ai/cli) |
9595
| **CoStrict** | `/openspec-proposal`, `/openspec-apply`, `/openspec-archive` (`.cospec/openspec/commands/`) — see [docs](https://costrict.ai)|
9696
| **Cursor** | `/openspec-proposal`, `/openspec-apply`, `/openspec-archive` |
97-
| **Cline** | Rules in `.clinerules/` directory (`.clinerules/openspec-*.md`) |
97+
| **Cline** | Workflows in `.clinerules/workflows/` directory (`.clinerules/workflows/openspec-*.md`) |
9898
| **Crush** | `/openspec-proposal`, `/openspec-apply`, `/openspec-archive` (`.crush/commands/openspec/`) |
9999
| **Factory Droid** | `/openspec-proposal`, `/openspec-apply`, `/openspec-archive` (`.factory/commands/`) |
100100
| **Gemini CLI** | `/openspec:proposal`, `/openspec:apply`, `/openspec:archive` (`.gemini/commands/openspec/`) |
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## Why
2+
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/`.
3+
4+
## What Changes
5+
- Update ClineSlashCommandConfigurator to use `.clinerules/workflows/` paths instead of `.clinerules/` paths
6+
- Update all tests to expect the correct workflow file locations
7+
- Update README.md documentation to reflect workflows instead of rules
8+
- **BREAKING**: Existing Cline users will need to re-run `openspec init` to get the corrected workflow files
9+
10+
## Impact
11+
- Affected specs: cli-init (corrected Cline workflow paths)
12+
- Affected code: `src/core/configurators/slash/cline.ts`, test files, README.md
13+
- Modified files: `.clinerules/workflows/openspec-*.md` (moved from `.clinerules/openspec-*.md`)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Delta for CLI Init
2+
3+
## MODIFIED Requirements
4+
### Requirement: Slash Command Configuration
5+
6+
#### Scenario: Generating slash commands for Cline
7+
- **WHEN** the user selects Cline during initialization
8+
- **THEN** create `.clinerules/workflows/openspec-proposal.md`, `.clinerules/workflows/openspec-apply.md`, and `.clinerules/workflows/openspec-archive.md`
9+
- **AND** populate each file from shared templates so command text matches other tools
10+
- **AND** include Cline-specific Markdown heading frontmatter
11+
- **AND** each template includes instructions for the relevant OpenSpec workflow stage
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## 1. Update ClineSlashCommandConfigurator
2+
- [x] Change FILE_PATHS in `src/core/configurators/slash/cline.ts` from `.clinerules/openspec-*.md` to `.clinerules/workflows/openspec-*.md`
3+
4+
## 2. Update Tests
5+
- [x] Update "should refresh existing Cline rule files" test in `test/core/update.test.ts` to use workflow paths
6+
- [x] Update "should create Cline rule files with templates" test in `test/core/init.test.ts` to use workflow paths
7+
8+
## 3. Update Documentation
9+
- [x] Update README.md table to show "Workflows in `.clinerules/workflows/` directory" for Cline
10+
11+
## 4. Validate Changes
12+
- [x] Ensure all tests pass with the new paths
13+
- [x] Verify the change follows OpenSpec conventions

src/core/configurators/slash/cline.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { SlashCommandConfigurator } from './base.js';
22
import { SlashCommandId } from '../../templates/index.js';
33

44
const FILE_PATHS: Record<SlashCommandId, string> = {
5-
proposal: '.clinerules/openspec-proposal.md',
6-
apply: '.clinerules/openspec-apply.md',
7-
archive: '.clinerules/openspec-archive.md'
5+
proposal: '.clinerules/workflows/openspec-proposal.md',
6+
apply: '.clinerules/workflows/openspec-apply.md',
7+
archive: '.clinerules/workflows/openspec-archive.md'
88
};
99

1010
export class ClineSlashCommandConfigurator extends SlashCommandConfigurator {

test/core/init.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,22 +481,22 @@ describe('InitCommand', () => {
481481
expect(updatedContent).toContain('Custom instructions here');
482482
});
483483

484-
it('should create Cline rule files with templates', async () => {
484+
it('should create Cline workflow files with templates', async () => {
485485
queueSelections('cline', DONE);
486486

487487
await initCommand.execute(testDir);
488488

489489
const clineProposal = path.join(
490490
testDir,
491-
'.clinerules/openspec-proposal.md'
491+
'.clinerules/workflows/openspec-proposal.md'
492492
);
493493
const clineApply = path.join(
494494
testDir,
495-
'.clinerules/openspec-apply.md'
495+
'.clinerules/workflows/openspec-apply.md'
496496
);
497497
const clineArchive = path.join(
498498
testDir,
499-
'.clinerules/openspec-archive.md'
499+
'.clinerules/workflows/openspec-archive.md'
500500
);
501501

502502
expect(await fileExists(clineProposal)).toBe(true);

test/core/update.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,10 @@ More rules after.`;
298298
expect(fileExists).toBe(false);
299299
});
300300

301-
it('should refresh existing Cline rule files', async () => {
301+
it('should refresh existing Cline workflow files', async () => {
302302
const proposalPath = path.join(
303303
testDir,
304-
'.clinerules/openspec-proposal.md'
304+
'.clinerules/workflows/openspec-proposal.md'
305305
);
306306
await fs.mkdir(path.dirname(proposalPath), { recursive: true });
307307
const initialContent = `# OpenSpec: Proposal
@@ -331,7 +331,7 @@ Old slash content
331331
);
332332
expect(logMessage).toContain('AGENTS.md (created)');
333333
expect(logMessage).toContain(
334-
'Updated slash commands: .clinerules/openspec-proposal.md'
334+
'Updated slash commands: .clinerules/workflows/openspec-proposal.md'
335335
);
336336

337337
consoleSpy.mockRestore();

0 commit comments

Comments
 (0)