Cassiiopeia/projectops / skills/pro-image
pro-image
VerifiedMake image assets (backgrounds, characters, icons, illustrations, items) that fit the project's own style: you write the prompt from a per-repo harness, Codex or Antigravity draws it, the CLI fixes size and transparency. Use for 'make an image', 'draw', 'generate an icon'.
scripts/pro_image/codex_runner.py
View on GitHub"""Codex CLI: check install, login type and image feature; run once with the subscription account"""
from __future__ import annotations
import json
import os
import shutil
import subprocess
from pathlib import Path
# Keys removed from the environment at run time (blocks the paid API path)
API_KEY_ENVIRONMENT_NAMES = ("OPENAI_API_KEY", "CODEX_API_KEY")
# auth_mode value for subscription login
SUBSCRIPTION_AUTH_MODE = "chatgpt"
# Folder name where Codex built-in image generation saves results (if the log has this path, the model drew it)
GENERATED_IMAGES_MARKER = "generated_images"
# "Cannot generate" reply phrase set by the prompt
IMAGE_UNAVAILABLE_PHRASE = "IMAGE GENERATION UNAVAILABLE"
def codex_home() -> Path:
configured = os.environ.get("CODEX_HOME")
return Path(configured).expanduser() if configured else Path.home() / ".codex"
def find_executable(command: str) -> str | None:
return shutil.which(command)
def login_facts() -> dict:
"""Reads only the login type from auth.json (token values are never printed)"""
path = codex_home() / "auth.json"
try:
loaded = json.loads(path.read_text(encoding="utf-8"))
except (OSError, ValueError):
return {"auth_file": str(path), "auth_mode": None, "has_stored_api_key": False}
return {"auth_file": str(path), "auth_mode": loaded.get("auth_mode"),
"has_stored_api_key": bool(loaded.get("OPENAI_API_KEY"))}
def _run_quick(executable: str, *arguments: str) -> str:
try:
completed = subprocess.run([executable, *arguments], capture_output=True, encoding="utf-8",
errors="replace", timeout=30)
except (OSError, subprocess.TimeoutExpired):
return ""
return completed.stdout or ""
def version(executable: str) -> str:
return _run_quick(executable, "--version").strip()
def is_image_generation_enabled(executable: str) -> bool | None:
"""image_generation line of codex features list > enabled or not, None if the line is missing"""
for line in _run_quick(executable, "features", "list").splitlines():
columns = line.split()
if columns and columns[0] == "image_generation":
return columns[-1].lower() == "true"
return None
def subscription_environment() -> dict:
environment = dict(os.environ)
for name in API_KEY_ENVIRONMENT_NAMES:
environment.pop(name, None)
return environment
def build_command(executable: str, invocation: dict, run_dir: Path, reference_files: list[Path]) -> list[str]:
"""Codex arguments: configured args + work folder + reference images (-i) + stdin prompt (-)"""
command = [executable, *invocation["args"], "-C", str(run_dir)]
for reference in reference_files:
command += ["-i", str(reference)]
return command + ["-"]
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |