Skip to content

Commit d67e148

Browse files
committed
Fixes in incorrect plugin path, export path
Signed-off-by: Swarup Ghosh <swghosh@redhat.com>
1 parent d064d6f commit d67e148

File tree

2 files changed

+31
-16
lines changed

2 files changed

+31
-16
lines changed

server/config.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
{
3+
"claude_allowed_tools": [
4+
"Bash(*)",
5+
"Read",
6+
"Write",
7+
"Edit",
8+
"Glob",
9+
"Grep",
10+
"WebFetch",
11+
"Task"
12+
]
13+
}

server/server.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import os
1313
import re
14+
import json
1415
from pathlib import Path
1516

1617
import anyio
@@ -23,9 +24,15 @@
2324
TextBlock,
2425
)
2526

27+
28+
with open("config.json") as cf:
29+
config_json_str = cf.read()
30+
CONFIGS = json.loads(config_json_str)
31+
32+
2633
app = FastAPI(
27-
title="OAPE API Implement",
28-
description="Invokes the /oape:api-implement Claude Code skill to generate "
34+
title="OAPE Operator Feature Developer",
35+
description="Invokes the /oape:api-implement Claude Code command to generate "
2936
"controller/reconciler code from an OpenShift enhancement proposal.",
3037
version="0.1.0",
3138
)
@@ -35,7 +42,9 @@
3542
)
3643

3744
# Resolve the plugin directory (repo root) relative to this file.
38-
PLUGIN_DIR = str(Path(__file__).resolve().parent.parent)
45+
# The SDK expects the path to the plugin root (containing .claude-plugin/).
46+
PLUGIN_DIR = str(Path(__file__).resolve().parent.parent / "plugins" / "oape")
47+
print(PLUGIN_DIR)
3948

4049

4150
@app.get("/api-implement")
@@ -75,22 +84,12 @@ async def api_implement(
7584
options = ClaudeAgentOptions(
7685
system_prompt=(
7786
"You are an OpenShift operator code generation assistant. "
78-
"Execute the /oape:api-implement skill with the provided EP URL. "
79-
"Generate production-ready controller code with zero TODOs."
87+
"Execute the oape:api-implement plugin with the provided EP URL. "
8088
),
8189
cwd=working_dir,
8290
permission_mode="bypassPermissions",
83-
allowed_tools=[
84-
"Bash",
85-
"Read",
86-
"Write",
87-
"Edit",
88-
"Glob",
89-
"Grep",
90-
"WebFetch",
91-
"Task",
92-
],
93-
plugins=[PLUGIN_DIR],
91+
allowed_tools=CONFIGS['claude_allowed_tools'],
92+
plugins=[{"type": "local", "path": PLUGIN_DIR}],
9493
)
9594

9695
# --- Run the agent ---
@@ -100,6 +99,7 @@ async def api_implement(
10099
try:
101100
async for message in query(
102101
prompt=f"/oape:api-implement {ep_url}",
102+
# prompt="explain the enhancement proposal to me like I'm 5 in 10 sentences, {ep_url}",
103103
options=options,
104104
):
105105
if isinstance(message, AssistantMessage):
@@ -108,6 +108,8 @@ async def api_implement(
108108
output_parts.append(block.text)
109109
elif isinstance(message, ResultMessage):
110110
cost_usd = message.total_cost_usd
111+
if message.result:
112+
output_parts.append(message.result)
111113
except Exception as exc:
112114
raise HTTPException(
113115
status_code=500,

0 commit comments

Comments
 (0)