mirror of
https://github.com/github/spec-kit.git
synced 2026-07-05 05:21:48 +08:00
* fix: write Codex dev skills as files * fix: route codex dev symlink policy through metadata * fix: replace codex dev symlinks on refresh * fix: migrate codex dev skill symlinks * fix: avoid inactive shared skill dev symlinks * fix: preserve unrelated dev skill symlinks
61 lines
1.7 KiB
Python
61 lines
1.7 KiB
Python
"""Codex CLI integration — skills-based agent.
|
|
|
|
Codex uses the ``.agents/skills/speckit-<name>/SKILL.md`` layout.
|
|
Commands are deprecated; ``--skills`` defaults to ``True``.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from ..base import IntegrationOption, SkillsIntegration
|
|
|
|
|
|
class CodexIntegration(SkillsIntegration):
|
|
"""Integration for OpenAI Codex CLI."""
|
|
|
|
key = "codex"
|
|
config = {
|
|
"name": "Codex CLI",
|
|
"folder": ".agents/",
|
|
"commands_subdir": "skills",
|
|
"install_url": "https://github.com/openai/codex",
|
|
"requires_cli": True,
|
|
}
|
|
registrar_config = {
|
|
"dir": ".agents/skills",
|
|
"format": "markdown",
|
|
"args": "$ARGUMENTS",
|
|
"extension": "/SKILL.md",
|
|
}
|
|
context_file = "AGENTS.md"
|
|
dev_no_symlink = True
|
|
multi_install_safe = True
|
|
|
|
def build_exec_args(
|
|
self,
|
|
prompt: str,
|
|
*,
|
|
model: str | None = None,
|
|
output_json: bool = True,
|
|
) -> list[str] | None:
|
|
# Codex uses ``codex exec "prompt"`` for non-interactive mode.
|
|
# Resolve argv[0] via the shared executable resolver so operators can
|
|
# override the binary with SPECKIT_INTEGRATION_CODEX_EXECUTABLE.
|
|
args: list[str] = [self._resolve_executable(), "exec", prompt]
|
|
self._apply_extra_args_env_var(args)
|
|
if model:
|
|
args.extend(["--model", model])
|
|
if output_json:
|
|
args.append("--json")
|
|
return args
|
|
|
|
@classmethod
|
|
def options(cls) -> list[IntegrationOption]:
|
|
return [
|
|
IntegrationOption(
|
|
"--skills",
|
|
is_flag=True,
|
|
default=True,
|
|
help="Install as agent skills (default for Codex)",
|
|
),
|
|
]
|