instruction
stringclasses
100 values
code
stringlengths
78
193k
response
stringlengths
259
170k
file
stringlengths
59
203
Add docstrings to my Python code
import zipfile from pathlib import Path def verify_file(file_path: str) -> dict: path = Path(file_path) if not path.exists(): return {"valid": False, "format": "unknown", "file_size": 0, "details": "File not found"} size = path.stat().st_size if size == 0: return {"valid": False, "fo...
--- +++ @@ -1,9 +1,14 @@+"""Export utilities — file format verification for downloaded AnyGen outputs.""" import zipfile from pathlib import Path def verify_file(file_path: str) -> dict: + """Verify a downloaded file's integrity and format. + + Returns {"valid": bool, "format": str, "file_size": int, "de...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/anygen/agent-harness/cli_anything/anygen/core/export.py
Help me comply with documentation standards
from typing import Dict, Any, List, Optional def add_label( project: Dict[str, Any], start: float, end: Optional[float] = None, text: str = "", ) -> Dict[str, Any]: labels = project.setdefault("labels", []) if start < 0: raise ValueError(f"Label start must be >= 0, got {start}") ...
--- +++ @@ -1,3 +1,9 @@+"""Audacity CLI - Label/marker management module. + +Labels mark timestamps or time ranges in an audio project. +They are commonly used for marking sections, timestamps for +transcription, and chapter markers. +""" from typing import Dict, Any, List, Optional @@ -8,6 +14,7 @@ end: Optio...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/audacity/agent-harness/cli_anything/audacity/core/labels.py
Add docstrings for better understanding
import json import os import copy from typing import Dict, Any, Optional, List from datetime import datetime def _locked_save_json(path, data, **dump_kwargs) -> None: try: f = open(path, "r+") except FileNotFoundError: os.makedirs(os.path.dirname(os.path.abspath(path)), exist_ok=True) ...
--- +++ @@ -1,3 +1,4 @@+"""Blender CLI - Session management with undo/redo.""" import json import os @@ -7,6 +8,7 @@ def _locked_save_json(path, data, **dump_kwargs) -> None: + """Atomically write JSON with exclusive file locking.""" try: f = open(path, "r+") except FileNotFoundError: @@ -...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/blender/agent-harness/cli_anything/blender/core/session.py
Improve my code by adding docstrings
import json import os import copy from datetime import datetime from typing import Optional, Dict, Any, List # Scene profiles (common setups) PROFILES = { "default": { "resolution_x": 1920, "resolution_y": 1080, "engine": "CYCLES", "samples": 128, "fps": 24, }, "preview": { "resol...
--- +++ @@ -1,3 +1,4 @@+"""Blender CLI - Scene/project management module.""" import json import os @@ -64,6 +65,7 @@ frame_start: int = 1, frame_end: int = 250, ) -> Dict[str, Any]: + """Create a new Blender scene (JSON project).""" if profile and profile in PROFILES: p = PROFILES[profile...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/blender/agent-harness/cli_anything/blender/core/scene.py
Generate docstrings with examples
import os import json from typing import Dict, Any, Optional, List from datetime import datetime # Render presets RENDER_PRESETS = { "cycles_default": { "engine": "CYCLES", "samples": 128, "use_denoising": True, "resolution_percentage": 100, }, "cycles_high": { "en...
--- +++ @@ -1,3 +1,8 @@+"""Blender CLI - Render settings and export module. + +Handles render configuration, preset management, and bpy script generation +for actual Blender rendering. +""" import os import json @@ -69,6 +74,24 @@ output_path: Optional[str] = None, preset: Optional[str] = None, ) -> Dict[...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/blender/agent-harness/cli_anything/blender/core/render.py
Add docstrings for internal functions
import copy from typing import Dict, Any, List, Optional # Default Principled BSDF material DEFAULT_MATERIAL = { "type": "principled", "color": [0.8, 0.8, 0.8, 1.0], "metallic": 0.0, "roughness": 0.5, "specular": 0.5, "emission_color": [0.0, 0.0, 0.0, 1.0], "emission_strength": 0.0, "...
--- +++ @@ -1,3 +1,4 @@+"""Blender CLI - Material management module.""" import copy from typing import Dict, Any, List, Optional @@ -30,12 +31,14 @@ def _next_id(project: Dict[str, Any]) -> int: + """Generate the next unique material ID.""" materials = project.get("materials", []) existing_ids = [m...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/blender/agent-harness/cli_anything/blender/core/materials.py
Write docstrings for this repository
import copy from typing import Dict, Any, List, Optional import math # Camera types CAMERA_TYPES = ["PERSP", "ORTHO", "PANO"] # Light types and their default properties LIGHT_TYPES = { "POINT": {"power": 1000.0, "color": [1.0, 1.0, 1.0], "radius": 0.25}, "SUN": {"power": 1.0, "color": [1.0, 1.0, 1.0], "angl...
--- +++ @@ -1,3 +1,4 @@+"""Blender CLI - Camera and light management module.""" import copy from typing import Dict, Any, List, Optional @@ -66,6 +67,23 @@ clip_end: float = 1000.0, set_active: bool = False, ) -> Dict[str, Any]: + """Add a camera to the scene. + + Args: + project: The scene d...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/blender/agent-harness/cli_anything/blender/core/lighting.py
Add docstrings including usage examples
from typing import Dict, Any, List, Optional # Modifier registry: maps modifier type -> specification MODIFIER_REGISTRY = { "subdivision_surface": { "category": "generate", "description": "Subdivide mesh for smoother appearance", "bpy_type": "SUBSURF", "params": { "lev...
--- +++ @@ -1,3 +1,4 @@+"""Blender CLI - Modifier registry and management module.""" from typing import Dict, Any, List, Optional @@ -115,6 +116,7 @@ def list_available(category: Optional[str] = None) -> List[Dict[str, Any]]: + """List available modifiers, optionally filtered by category.""" result = [...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/blender/agent-harness/cli_anything/blender/core/modifiers.py
Add verbose docstrings with examples
import os import wave import math import struct from typing import Dict, Any, Optional, List, Tuple from cli_anything.audacity.utils.audio_utils import ( generate_sine_wave, generate_silence, mix_audio, apply_gain, apply_fade_in, apply_fade_out, apply_reverse, apply_echo, apply_low...
--- +++ @@ -1,3 +1,11 @@+"""Audacity CLI - Export/mixdown/rendering pipeline module. + +This module handles the critical rendering step: mixing all tracks +with their clips and effects, then exporting to audio file formats. + +Uses ONLY Python stdlib (wave, struct, math) for WAV rendering. +Effects are applied in the a...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/audacity/agent-harness/cli_anything/audacity/core/export.py
Turn comments into proper docstrings
import os import wave import struct from typing import Dict, Any, Optional def probe_audio(path: str) -> Dict[str, Any]: if not os.path.exists(path): raise FileNotFoundError(f"Audio file not found: {path}") abs_path = os.path.abspath(path) info = { "path": abs_path, "filename": o...
--- +++ @@ -1,3 +1,8 @@+"""Audacity CLI - Audio probing and media analysis module. + +Uses the wave module (stdlib) to probe WAV files and extract +metadata such as sample rate, channels, duration, bit depth. +""" import os import wave @@ -6,6 +11,7 @@ def probe_audio(path: str) -> Dict[str, Any]: + """Analy...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/audacity/agent-harness/cli_anything/audacity/core/media.py
Write clean docstrings for readability
import copy from typing import Dict, Any, List, Optional # Valid mesh primitive types and their default parameters MESH_PRIMITIVES = { "cube": {"size": 2.0}, "sphere": {"radius": 1.0, "segments": 32, "rings": 16}, "cylinder": {"radius": 1.0, "depth": 2.0, "vertices": 32}, "cone": {"radius1": 1.0, "ra...
--- +++ @@ -1,3 +1,4 @@+"""Blender CLI - 3D object management module.""" import copy from typing import Dict, Any, List, Optional @@ -19,12 +20,14 @@ def _next_id(project: Dict[str, Any], collection_key: str = "objects") -> int: + """Generate the next unique ID for a collection.""" items = project.get(c...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/blender/agent-harness/cli_anything/blender/core/objects.py
Document this module using docstrings
from typing import Dict, Any, List, Optional # Effect registry: maps effect name -> parameter specifications EFFECT_REGISTRY = { "amplify": { "category": "volume", "description": "Amplify or attenuate audio by a dB amount", "params": { "gain_db": {"type": "float", "default": 0...
--- +++ @@ -1,3 +1,9 @@+"""Audacity CLI - Effect registry and management module. + +Provides a registry of audio effects with parameter specifications, +and functions to add/remove/modify effects on tracks. Effects are +stored in the project JSON and applied during export/render. +""" from typing import Dict, Any, L...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/audacity/agent-harness/cli_anything/audacity/core/effects.py
Can you add docstrings to this Python file?
from typing import Dict, Any, List, Optional # Valid keyframe properties that can be animated ANIMATABLE_PROPERTIES = [ "location", "rotation", "scale", "visible", "material.color", "material.metallic", "material.roughness", "material.alpha", "material.emission_strength", ] # Keyframe interpolation type...
--- +++ @@ -1,3 +1,4 @@+"""Blender CLI - Animation and keyframe management module.""" from typing import Dict, Any, List, Optional @@ -21,6 +22,19 @@ value: Any, interpolation: str = "BEZIER", ) -> Dict[str, Any]: + """Add a keyframe to an object. + + Args: + project: The scene dict + ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/blender/agent-harness/cli_anything/blender/core/animation.py
Add docstrings to improve code quality
#!/usr/bin/env python3 import sys import os import json import click sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from cli_anything.comfyui.core import workflows as workflow_mod from cli_anything.comfyui.core import queue as queue_mod from cli_anything.comfyui.core import models as...
--- +++ @@ -1,354 +1,409 @@-#!/usr/bin/env python3 - -import sys -import os -import json -import click - -sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) - -from cli_anything.comfyui.core import workflows as workflow_mod -from cli_anything.comfyui.core import queue as queue_mod -from cli...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/comfyui/agent-harness/cli_anything/comfyui/comfyui_cli.py
Add professional docstrings to my codebase
from pathlib import Path from cli_anything.comfyui.utils.comfyui_backend import api_get_raw from cli_anything.comfyui.core.queue import get_prompt_history def list_output_images(base_url: str, prompt_id: str) -> list[dict]: history = get_prompt_history(base_url, prompt_id) outputs = history.get("outputs", ...
--- +++ @@ -1,88 +1,137 @@- -from pathlib import Path - -from cli_anything.comfyui.utils.comfyui_backend import api_get_raw -from cli_anything.comfyui.core.queue import get_prompt_history - - -def list_output_images(base_url: str, prompt_id: str) -> list[dict]: - history = get_prompt_history(base_url, prompt_id) - -...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/comfyui/agent-harness/cli_anything/comfyui/core/images.py
Fully document this Python code with docstrings
import os import shutil import subprocess from typing import Optional, List def find_sox() -> str: path = shutil.which("sox") if path: return path raise RuntimeError( "SoX is not installed. Install it with:\n" " apt install sox # Debian/Ubuntu" ) def get_version() -> str:...
--- +++ @@ -1,3 +1,11 @@+"""SoX backend — invoke SoX for audio processing and format conversion. + +SoX (Sound eXchange) is the Swiss Army knife of audio processing. +Audacity uses it for many of its effects. + +Requires: sox (system package) + apt install sox +""" import os import shutil @@ -6,6 +14,7 @@ de...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/audacity/agent-harness/cli_anything/audacity/utils/sox_backend.py
Add docstrings with type hints explained
#!/usr/bin/env python3 import sys import os import json import click from typing import Optional # Add parent to path for imports sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from cli_anything.blender.core.session import Session from cli_anything.blender.core import scene as scene_...
--- +++ @@ -1,4 +1,18 @@ #!/usr/bin/env python3 +"""Blender CLI — A stateful command-line interface for 3D scene editing. + +This CLI provides full 3D scene management capabilities using a JSON +scene description format, with bpy script generation for actual rendering. + +Usage: + # One-shot commands + python3 -m...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/blender/agent-harness/cli_anything/blender/blender_cli.py
Add minimal docstrings for each function
import os import shutil import tempfile from typing import Optional from ..utils import drawio_xml from ..utils import drawio_backend from .session import Session # Export format configurations EXPORT_FORMATS = { "png": {"ext": ".png", "description": "PNG image (raster)"}, "pdf": {"ext": ".pdf", "descriptio...
--- +++ @@ -1,3 +1,4 @@+"""Export/render operations: export diagrams to PNG, PDF, SVG.""" import os import shutil @@ -20,6 +21,7 @@ def list_formats() -> list[dict]: + """List all available export formats.""" return [ {"name": name, **info} for name, info in sorted(EXPORT_FORMATS.items...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/drawio/agent-harness/cli_anything/drawio/core/export.py
Improve documentation using docstrings
from typing import Dict, Any, List, Optional def add_track( project: Dict[str, Any], name: Optional[str] = None, track_type: str = "audio", volume: float = 1.0, pan: float = 0.0, ) -> Dict[str, Any]: tracks = project.setdefault("tracks", []) if track_type not in ("audio", "label"): ...
--- +++ @@ -1,3 +1,9 @@+"""Audacity CLI - Track management module. + +Handles adding, removing, renaming, and configuring audio tracks. +Each track has properties: name, type, mute, solo, volume, pan, +plus lists of clips and effects. +""" from typing import Dict, Any, List, Optional @@ -9,6 +15,7 @@ volume: f...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/audacity/agent-harness/cli_anything/audacity/core/tracks.py
Add docstrings to improve collaboration
import os import sys # ── ANSI color codes (no external deps for core styling) ────────────── _RESET = "\033[0m" _BOLD = "\033[1m" _DIM = "\033[2m" _ITALIC = "\033[3m" _UNDERLINE = "\033[4m" # Brand colors _CYAN = "\033[38;5;80m" # cli-anything brand cyan _CYAN_BG = "\033[48;5;80m" _WHITE = "\033[97m" _GRAY =...
--- +++ @@ -1,3 +1,22 @@+"""cli-anything REPL Skin — Unified terminal interface for all CLI harnesses. + +Copy this file into your CLI package at: + cli_anything/<software>/utils/repl_skin.py + +Usage: + from cli_anything.<software>.utils.repl_skin import ReplSkin + + skin = ReplSkin("shotcut", version="1.0.0"...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/audacity/agent-harness/cli_anything/audacity/utils/repl_skin.py
Document all public functions with docstrings
import json import os import copy from typing import Dict, Any, Optional, List def _locked_save_json(path, data, **dump_kwargs) -> None: try: f = open(path, "r+") except FileNotFoundError: os.makedirs(os.path.dirname(os.path.abspath(path)), exist_ok=True) f = open(path, "w") with ...
--- +++ @@ -1,3 +1,8 @@+"""Audacity CLI - Session management with undo/redo. + +Same pattern as GIMP/Blender CLIs: maintains project state with a +snapshot-based undo/redo stack using deep copy. +""" import json import os @@ -6,6 +11,7 @@ def _locked_save_json(path, data, **dump_kwargs) -> None: + """Atomica...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/audacity/agent-harness/cli_anything/audacity/core/session.py
Add inline docstrings for readability
import os import shutil import subprocess from typing import Optional def find_drawio() -> str: # Common executable names across platforms candidates = ["draw.io", "drawio", "draw.io.exe"] for name in candidates: path = shutil.which(name) if path: return path # macOS app...
--- +++ @@ -1,3 +1,15 @@+"""Draw.io backend — invoke draw.io desktop CLI for diagram export. + +The draw.io desktop app (Electron-based) supports command-line export: + draw.io -x input.drawio -o output.png -f png + draw.io -x input.drawio -o output.pdf -f pdf + draw.io -x input.drawio -o output.svg -f svg + +...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/drawio/agent-harness/cli_anything/drawio/utils/drawio_backend.py
Please document this code using docstrings
from ..utils import drawio_xml from .session import Session def list_connectors(session: Session, diagram_index: int = 0) -> list[dict]: if not session.is_open: raise RuntimeError("No project is open") cells = drawio_xml.get_edges(session.root, diagram_index) return [drawio_xml.get_cell_info(c) f...
--- +++ @@ -1,9 +1,11 @@+"""Connector (edge) operations: add, remove, modify, list.""" from ..utils import drawio_xml from .session import Session def list_connectors(session: Session, diagram_index: int = 0) -> list[dict]: + """List all connectors (edges) on a page.""" if not session.is_open: ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/drawio/agent-harness/cli_anything/drawio/core/connectors.py
Write docstrings for utility functions
import requests from typing import Any # Default ComfyUI server URL DEFAULT_BASE_URL = "http://localhost:8188" def api_get(base_url: str, endpoint: str, params: dict | None = None) -> Any: url = f"{base_url.rstrip('/')}{endpoint}" try: resp = requests.get(url, params=params, timeout=30) resp...
--- +++ @@ -1,96 +1,156 @@- -import requests -from typing import Any - -# Default ComfyUI server URL -DEFAULT_BASE_URL = "http://localhost:8188" - - -def api_get(base_url: str, endpoint: str, params: dict | None = None) -> Any: - url = f"{base_url.rstrip('/')}{endpoint}" - try: - resp = requests.get(url, p...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/comfyui/agent-harness/cli_anything/comfyui/utils/comfyui_backend.py
Add docstrings to improve readability
import os import time from xml.etree import ElementTree as ET from typing import Optional # ============================================================================ # File I/O # ============================================================================ def parse_drawio(path: str) -> ET.Element: if not os....
--- +++ @@ -1,3 +1,27 @@+"""Draw.io XML manipulation utilities. + +Draw.io files (.drawio) are XML-based, using the mxGraph format. +We manipulate them directly by parsing and modifying the XML tree. + +Structure: + <mxfile> + <diagram id="..." name="Page-1"> + <mxGraphModel dx="..." dy="..." ...> + ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/drawio/agent-harness/cli_anything/drawio/utils/drawio_xml.py
Add docstrings that explain purpose and usage
from typing import Dict, Any, List, Optional, Tuple # Filter registry: maps CLI name -> implementation details FILTER_REGISTRY = { # Image Adjustments "brightness": { "category": "adjustment", "description": "Adjust image brightness", "params": {"factor": {"type": "float", "default": ...
--- +++ @@ -1,3 +1,4 @@+"""GIMP CLI - Filter registry and application module.""" from typing import Dict, Any, List, Optional, Tuple @@ -214,6 +215,7 @@ def list_available(category: Optional[str] = None) -> List[Dict[str, Any]]: + """List available filters, optionally filtered by category.""" result = ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/gimp/agent-harness/cli_anything/gimp/core/filters.py
Add docstrings that explain logic
import os import json import subprocess from typing import Dict, Any, Optional def probe_image(path: str) -> Dict[str, Any]: if not os.path.exists(path): raise FileNotFoundError(f"Image file not found: {path}") info: Dict[str, Any] = { "path": os.path.abspath(path), "filename": os.pa...
--- +++ @@ -1,3 +1,9 @@+"""GIMP CLI - Media file analysis module. + +Uses Pillow when available for rich metadata (EXIF, histograms). Falls back +to pure-Python header parsing for basic dimensions / format detection when +Pillow is not installed. +""" import os import json @@ -6,6 +12,11 @@ def probe_image(pat...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/gimp/agent-harness/cli_anything/gimp/core/media.py
Add detailed documentation for each class
import math import struct import wave import array import os from typing import List, Tuple, Optional def generate_sine_wave( frequency: float = 440.0, duration: float = 1.0, sample_rate: int = 44100, amplitude: float = 0.5, channels: int = 1, ) -> List[float]: num_samples = int(duration * sa...
--- +++ @@ -1,3 +1,11 @@+"""Audacity CLI - Audio utility functions. + +Pure Python audio processing using only stdlib (wave, struct, math, array). +These functions handle raw PCM audio data as lists or arrays of samples. + +All internal audio is represented as lists of float samples in [-1.0, 1.0]. +Multi-channel audio...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/audacity/agent-harness/cli_anything/audacity/utils/audio_utils.py
Add professional docstrings to my codebase
import os import copy import struct from typing import Dict, Any, List, Optional # Valid blend modes BLEND_MODES = [ "normal", "multiply", "screen", "overlay", "soft_light", "hard_light", "difference", "darken", "lighten", "color_dodge", "color_burn", "addition", "subtract", "grain_merge", "grain_extract...
--- +++ @@ -1,3 +1,4 @@+"""GIMP CLI - Layer management module.""" import os import copy @@ -27,6 +28,25 @@ offset_x: int = 0, offset_y: int = 0, ) -> Dict[str, Any]: + """Add a new layer to the project. + + Args: + project: The project dict + name: Layer name + layer_type: "imag...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/gimp/agent-harness/cli_anything/gimp/core/layers.py
Generate missing documentation strings
import json import os import copy from datetime import datetime from typing import Optional, Dict, Any, List # Default canvas profiles PROFILES = { "hd1080p": {"width": 1920, "height": 1080, "dpi": 72}, "hd720p": {"width": 1280, "height": 720, "dpi": 72}, "4k": {"width": 3840, "height": 2160, "dpi": 72},...
--- +++ @@ -1,3 +1,4 @@+"""GIMP CLI - Core project management module.""" import json import os @@ -36,6 +37,7 @@ name: str = "untitled", profile: Optional[str] = None, ) -> Dict[str, Any]: + """Create a new GIMP CLI project.""" if profile and profile in PROFILES: p = PROFILES[profile] ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/gimp/agent-harness/cli_anything/gimp/core/project.py
Add inline docstrings for readability
import json import os import copy from typing import Dict, Any, Optional, List from datetime import datetime def _locked_save_json(path, data, **dump_kwargs) -> None: try: f = open(path, "r+") except FileNotFoundError: os.makedirs(os.path.dirname(os.path.abspath(path)), exist_ok=True) ...
--- +++ @@ -1,3 +1,4 @@+"""GIMP CLI - Session management with undo/redo.""" import json import os @@ -7,6 +8,7 @@ def _locked_save_json(path, data, **dump_kwargs) -> None: + """Atomically write JSON with exclusive file locking.""" try: f = open(path, "r+") except FileNotFoundError: @@ -32,...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/gimp/agent-harness/cli_anything/gimp/core/session.py
Document all public functions with docstrings
#!/usr/bin/env python3 import sys import os import json import click from typing import Optional # Add parent to path for imports sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from cli_anything.gimp.core.session import Session from cli_anything.gimp.core import project as proj_mod f...
--- +++ @@ -1,4 +1,19 @@ #!/usr/bin/env python3 +"""GIMP CLI — A stateful command-line interface for image editing. + +This CLI provides full image editing capabilities using Pillow as the +backend engine, with a project format that tracks layers, filters, +and history. + +Usage: + # One-shot commands + python3 -...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/gimp/agent-harness/cli_anything/gimp/gimp_cli.py
Provide clean and structured docstrings
import json import math from typing import Dict, Any, Optional, List def generate_full_script( project: Dict[str, Any], output_path: str, frame: Optional[int] = None, animation: bool = False, ) -> str: lines = [] lines.append("#!/usr/bin/env python3") lines.append('"""Auto-generated Blend...
--- +++ @@ -1,3 +1,8 @@+"""Blender CLI - Generate Blender Python (bpy) scripts from scene JSON. + +This module translates a scene JSON into a complete bpy script that can be +run with: blender --background --python script.py +""" import json import math @@ -10,6 +15,17 @@ frame: Optional[int] = None, anima...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/blender/agent-harness/cli_anything/blender/utils/bpy_gen.py
Add docstrings to improve readability
import os import shutil import subprocess from typing import Dict, Any, Optional, List def _script_fu_escape(value: str) -> str: return ( value.replace("\\", "\\\\") .replace('"', '\\"') .replace("\r", "\\r") .replace("\n", "\\n") ) def find_gimp() -> str: for name in ("...
--- +++ @@ -1,3 +1,10 @@+"""GIMP backend — invoke GIMP in batch mode for image processing. + +Uses GIMP's Script-Fu batch mode for true image processing. + +Requires: gimp (system package) + apt install gimp +""" import os import shutil @@ -6,6 +13,7 @@ def _script_fu_escape(value: str) -> str: + """Escap...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/gimp/agent-harness/cli_anything/gimp/utils/gimp_backend.py
Generate docstrings with examples
from typing import Dict, Any, List, Optional from cli_anything.inkscape.utils.svg_utils import generate_id def add_layer( project: Dict[str, Any], name: str = "New Layer", visible: bool = True, locked: bool = False, opacity: float = 1.0, position: Optional[int] = None, ) -> Dict[str, Any]: ...
--- +++ @@ -1,3 +1,8 @@+"""Inkscape CLI - Layer/group management module. + +Layers in Inkscape are SVG <g> elements with inkscape:groupmode="layer". +This module manages layers in the JSON project format. +""" from typing import Dict, Any, List, Optional @@ -12,6 +17,11 @@ opacity: float = 1.0, position: ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/inkscape/agent-harness/cli_anything/inkscape/core/layers.py
Expand my code with proper documentation strings
import os import shutil import subprocess import tempfile from typing import Optional def find_blender() -> str: for name in ("blender",): path = shutil.which(name) if path: return path raise RuntimeError( "Blender is not installed. Install it with:\n" " apt insta...
--- +++ @@ -1,3 +1,8 @@+"""Blender backend — invoke Blender headless for rendering. + +Requires: blender (system package) + apt install blender +""" import os import shutil @@ -7,6 +12,7 @@ def find_blender() -> str: + """Find the Blender executable. Raises RuntimeError if not found.""" for name in (...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/blender/agent-harness/cli_anything/blender/utils/blender_backend.py
Add docstrings for production code
import os import shutil from typing import Dict, Any, List, Optional from cli_anything.inkscape.core.document import project_to_svg, save_svg from cli_anything.inkscape.utils.svg_utils import serialize_svg # Export presets EXPORT_PRESETS = { "png_web": { "format": "png", "dpi": 96, "descr...
--- +++ @@ -1,3 +1,9 @@+"""Inkscape CLI - Export module. + +Handles rendering SVG to PNG, exporting to PDF, and saving SVG files. +Uses Pillow for basic PNG rendering and the project's SVG generation +for SVG/PDF output. +""" import os import shutil @@ -52,6 +58,12 @@ background: Optional[str] = None, over...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/inkscape/agent-harness/cli_anything/inkscape/core/export.py
Fill in missing docstrings in my code
import json import os import copy from datetime import datetime from typing import Optional, Dict, Any, List PROJECT_VERSION = "1.0" # Default project settings DEFAULT_SETTINGS = { "sample_rate": 44100, "bit_depth": 16, "channels": 2, } def create_project( name: str = "untitled", sample_rate: ...
--- +++ @@ -1,3 +1,9 @@+"""Audacity CLI - Core project management module. + +Handles create, open, save, info, and settings for audio projects. +The project format is a JSON file that tracks tracks, clips, effects, +labels, selection, and metadata. +""" import json import os @@ -22,6 +28,7 @@ bit_depth: int = 1...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/audacity/agent-harness/cli_anything/audacity/core/project.py
Create docstrings for reusable components
from typing import Dict, Any def set_selection( project: Dict[str, Any], start: float, end: float, ) -> Dict[str, Any]: if start < 0: raise ValueError(f"Selection start must be >= 0, got {start}") if end < start: raise ValueError(f"Selection end ({end}) must be >= start ({start})"...
--- +++ @@ -1,3 +1,9 @@+"""Audacity CLI - Selection management module. + +Manages the current selection range (start and end time) within the project. +The selection determines which portion of the timeline is affected by +operations like effects, cut, copy, paste. +""" from typing import Dict, Any @@ -7,6 +13,7 @...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/audacity/agent-harness/cli_anything/audacity/core/selection.py
Generate documentation strings for clarity
import re from pathlib import Path from typing import Optional from dataclasses import dataclass, field def _format_display_name(name: str) -> str: return name.replace("_", " ").replace("-", " ").title() @dataclass class CommandInfo: name: str description: str @dataclass class CommandGroup: name:...
--- +++ @@ -1,3 +1,15 @@+""" +SKILL.md Generator for CLI-Anything + +This module extracts metadata from CLI-Anything harnesses and generates +SKILL.md files following the skill-creator methodology. + +The generated SKILL.md files contain: +- YAML frontmatter with name and description (triggering metadata) +- Markdown b...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/cli-anything-plugin/skill_generator.py
Write documentation strings for class attributes
#!/usr/bin/env python3 import sys import os import json import click from typing import Optional # Add parent to path for imports sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from cli_anything.inkscape.core.session import Session from cli_anything.inkscape.core import document as d...
--- +++ @@ -1,4 +1,18 @@ #!/usr/bin/env python3 +"""Inkscape CLI — A stateful command-line interface for vector graphics editing. + +This CLI provides full SVG editing capabilities using direct SVG/XML +manipulation, with a project format that tracks objects, layers, and history. + +Usage: + # One-shot commands + ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/inkscape/agent-harness/cli_anything/inkscape/inkscape_cli.py
Add docstrings that explain logic
import os import sys # ── ANSI color codes (no external deps for core styling) ────────────── _RESET = "\033[0m" _BOLD = "\033[1m" _DIM = "\033[2m" _ITALIC = "\033[3m" _UNDERLINE = "\033[4m" # Brand colors _CYAN = "\033[38;5;80m" # cli-anything brand cyan _CYAN_BG = "\033[48;5;80m" _WHITE = "\033[97m" _GRAY =...
--- +++ @@ -1,3 +1,22 @@+"""cli-anything REPL Skin — Unified terminal interface for all CLI harnesses. + +Copy this file into your CLI package at: + cli_anything/<software>/utils/repl_skin.py + +Usage: + from cli_anything.<software>.utils.repl_skin import ReplSkin + + skin = ReplSkin("shotcut", version="1.0.0"...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/cli-anything-plugin/repl_skin.py
Generate docstrings with examples
import json import os import copy from typing import Dict, Any, Optional, List from datetime import datetime def _locked_save_json(path, data, **dump_kwargs) -> None: try: f = open(path, "r+") except FileNotFoundError: os.makedirs(os.path.dirname(os.path.abspath(path)), exist_ok=True) ...
--- +++ @@ -1,3 +1,4 @@+"""Inkscape CLI - Session management with undo/redo.""" import json import os @@ -7,6 +8,7 @@ def _locked_save_json(path, data, **dump_kwargs) -> None: + """Atomically write JSON with exclusive file locking.""" try: f = open(path, "r+") except FileNotFoundError: @@ ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/inkscape/agent-harness/cli_anything/inkscape/core/session.py
Turn comments into proper docstrings
from typing import Dict, Any, List, Optional from cli_anything.inkscape.utils.svg_utils import generate_id, parse_style, serialize_style def add_linear_gradient( project: Dict[str, Any], stops: Optional[List[Dict[str, Any]]] = None, x1: float = 0, y1: float = 0, x2: float = 1, y2: float = 0, nam...
--- +++ @@ -1,3 +1,8 @@+"""Inkscape CLI - Gradient management module. + +Handles creating linear and radial gradients, applying them to objects, +and listing gradients. +""" from typing import Dict, Any, List, Optional @@ -12,6 +17,14 @@ name: Optional[str] = None, gradient_units: str = "objectBoundingBox...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/inkscape/agent-harness/cli_anything/inkscape/core/gradients.py
Add docstrings to existing functions
from typing import Dict, Any, List, Optional import copy from cli_anything.inkscape.utils.svg_utils import generate_id # Path operations that Inkscape supports PATH_OPERATIONS = { "union": { "description": "Union (combine) two shapes", "inkscape_verb": "SelectionUnion", "inkscape_action":...
--- +++ @@ -1,3 +1,11 @@+"""Inkscape CLI - Path boolean operations module. + +Handles union, intersection, difference, exclusion, and path conversion. +These operations modify the JSON model. Actual SVG path computation for +complex shapes would require Inkscape CLI or a path library. For simple +cases, we represent th...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/inkscape/agent-harness/cli_anything/inkscape/core/paths.py
Add missing documentation to my Python functions
import json import os from datetime import datetime from typing import Optional, Dict, Any, List from cli_anything.inkscape.utils.svg_utils import ( create_svg_element, serialize_svg, write_svg_file, parse_svg_file, SVG_NS, INKSCAPE_NS, SODIPODI_NS, find_all_shapes, _ns, ) # Document profiles (common canvas ...
--- +++ @@ -1,3 +1,9 @@+"""Inkscape CLI - Document management module. + +Handles creating, opening, saving, and inspecting SVG documents. +Maintains both a JSON project format for state tracking and +generates valid SVG files. +""" import json import os @@ -47,6 +53,7 @@ profile: Optional[str] = None, back...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/inkscape/agent-harness/cli_anything/inkscape/core/document.py
Include argument descriptions in docstrings
import os from typing import Optional from ..utils import drawio_xml from .session import Session # Standard page presets PAGE_PRESETS = { "letter": {"width": 850, "height": 1100}, "a4": {"width": 827, "height": 1169}, "a3": {"width": 1169, "height": 1654}, "16:9": {"width": 1280, "height": 720}, ...
--- +++ @@ -1,3 +1,4 @@+"""Project management operations.""" import os from typing import Optional @@ -20,6 +21,17 @@ def new_project(session: Session, preset: str = "letter", width: Optional[int] = None, height: Optional[int] = None) -> dict: + """Create a new blank diagram project. + + Ar...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/drawio/agent-harness/cli_anything/drawio/core/project.py
Write Python docstrings for this snippet
import xml.etree.ElementTree as ET import re from typing import Dict, Optional, Any # ── SVG Namespaces ────────────────────────────────────────────── SVG_NS = "http://www.w3.org/2000/svg" INKSCAPE_NS = "http://www.inkscape.org/namespaces/inkscape" SODIPODI_NS = "http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" X...
--- +++ @@ -1,3 +1,8 @@+"""SVG XML helper functions for Inkscape CLI. + +Provides namespace constants, SVG creation/parsing/serialization, +and style string helpers. +""" import xml.etree.ElementTree as ET import re @@ -31,6 +36,7 @@ def _ns(prefix: str, local: str) -> str: + """Build a Clark-notation tag li...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/inkscape/agent-harness/cli_anything/inkscape/utils/svg_utils.py
Auto-generate documentation strings for this file
import os import shutil import subprocess from typing import Optional def find_inkscape() -> str: path = shutil.which("inkscape") if path: return path raise RuntimeError( "Inkscape is not installed. Install it with:\n" " apt install inkscape # Debian/Ubuntu" ) def get_ver...
--- +++ @@ -1,3 +1,8 @@+"""Inkscape backend — invoke Inkscape CLI for SVG export. + +Requires: inkscape (system package) + apt install inkscape +""" import os import shutil @@ -6,6 +11,7 @@ def find_inkscape() -> str: + """Find the Inkscape executable.""" path = shutil.which("inkscape") if path:...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/inkscape/agent-harness/cli_anything/inkscape/utils/inkscape_backend.py
Create docstrings for API functions
from cli_anything.comfyui.utils.comfyui_backend import api_get def list_checkpoints(base_url: str) -> list[str]: result = api_get(base_url, "/object_info/CheckpointLoaderSimple") try: ckpt_input = result["CheckpointLoaderSimple"]["input"]["required"]["ckpt_name"] models = ckpt_input[0] ...
--- +++ @@ -1,92 +1,169 @@- -from cli_anything.comfyui.utils.comfyui_backend import api_get - - -def list_checkpoints(base_url: str) -> list[str]: - result = api_get(base_url, "/object_info/CheckpointLoaderSimple") - - try: - ckpt_input = result["CheckpointLoaderSimple"]["input"]["required"]["ckpt_name"] -...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/comfyui/agent-harness/cli_anything/comfyui/core/models.py
Write docstrings including parameters and return values
import json import os import time from pathlib import Path from typing import Optional from xml.etree import ElementTree as ET from ..utils import drawio_xml def _locked_save_json(path, data, **dump_kwargs) -> None: path = str(path) try: f = open(path, "r+") except FileNotFoundError: os....
--- +++ @@ -1,3 +1,8 @@+"""Stateful session management for the Draw.io CLI. + +A session tracks the currently open project, undo history, and working state. +Sessions persist to disk as JSON so they survive process restarts. +""" import json import os @@ -10,6 +15,7 @@ def _locked_save_json(path, data, **dump_k...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/drawio/agent-harness/cli_anything/drawio/core/session.py
Document helper functions with docstrings
import json from pathlib import Path def load_workflow(path: str) -> dict: p = Path(path) if not p.exists(): raise RuntimeError(f"Workflow file not found: {path}") if not p.suffix.lower() == ".json": raise RuntimeError(f"Workflow file must be a .json file, got: {path}") try: w...
--- +++ @@ -1,108 +1,158 @@- -import json -from pathlib import Path - - -def load_workflow(path: str) -> dict: - p = Path(path) - if not p.exists(): - raise RuntimeError(f"Workflow file not found: {path}") - if not p.suffix.lower() == ".json": - raise RuntimeError(f"Workflow file must be a .json ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/comfyui/agent-harness/cli_anything/comfyui/core/workflows.py
Write clean docstrings for readability
from ..utils import drawio_xml from .session import Session def list_pages(session: Session) -> list[dict]: if not session.is_open: raise RuntimeError("No project is open") return drawio_xml.list_pages(session.root) def add_page(session: Session, name: str = "", page_width: int = 850, ...
--- +++ @@ -1,9 +1,11 @@+"""Multi-page operations: add, remove, rename, list pages.""" from ..utils import drawio_xml from .session import Session def list_pages(session: Session) -> list[dict]: + """List all pages in the diagram.""" if not session.is_open: raise RuntimeError("No project is op...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/drawio/agent-harness/cli_anything/drawio/core/pages.py
Write docstrings for algorithm functions
import uuid from cli_anything.comfyui.utils.comfyui_backend import api_get, api_post, api_delete def queue_prompt( base_url: str, workflow: dict, client_id: str | None = None, ) -> dict: if not workflow: raise RuntimeError("Cannot queue an empty workflow.") if client_id is None: ...
--- +++ @@ -1,114 +1,194 @@- -import uuid - -from cli_anything.comfyui.utils.comfyui_backend import api_get, api_post, api_delete - - -def queue_prompt( - base_url: str, - workflow: dict, - client_id: str | None = None, -) -> dict: - if not workflow: - raise RuntimeError("Cannot queue an empty workfl...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/comfyui/agent-harness/cli_anything/comfyui/core/queue.py
Document functions with clear intent
import copy from typing import Dict, Any, List, Optional TRACK_TYPES = ("video", "audio") def _validate_track_index(project: Dict[str, Any], track_id: int) -> int: tracks = project.get("tracks", []) for i, t in enumerate(tracks): if t["id"] == track_id: return i raise ValueError(f"T...
--- +++ @@ -1,3 +1,4 @@+"""Kdenlive CLI - Timeline (tracks and clip placement) management.""" import copy from typing import Dict, Any, List, Optional @@ -7,6 +8,7 @@ def _validate_track_index(project: Dict[str, Any], track_id: int) -> int: + """Find index by track id, raise if not found.""" tracks = pr...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/kdenlive/agent-harness/cli_anything/kdenlive/core/timeline.py
Add documentation for all methods
from typing import Dict, Any, List, Optional TRANSITION_TYPES = { "dissolve": { "mlt_service": "luma", "params": { "duration": {"type": "float", "default": 1.0, "min": 0.01, "max": 60.0}, "softness": {"type": "float", "default": 0.0, "min": 0.0, "max": 1.0}, }, ...
--- +++ @@ -1,3 +1,4 @@+"""Kdenlive CLI - Transition management module.""" from typing import Dict, Any, List, Optional @@ -42,6 +43,7 @@ def _next_transition_id(project: Dict[str, Any]) -> int: + """Generate next unique transition ID.""" existing = {t.get("id", -1) for t in project.get("transitions", ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/kdenlive/agent-harness/cli_anything/kdenlive/core/transitions.py
Generate missing documentation strings
from typing import Dict, Any VALID_MODES = ("RGB", "RGBA", "L", "LA", "CMYK", "P") RESAMPLE_METHODS = ("nearest", "bilinear", "bicubic", "lanczos") def resize_canvas( project: Dict[str, Any], width: int, height: int, anchor: str = "center", ) -> Dict[str, Any]: if width < 1 or height < 1: ...
--- +++ @@ -1,3 +1,4 @@+"""GIMP CLI - Canvas operations module.""" from typing import Dict, Any @@ -12,6 +13,16 @@ height: int, anchor: str = "center", ) -> Dict[str, Any]: + """Resize the canvas (does not scale content, adds/removes space). + + Args: + project: The project dict + wid...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/gimp/agent-harness/cli_anything/gimp/core/canvas.py
Generate documentation strings for clarity
import json import os import copy from typing import Dict, Any, Optional, List from datetime import datetime def _locked_save_json(path, data, **dump_kwargs) -> None: try: f = open(path, "r+") except FileNotFoundError: os.makedirs(os.path.dirname(os.path.abspath(path)), exist_ok=True) ...
--- +++ @@ -1,3 +1,4 @@+"""Kdenlive CLI - Session management with undo/redo.""" import json import os @@ -7,6 +8,7 @@ def _locked_save_json(path, data, **dump_kwargs) -> None: + """Atomically write JSON with exclusive file locking.""" try: f = open(path, "r+") except FileNotFoundError: @@ ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/kdenlive/agent-harness/cli_anything/kdenlive/core/session.py
Add docstrings to my Python code
#!/usr/bin/env python3 import sys import os import json import click from typing import Optional # Add parent to path for imports sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from cli_anything.kdenlive.core.session import Session from cli_anything.kdenlive.core import project as pr...
--- +++ @@ -1,4 +1,18 @@ #!/usr/bin/env python3 +"""Kdenlive CLI — A stateful command-line interface for video editing. + +This CLI provides full video project management capabilities using a JSON +project format, with MLT XML generation for Kdenlive/melt. + +Usage: + # One-shot commands + python3 -m cli.kdenlive...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/kdenlive/agent-harness/cli_anything/kdenlive/kdenlive_cli.py
Add clean documentation to messy code
import os import sys # ── ANSI color codes (no external deps for core styling) ────────────── _RESET = "\033[0m" _BOLD = "\033[1m" _DIM = "\033[2m" _ITALIC = "\033[3m" _UNDERLINE = "\033[4m" # Brand colors _CYAN = "\033[38;5;80m" # cli-anything brand cyan _CYAN_BG = "\033[48;5;80m" _WHITE = "\033[97m" _GRAY =...
--- +++ @@ -1,3 +1,22 @@+"""cli-anything REPL Skin — Unified terminal interface for all CLI harnesses. + +Copy this file into your CLI package at: + cli_anything/<software>/utils/repl_skin.py + +Usage: + from cli_anything.<software>.utils.repl_skin import ReplSkin + + skin = ReplSkin("shotcut", version="1.0.0"...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/drawio/agent-harness/cli_anything/drawio/utils/repl_skin.py
Add docstrings explaining edge cases
import os import html as html_module import tempfile from typing import Dict, Any, Optional, List from cli_anything.libreoffice.utils.odf_utils import write_odf, ODF_EXTENSIONS from cli_anything.libreoffice.utils.lo_backend import convert_odf_to # Export presets # "native" presets produce ODF/HTML/text directly (no...
--- +++ @@ -1,3 +1,8 @@+"""LibreOffice CLI - Export module. + +Exports project JSON to ODF files (real ZIP archives), HTML, plain text, +and via LibreOffice headless to PDF, DOCX, XLSX, PPTX, and other formats. +""" import os import html as html_module @@ -35,6 +40,7 @@ def list_presets() -> List[Dict[str, Any]...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/libreoffice/agent-harness/cli_anything/libreoffice/core/export.py
Generate NumPy-style docstrings
import os from typing import Dict, Any, Optional, Tuple # Export presets EXPORT_PRESETS = { "png": {"format": "PNG", "ext": ".png", "params": {"compress_level": 6}}, "png-max": {"format": "PNG", "ext": ".png", "params": {"compress_level": 9}}, "jpeg-high": {"format": "JPEG", "ext": ".jpg", "params": {"qu...
--- +++ @@ -1,3 +1,12 @@+"""GIMP CLI - Export/rendering pipeline module. + +This module handles the critical "rendering" step: flattening the layer stack +with all filters applied and exporting to various image formats. + +Rendering backends (tried in order): + 1. GIMP Script-Fu batch mode – uses the real GIMP engine...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/gimp/agent-harness/cli_anything/gimp/core/export.py
Write clean docstrings for readability
#!/usr/bin/env python3 import sys import os import json import click from typing import Optional # Add parent to path for imports sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from cli_anything.drawio.core.session import Session from cli_anything.drawio.core import project as proj_m...
--- +++ @@ -1,4 +1,18 @@ #!/usr/bin/env python3 +"""Draw.io CLI — A stateful command-line interface for diagram creation. + +This CLI manipulates Draw.io XML files directly, providing full diagram +creation capabilities for AI agents and power users. + +Usage: + # One-shot commands + cli-anything-drawio project n...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/drawio/agent-harness/cli_anything/drawio/drawio_cli.py
Write documentation strings for class attributes
from typing import Dict, Any, List, Optional def _ensure_impress(project: Dict[str, Any]) -> None: if project.get("type") != "impress": raise ValueError( f"Document type is '{project.get('type')}', expected 'impress'." ) if "slides" not in project: project["slides"] = [] ...
--- +++ @@ -1,8 +1,10 @@+"""LibreOffice CLI - Impress (presentations) module.""" from typing import Dict, Any, List, Optional def _ensure_impress(project: Dict[str, Any]) -> None: + """Ensure the project is an Impress document.""" if project.get("type") != "impress": raise ValueError( ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/libreoffice/agent-harness/cli_anything/libreoffice/core/impress.py
Add docstrings that explain inputs and outputs
from typing import Dict, Any, List, Optional def _ensure_calc(project: Dict[str, Any]) -> None: if project.get("type") != "calc": raise ValueError( f"Document type is '{project.get('type')}', expected 'calc'." ) if "sheets" not in project: project["sheets"] = [] def _get...
--- +++ @@ -1,8 +1,10 @@+"""LibreOffice CLI - Calc (spreadsheet) module.""" from typing import Dict, Any, List, Optional def _ensure_calc(project: Dict[str, Any]) -> None: + """Ensure the project is a Calc document.""" if project.get("type") != "calc": raise ValueError( f"Document ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/libreoffice/agent-harness/cli_anything/libreoffice/core/calc.py
Generate docstrings for script automation
from ..utils import drawio_xml from .session import Session def list_shapes(session: Session, diagram_index: int = 0) -> list[dict]: if not session.is_open: raise RuntimeError("No project is open") cells = drawio_xml.get_vertices(session.root, diagram_index) return [drawio_xml.get_cell_info(c) fo...
--- +++ @@ -1,9 +1,11 @@+"""Shape (vertex) operations: add, remove, modify, list.""" from ..utils import drawio_xml from .session import Session def list_shapes(session: Session, diagram_index: int = 0) -> list[dict]: + """List all shapes on a page.""" if not session.is_open: raise RuntimeErro...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/drawio/agent-harness/cli_anything/drawio/core/shapes.py
Insert docstrings into my code
import copy import math from typing import Dict, Any, List, Optional from cli_anything.inkscape.utils.svg_utils import generate_id, serialize_style # ── Shape Registry ────────────────────────────────────────────── SHAPE_TYPES = { "rect": { "description": "Rectangle", "required_attrs": [], ...
--- +++ @@ -1,3 +1,8 @@+"""Inkscape CLI - Shape operations module. + +Handles adding, removing, duplicating, and listing SVG shape objects. +All operations modify the project JSON; SVG is generated from it. +""" import copy import math @@ -82,6 +87,7 @@ style: Optional[str] = None, layer: Optional[str] = N...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/inkscape/agent-harness/cli_anything/inkscape/core/shapes.py
Help me document legacy Python code
import json import os import copy from datetime import datetime from typing import Optional, Dict, Any, List # Document profiles (page size presets) PROFILES = { "a4_portrait": { "page_width": "21cm", "page_height": "29.7cm", "margin_top": "2cm", "margin_bottom": "2cm", "margin_left": "2c...
--- +++ @@ -1,3 +1,4 @@+"""LibreOffice CLI - Core document management module.""" import json import os @@ -56,6 +57,7 @@ profile: Optional[str] = None, settings: Optional[Dict[str, str]] = None, ) -> Dict[str, Any]: + """Create a new LibreOffice CLI document project.""" if doc_type not in VALID_DO...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/libreoffice/agent-harness/cli_anything/libreoffice/core/document.py
Document functions with clear intent
import os import zipfile import xml.etree.ElementTree as ET from typing import Dict, Any, Optional from datetime import datetime # ODF XML Namespaces ODF_NS = { "office": "urn:oasis:names:tc:opendocument:xmlns:office:1.0", "text": "urn:oasis:names:tc:opendocument:xmlns:text:1.0", "table": "urn:oasis:name...
--- +++ @@ -1,3 +1,15 @@+"""LibreOffice CLI - ODF XML helpers. + +ODF (Open Document Format) files are ZIP archives containing XML files. +This module provides utilities for creating, parsing, and writing ODF documents. + +Key ODF structure: + mimetype - MIME type (stored uncompressed, first entry) + content...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/libreoffice/agent-harness/cli_anything/libreoffice/utils/odf_utils.py
Document functions with clear intent
from typing import Dict, Any, List, Optional CLIP_TYPES = ("video", "audio", "image", "color", "title") def _next_clip_id(project: Dict[str, Any]) -> str: existing = {c["id"] for c in project.get("bin", [])} idx = 0 while f"clip{idx}" in existing: idx += 1 return f"clip{idx}" def _unique_...
--- +++ @@ -1,3 +1,4 @@+"""Kdenlive CLI - Media bin management module.""" from typing import Dict, Any, List, Optional @@ -6,6 +7,7 @@ def _next_clip_id(project: Dict[str, Any]) -> str: + """Generate next unique clip ID.""" existing = {c["id"] for c in project.get("bin", [])} idx = 0 while f"...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/kdenlive/agent-harness/cli_anything/kdenlive/core/bin.py
Create structured documentation for my script
from typing import Dict, Any, List, Optional GUIDE_TYPES = ("default", "chapter", "segment") def _next_guide_id(project: Dict[str, Any]) -> int: existing = {g.get("id", -1) for g in project.get("guides", [])} idx = 0 while idx in existing: idx += 1 return idx def add_guide( project: D...
--- +++ @@ -1,3 +1,4 @@+"""Kdenlive CLI - Guide/marker management module.""" from typing import Dict, Any, List, Optional @@ -6,6 +7,7 @@ def _next_guide_id(project: Dict[str, Any]) -> int: + """Generate next unique guide ID.""" existing = {g.get("id", -1) for g in project.get("guides", [])} idx =...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/kdenlive/agent-harness/cli_anything/kdenlive/core/guides.py
Write docstrings for backend logic
import os import shutil import subprocess import tempfile from typing import Optional def find_libreoffice() -> str: # 1) Check PATH for name in ("libreoffice", "soffice"): path = shutil.which(name) if path: return path # 2) Check common installation paths (Windows) impor...
--- +++ @@ -1,3 +1,14 @@+"""LibreOffice backend — invoke LibreOffice headless for format conversions. + +This module is the bridge between the CLI and the real LibreOffice installation. +Instead of reimplementing document rendering, we generate valid ODF files and +then use `libreoffice --headless --convert-to` to prod...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/libreoffice/agent-harness/cli_anything/libreoffice/utils/lo_backend.py
Add return value explanations in docstrings
from typing import Dict, Any, List, Optional FILTER_REGISTRY = { "brightness": { "mlt_service": "brightness", "category": "color", "params": { "level": {"type": "float", "default": 1.0, "min": 0.0, "max": 5.0}, }, }, "contrast": { "mlt_service": "bright...
--- +++ @@ -1,3 +1,4 @@+"""Kdenlive CLI - Filter (effect) management module.""" from typing import Dict, Any, List, Optional @@ -103,6 +104,7 @@ def _validate_filter_params(filter_name: str, params: Dict[str, Any]) -> Dict[str, Any]: + """Validate and fill defaults for filter parameters.""" spec = FILT...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/kdenlive/agent-harness/cli_anything/kdenlive/core/filters.py
Create documentation strings for testing functions
from typing import Dict, Any, List, Optional from cli_anything.inkscape.utils.svg_utils import parse_style, serialize_style, validate_color # Style properties that can be set STYLE_PROPERTIES = { "fill": {"type": "color", "description": "Fill color (hex, named, rgb, none)"}, "stroke": {"type": "color", "des...
--- +++ @@ -1,3 +1,8 @@+"""Inkscape CLI - Style management module. + +Handles setting fill, stroke, opacity, and other CSS style properties +on SVG objects. +""" from typing import Dict, Any, List, Optional @@ -36,11 +41,13 @@ def set_fill(project: Dict[str, Any], index: int, color: str) -> Dict[str, Any]: + ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/inkscape/agent-harness/cli_anything/inkscape/core/styles.py
Add detailed documentation for each class
from typing import Dict, Any, List, Optional from cli_anything.kdenlive.utils.mlt_xml import ( xml_escape, seconds_to_frames, build_mlt_xml, ) RENDER_PRESETS = { "h264_hq": { "description": "H.264 High Quality", "vcodec": "libx264", "acodec": "aac", "vbitrate": "8000k"...
--- +++ @@ -1,3 +1,4 @@+"""Kdenlive CLI - Export module: JSON to MLT/Kdenlive XML generation.""" from typing import Dict, Any, List, Optional from cli_anything.kdenlive.utils.mlt_xml import ( @@ -76,10 +77,15 @@ def generate_kdenlive_xml(project: Dict[str, Any]) -> str: + """Generate valid Kdenlive/MLT XML f...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/kdenlive/agent-harness/cli_anything/kdenlive/core/export.py
Add docstrings that explain inputs and outputs
#!/usr/bin/env python3 from __future__ import annotations import json import sys import click from cli_anything.notebooklm import __version__ from cli_anything.notebooklm.core.session import Session from cli_anything.notebooklm.utils.notebooklm_backend import run_notebooklm _json_output = False _session: Session |...
--- +++ @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +"""NotebookLM CLI — Experimental NotebookLM wrapper for AI agents.""" from __future__ import annotations @@ -58,6 +59,7 @@ @click.option("--notebook", "notebook_id", default=None, help="Active notebook ID") @click.pass_context def cli(ctx, use_json, notebook_id): +...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/notebooklm/agent-harness/cli_anything/notebooklm/notebooklm_cli.py
Create docstrings for each class method
import re import math from typing import Dict, Any, List, Optional, Tuple def translate(project: Dict[str, Any], index: int, tx: float, ty: float = 0) -> Dict[str, Any]: obj = _get_object(project, index) current = parse_transform_string(obj.get("transform", "")) current.append(("translate", [tx, ty])) ...
--- +++ @@ -1,3 +1,8 @@+"""Inkscape CLI - Transform operations module. + +Handles translate, rotate, scale, and skew transforms on SVG objects. +Transforms are stored as SVG transform attribute strings. +""" import re import math @@ -5,6 +10,7 @@ def translate(project: Dict[str, Any], index: int, tx: float, ty:...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/inkscape/agent-harness/cli_anything/inkscape/core/transforms.py
Turn comments into proper docstrings
from typing import Dict, Any, List, Optional from cli_anything.inkscape.utils.svg_utils import generate_id, parse_style, serialize_style # Font properties that can be set TEXT_PROPERTIES = { "text": {"type": "str", "description": "The text content"}, "font-family": {"type": "str", "description": "Font famil...
--- +++ @@ -1,3 +1,7 @@+"""Inkscape CLI - Text management module. + +Handles adding text elements and modifying text properties. +""" from typing import Dict, Any, List, Optional @@ -44,6 +48,7 @@ name: Optional[str] = None, layer: Optional[str] = None, ) -> Dict[str, Any]: + """Add a text element to ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/inkscape/agent-harness/cli_anything/inkscape/core/text.py
Improve documentation using docstrings
import copy from typing import Dict, Any, List, Optional from cli_anything.obs_studio.utils.obs_utils import generate_id, unique_name, get_item, validate_range SOURCE_TYPES = { "video_capture": { "label": "Video Capture Device", "category": "video", "default_settings": {"device": "", "res...
--- +++ @@ -1,3 +1,4 @@+"""OBS Studio CLI - Source management.""" import copy from typing import Dict, Any, List, Optional @@ -69,12 +70,14 @@ def _get_scene_sources(project: Dict[str, Any], scene_index: int) -> List[Dict[str, Any]]: + """Get sources for a scene.""" scenes = project.get("scenes", []) ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/obs-studio/agent-harness/cli_anything/obs_studio/core/sources.py
Insert docstrings into my code
import json import os import copy from typing import Dict, Any, Optional, List from datetime import datetime def _locked_save_json(path, data, **dump_kwargs) -> None: try: f = open(path, "r+") except FileNotFoundError: os.makedirs(os.path.dirname(os.path.abspath(path)), exist_ok=True) ...
--- +++ @@ -1,3 +1,4 @@+"""LibreOffice CLI - Session management with undo/redo.""" import json import os @@ -7,6 +8,7 @@ def _locked_save_json(path, data, **dump_kwargs) -> None: + """Atomically write JSON with exclusive file locking.""" try: f = open(path, "r+") except FileNotFoundError: ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/libreoffice/agent-harness/cli_anything/libreoffice/core/session.py
Add docstrings to meet PEP guidelines
from typing import Dict, Any, List, Optional from cli_anything.obs_studio.utils.obs_utils import validate_range ENCODING_PRESETS = { "ultrafast": {"encoder": "x264", "video_bitrate": 2500, "audio_bitrate": 128, "preset_label": "Ultra Fast"}, "fast": {"encoder": "x264", "video_bitrate": 4500, "audio_bitrate":...
--- +++ @@ -1,3 +1,4 @@+"""OBS Studio CLI - Output/streaming/recording configuration.""" from typing import Dict, Any, List, Optional from cli_anything.obs_studio.utils.obs_utils import validate_range @@ -25,6 +26,7 @@ server: Optional[str] = None, key: Optional[str] = None, ) -> Dict[str, Any]: + """C...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/obs-studio/agent-harness/cli_anything/obs_studio/core/output.py
Generate consistent documentation across files
import copy from typing import Dict, Any, List, Optional from cli_anything.obs_studio.utils.obs_utils import generate_id, unique_name, get_item def _get_scenes(project: Dict[str, Any]) -> List[Dict[str, Any]]: return project.setdefault("scenes", []) def add_scene(project: Dict[str, Any], name: str = "Scene") -...
--- +++ @@ -1,3 +1,4 @@+"""OBS Studio CLI - Scene management.""" import copy from typing import Dict, Any, List, Optional @@ -9,6 +10,7 @@ def add_scene(project: Dict[str, Any], name: str = "Scene") -> Dict[str, Any]: + """Add a new scene to the project.""" scenes = _get_scenes(project) name = uniq...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/obs-studio/agent-harness/cli_anything/obs_studio/core/scenes.py
Add docstrings to my Python code
import copy from typing import Dict, Any, List, Optional from cli_anything.obs_studio.utils.obs_utils import generate_id, unique_name, get_item, validate_range MONITOR_TYPES = ("none", "monitor_only", "monitor_and_output") def _get_audio_sources(project: Dict[str, Any]) -> List[Dict[str, Any]]: return project....
--- +++ @@ -1,3 +1,4 @@+"""OBS Studio CLI - Audio management.""" import copy from typing import Dict, Any, List, Optional @@ -20,6 +21,7 @@ muted: bool = False, monitor: str = "none", ) -> Dict[str, Any]: + """Add a global audio source.""" if audio_type not in ("input", "output"): raise V...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/obs-studio/agent-harness/cli_anything/obs_studio/core/audio.py
Write docstrings for this repository
import json import os import copy from datetime import datetime from typing import Optional, Dict, Any, List PROJECT_VERSION = "1.0" def _default_project(name: str = "untitled") -> Dict[str, Any]: return { "version": PROJECT_VERSION, "name": name, "settings": { "output_width...
--- +++ @@ -1,3 +1,4 @@+"""OBS Studio CLI - Project/scene collection management.""" import json import os @@ -10,6 +11,7 @@ def _default_project(name: str = "untitled") -> Dict[str, Any]: + """Return the default project structure.""" return { "version": PROJECT_VERSION, "name": name, @...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/obs-studio/agent-harness/cli_anything/obs_studio/core/project.py
Add professional docstrings to my codebase
from typing import Dict, Any, List, Optional def _ensure_writer(project: Dict[str, Any]) -> None: if project.get("type") != "writer": raise ValueError( f"Document type is '{project.get('type')}', expected 'writer'." ) if "content" not in project: project["content"] = [] ...
--- +++ @@ -1,8 +1,10 @@+"""LibreOffice CLI - Writer (word processor) module.""" from typing import Dict, Any, List, Optional def _ensure_writer(project: Dict[str, Any]) -> None: + """Ensure the project is a Writer document.""" if project.get("type") != "writer": raise ValueError( ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/libreoffice/agent-harness/cli_anything/libreoffice/core/writer.py
Document all endpoints with docstrings
import re from typing import Dict, Any, Optional def xml_escape(s: str) -> str: s = s.replace("&", "&amp;") s = s.replace("<", "&lt;") s = s.replace(">", "&gt;") s = s.replace('"', "&quot;") s = s.replace("'", "&apos;") return s def seconds_to_timecode(seconds: float) -> str: if seconds...
--- +++ @@ -1,9 +1,11 @@+"""Kdenlive CLI - MLT XML generation helpers and timecode conversions.""" import re from typing import Dict, Any, Optional def xml_escape(s: str) -> str: + """Escape special characters for XML.""" s = s.replace("&", "&amp;") s = s.replace("<", "&lt;") s = s.replace(">...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/kdenlive/agent-harness/cli_anything/kdenlive/utils/mlt_xml.py
Auto-generate documentation strings for this file
import copy from typing import Dict, Any, List, Optional from cli_anything.obs_studio.utils.obs_utils import generate_id, unique_name, get_item, validate_range FILTER_TYPES = { "color_correction": { "label": "Color Correction", "category": "video", "params": { "gamma": {"type"...
--- +++ @@ -1,3 +1,4 @@+"""OBS Studio CLI - Filter management.""" import copy from typing import Dict, Any, List, Optional @@ -127,6 +128,7 @@ def _get_source_filters(project: Dict[str, Any], source_index: int, scene_index: int = 0) -> List[Dict[str, Any]]: + """Get the filter list for a source.""" scen...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/obs-studio/agent-harness/cli_anything/obs_studio/core/filters.py
Improve documentation using docstrings
#!/usr/bin/env python3 import sys import os import json import click from typing import Optional # Add parent to path for imports sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from cli_anything.libreoffice.core.session import Session from cli_anything.libreoffice.core import documen...
--- +++ @@ -1,4 +1,18 @@ #!/usr/bin/env python3 +"""LibreOffice CLI -- A stateful command-line interface for document editing. + +This CLI provides document creation and editing capabilities for Writer, +Calc, and Impress documents, with export to real ODF files (ZIP archives). + +Usage: + # One-shot commands + p...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/libreoffice/agent-harness/cli_anything/libreoffice/libreoffice_cli.py
Generate docstrings with parameter types
import json import os import copy import time from pathlib import Path from typing import Optional from lxml import etree from ..utils import mlt_xml def _locked_save_json(path, data, **dump_kwargs) -> None: path = str(path) try: f = open(path, "r+") except FileNotFoundError: os.makedirs...
--- +++ @@ -1,3 +1,8 @@+"""Stateful session management for the Shotcut CLI. + +A session tracks the currently open project, undo history, and working state. +Sessions persist to disk as JSON so they survive process restarts. +""" import json import os @@ -11,6 +16,7 @@ def _locked_save_json(path, data, **dump_k...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/shotcut/agent-harness/cli_anything/shotcut/core/session.py
Add docstrings to improve code quality
from __future__ import annotations import json import re import shutil import subprocess JSON_SUPPORTED_COMMANDS = { ("auth", "check"), ("status",), ("list",), ("create",), ("source", "list"), ("source", "add"), ("ask",), ("history",), ("artifact", "list"), ("generate", "repo...
--- +++ @@ -1,3 +1,17 @@+"""NotebookLM backend adapter. + +This module wraps an installed `notebooklm` CLI for use inside a CLI-Anything +harness. It does not implement a Google official API client. + +References: +- CLI-Anything methodology: https://github.com/HKUDS/CLI-Anything +- notebooklm-py project: https://githu...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/notebooklm/agent-harness/cli_anything/notebooklm/utils/notebooklm_backend.py
Write docstrings describing functionality
from typing import Dict, Any, List, Optional VALID_FAMILIES = ("paragraph", "text") VALID_PROPERTIES = { "font_size", "font_name", "bold", "italic", "underline", "color", "alignment", "line_height", "margin_top", "margin_bottom", } def create_style( project: Dict[str, Any], name: str, family: ...
--- +++ @@ -1,3 +1,4 @@+"""LibreOffice CLI - Document styles module.""" from typing import Dict, Any, List, Optional @@ -17,6 +18,7 @@ parent: Optional[str] = None, properties: Optional[Dict] = None, ) -> Dict[str, Any]: + """Create a new named style.""" if "styles" not in project: proje...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/libreoffice/agent-harness/cli_anything/libreoffice/core/styles.py
Add docstrings including usage examples
import os import subprocess import json import shutil from typing import Optional from ..utils import mlt_xml from .session import Session def _find_tool(name: str) -> Optional[str]: return shutil.which(name) def probe_media(filepath: str) -> dict: filepath = os.path.abspath(filepath) if not os.path.i...
--- +++ @@ -1,3 +1,4 @@+"""Media file operations: probe, import, list.""" import os import subprocess @@ -10,10 +11,18 @@ def _find_tool(name: str) -> Optional[str]: + """Find a tool in PATH.""" return shutil.which(name) def probe_media(filepath: str) -> dict: + """Probe a media file for its pro...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/shotcut/agent-harness/cli_anything/shotcut/core/media.py
Write docstrings for this repository
from __future__ import annotations import json from pathlib import Path class Session: def __init__(self, session_file: str | Path | None = None): if session_file is None: session_file = Path.home() / ".cli-anything-notebooklm" / "session.json" self.session_file = Path(session_file)...
--- +++ @@ -1,3 +1,4 @@+"""Session persistence helpers for NotebookLM CLI context.""" from __future__ import annotations @@ -6,6 +7,7 @@ class Session: + """Persist the active notebook for REPL and one-shot commands.""" def __init__(self, session_file: str | Path | None = None): if session_f...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/notebooklm/agent-harness/cli_anything/notebooklm/core/session.py
Write docstrings for utility functions
import os from typing import Optional from lxml import etree from ..utils import mlt_xml from .session import Session # Standard video profiles PROFILES = { "hd1080p30": { "width": "1920", "height": "1080", "frame_rate_num": "30000", "frame_rate_den": "1001", "sample_aspect_num": "1", "s...
--- +++ @@ -1,3 +1,4 @@+"""Project management operations.""" import os from typing import Optional @@ -62,6 +63,15 @@ def new_project(session: Session, profile_name: str = "hd1080p30") -> dict: + """Create a new blank project. + + Args: + session: The active session + profile_name: Name of t...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/shotcut/agent-harness/cli_anything/shotcut/core/project.py
Document functions with detailed explanations
#!/usr/bin/env python3 import sys import os import json import click from typing import Optional # Add parent to path for imports sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from cli_anything.shotcut.core.session import Session from cli_anything.shotcut.core import project as proj...
--- +++ @@ -1,4 +1,18 @@ #!/usr/bin/env python3 +"""Shotcut CLI — A stateful command-line interface for video editing. + +This CLI manipulates Shotcut/MLT project files directly, providing +full video editing capabilities for AI agents and power users. + +Usage: + # One-shot commands + shotcut-cli project new --p...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/shotcut/agent-harness/cli_anything/shotcut/shotcut_cli.py
Generate docstrings for exported functions
import re from typing import Union # Default profile settings DEFAULT_FPS_NUM = 30000 DEFAULT_FPS_DEN = 1001 # 29.97 fps def fps_float(fps_num: int = DEFAULT_FPS_NUM, fps_den: int = DEFAULT_FPS_DEN) -> float: return fps_num / fps_den def timecode_to_frames(tc: str, fps_num: int = DEFAULT_FPS_NUM, ...
--- +++ @@ -1,3 +1,4 @@+"""Timecode utilities for MLT frame/time conversions.""" import re from typing import Union @@ -8,11 +9,20 @@ def fps_float(fps_num: int = DEFAULT_FPS_NUM, fps_den: int = DEFAULT_FPS_DEN) -> float: + """Get floating-point FPS from numerator/denominator.""" return fps_num / fps_de...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/shotcut/agent-harness/cli_anything/shotcut/utils/time.py
Add concise docstrings to each method
import copy import uuid from lxml import etree from typing import Optional def new_id(prefix: str = "producer") -> str: return f"{prefix}_{uuid.uuid4().hex[:8]}" def parse_mlt(filepath: str) -> etree._Element: parser = etree.XMLParser(remove_blank_text=True) tree = etree.parse(filepath, parser) ret...
--- +++ @@ -1,3 +1,8 @@+"""MLT XML parsing and generation utilities. + +This module handles all low-level MLT XML manipulation. It understands the MLT +XML schema and provides helper functions for common operations. +""" import copy import uuid @@ -6,28 +11,33 @@ def new_id(prefix: str = "producer") -> str: + ...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/shotcut/agent-harness/cli_anything/shotcut/utils/mlt_xml.py
Document all public functions with docstrings
import os import shutil import subprocess import tempfile from typing import Optional def find_melt() -> str: path = shutil.which("melt") if path: return path raise RuntimeError( "melt is not installed. Install it with:\n" " apt install melt # Debian/Ubuntu" ) def find_ff...
--- +++ @@ -1,3 +1,11 @@+"""MLT/melt backend — invoke melt for rendering MLT XML projects. + +Shotcut and Kdenlive both use the MLT framework. The `melt` command-line +tool can render MLT XML projects to video files. + +Requires: melt (system package) + apt install melt +""" import os import shutil @@ -7,6 +15,7...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/shotcut/agent-harness/cli_anything/shotcut/utils/melt_backend.py
Add detailed documentation for each class
import json import os import copy from typing import Dict, Any, List, Optional def generate_id(items: List[Dict[str, Any]]) -> int: if not items: return 0 return max(item.get("id", 0) for item in items) + 1 def unique_name(name: str, items: List[Dict[str, Any]], key: str = "name") -> str: exist...
--- +++ @@ -1,3 +1,4 @@+"""OBS Studio CLI - JSON helpers and utilities.""" import json import os @@ -6,12 +7,14 @@ def generate_id(items: List[Dict[str, Any]]) -> int: + """Generate the next unique ID for a list of items.""" if not items: return 0 return max(item.get("id", 0) for item in i...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/obs-studio/agent-harness/cli_anything/obs_studio/utils/obs_utils.py
Add docstrings for internal functions
import os import sys # ── ANSI color codes (no external deps for core styling) ────────────── _RESET = "\033[0m" _BOLD = "\033[1m" _DIM = "\033[2m" _ITALIC = "\033[3m" _UNDERLINE = "\033[4m" # Brand colors _CYAN = "\033[38;5;80m" # cli-anything brand cyan _CYAN_BG = "\033[48;5;80m" _WHITE = "\033[97m" _GRAY =...
--- +++ @@ -1,3 +1,22 @@+"""cli-anything REPL Skin — Unified terminal interface for all CLI harnesses. + +Copy this file into your CLI package at: + cli_anything/<software>/utils/repl_skin.py + +Usage: + from cli_anything.<software>.utils.repl_skin import ReplSkin + + skin = ReplSkin("shotcut", version="1.0.0"...
https://raw.githubusercontent.com/HKUDS/CLI-Anything/HEAD/zoom/agent-harness/cli_anything/zoom/utils/repl_skin.py