-
Notifications
You must be signed in to change notification settings - Fork 968
feat(iflow-cli): add iFlow-cli integration #268
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import path from "path"; | ||
| import { ToolConfigurator } from "./base.js"; | ||
| import { FileSystemUtils } from "../../utils/file-system.js"; | ||
| import { TemplateManager } from "../templates/index.js"; | ||
| import { OPENSPEC_MARKERS } from "../config.js"; | ||
|
|
||
| export class IflowConfigurator implements ToolConfigurator { | ||
| name = "iFlow"; | ||
| configFileName = "IFLOW.md"; | ||
| isAvailable = true; | ||
|
|
||
| async configure(projectPath: string, openspecDir: string): Promise<void> { | ||
| const filePath = path.join(projectPath, this.configFileName); | ||
| const content = TemplateManager.getClaudeTemplate(); | ||
|
|
||
| await FileSystemUtils.updateFileWithMarkers( | ||
| filePath, | ||
| content, | ||
| OPENSPEC_MARKERS.start, | ||
| OPENSPEC_MARKERS.end | ||
| ); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import { SlashCommandConfigurator } from './base.js'; | ||
| import { SlashCommandId } from '../../templates/index.js'; | ||
|
|
||
| const FILE_PATHS: Record<SlashCommandId, string> = { | ||
| proposal: '.iflow/commands/openspec-proposal.md', | ||
| apply: '.iflow/commands/openspec-apply.md', | ||
| archive: '.iflow/commands/openspec-archive.md' | ||
| }; | ||
|
|
||
| const FRONTMATTER: Record<SlashCommandId, string> = { | ||
| proposal: `--- | ||
| name: /openspec-proposal | ||
| id: openspec-proposal | ||
| category: OpenSpec | ||
| description: Scaffold a new OpenSpec change and validate strictly. | ||
| ---`, | ||
| apply: `--- | ||
| name: /openspec-apply | ||
| id: openspec-apply | ||
| category: OpenSpec | ||
| description: Implement an approved OpenSpec change and keep tasks in sync. | ||
| ---`, | ||
| archive: `--- | ||
| name: /openspec-archive | ||
| id: openspec-archive | ||
| category: OpenSpec | ||
| description: Archive a deployed OpenSpec change and update specs. | ||
| ---` | ||
| }; | ||
|
|
||
| export class IflowSlashCommandConfigurator extends SlashCommandConfigurator { | ||
| readonly toolId = 'iflow'; | ||
| readonly isAvailable = true; | ||
|
|
||
| protected getRelativePath(id: SlashCommandId): string { | ||
| return FILE_PATHS[id]; | ||
| } | ||
|
|
||
| protected getFrontmatter(id: SlashCommandId): string { | ||
| return FRONTMATTER[id]; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -663,6 +663,53 @@ Old Gemini body | |
|
|
||
| consoleSpy.mockRestore(); | ||
| }); | ||
|
|
||
| it('should refresh existing IFLOW slash commands', async () => { | ||
| const iflowProposal = path.join( | ||
| testDir, | ||
| '.iflow/commands/openspec-proposal.md' | ||
| ); | ||
| await fs.mkdir(path.dirname(iflowProposal), { recursive: true }); | ||
| const initialContent = `description: Scaffold a new OpenSpec change and validate strictly." | ||
|
|
||
| prompt = """ | ||
| <!-- OPENSPEC:START --> | ||
| Old IFlow body | ||
| <!-- OPENSPEC:END --> | ||
| """ | ||
| `; | ||
| await fs.writeFile(iflowProposal, initialContent); | ||
|
|
||
| const consoleSpy = vi.spyOn(console, 'log'); | ||
|
|
||
| await updateCommand.execute(testDir); | ||
|
|
||
| const updated = await fs.readFile(iflowProposal, 'utf-8'); | ||
| expect(updated).toContain('description: Scaffold a new OpenSpec change and validate strictly.'); | ||
| expect(updated).toContain('<!-- OPENSPEC:START -->'); | ||
| expect(updated).toContain('**Guardrails**'); | ||
| expect(updated).toContain('<!-- OPENSPEC:END -->'); | ||
| expect(updated).not.toContain('Old IFlow body'); | ||
|
|
||
| const iflowApply = path.join( | ||
| testDir, | ||
| '.iflow/commands/openspec-apply.md' | ||
| ); | ||
| const iflowArchive = path.join( | ||
| testDir, | ||
| '.iflow/commands/openspec-archive.md' | ||
| ); | ||
|
|
||
| await expect(FileSystemUtils.fileExists(iflowApply)).resolves.toBe(false); | ||
| await expect(FileSystemUtils.fileExists(iflowArchive)).resolves.toBe(false); | ||
|
|
||
| const [logMessage] = consoleSpy.mock.calls[0]; | ||
| expect(logMessage).toContain( | ||
| 'Updated slash commands: .iflow/commands/openspec-proposal.md' | ||
| ); | ||
|
|
||
| consoleSpy.mockRestore(); | ||
| }); | ||
|
Comment on lines
+667
to
+712
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix the inconsistent file format in the test. The Update the initialContent to use consistent markdown format: - const initialContent = `description: Scaffold a new OpenSpec change and validate strictly."
-
-prompt = """
-<!-- OPENSPEC:START -->
-Old IFlow body
-<!-- OPENSPEC:END -->
-"""
-`;
+ const initialContent = `description: Scaffold a new OpenSpec change and validate strictly.
+
+<!-- OPENSPEC:START -->
+Old IFlow body
+<!-- OPENSPEC:END -->
+`;Also remove the TOML-style prompt assertion on line 689 if it doesn't apply to the markdown format. 🤖 Prompt for AI Agents |
||
|
|
||
| it('should refresh existing Factory slash commands', async () => { | ||
| const factoryPath = path.join( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
Use an iFlow-specific template for IFLOW.md content.
Lines 14-21 call
TemplateManager.getClaudeTemplate(), which writes Claude-specific guidance into IFLOW.md. That gives users the wrong setup steps for iFlow. Please add an iFlow template (e.g.,TemplateManager.getIflowTemplate()) and use it here so the configurator emits the correct instructions.🤖 Prompt for AI Agents
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.
while ClaudeTemplate also works for iflow or other cli.
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.
@ydai-hub, thank you for clarifying! I understand now that the Claude template is generic enough to work with iFlow and other CLI tools, so using
getClaudeTemplate()here is appropriate.✏️ Learnings added