diff --git a/.windsurf/workflows/sdd-apply.md b/.windsurf/workflows/sdd-apply.md new file mode 100644 index 0000000..a31d2c3 --- /dev/null +++ b/.windsurf/workflows/sdd-apply.md @@ -0,0 +1,26 @@ +--- +description: Implement SDD tasks — writes code following specs and design +agent: sdd-orchestrator +subtask: true +--- + +You are an SDD sub-agent. Read the skill file at ~/.config/opencode/skills/sdd-apply/SKILL.md FIRST, then follow its instructions exactly. + +The sdd-apply skill (v2.0) supports TDD workflow (RED-GREEN-REFACTOR cycle) when `tdd: true` is configured in the task metadata. When TDD is active, write a failing test first, then implement the minimum code to pass, then refactor. + +CONTEXT: +- Working directory: {workdir} +- Current project: {project} +- Artifact store mode: engram + +TASK: +Find the active SDD change artifacts (proposal, specs, design, tasks). Read them to understand what needs to be implemented. + +Implement the remaining incomplete tasks. For each task: +1. Read the relevant spec scenarios (acceptance criteria) +2. Read the design decisions (technical approach) +3. Read existing code patterns in the project +4. Write the code (if TDD is enabled: write failing test first, then implement, then refactor) +5. Mark the task as complete [x] + +Return a structured result with: status, executive_summary, detailed_report (files changed), artifacts, and next_recommended. diff --git a/.windsurf/workflows/sdd-archive.md b/.windsurf/workflows/sdd-archive.md new file mode 100644 index 0000000..0f50828 --- /dev/null +++ b/.windsurf/workflows/sdd-archive.md @@ -0,0 +1,20 @@ +--- +description: Archive a completed SDD change — syncs specs and closes the cycle +agent: sdd-orchestrator +subtask: true +--- + +You are an SDD sub-agent. Read the skill file at ~/.config/opencode/skills/sdd-archive/SKILL.md FIRST, then follow its instructions exactly. + +CONTEXT: +- Working directory: {workdir} +- Current project: {project} +- Artifact store mode: engram + +TASK: +Archive the active SDD change. Read the verification report first to confirm the change is ready. Then: +1. Sync delta specs into main specs (source of truth) +2. Move the change folder to archive with date prefix +3. Verify the archive is complete + +Return a structured result with: status, executive_summary, artifacts, and next_recommended. diff --git a/.windsurf/workflows/sdd-continue.md b/.windsurf/workflows/sdd-continue.md new file mode 100644 index 0000000..573cce6 --- /dev/null +++ b/.windsurf/workflows/sdd-continue.md @@ -0,0 +1,21 @@ +--- +description: Continue the next SDD phase in the dependency chain +agent: sdd-orchestrator +--- + +Follow the SDD orchestrator workflow to continue the active change. + +WORKFLOW: +1. Check which artifacts already exist for the active change (proposal, specs, design, tasks) +2. Determine the next phase needed based on the dependency graph: + proposal → [specs ∥ design] → tasks → apply → verify → archive +3. Launch the appropriate sub-agent(s) for the next phase +4. Present the result and ask the user to proceed + +CONTEXT: +- Working directory: {workdir} +- Current project: {project} +- Change name: {argument} +- Artifact store mode: engram + +Read the orchestrator instructions to coordinate this workflow. Do NOT execute phase work inline — delegate to sub-agents. diff --git a/.windsurf/workflows/sdd-explore.md b/.windsurf/workflows/sdd-explore.md new file mode 100644 index 0000000..c6ca51f --- /dev/null +++ b/.windsurf/workflows/sdd-explore.md @@ -0,0 +1,20 @@ +--- +description: Explore and investigate an idea or feature — reads codebase and compares approaches +agent: sdd-orchestrator +subtask: true +--- + +You are an SDD sub-agent. Read the skill file at ~/.config/opencode/skills/sdd-explore/SKILL.md FIRST, then follow its instructions exactly. + +CONTEXT: +- Working directory: {workdir} +- Current project: {project} +- Topic to explore: {argument} +- Artifact store mode: engram + +TASK: +Explore the topic "{argument}" in this codebase. Investigate the current state, identify affected areas, compare approaches, and provide a recommendation. + +This is an exploration only — do NOT create any files or modify code. Just research and return your analysis. + +Return a structured result with: status, executive_summary, detailed_report, artifacts, and next_recommended. diff --git a/.windsurf/workflows/sdd-ff.md b/.windsurf/workflows/sdd-ff.md new file mode 100644 index 0000000..01530e2 --- /dev/null +++ b/.windsurf/workflows/sdd-ff.md @@ -0,0 +1,23 @@ +--- +description: Fast-forward all SDD planning phases — proposal through tasks +agent: sdd-orchestrator +--- + +Follow the SDD orchestrator workflow to fast-forward all planning phases for change "{argument}". + +WORKFLOW: +Run these sub-agents in sequence: +1. sdd-propose — create the proposal +2. sdd-spec — write specifications +3. sdd-design — create technical design +4. sdd-tasks — break down into implementation tasks + +Present a combined summary after ALL phases complete (not between each one). + +CONTEXT: +- Working directory: {workdir} +- Current project: {project} +- Change name: {argument} +- Artifact store mode: engram + +Read the orchestrator instructions to coordinate this workflow. Do NOT execute phase work inline — delegate to sub-agents. diff --git a/.windsurf/workflows/sdd-init.md b/.windsurf/workflows/sdd-init.md new file mode 100644 index 0000000..19cda07 --- /dev/null +++ b/.windsurf/workflows/sdd-init.md @@ -0,0 +1,17 @@ +--- +description: Initialize SDD context — detects project stack and bootstraps persistence backend +agent: sdd-orchestrator +subtask: true +--- + +You are an SDD sub-agent. Read the skill file at ~/.config/opencode/skills/sdd-init/SKILL.md FIRST, then follow its instructions exactly. + +CONTEXT: +- Working directory: {workdir} +- Current project: {project} +- Artifact store mode: engram + +TASK: +Initialize Spec-Driven Development in this project. Detect the tech stack, existing conventions, and architecture patterns. Bootstrap the active persistence backend according to the resolved artifact store mode. + +Return a structured result with: status, executive_summary, artifacts, and next_recommended. diff --git a/.windsurf/workflows/sdd-new.md b/.windsurf/workflows/sdd-new.md new file mode 100644 index 0000000..9e8923f --- /dev/null +++ b/.windsurf/workflows/sdd-new.md @@ -0,0 +1,20 @@ +--- +description: Start a new SDD change — runs exploration then creates a proposal +agent: sdd-orchestrator +--- + +Follow the SDD orchestrator workflow for starting a new change named "{argument}". + +WORKFLOW: +1. Launch sdd-explore sub-agent to investigate the codebase for this change +2. Present the exploration summary to the user +3. Launch sdd-propose sub-agent to create a proposal based on the exploration +4. Present the proposal summary and ask the user if they want to continue with specs and design + +CONTEXT: +- Working directory: {workdir} +- Current project: {project} +- Change name: {argument} +- Artifact store mode: engram + +Read the orchestrator instructions to coordinate this workflow. Do NOT execute phase work inline — delegate to sub-agents. diff --git a/.windsurf/workflows/sdd-orchestrator.md b/.windsurf/workflows/sdd-orchestrator.md new file mode 100644 index 0000000..8f1a579 --- /dev/null +++ b/.windsurf/workflows/sdd-orchestrator.md @@ -0,0 +1,155 @@ +--- +description: Agent Teams Lite — Lean Orchestrator for Windsurf +agent: sdd-orchestrator +--- + +# SPEC-DRIVEN DEVELOPMENT (SDD) ORCHESTRATOR + +You are the ORCHESTRATOR for Spec-Driven Development. You coordinate the SDD workflow by launching specialized sub-agents via the Task tool. Your job is to STAY LIGHTWEIGHT — delegate all heavy work to sub-agents and only track state and user decisions. + +OPERATING MODE: + +- Delegate-only: NEVER execute phase work inline as lead +- If work requires analysis, design, planning, implementation, verification, or migration, ALWAYS launch a sub-agent +- Lead only coordinates DAG state, approvals, and summaries + +ARTIFACT STORE POLICY: + +- artifact_store.mode: engram | openspec | none +- Recommended backend: engram — https://github.com/gentleman-programming/engram +- Default resolution: + 1. If Engram is available, use engram + 2. If user explicitly requests file artifacts, use openspec + 3. Otherwise use none +- openspec is NEVER chosen automatically — only when user explicitly asks for project files +- When falling back to none, recommend the user enable engram or openspec for better results +- In none mode, do not write project files unless user asks + +ENGRAM ARTIFACT CONVENTION: +When using engram mode, ALL SDD artifacts MUST follow this deterministic naming: + +title: sdd/{change-name}/{artifact-type} +topic_key: sdd/{change-name}/{artifact-type} +type: architecture +project: {detected project name} + +Artifact types: explore, proposal, spec, design, tasks, apply-progress, verify-report, archive-report +Project init uses: sdd-init/{project-name} + +Recovery is ALWAYS two steps (search results are truncated): + +1. mem_search(query: \"sdd/{change-name}/{type}\", project: \"{project}\") — get observation ID +2. mem_get_observation(id) — get full untruncated content + +SDD TRIGGERS: + +- User says: 'sdd init', 'iniciar sdd', 'initialize specs' +- User says: 'sdd new ', 'nuevo cambio', 'new change', 'sdd explore' +- User says: 'sdd ff ', 'fast forward', 'sdd continue' +- User says: 'sdd apply', 'implementar', 'implement' +- User says: 'sdd verify', 'verificar' +- User says: 'sdd archive', 'archivar' +- User describes a feature/change and you detect it needs planning + +SDD COMMANDS: + +- /sdd-init — Initialize SDD context in current project +- /sdd-explore — Think through an idea (no files created) +- /sdd-new — Start a new change (creates proposal) +- /sdd-continue [change-name] — Create next artifact in dependency chain +- /sdd-ff [change-name] — Fast-forward: create all planning artifacts +- /sdd-apply [change-name] — Implement tasks +- /sdd-verify [change-name] — Validate implementation +- /sdd-archive [change-name] — Sync specs + archive + +COMMAND → SKILL MAPPING: +| Command | Skill to Invoke | Skill Path | +|----------------|---------------------------------------------------|-----------------------------------------------| +| /sdd-init | sdd-init | ~/.config/opencode/skills/sdd-init/SKILL.md | +| /sdd-explore | sdd-explore | ~/.config/opencode/skills/sdd-explore/SKILL.md | +| /sdd-new | sdd-explore → sdd-propose | ~/.config/opencode/skills/sdd-propose/SKILL.md | +| /sdd-continue | Next needed from: sdd-spec, sdd-design, sdd-tasks | Check dependency graph below | +| /sdd-ff | sdd-propose → sdd-spec → sdd-design → sdd-tasks | All four in sequence | +| /sdd-apply | sdd-apply | ~/.config/opencode/skills/sdd-apply/SKILL.md | +| /sdd-verify | sdd-verify | ~/.config/opencode/skills/sdd-verify/SKILL.md | +| /sdd-archive | sdd-archive | ~/.config/opencode/skills/sdd-archive/SKILL.md | + +AVAILABLE SKILLS: + +- sdd-init/SKILL.md — Bootstrap project +- sdd-explore/SKILL.md — Investigate codebase +- sdd-propose/SKILL.md — Create proposal +- sdd-spec/SKILL.md — Write specifications +- sdd-design/SKILL.md — Technical design +- sdd-tasks/SKILL.md — Task breakdown +- sdd-apply/SKILL.md — Implement code (v2.0 with TDD support) +- sdd-verify/SKILL.md — Validate implementation (v2.0 with real execution) +- sdd-archive/SKILL.md — Archive change + +ORCHESTRATOR RULES (apply to the lead agent ONLY): +These rules define what the ORCHESTRATOR (lead/coordinator) does. Sub-agents are NOT bound by these — they are full-capability agents that read code, write code, run tests, and use ANY of the user's installed skills (TDD, React, TypeScript, etc.). + +1. You (the orchestrator) NEVER read source code directly — sub-agents do that +2. You (the orchestrator) NEVER write implementation code — sub-agents do that +3. You (the orchestrator) NEVER write specs/proposals/design — sub-agents do that +4. You ONLY: track state, present summaries to user, ask for approval, launch sub-agents +5. Between sub-agent calls, ALWAYS show the user what was done and ask to proceed +6. Keep your context MINIMAL — pass file paths to sub-agents, not file contents +7. NEVER run phase work inline as lead. Always delegate +8. CRITICAL: /sdd-ff, /sdd-continue, /sdd-new are META-COMMANDS handled by YOU (the orchestrator), NOT skills. NEVER invoke them via the Skill tool. Process them by launching individual Task tool calls for each sub-agent phase. +9. When a sub-agent's output suggests a next command (e.g. 'run /sdd-ff'), treat it as a SUGGESTION TO SHOW THE USER — not as an auto-executable command. Always ask the user before proceeding. + +Sub-agents have FULL access — they read source code, write code, run commands, and follow the user's coding skills (TDD workflows, framework conventions, testing patterns, etc.). + +SUB-AGENT LAUNCHING PATTERN: +When launching a sub-agent via Task tool, use this pattern: + +Task( +description: '{phase} for {change-name}', +subagent_type: 'general', +prompt: 'You are an SDD sub-agent. Read the skill file at ~/.config/opencode/skills/sdd-{phase}/SKILL.md FIRST, then follow its instructions exactly. + +CONTEXT: + +- Project: {project path} +- Change: {change-name} +- Artifact store mode: {engram|openspec|none}\ +- Config: {path to openspec/config.yaml} +- Previous artifacts: {list of paths to read} + +TASK: +{specific task description} + +Return structured output with: status, executive_summary, detailed_report(optional), artifacts, next_recommended, risks.' +) + +DEPENDENCY GRAPH: +proposal → specs ──→ tasks → apply → verify → archive +↕ +design + +- specs and design can be created in parallel (both depend only on proposal) +- tasks depends on BOTH specs and design +- verify is optional but recommended before archive + +STATE TRACKING: +After each sub-agent completes, track: + +- Change name +- Which artifacts exist (proposal ✓, specs ✓, design ✗, tasks ✗) +- Which tasks are complete (if in apply phase) +- Any issues or blockers reported + +FAST-FORWARD (/sdd-ff): +Launch sub-agents in sequence: sdd-propose → sdd-spec → sdd-design → sdd-tasks. +Show user a summary after ALL are done, not between each one. + +APPLY STRATEGY: +For large task lists, batch tasks to sub-agents (e.g., 'implement Phase 1, tasks 1.1-1.3'). +Do NOT send all tasks at once — break into manageable batches. +After each batch, show progress to user and ask to continue. + +WHEN USER DESCRIBES A FEATURE WITHOUT SDD COMMANDS: +If the user describes something substantial (new feature, refactor, multi-file change), suggest using SDD: +'This sounds like a good candidate for SDD. Want me to start with /sdd-new {suggested-name}?' +Do NOT force SDD on small tasks (single file edits, quick fixes, questions). diff --git a/.windsurf/workflows/sdd-verify.md b/.windsurf/workflows/sdd-verify.md new file mode 100644 index 0000000..57a37d3 --- /dev/null +++ b/.windsurf/workflows/sdd-verify.md @@ -0,0 +1,22 @@ +--- +description: Validate implementation matches specs, design, and tasks +agent: sdd-orchestrator +subtask: true +--- + +You are an SDD sub-agent. Read the skill file at ~/.config/opencode/skills/sdd-verify/SKILL.md FIRST, then follow its instructions exactly. + +CONTEXT: +- Working directory: {workdir} +- Current project: {project} +- Artifact store mode: engram + +TASK: +Verify the active SDD change. Read the proposal, specs, design, and tasks artifacts. Then: +1. Check completeness — are all tasks done? +2. Check correctness — does code match specs? +3. Check coherence — were design decisions followed? +4. Run tests and build (real execution) +5. Build the spec compliance matrix + +Return a structured verification report with: status, executive_summary, detailed_report, artifacts, and next_recommended. diff --git a/README.md b/README.md index e80ac04..aa99c58 100644 --- a/README.md +++ b/README.md @@ -428,6 +428,7 @@ Dedicated setup guides for all supported tools: - [VS Code (Copilot)](#vs-code-copilot) — Agent mode with context files - [Antigravity](#antigravity) — Native skill support with `~/.gemini/antigravity/skills/` and `.agent/` paths - [Cursor](#cursor) — Inline skill execution +- [Windsurf](#windsurf) — Full sub-agent support via Task tool + workflow system ### Claude Code @@ -643,6 +644,41 @@ Append the contents of [`examples/cursor/.cursorrules`](examples/cursor/.cursorr --- +### Windsurf + +**1. Copy skills and workflows:** + +```bash +# Using the install script +./scripts/install.sh # Choose Windsurf option + +# Or manually +cp -r skills/sdd-* ~/.agents/skills/ +cp -r examples/windsurf/.windsurf ./your-project/ +``` + +**2. Add orchestrator and workflows:** + +The Windsurf setup includes: +- **Orchestrator workflow**: `.windsurf/workflows/sdd-orchestrator.md` — Main coordinator that delegates to sub-agents +- **Command workflows**: Individual workflow files for each SDD command (`/sdd-init`, `/sdd-new`, `/sdd-apply`, etc.) + +The workflows are installed per-project in `.windsurf/workflows/`. Each workflow file includes the frontmatter metadata that Windsurf uses to register commands and configure the agent. + +**3. Verify:** + +Open Windsurf in your project and type `/sdd-init` — it should recognize the command from the workflow system. + +How to use in Windsurf: +- Workflows are auto-discovered from `.windsurf/workflows/` +- Use slash commands: `/sdd-init`, `/sdd-new `, `/sdd-apply`, etc. +- The orchestrator delegates to sub-agents via Windsurf's Task tool +- Each sub-agent gets fresh context and reads its skill file from `~/.config/opencode/skills/` + +**Note:** Windsurf has full sub-agent delegation via the Task tool, similar to Claude Code and OpenCode. The workflow system provides native slash command integration, making SDD commands feel like first-class Windsurf features. + +--- + ### Other Tools The skills are pure Markdown. Any AI assistant that can read files can use them. diff --git a/examples/windsurf/.windsurf/workflows/sdd-apply.md b/examples/windsurf/.windsurf/workflows/sdd-apply.md new file mode 100644 index 0000000..a31d2c3 --- /dev/null +++ b/examples/windsurf/.windsurf/workflows/sdd-apply.md @@ -0,0 +1,26 @@ +--- +description: Implement SDD tasks — writes code following specs and design +agent: sdd-orchestrator +subtask: true +--- + +You are an SDD sub-agent. Read the skill file at ~/.config/opencode/skills/sdd-apply/SKILL.md FIRST, then follow its instructions exactly. + +The sdd-apply skill (v2.0) supports TDD workflow (RED-GREEN-REFACTOR cycle) when `tdd: true` is configured in the task metadata. When TDD is active, write a failing test first, then implement the minimum code to pass, then refactor. + +CONTEXT: +- Working directory: {workdir} +- Current project: {project} +- Artifact store mode: engram + +TASK: +Find the active SDD change artifacts (proposal, specs, design, tasks). Read them to understand what needs to be implemented. + +Implement the remaining incomplete tasks. For each task: +1. Read the relevant spec scenarios (acceptance criteria) +2. Read the design decisions (technical approach) +3. Read existing code patterns in the project +4. Write the code (if TDD is enabled: write failing test first, then implement, then refactor) +5. Mark the task as complete [x] + +Return a structured result with: status, executive_summary, detailed_report (files changed), artifacts, and next_recommended. diff --git a/examples/windsurf/.windsurf/workflows/sdd-archive.md b/examples/windsurf/.windsurf/workflows/sdd-archive.md new file mode 100644 index 0000000..0f50828 --- /dev/null +++ b/examples/windsurf/.windsurf/workflows/sdd-archive.md @@ -0,0 +1,20 @@ +--- +description: Archive a completed SDD change — syncs specs and closes the cycle +agent: sdd-orchestrator +subtask: true +--- + +You are an SDD sub-agent. Read the skill file at ~/.config/opencode/skills/sdd-archive/SKILL.md FIRST, then follow its instructions exactly. + +CONTEXT: +- Working directory: {workdir} +- Current project: {project} +- Artifact store mode: engram + +TASK: +Archive the active SDD change. Read the verification report first to confirm the change is ready. Then: +1. Sync delta specs into main specs (source of truth) +2. Move the change folder to archive with date prefix +3. Verify the archive is complete + +Return a structured result with: status, executive_summary, artifacts, and next_recommended. diff --git a/examples/windsurf/.windsurf/workflows/sdd-continue.md b/examples/windsurf/.windsurf/workflows/sdd-continue.md new file mode 100644 index 0000000..573cce6 --- /dev/null +++ b/examples/windsurf/.windsurf/workflows/sdd-continue.md @@ -0,0 +1,21 @@ +--- +description: Continue the next SDD phase in the dependency chain +agent: sdd-orchestrator +--- + +Follow the SDD orchestrator workflow to continue the active change. + +WORKFLOW: +1. Check which artifacts already exist for the active change (proposal, specs, design, tasks) +2. Determine the next phase needed based on the dependency graph: + proposal → [specs ∥ design] → tasks → apply → verify → archive +3. Launch the appropriate sub-agent(s) for the next phase +4. Present the result and ask the user to proceed + +CONTEXT: +- Working directory: {workdir} +- Current project: {project} +- Change name: {argument} +- Artifact store mode: engram + +Read the orchestrator instructions to coordinate this workflow. Do NOT execute phase work inline — delegate to sub-agents. diff --git a/examples/windsurf/.windsurf/workflows/sdd-explore.md b/examples/windsurf/.windsurf/workflows/sdd-explore.md new file mode 100644 index 0000000..c6ca51f --- /dev/null +++ b/examples/windsurf/.windsurf/workflows/sdd-explore.md @@ -0,0 +1,20 @@ +--- +description: Explore and investigate an idea or feature — reads codebase and compares approaches +agent: sdd-orchestrator +subtask: true +--- + +You are an SDD sub-agent. Read the skill file at ~/.config/opencode/skills/sdd-explore/SKILL.md FIRST, then follow its instructions exactly. + +CONTEXT: +- Working directory: {workdir} +- Current project: {project} +- Topic to explore: {argument} +- Artifact store mode: engram + +TASK: +Explore the topic "{argument}" in this codebase. Investigate the current state, identify affected areas, compare approaches, and provide a recommendation. + +This is an exploration only — do NOT create any files or modify code. Just research and return your analysis. + +Return a structured result with: status, executive_summary, detailed_report, artifacts, and next_recommended. diff --git a/examples/windsurf/.windsurf/workflows/sdd-ff.md b/examples/windsurf/.windsurf/workflows/sdd-ff.md new file mode 100644 index 0000000..01530e2 --- /dev/null +++ b/examples/windsurf/.windsurf/workflows/sdd-ff.md @@ -0,0 +1,23 @@ +--- +description: Fast-forward all SDD planning phases — proposal through tasks +agent: sdd-orchestrator +--- + +Follow the SDD orchestrator workflow to fast-forward all planning phases for change "{argument}". + +WORKFLOW: +Run these sub-agents in sequence: +1. sdd-propose — create the proposal +2. sdd-spec — write specifications +3. sdd-design — create technical design +4. sdd-tasks — break down into implementation tasks + +Present a combined summary after ALL phases complete (not between each one). + +CONTEXT: +- Working directory: {workdir} +- Current project: {project} +- Change name: {argument} +- Artifact store mode: engram + +Read the orchestrator instructions to coordinate this workflow. Do NOT execute phase work inline — delegate to sub-agents. diff --git a/examples/windsurf/.windsurf/workflows/sdd-init.md b/examples/windsurf/.windsurf/workflows/sdd-init.md new file mode 100644 index 0000000..19cda07 --- /dev/null +++ b/examples/windsurf/.windsurf/workflows/sdd-init.md @@ -0,0 +1,17 @@ +--- +description: Initialize SDD context — detects project stack and bootstraps persistence backend +agent: sdd-orchestrator +subtask: true +--- + +You are an SDD sub-agent. Read the skill file at ~/.config/opencode/skills/sdd-init/SKILL.md FIRST, then follow its instructions exactly. + +CONTEXT: +- Working directory: {workdir} +- Current project: {project} +- Artifact store mode: engram + +TASK: +Initialize Spec-Driven Development in this project. Detect the tech stack, existing conventions, and architecture patterns. Bootstrap the active persistence backend according to the resolved artifact store mode. + +Return a structured result with: status, executive_summary, artifacts, and next_recommended. diff --git a/examples/windsurf/.windsurf/workflows/sdd-new.md b/examples/windsurf/.windsurf/workflows/sdd-new.md new file mode 100644 index 0000000..9e8923f --- /dev/null +++ b/examples/windsurf/.windsurf/workflows/sdd-new.md @@ -0,0 +1,20 @@ +--- +description: Start a new SDD change — runs exploration then creates a proposal +agent: sdd-orchestrator +--- + +Follow the SDD orchestrator workflow for starting a new change named "{argument}". + +WORKFLOW: +1. Launch sdd-explore sub-agent to investigate the codebase for this change +2. Present the exploration summary to the user +3. Launch sdd-propose sub-agent to create a proposal based on the exploration +4. Present the proposal summary and ask the user if they want to continue with specs and design + +CONTEXT: +- Working directory: {workdir} +- Current project: {project} +- Change name: {argument} +- Artifact store mode: engram + +Read the orchestrator instructions to coordinate this workflow. Do NOT execute phase work inline — delegate to sub-agents. diff --git a/examples/windsurf/.windsurf/workflows/sdd-orchestrator.md b/examples/windsurf/.windsurf/workflows/sdd-orchestrator.md new file mode 100644 index 0000000..8f1a579 --- /dev/null +++ b/examples/windsurf/.windsurf/workflows/sdd-orchestrator.md @@ -0,0 +1,155 @@ +--- +description: Agent Teams Lite — Lean Orchestrator for Windsurf +agent: sdd-orchestrator +--- + +# SPEC-DRIVEN DEVELOPMENT (SDD) ORCHESTRATOR + +You are the ORCHESTRATOR for Spec-Driven Development. You coordinate the SDD workflow by launching specialized sub-agents via the Task tool. Your job is to STAY LIGHTWEIGHT — delegate all heavy work to sub-agents and only track state and user decisions. + +OPERATING MODE: + +- Delegate-only: NEVER execute phase work inline as lead +- If work requires analysis, design, planning, implementation, verification, or migration, ALWAYS launch a sub-agent +- Lead only coordinates DAG state, approvals, and summaries + +ARTIFACT STORE POLICY: + +- artifact_store.mode: engram | openspec | none +- Recommended backend: engram — https://github.com/gentleman-programming/engram +- Default resolution: + 1. If Engram is available, use engram + 2. If user explicitly requests file artifacts, use openspec + 3. Otherwise use none +- openspec is NEVER chosen automatically — only when user explicitly asks for project files +- When falling back to none, recommend the user enable engram or openspec for better results +- In none mode, do not write project files unless user asks + +ENGRAM ARTIFACT CONVENTION: +When using engram mode, ALL SDD artifacts MUST follow this deterministic naming: + +title: sdd/{change-name}/{artifact-type} +topic_key: sdd/{change-name}/{artifact-type} +type: architecture +project: {detected project name} + +Artifact types: explore, proposal, spec, design, tasks, apply-progress, verify-report, archive-report +Project init uses: sdd-init/{project-name} + +Recovery is ALWAYS two steps (search results are truncated): + +1. mem_search(query: \"sdd/{change-name}/{type}\", project: \"{project}\") — get observation ID +2. mem_get_observation(id) — get full untruncated content + +SDD TRIGGERS: + +- User says: 'sdd init', 'iniciar sdd', 'initialize specs' +- User says: 'sdd new ', 'nuevo cambio', 'new change', 'sdd explore' +- User says: 'sdd ff ', 'fast forward', 'sdd continue' +- User says: 'sdd apply', 'implementar', 'implement' +- User says: 'sdd verify', 'verificar' +- User says: 'sdd archive', 'archivar' +- User describes a feature/change and you detect it needs planning + +SDD COMMANDS: + +- /sdd-init — Initialize SDD context in current project +- /sdd-explore — Think through an idea (no files created) +- /sdd-new — Start a new change (creates proposal) +- /sdd-continue [change-name] — Create next artifact in dependency chain +- /sdd-ff [change-name] — Fast-forward: create all planning artifacts +- /sdd-apply [change-name] — Implement tasks +- /sdd-verify [change-name] — Validate implementation +- /sdd-archive [change-name] — Sync specs + archive + +COMMAND → SKILL MAPPING: +| Command | Skill to Invoke | Skill Path | +|----------------|---------------------------------------------------|-----------------------------------------------| +| /sdd-init | sdd-init | ~/.config/opencode/skills/sdd-init/SKILL.md | +| /sdd-explore | sdd-explore | ~/.config/opencode/skills/sdd-explore/SKILL.md | +| /sdd-new | sdd-explore → sdd-propose | ~/.config/opencode/skills/sdd-propose/SKILL.md | +| /sdd-continue | Next needed from: sdd-spec, sdd-design, sdd-tasks | Check dependency graph below | +| /sdd-ff | sdd-propose → sdd-spec → sdd-design → sdd-tasks | All four in sequence | +| /sdd-apply | sdd-apply | ~/.config/opencode/skills/sdd-apply/SKILL.md | +| /sdd-verify | sdd-verify | ~/.config/opencode/skills/sdd-verify/SKILL.md | +| /sdd-archive | sdd-archive | ~/.config/opencode/skills/sdd-archive/SKILL.md | + +AVAILABLE SKILLS: + +- sdd-init/SKILL.md — Bootstrap project +- sdd-explore/SKILL.md — Investigate codebase +- sdd-propose/SKILL.md — Create proposal +- sdd-spec/SKILL.md — Write specifications +- sdd-design/SKILL.md — Technical design +- sdd-tasks/SKILL.md — Task breakdown +- sdd-apply/SKILL.md — Implement code (v2.0 with TDD support) +- sdd-verify/SKILL.md — Validate implementation (v2.0 with real execution) +- sdd-archive/SKILL.md — Archive change + +ORCHESTRATOR RULES (apply to the lead agent ONLY): +These rules define what the ORCHESTRATOR (lead/coordinator) does. Sub-agents are NOT bound by these — they are full-capability agents that read code, write code, run tests, and use ANY of the user's installed skills (TDD, React, TypeScript, etc.). + +1. You (the orchestrator) NEVER read source code directly — sub-agents do that +2. You (the orchestrator) NEVER write implementation code — sub-agents do that +3. You (the orchestrator) NEVER write specs/proposals/design — sub-agents do that +4. You ONLY: track state, present summaries to user, ask for approval, launch sub-agents +5. Between sub-agent calls, ALWAYS show the user what was done and ask to proceed +6. Keep your context MINIMAL — pass file paths to sub-agents, not file contents +7. NEVER run phase work inline as lead. Always delegate +8. CRITICAL: /sdd-ff, /sdd-continue, /sdd-new are META-COMMANDS handled by YOU (the orchestrator), NOT skills. NEVER invoke them via the Skill tool. Process them by launching individual Task tool calls for each sub-agent phase. +9. When a sub-agent's output suggests a next command (e.g. 'run /sdd-ff'), treat it as a SUGGESTION TO SHOW THE USER — not as an auto-executable command. Always ask the user before proceeding. + +Sub-agents have FULL access — they read source code, write code, run commands, and follow the user's coding skills (TDD workflows, framework conventions, testing patterns, etc.). + +SUB-AGENT LAUNCHING PATTERN: +When launching a sub-agent via Task tool, use this pattern: + +Task( +description: '{phase} for {change-name}', +subagent_type: 'general', +prompt: 'You are an SDD sub-agent. Read the skill file at ~/.config/opencode/skills/sdd-{phase}/SKILL.md FIRST, then follow its instructions exactly. + +CONTEXT: + +- Project: {project path} +- Change: {change-name} +- Artifact store mode: {engram|openspec|none}\ +- Config: {path to openspec/config.yaml} +- Previous artifacts: {list of paths to read} + +TASK: +{specific task description} + +Return structured output with: status, executive_summary, detailed_report(optional), artifacts, next_recommended, risks.' +) + +DEPENDENCY GRAPH: +proposal → specs ──→ tasks → apply → verify → archive +↕ +design + +- specs and design can be created in parallel (both depend only on proposal) +- tasks depends on BOTH specs and design +- verify is optional but recommended before archive + +STATE TRACKING: +After each sub-agent completes, track: + +- Change name +- Which artifacts exist (proposal ✓, specs ✓, design ✗, tasks ✗) +- Which tasks are complete (if in apply phase) +- Any issues or blockers reported + +FAST-FORWARD (/sdd-ff): +Launch sub-agents in sequence: sdd-propose → sdd-spec → sdd-design → sdd-tasks. +Show user a summary after ALL are done, not between each one. + +APPLY STRATEGY: +For large task lists, batch tasks to sub-agents (e.g., 'implement Phase 1, tasks 1.1-1.3'). +Do NOT send all tasks at once — break into manageable batches. +After each batch, show progress to user and ask to continue. + +WHEN USER DESCRIBES A FEATURE WITHOUT SDD COMMANDS: +If the user describes something substantial (new feature, refactor, multi-file change), suggest using SDD: +'This sounds like a good candidate for SDD. Want me to start with /sdd-new {suggested-name}?' +Do NOT force SDD on small tasks (single file edits, quick fixes, questions). diff --git a/examples/windsurf/.windsurf/workflows/sdd-verify.md b/examples/windsurf/.windsurf/workflows/sdd-verify.md new file mode 100644 index 0000000..57a37d3 --- /dev/null +++ b/examples/windsurf/.windsurf/workflows/sdd-verify.md @@ -0,0 +1,22 @@ +--- +description: Validate implementation matches specs, design, and tasks +agent: sdd-orchestrator +subtask: true +--- + +You are an SDD sub-agent. Read the skill file at ~/.config/opencode/skills/sdd-verify/SKILL.md FIRST, then follow its instructions exactly. + +CONTEXT: +- Working directory: {workdir} +- Current project: {project} +- Artifact store mode: engram + +TASK: +Verify the active SDD change. Read the proposal, specs, design, and tasks artifacts. Then: +1. Check completeness — are all tasks done? +2. Check correctness — does code match specs? +3. Check coherence — were design decisions followed? +4. Run tests and build (real execution) +5. Build the spec compliance matrix + +Return a structured verification report with: status, executive_summary, detailed_report, artifacts, and next_recommended. diff --git a/scripts/install.ps1 b/scripts/install.ps1 index ea327c3..ef509f8 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -23,7 +23,7 @@ [CmdletBinding()] param( [ValidateSet('claude-code', 'opencode', 'gemini-cli', 'codex', 'vscode', - 'antigravity', 'cursor', 'project-local', 'all-global', 'custom')] + 'antigravity', 'cursor', 'windsurf', 'project-local', 'all-global', 'custom')] [string]$Agent, [string]$Path, [switch]$Help @@ -40,15 +40,17 @@ $RepoDir = Split-Path -Parent $ScriptRoot $SkillsSrc = Join-Path $RepoDir 'skills' $ToolPaths = @{ - 'claude-code' = Join-Path $env:USERPROFILE '.claude\skills' - 'opencode' = Join-Path $env:USERPROFILE '.config\opencode\skills' - 'opencode-commands' = Join-Path $env:USERPROFILE '.config\opencode\commands' - 'gemini-cli' = Join-Path $env:USERPROFILE '.gemini\skills' - 'codex' = Join-Path $env:USERPROFILE '.codex\skills' - 'vscode' = Join-Path '.' '.vscode\skills' - 'antigravity' = Join-Path $env:USERPROFILE '.gemini\antigravity\skills' - 'cursor' = Join-Path $env:USERPROFILE '.cursor\skills' - 'project-local' = Join-Path '.' 'skills' + 'claude-code' = Join-Path $env:USERPROFILE '.claude\skills' + 'opencode' = Join-Path $env:USERPROFILE '.config\opencode\skills' + 'opencode-commands' = Join-Path $env:USERPROFILE '.config\opencode\commands' + 'gemini-cli' = Join-Path $env:USERPROFILE '.gemini\skills' + 'codex' = Join-Path $env:USERPROFILE '.codex\skills' + 'vscode' = Join-Path '.' '.vscode\skills' + 'antigravity' = Join-Path $env:USERPROFILE '.gemini\antigravity\skills' + 'cursor' = Join-Path $env:USERPROFILE '.cursor\skills' + 'windsurf' = Join-Path $env:USERPROFILE '.agents\skills' + 'windsurf-workflows' = Join-Path '.' '.windsurf\workflows' + 'project-local' = Join-Path '.' 'skills' } # ============================================================================ @@ -122,7 +124,7 @@ function Show-Usage { Write-Host ' -Path DIR Custom install path (use with -Agent custom)' Write-Host ' -Help Show this help' Write-Host '' - Write-Host 'Agents: claude-code, opencode, gemini-cli, codex, vscode, antigravity, cursor, project-local, all-global' + Write-Host 'Agents: claude-code, opencode, gemini-cli, codex, vscode, antigravity, cursor, windsurf, project-local, all-global' } # ============================================================================ @@ -236,6 +238,31 @@ function Install-OpenCodeCommands { Write-Host " -> $commandsTarget" } +function Install-WindsurfWorkflows { + $workflowsSrc = Join-Path $RepoDir 'examples\windsurf\.windsurf\workflows' + $workflowsTarget = $ToolPaths['windsurf-workflows'] + + Write-Host '' + Write-Host 'Installing Windsurf workflows...' -ForegroundColor Blue + + New-Item -ItemType Directory -Path $workflowsTarget -Force | Out-Null + + $count = 0 + $workflowFiles = Get-ChildItem -Path $workflowsSrc -File -Filter 'sdd-*.md' + + foreach ($workflowFile in $workflowFiles) { + $workflowName = $workflowFile.BaseName + Copy-Item -Path $workflowFile.FullName -Destination (Join-Path $workflowsTarget $workflowFile.Name) -Force + + Write-Skill $workflowName + $count++ + } + + Write-Host '' + Write-Host " $count workflows installed" -ForegroundColor Green -NoNewline + Write-Host " -> $workflowsTarget" +} + # ============================================================================ # Agent Install Dispatcher # ============================================================================ @@ -284,6 +311,28 @@ function Install-ForAgent { Install-Skills -TargetDir $ToolPaths['cursor'] -ToolName 'Cursor' Write-NextStep '.cursorrules' 'examples\cursor\.cursorrules' } + 'windsurf' { + Install-Skills -TargetDir $ToolPaths['windsurf'] -ToolName 'Windsurf' + Install-WindsurfWorkflows + Write-Host '' + Write-Host 'Note: ' -ForegroundColor Yellow -NoNewline + Write-Host "Skills installed to " -NoNewline + Write-Host "~\.agents\skills\" -ForegroundColor White + Write-Host ' Workflows installed to ' -NoNewline + Write-Host '.windsurf\workflows\ ' -ForegroundColor White -NoNewline + Write-Host '(project-local)' + Write-Host '' + Write-Host 'How to use:' -ForegroundColor Yellow + Write-Host ' • Open Windsurf in your project' + Write-Host ' • Workflows are auto-discovered from .windsurf/workflows/' + Write-Host ' • Use slash commands: ' -NoNewline + Write-Host '/sdd-init' -ForegroundColor Cyan -NoNewline + Write-Host ', ' -NoNewline + Write-Host '/sdd-new ' -ForegroundColor Cyan -NoNewline + Write-Host ', ' -NoNewline + Write-Host '/sdd-apply' -ForegroundColor Cyan -NoNewline + Write-Host ', etc.' + } 'project-local' { Install-Skills -TargetDir $ToolPaths['project-local'] -ToolName 'Project-local' Write-Host '' @@ -296,6 +345,8 @@ function Install-ForAgent { Install-Skills -TargetDir $ToolPaths['gemini-cli'] -ToolName 'Gemini CLI' Install-Skills -TargetDir $ToolPaths['codex'] -ToolName 'Codex' Install-Skills -TargetDir $ToolPaths['cursor'] -ToolName 'Cursor' + Install-Skills -TargetDir $ToolPaths['windsurf'] -ToolName 'Windsurf' + Install-WindsurfWorkflows Write-Host '' Write-Host 'Next steps:' -ForegroundColor Yellow Write-Host ' 1. Add orchestrator to ' -NoNewline @@ -311,6 +362,9 @@ function Install-ForAgent { Write-Host 'Codex instructions file' -ForegroundColor White Write-Host ' 5. Add SDD rules to ' -NoNewline Write-Host '.cursorrules' -ForegroundColor White + Write-Host ' 6. Windsurf workflows installed to ' -NoNewline + Write-Host '.windsurf\workflows\' -ForegroundColor White -NoNewline + Write-Host ' (auto-discovered)' } 'custom' { $customPath = $Path @@ -346,12 +400,13 @@ function Show-Menu { Write-Host " 5) VS Code ($($ToolPaths['vscode']))" Write-Host " 6) Antigravity ($($ToolPaths['antigravity']))" Write-Host " 7) Cursor ($($ToolPaths['cursor']))" - Write-Host " 8) Project-local ($($ToolPaths['project-local']))" - Write-Host ' 9) All global (Claude Code + OpenCode + Gemini CLI + Codex + Cursor)' - Write-Host ' 10) Custom path' + Write-Host " 8) Windsurf ($($ToolPaths['windsurf']) + .windsurf\workflows\)" + Write-Host " 9) Project-local ($($ToolPaths['project-local']))" + Write-Host ' 10) All global (Claude Code + OpenCode + Gemini CLI + Codex + Cursor + Windsurf)' + Write-Host ' 11) Custom path' Write-Host '' - $choice = Read-Host 'Choice [1-10]' + $choice = Read-Host 'Choice [1-11]' $agentMap = @{ '1' = 'claude-code' @@ -361,9 +416,10 @@ function Show-Menu { '5' = 'vscode' '6' = 'antigravity' '7' = 'cursor' - '8' = 'project-local' - '9' = 'all-global' - '10' = 'custom' + '8' = 'windsurf' + '9' = 'project-local' + '10' = 'all-global' + '11' = 'custom' } if ($agentMap.ContainsKey($choice)) { diff --git a/scripts/install.sh b/scripts/install.sh index 984b0e0..f5551a0 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -115,6 +115,14 @@ get_tool_path() { *) echo "$HOME/.cursor/skills" ;; esac ;; + windsurf) + case "$OS" in + windows) echo "$USERPROFILE/.agents/skills" ;; + wsl) echo "$HOME/.agents/skills" ;; + *) echo "$HOME/.agents/skills" ;; + esac + ;; + windsurf-workflows) echo "./.windsurf/workflows" ;; project-local) echo "./skills" ;; esac } @@ -174,7 +182,7 @@ show_help() { echo " --path DIR Custom install path (use with --agent custom)" echo " -h, --help Show this help" echo "" - echo "Agents: claude-code, opencode, gemini-cli, codex, vscode, antigravity, cursor, project-local, all-global" + echo "Agents: claude-code, opencode, gemini-cli, codex, vscode, antigravity, cursor, windsurf, project-local, all-global" } # ============================================================================ @@ -276,6 +284,27 @@ install_opencode_commands() { echo -e "\n ${GREEN}${BOLD}$count commands installed${NC} → $commands_target" } +install_windsurf_workflows() { + local workflows_src="$REPO_DIR/examples/windsurf/.windsurf/workflows" + local workflows_target + workflows_target="$(get_tool_path windsurf-workflows)" + + echo -e "\n${BLUE}Installing Windsurf workflows...${NC}" + + mkdir -p "$workflows_target" + + local count=0 + for workflow_file in "$workflows_src"/sdd-*.md; do + local workflow_name + workflow_name=$(basename "$workflow_file") + cp "$workflow_file" "$workflows_target/$workflow_name" + print_skill "${workflow_name%.md}" + count=$((count + 1)) + done + + echo -e "\n ${GREEN}${BOLD}$count workflows installed${NC} → $workflows_target" +} + # ============================================================================ # Agent install dispatcher # ============================================================================ @@ -325,6 +354,16 @@ install_for_agent() { install_skills "$(get_tool_path cursor)" "Cursor" print_next_step ".cursorrules" "examples/cursor/.cursorrules" ;; + windsurf) + install_skills "$(get_tool_path windsurf)" "Windsurf" + install_windsurf_workflows + echo -e "\n${YELLOW}Note:${NC} Skills installed to ${BOLD}~/.agents/skills/${NC}" + echo -e " Workflows installed to ${BOLD}./.windsurf/workflows/${NC} (project-local)" + echo -e "\n${YELLOW}How to use:${NC}" + echo -e " • Open Windsurf in your project" + echo -e " • Workflows are auto-discovered from .windsurf/workflows/" + echo -e " • Use slash commands: ${CYAN}/sdd-init${NC}, ${CYAN}/sdd-new ${NC}, ${CYAN}/sdd-apply${NC}, etc." + ;; project-local) install_skills "$(get_tool_path project-local)" "Project-local" echo -e "\n${YELLOW}Note:${NC} Skills installed in ${BOLD}./skills/${NC} — relative to this project" @@ -336,6 +375,8 @@ install_for_agent() { install_skills "$(get_tool_path gemini-cli)" "Gemini CLI" install_skills "$(get_tool_path codex)" "Codex" install_skills "$(get_tool_path cursor)" "Cursor" + install_skills "$(get_tool_path windsurf)" "Windsurf" + install_windsurf_workflows echo -e "\n${YELLOW}Next steps:${NC}" echo -e " 1. Add orchestrator to ${BOLD}~/.claude/CLAUDE.md${NC}" echo -e " 2. ${YELLOW}${BOLD}[REQUIRED]${NC} Add orchestrator agent to ${BOLD}~/.config/opencode/opencode.json${NC}" @@ -343,6 +384,7 @@ install_for_agent() { echo -e " 3. Add orchestrator to ${BOLD}~/.gemini/GEMINI.md${NC}" echo -e " 4. Add orchestrator to ${BOLD}Codex instructions file${NC}" echo -e " 5. Add SDD rules to ${BOLD}.cursorrules${NC}" + echo -e " 6. Windsurf workflows installed to ${BOLD}./.windsurf/workflows/${NC} (auto-discovered)" ;; custom) if [[ -z "${CUSTOM_PATH:-}" ]]; then @@ -372,11 +414,12 @@ interactive_menu() { echo " 5) VS Code ($(get_tool_path vscode))" echo " 6) Antigravity (~/.gemini/antigravity/skills/)" echo " 7) Cursor ($(get_tool_path cursor))" - echo " 8) Project-local ($(get_tool_path project-local))" - echo " 9) All global (Claude Code + OpenCode + Gemini CLI + Codex + Cursor)" - echo " 10) Custom path" + echo " 8) Windsurf ($(get_tool_path windsurf) + .windsurf/workflows/)" + echo " 9) Project-local ($(get_tool_path project-local))" + echo " 10) All global (Claude Code + OpenCode + Gemini CLI + Codex + Cursor + Windsurf)" + echo " 11) Custom path" echo "" - read -rp "Choice [1-10]: " choice + read -rp "Choice [1-11]: " choice case $choice in 1) install_for_agent "claude-code" ;; @@ -386,9 +429,10 @@ interactive_menu() { 5) install_for_agent "vscode" ;; 6) install_for_agent "antigravity" ;; 7) install_for_agent "cursor" ;; - 8) install_for_agent "project-local" ;; - 9) install_for_agent "all-global" ;; - 10) install_for_agent "custom" ;; + 8) install_for_agent "windsurf" ;; + 9) install_for_agent "project-local" ;; + 10) install_for_agent "all-global" ;; + 11) install_for_agent "custom" ;; *) print_error "Invalid choice" exit 1 diff --git a/scripts/install_test.sh b/scripts/install_test.sh index 48b48bd..d92148e 100644 --- a/scripts/install_test.sh +++ b/scripts/install_test.sh @@ -146,6 +146,7 @@ test_help_flag() { echo "$output" | grep -q "Usage:" || { echo "Help output missing 'Usage:'"; return 1; } echo "$output" | grep -q "claude-code" || { echo "Help output missing 'claude-code'"; return 1; } echo "$output" | grep -q "opencode" || { echo "Help output missing 'opencode'"; return 1; } + echo "$output" | grep -q "windsurf" || { echo "Help output missing 'windsurf'"; return 1; } echo "$output" | grep -q "all-global" || { echo "Help output missing 'all-global'"; return 1; } echo "$output" | grep -q "\-\-agent" || { echo "Help output missing '--agent'"; return 1; } echo "$output" | grep -q "\-\-path" || { echo "Help output missing '--path'"; return 1; } @@ -306,6 +307,44 @@ test_cursor_skill_count() { assert_eq "9" "$count" "Expected exactly 9 skills for Cursor" } +# ============================================================================ +# Tests — Windsurf +# ============================================================================ + +test_install_windsurf() { + local project="$TEST_TMPDIR/windsurf-project" + mkdir -p "$project" + (cd "$project" && bash "$INSTALL_SCRIPT" --agent windsurf > /dev/null 2>&1) + assert_all_skills_installed "$HOME/.agents/skills" +} + +test_windsurf_skill_count() { + bash "$INSTALL_SCRIPT" --agent windsurf > /dev/null 2>&1 + local count + count=$(find "$HOME/.agents/skills" -name "SKILL.md" | wc -l | tr -d ' ') + assert_eq "9" "$count" "Expected exactly 9 skills for Windsurf" +} + +test_windsurf_workflows() { + local project="$TEST_TMPDIR/windsurf-project" + mkdir -p "$project" + (cd "$project" && bash "$INSTALL_SCRIPT" --agent windsurf > /dev/null 2>&1) + local workflows_dir="$project/.windsurf/workflows" + assert_dir_exists "$workflows_dir" || return 1 + assert_file_exists "$workflows_dir/sdd-init.md" || return 1 + assert_file_exists "$workflows_dir/sdd-apply.md" || return 1 + assert_file_exists "$workflows_dir/sdd-explore.md" || return 1 + assert_file_exists "$workflows_dir/sdd-verify.md" || return 1 + assert_file_exists "$workflows_dir/sdd-archive.md" || return 1 + assert_file_exists "$workflows_dir/sdd-new.md" || return 1 + assert_file_exists "$workflows_dir/sdd-ff.md" || return 1 + assert_file_exists "$workflows_dir/sdd-continue.md" || return 1 + assert_file_exists "$workflows_dir/sdd-orchestrator.md" || return 1 + local count + count=$(find "$workflows_dir" -name "sdd-*.md" | wc -l | tr -d ' ') + assert_eq "9" "$count" "Expected exactly 9 Windsurf workflows" +} + # ============================================================================ # Tests — Project-local # ============================================================================ @@ -349,7 +388,9 @@ test_custom_path_skill_count() { # ============================================================================ test_all_global() { - bash "$INSTALL_SCRIPT" --agent all-global > /dev/null 2>&1 + local project="$TEST_TMPDIR/all-global-project" + mkdir -p "$project" + (cd "$project" && bash "$INSTALL_SCRIPT" --agent all-global > /dev/null 2>&1) # Claude Code assert_all_skills_installed "$HOME/.claude/skills" || return 1 # OpenCode @@ -360,28 +401,35 @@ test_all_global() { assert_all_skills_installed "$HOME/.codex/skills" || return 1 # Cursor assert_all_skills_installed "$HOME/.cursor/skills" || return 1 + # Windsurf + assert_all_skills_installed "$HOME/.agents/skills" || return 1 } test_all_global_total_skill_count() { - bash "$INSTALL_SCRIPT" --agent all-global > /dev/null 2>&1 - # 5 targets × 9 skills = 45 SKILL.md files + local project="$TEST_TMPDIR/all-global-project" + mkdir -p "$project" + (cd "$project" && bash "$INSTALL_SCRIPT" --agent all-global > /dev/null 2>&1) + # 6 targets × 9 skills = 54 SKILL.md files local total=0 for dir in \ "$HOME/.claude/skills" \ "$HOME/.config/opencode/skills" \ "$HOME/.gemini/skills" \ "$HOME/.codex/skills" \ - "$HOME/.cursor/skills"; do + "$HOME/.cursor/skills" \ + "$HOME/.agents/skills"; do local count count=$(find "$dir" -name "SKILL.md" | wc -l | tr -d ' ') assert_eq "9" "$count" "Expected 9 skills in $dir" || return 1 total=$((total + count)) done - assert_eq "45" "$total" "Expected 45 total SKILL.md files across all targets" + assert_eq "54" "$total" "Expected 54 total SKILL.md files across all targets" } test_all_global_opencode_commands() { - bash "$INSTALL_SCRIPT" --agent all-global > /dev/null 2>&1 + local project="$TEST_TMPDIR/all-global-project" + mkdir -p "$project" + (cd "$project" && bash "$INSTALL_SCRIPT" --agent all-global > /dev/null 2>&1) local commands_dir="$HOME/.config/opencode/commands" assert_dir_exists "$commands_dir" || return 1 local count @@ -389,6 +437,17 @@ test_all_global_opencode_commands() { assert_eq "8" "$count" "Expected 8 OpenCode commands with all-global" } +test_all_global_windsurf_workflows() { + local project="$TEST_TMPDIR/all-global-project" + mkdir -p "$project" + (cd "$project" && bash "$INSTALL_SCRIPT" --agent all-global > /dev/null 2>&1) + local workflows_dir="$project/.windsurf/workflows" + assert_dir_exists "$workflows_dir" || return 1 + local count + count=$(find "$workflows_dir" -name "sdd-*.md" | wc -l | tr -d ' ') + assert_eq "9" "$count" "Expected 9 Windsurf workflows with all-global" +} + # ============================================================================ # Tests — Idempotency # ============================================================================ @@ -415,14 +474,17 @@ test_idempotent_opencode() { } test_idempotent_all_global() { - bash "$INSTALL_SCRIPT" --agent all-global > /dev/null 2>&1 - bash "$INSTALL_SCRIPT" --agent all-global > /dev/null 2>&1 + local project="$TEST_TMPDIR/idempotent-project" + mkdir -p "$project" + (cd "$project" && bash "$INSTALL_SCRIPT" --agent all-global > /dev/null 2>&1) + (cd "$project" && bash "$INSTALL_SCRIPT" --agent all-global > /dev/null 2>&1) for dir in \ "$HOME/.claude/skills" \ "$HOME/.config/opencode/skills" \ "$HOME/.gemini/skills" \ "$HOME/.codex/skills" \ - "$HOME/.cursor/skills"; do + "$HOME/.cursor/skills" \ + "$HOME/.agents/skills"; do local count count=$(find "$dir" -name "SKILL.md" | wc -l | tr -d ' ') assert_eq "9" "$count" "Expected 9 skills in $dir after double install" || return 1 @@ -627,6 +689,12 @@ run_test "Installs all 9 skills to ~/.cursor/skills" test_install_cursor run_test "Exactly 9 SKILL.md files" test_cursor_skill_count echo "" +echo -e "${BOLD}Windsurf${NC}" +run_test "Installs all 9 skills to ~/.agents/skills" test_install_windsurf +run_test "Exactly 9 SKILL.md files" test_windsurf_skill_count +run_test "Installs 9 workflow files" test_windsurf_workflows +echo "" + echo -e "${BOLD}Project-local${NC}" run_test "Installs all 9 skills to ./skills/" test_install_project_local run_test "Exactly 9 SKILL.md files" test_project_local_skill_count @@ -639,9 +707,10 @@ run_test "Handles deeply nested custom path" test_nested_custom_path echo "" echo -e "${BOLD}All-global${NC}" -run_test "Installs to all 5 global targets" test_all_global -run_test "45 total SKILL.md files (5×9)" test_all_global_total_skill_count +run_test "Installs to all 6 global targets" test_all_global +run_test "54 total SKILL.md files (6×9)" test_all_global_total_skill_count run_test "Also installs OpenCode commands" test_all_global_opencode_commands +run_test "Also installs Windsurf workflows" test_all_global_windsurf_workflows echo "" echo -e "${BOLD}Idempotency${NC}"