From 237e918f110fe4bfb314889023d1852556c16df6 Mon Sep 17 00:00:00 2001 From: vishal-gandhi Date: Wed, 29 Apr 2026 16:22:06 -0500 Subject: [PATCH] feat(integrations): add Devin for Terminal skills-based integration (#2364) * feat(integrations): add Devin for Terminal skills-based integration - Register DevinIntegration as a SkillsIntegration with .devin/skills/ layout - Add catalog entry, docs row, and supported-agents listing - Display /speckit- hyphen syntax in init "Next Steps" panel (matches Claude/Cursor/Copilot skills mode, since Devin invokes skills by directory name) Closes #2346 * fix(devin): implement -p non-interactive dispatch; clarify skills comment Addresses Copilot review on PR #2364: - Override build_exec_args() in DevinIntegration to emit 'devin -p [--model X]' for non-interactive text dispatch (verified Devin CLI supports -p / --print). Returns None when output_json=True since Devin has no structured-output flag, so CommandStep workflows that require JSON cleanly raise NotImplementedError instead of crashing on an unknown CLI flag. requires_cli=True is retained for tool detection. - Extend the skills-integrations enumeration comment in specify_cli/__init__.py to include copilot and devin so the comment matches the code below it. * fix(devin): always return exec args; document plain-text stdout Addresses third Copilot review comment on PR #2364. Returning None from build_exec_args() when output_json=True incorrectly used the codebase's IDE-only sentinel: workflow CommandStep checks 'impl.build_exec_args("test") is None' to detect non-dispatchable integrations (test_workflows.py exercises this with WindsurfIntegration). The previous implementation made Devin appear non-dispatchable to all command steps even though it runs fine via 'devin -p'. Always return the args list. When output_json is requested, Devin is still dispatched and returns plain-text stdout instead of structured JSON; the docstring documents this explicitly. * docs(devin): include claude in skills-integrations enumeration comment Addresses Copilot review on PR #2364: the comment listing skills integrations omitted Claude, which is also a SkillsIntegration subclass. Updated to keep the comment accurate for future readers. * test(devin): add build_exec_args regression tests; bump catalog updated_at Addresses Copilot review on PR #2364, per @mnriem's request to 'address the Copilot feedback, especially the testing ask': - tests/integrations/test_integration_devin.py: add TestDevinBuildExecArgs with three regression assertions: * build_exec_args returns args (not the None IDE-only sentinel) * --output-format is never emitted, regardless of output_json * --model flag is passed through correctly - integrations/catalog.json: bump top-level updated_at to reflect the Devin entry addition so downstream catalog consumers can detect the change reliably. --- .github/ISSUE_TEMPLATE/agent_request.yml | 2 +- docs/reference/integrations.md | 1 + integrations/catalog.json | 11 ++- src/specify_cli/__init__.py | 10 ++- src/specify_cli/integrations/__init__.py | 2 + .../integrations/devin/__init__.py | 65 ++++++++++++++++ tests/integrations/test_integration_devin.py | 75 +++++++++++++++++++ 7 files changed, 161 insertions(+), 5 deletions(-) create mode 100644 src/specify_cli/integrations/devin/__init__.py create mode 100644 tests/integrations/test_integration_devin.py diff --git a/.github/ISSUE_TEMPLATE/agent_request.yml b/.github/ISSUE_TEMPLATE/agent_request.yml index 37b0fea5b..1a44adec2 100644 --- a/.github/ISSUE_TEMPLATE/agent_request.yml +++ b/.github/ISSUE_TEMPLATE/agent_request.yml @@ -8,7 +8,7 @@ body: value: | Thanks for requesting a new agent! Before submitting, please check if the agent is already supported. - **Currently supported agents**: Claude Code, Gemini CLI, GitHub Copilot, Cursor, Qwen Code, opencode, Codex CLI, Windsurf, Kilo Code, Auggie CLI, Roo Code, CodeBuddy, Qoder CLI, Kiro CLI, Amp, SHAI, Tabnine CLI, Antigravity, IBM Bob, Mistral Vibe, Kimi Code, Trae, Pi Coding Agent, iFlow CLI + **Currently supported agents**: Claude Code, Gemini CLI, GitHub Copilot, Cursor, Qwen Code, opencode, Codex CLI, Windsurf, Kilo Code, Auggie CLI, Roo Code, CodeBuddy, Qoder CLI, Kiro CLI, Amp, SHAI, Tabnine CLI, Antigravity, IBM Bob, Mistral Vibe, Kimi Code, Trae, Pi Coding Agent, iFlow CLI, Devin for Terminal - type: input id: agent-name diff --git a/docs/reference/integrations.md b/docs/reference/integrations.md index dcb9a2b35..e1b8e60a8 100644 --- a/docs/reference/integrations.md +++ b/docs/reference/integrations.md @@ -13,6 +13,7 @@ The Specify CLI supports a wide range of AI coding agents. When you run `specify | [CodeBuddy CLI](https://www.codebuddy.ai/cli) | `codebuddy` | | | [Codex CLI](https://github.com/openai/codex) | `codex` | Skills-based integration; installs skills into `.agents/skills` and invokes them as `$speckit-` | | [Cursor](https://cursor.sh/) | `cursor-agent` | | +| [Devin for Terminal](https://cli.devin.ai/docs) | `devin` | Skills-based integration; installs skills into `.devin/skills/` and invokes them as `/speckit-` | | [Forge](https://forgecode.dev/) | `forge` | | | [Gemini CLI](https://github.com/google-gemini/gemini-cli) | `gemini` | | | [GitHub Copilot](https://code.visualstudio.com/) | `copilot` | | diff --git a/integrations/catalog.json b/integrations/catalog.json index 3df96b878..aad8f14f7 100644 --- a/integrations/catalog.json +++ b/integrations/catalog.json @@ -1,6 +1,6 @@ { "schema_version": "1.0", - "updated_at": "2026-04-08T00:00:00Z", + "updated_at": "2026-04-28T00:00:00Z", "catalog_url": "https://raw.githubusercontent.com/github/spec-kit/main/integrations/catalog.json", "integrations": { "claude": { @@ -66,6 +66,15 @@ "repository": "https://github.com/github/spec-kit", "tags": ["cli", "skills"] }, + "devin": { + "id": "devin", + "name": "Devin for Terminal", + "version": "1.0.0", + "description": "Devin for Terminal CLI skills-based integration", + "author": "spec-kit-core", + "repository": "https://github.com/github/spec-kit", + "tags": ["cli", "skills"] + }, "qwen": { "id": "qwen", "name": "Qwen Code", diff --git a/src/specify_cli/__init__.py b/src/specify_cli/__init__.py index f5e117bee..8039f7998 100644 --- a/src/specify_cli/__init__.py +++ b/src/specify_cli/__init__.py @@ -1528,7 +1528,7 @@ def init( step_num = 2 # Determine skill display mode for the next-steps panel. - # Skills integrations (codex, kimi, agy, trae, cursor-agent) should show skill invocation syntax. + # Skills integrations (codex, claude, kimi, agy, trae, cursor-agent, copilot, devin) should show skill invocation syntax. from .integrations.base import SkillsIntegration as _SkillsInt _is_skills_integration = isinstance(resolved_integration, _SkillsInt) or getattr(resolved_integration, "_skills_mode", False) @@ -1539,7 +1539,8 @@ def init( trae_skill_mode = selected_ai == "trae" cursor_agent_skill_mode = selected_ai == "cursor-agent" and (ai_skills or _is_skills_integration) copilot_skill_mode = selected_ai == "copilot" and _is_skills_integration - native_skill_mode = codex_skill_mode or claude_skill_mode or kimi_skill_mode or agy_skill_mode or trae_skill_mode or cursor_agent_skill_mode or copilot_skill_mode + devin_skill_mode = selected_ai == "devin" + native_skill_mode = codex_skill_mode or claude_skill_mode or kimi_skill_mode or agy_skill_mode or trae_skill_mode or cursor_agent_skill_mode or copilot_skill_mode or devin_skill_mode if codex_skill_mode and not ai_skills: # Integration path installed skills; show the helpful notice @@ -1551,6 +1552,9 @@ def init( if cursor_agent_skill_mode and not ai_skills: steps_lines.append(f"{step_num}. Start Cursor Agent in this project directory; spec-kit skills were installed to [cyan].cursor/skills[/cyan]") step_num += 1 + if devin_skill_mode: + steps_lines.append(f"{step_num}. Start Devin in this project directory; spec-kit skills were installed to [cyan].devin/skills[/cyan]") + step_num += 1 usage_label = "skills" if native_skill_mode else "slash commands" def _display_cmd(name: str) -> str: @@ -1560,7 +1564,7 @@ def init( return f"/speckit-{name}" if kimi_skill_mode: return f"/skill:speckit-{name}" - if cursor_agent_skill_mode or copilot_skill_mode: + if cursor_agent_skill_mode or copilot_skill_mode or devin_skill_mode: return f"/speckit-{name}" return f"/speckit.{name}" diff --git a/src/specify_cli/integrations/__init__.py b/src/specify_cli/integrations/__init__.py index a5fb3833d..79ada4ddf 100644 --- a/src/specify_cli/integrations/__init__.py +++ b/src/specify_cli/integrations/__init__.py @@ -56,6 +56,7 @@ def _register_builtins() -> None: from .codex import CodexIntegration from .copilot import CopilotIntegration from .cursor_agent import CursorAgentIntegration + from .devin import DevinIntegration from .forge import ForgeIntegration from .gemini import GeminiIntegration from .generic import GenericIntegration @@ -86,6 +87,7 @@ def _register_builtins() -> None: _register(CodexIntegration()) _register(CopilotIntegration()) _register(CursorAgentIntegration()) + _register(DevinIntegration()) _register(ForgeIntegration()) _register(GeminiIntegration()) _register(GenericIntegration()) diff --git a/src/specify_cli/integrations/devin/__init__.py b/src/specify_cli/integrations/devin/__init__.py new file mode 100644 index 000000000..f5656e4ae --- /dev/null +++ b/src/specify_cli/integrations/devin/__init__.py @@ -0,0 +1,65 @@ +"""Devin for Terminal integration — skills-based agent. + +Devin uses the ``.devin/skills/speckit-/SKILL.md`` layout and +reads project context from ``AGENTS.md`` at the repo root. The CLI +binary is ``devin`` and skills are invoked via ``/`` inside an +interactive ``devin`` session. + +See: https://cli.devin.ai/docs/extensibility/skills/overview +""" + +from __future__ import annotations + +from ..base import IntegrationOption, SkillsIntegration + + +class DevinIntegration(SkillsIntegration): + """Integration for Cognition AI's Devin for Terminal.""" + + key = "devin" + config = { + "name": "Devin for Terminal", + "folder": ".devin/", + "commands_subdir": "skills", + "install_url": "https://cli.devin.ai/docs", + "requires_cli": True, + } + registrar_config = { + "dir": ".devin/skills", + "format": "markdown", + "args": "$ARGUMENTS", + "extension": "/SKILL.md", + } + context_file = "AGENTS.md" + + def build_exec_args( + self, + prompt: str, + *, + model: str | None = None, + output_json: bool = True, + ) -> list[str] | None: + """Build non-interactive CLI args for Devin for Terminal. + + Devin supports ``devin -p `` for single-turn execution + and ``--model`` for model selection, but its CLI has no flag + for structured JSON output. When ``output_json`` is requested, + Devin is still dispatched normally and returns plain-text + stdout instead of structured JSON. ``requires_cli=True`` is + kept on the integration for tool detection. + """ + args = [self.key, "-p", prompt] + if model: + args.extend(["--model", model]) + return args + + @classmethod + def options(cls) -> list[IntegrationOption]: + return [ + IntegrationOption( + "--skills", + is_flag=True, + default=True, + help="Install as agent skills (default for Devin)", + ), + ] \ No newline at end of file diff --git a/tests/integrations/test_integration_devin.py b/tests/integrations/test_integration_devin.py new file mode 100644 index 000000000..d218513d6 --- /dev/null +++ b/tests/integrations/test_integration_devin.py @@ -0,0 +1,75 @@ +"""Tests for DevinIntegration.""" + +from .test_integration_base_skills import SkillsIntegrationTests + + +class TestDevinIntegration(SkillsIntegrationTests): + KEY = "devin" + FOLDER = ".devin/" + COMMANDS_SUBDIR = "skills" + REGISTRAR_DIR = ".devin/skills" + CONTEXT_FILE = "AGENTS.md" + + +class TestDevinBuildExecArgs: + """Regression tests for DevinIntegration.build_exec_args. + + Devin's CLI has no --output-format flag, so build_exec_args must + omit it regardless of the output_json argument. The integration + must also remain dispatchable (must not return None, which is the + codebase's IDE-only sentinel checked by CommandStep). + """ + + def test_returns_args_not_none_for_dispatch(self): + """Devin is CLI-dispatchable; build_exec_args must not return None.""" + from specify_cli.integrations.devin import DevinIntegration + + impl = DevinIntegration() + args = impl.build_exec_args("test prompt") + assert args is not None, ( + "DevinIntegration.build_exec_args must not return None. " + "None is the codebase sentinel for IDE-only integrations " + "(see WindsurfIntegration); Devin is dispatchable via 'devin -p'." + ) + assert args[:3] == ["devin", "-p", "test prompt"] + + def test_output_json_does_not_emit_output_format_flag(self): + """Devin has no --output-format flag; output_json=True must not add it.""" + from specify_cli.integrations.devin import DevinIntegration + + impl = DevinIntegration() + args_json = impl.build_exec_args("hello", output_json=True) + args_text = impl.build_exec_args("hello", output_json=False) + + assert "--output-format" not in args_json + assert "json" not in args_json[3:] + # The two should be identical: output_json is documented as having + # no effect on the command line for Devin (plain-text stdout). + assert args_json == args_text + + def test_model_flag_passed_through(self): + """--model is supported and should appear when provided.""" + from specify_cli.integrations.devin import DevinIntegration + + impl = DevinIntegration() + args = impl.build_exec_args("hi", model="claude-sonnet-4") + assert args == ["devin", "-p", "hi", "--model", "claude-sonnet-4"] + + +class TestDevinAutoPromote: + """--ai devin auto-promotes to integration path.""" + + def test_ai_devin_without_ai_skills_auto_promotes(self, tmp_path): + """--ai devin should work the same as --integration devin.""" + from typer.testing import CliRunner + from specify_cli import app + + runner = CliRunner() + target = tmp_path / "test-proj" + result = runner.invoke( + app, + ["init", str(target), "--ai", "devin", "--no-git", "--ignore-agent-tools", "--script", "sh"], + ) + + assert result.exit_code == 0, f"init --ai devin failed: {result.output}" + assert (target / ".devin" / "skills" / "speckit-plan" / "SKILL.md").exists() \ No newline at end of file