Dianel555/DSkills / skills/ace-tool
ace-tool
VerifiedSemantic codebase search, code indexing, and prompt enhancement via standalone CLI. Use when: (1) Semantic code search with natural language queries, (2) Code indexing for remote codebase retrieval, (3) Prompt enhancement with codebase context, (4) Before grep/find/glob operations for better accuracy, (5) Complex requirements clarification, (6) Large codebase navigation. Triggers: "search context", "enhance prompt", "find code that", "index project", "clarify requirements". IMPORTANT: Always use ace-tool BEFORE grep/find/glob for semantic-level code location.
scripts/ace_cli.py
View on GitHub#!/usr/bin/env python3
"""ACE-Tool CLI - Semantic code search and prompt enhancement."""
import argparse
import json
import sys
from pathlib import Path
import httpx
try:
from .client import AceToolClient
from .indexer import Indexer
from .utils import load_env
from .web_ui import run_interactive_enhance
except ImportError:
from client import AceToolClient
from indexer import Indexer
from utils import load_env
from web_ui import run_interactive_enhance
load_env()
def cmd_search_context(args):
"""Handle search_context command."""
client = AceToolClient(args.api_url, args.token, args.endpoint)
result = client.search_context(args.project_root, args.query)
print(json.dumps(result, indent=2, ensure_ascii=False))
def cmd_enhance_prompt(args):
"""Handle enhance_prompt command."""
client = AceToolClient(args.api_url, args.token, args.endpoint, args.reasoning_effort)
history = args.history
if args.history_file:
history = Path(args.history_file).read_text(encoding="utf-8")
if not args.no_interactive:
result = run_interactive_enhance(
client,
args.prompt,
history,
args.port,
auto_open_browser=not args.no_browser,
project_root=args.project_root,
)
if result:
print(json.dumps({"enhanced_prompt": result}, indent=2, ensure_ascii=False))
else:
print(json.dumps({"cancelled": True}), file=sys.stderr)
sys.exit(1)
else:
result = client.enhance_prompt(args.prompt, history, args.project_root)
if "error" in result:
print(json.dumps(result), file=sys.stderr)
sys.exit(1)
print(json.dumps(result, indent=2, ensure_ascii=False))
def cmd_get_config(args):
"""Handle get_config command."""
client = AceToolClient(args.api_url, args.token, args.endpoint)
result = client.get_config()
print(json.dumps(result, indent=2, ensure_ascii=False))
def cmd_index(args):
"""Handle index command."""
client = AceToolClient(args.api_url, args.token, args.endpoint)
if not client.base_url or not client.token:
print(
json.dumps(
{
"error": "No authentication configured for indexing. Set up session.json, AUGMENT_SESSION_AUTH, or ACE_API_URL/ACE_API_TOKEN"
}
),
file=sys.stderr,
)
sys.exit(1)
with Indexer(args.project_root, client.base_url, client.token) as indexer:
blob_names, _ = client._wait_for_index(indexer, indexer.get_blob_names())
result = {
"total_blobs": len(blob_names),
"last_indexed": indexer._index.last_indexed,
"project_root": args.project_root,
"effective_root": str(indexer.root),
}
print(json.dumps(result, indent=2, ensure_ascii=False))
def main():
parser = argparse.ArgumentParser(description="ACE-Tool CLI - Semantic code search and prompt enhancement")
parser.add_argument("--api-url", help="API base URL")
parser.add_argument("--token", help="API authentication token")
parser.add_argument(
"--endpoint",
choices=["new", "old", "claude", "openai", "gemini", "codex"],
help="Enhancer endpoint type",
)
subparsers = parser.add_subparsers(dest="command", required=True)
p_search = subparsers.add_parser("search_context", help="Search codebase with natural language")
p_search.add_argument("-p", "--project-root", required=True, help="Project root path")
p_search.add_argument("-q", "--query", required=True, help="Natural language query")
p_search.set_defaults(func=cmd_search_context)
p_enhance = subparsers.add_parser("enhance_prompt", help="Enhance prompt with context")
p_enhance.add_argument("-p", "--prompt", required=True, help="Original prompt")
p_enhance.add_argument("-H", "--history", default="", help="Conversation history")
p_enhance.add_argument("--history-file", help="File containing conversation history")
p_enhance.add_argument("--project-root", help="Project root path (optional)")
p_enhance.add_argument(
"--reasoning-effort",
default=None,
metavar="LEVEL",
help="Reasoning effort: none/minimal/low/medium/high/xhigh/max (default: none, or PROMPT_ENHANCER_REASONING_EFFORT; empty string omits the parameter)",
)
p_enhance.add_argument("--no-interactive", action="store_true", help="Disable web UI, output JSON directly")
p_enhance.add_argument("--no-browser", action="store_true", help="Don't auto-open browser, just print URL")
p_enhance.add_argument("--port", type=int, default=8765, help="Port for interactive web server (default: 8765)")
p_enhance.set_defaults(func=cmd_enhance_prompt)
p_config = subparsers.add_parser("get_config", help="Show current configuration")
p_config.set_defaults(func=cmd_get_config)
p_index = subparsers.add_parser("index", help="Index project for remote search")
p_index.add_argument("-p", "--project-root", required=True, help="Project root path")
p_index.set_defaults(func=cmd_index)
args = parser.parse_args()
try:
args.func(args)
except httpx.HTTPStatusError as e:
print(json.dumps({"error": str(e), "status_code": e.response.status_code}), file=sys.stderr)
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}), file=sys.stderr)
sys.exit(1)
if __name__ == "__main__":
main()
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 |