first commit
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
plugins { id("java-library-conventions") }
|
||||
dependencies {
|
||||
implementation(project(":gateway-module-tool-registry:tool-registry-contract-subjects"))
|
||||
implementation("org.springframework.boot:spring-boot-starter")
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package net.bquarkz.ai.gateway.providers.database;
|
||||
|
||||
import net.bquarkz.ai.gateway.tools.contracts.ToolProvider;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class DatabaseExecuteScriptProvider implements ToolProvider {
|
||||
@Override
|
||||
public String getName() { return "db.executeScript"; }
|
||||
|
||||
@Override
|
||||
public String getDescription() { return "Execute an arbitrary database script"; }
|
||||
|
||||
@Override
|
||||
public List<String> getActions() { return List.of("execute"); }
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getInputSchema() {
|
||||
return Map.of(
|
||||
"type", "object",
|
||||
"properties", Map.of(
|
||||
"script", Map.of("type", "string", "description", "SQL script to execute")
|
||||
),
|
||||
"required", List.of("script")
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(String action, Map<String, Object> arguments) {
|
||||
return Map.of("status", "executed");
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package net.bquarkz.ai.gateway.providers.database;
|
||||
|
||||
import net.bquarkz.ai.gateway.tools.contracts.ToolProvider;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class DatabaseQueryReadonlyProvider implements ToolProvider {
|
||||
@Override
|
||||
public String getName() { return "db.queryReadonly"; }
|
||||
|
||||
@Override
|
||||
public String getDescription() { return "Execute a read-only database query"; }
|
||||
|
||||
@Override
|
||||
public List<String> getActions() { return List.of("query"); }
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getInputSchema() {
|
||||
return Map.of(
|
||||
"type", "object",
|
||||
"properties", Map.of(
|
||||
"sql", Map.of("type", "string", "description", "SQL query to execute")
|
||||
),
|
||||
"required", List.of("sql")
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(String action, Map<String, Object> arguments) {
|
||||
return Map.of(
|
||||
"rows", List.of(Map.of("id", 1, "name", "test")),
|
||||
"count", 1
|
||||
);
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package net.bquarkz.ai.gateway.providers.database;
|
||||
|
||||
import net.bquarkz.ai.gateway.tools.contracts.ToolProvider;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class DatabaseRunLiquibaseProvider implements ToolProvider {
|
||||
@Override
|
||||
public String getName() { return "db.runLiquibase"; }
|
||||
|
||||
@Override
|
||||
public String getDescription() { return "Run a Liquibase changelog migration"; }
|
||||
|
||||
@Override
|
||||
public List<String> getActions() { return List.of("migrate"); }
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getInputSchema() {
|
||||
return Map.of(
|
||||
"type", "object",
|
||||
"properties", Map.of(
|
||||
"changelog", Map.of("type", "string", "description", "Changelog file to apply")
|
||||
),
|
||||
"required", List.of("changelog")
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(String action, Map<String, Object> arguments) {
|
||||
return Map.of(
|
||||
"status", "migration applied",
|
||||
"changelog", arguments.getOrDefault("changelog", "unknown")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
plugins { id("java-library-conventions") }
|
||||
dependencies {
|
||||
implementation(project(":gateway-module-tool-registry:tool-registry-contract-subjects"))
|
||||
implementation("org.springframework.boot:spring-boot-starter")
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package net.bquarkz.ai.gateway.providers.jenkins;
|
||||
|
||||
import net.bquarkz.ai.gateway.tools.contracts.ToolProvider;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class JenkinsDeployProvider implements ToolProvider {
|
||||
@Override
|
||||
public String getName() { return "jenkins.deploy"; }
|
||||
|
||||
@Override
|
||||
public String getDescription() { return "Trigger a Jenkins deployment"; }
|
||||
|
||||
@Override
|
||||
public List<String> getActions() { return List.of("deploy"); }
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getInputSchema() {
|
||||
return Map.of(
|
||||
"type", "object",
|
||||
"properties", Map.of(
|
||||
"env", Map.of("type", "string", "description", "Target environment"),
|
||||
"branch", Map.of("type", "string", "description", "Branch to deploy")
|
||||
),
|
||||
"required", List.of("env", "branch")
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(String action, Map<String, Object> arguments) {
|
||||
return Map.of(
|
||||
"status", "deploy triggered",
|
||||
"jobId", "jenkins-42",
|
||||
"env", arguments.getOrDefault("env", "staging"),
|
||||
"branch", arguments.getOrDefault("branch", "main")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
plugins { id("java-library-conventions") }
|
||||
dependencies {
|
||||
implementation(project(":gateway-module-tool-registry:tool-registry-contract-subjects"))
|
||||
implementation("org.springframework.boot:spring-boot-starter")
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package net.bquarkz.ai.gateway.providers.jira;
|
||||
|
||||
import net.bquarkz.ai.gateway.tools.contracts.ToolProvider;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class JiraCreateTicketProvider implements ToolProvider {
|
||||
@Override
|
||||
public String getName() { return "jira.createTicket"; }
|
||||
|
||||
@Override
|
||||
public String getDescription() { return "Create a new Jira ticket"; }
|
||||
|
||||
@Override
|
||||
public List<String> getActions() { return List.of("create"); }
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getInputSchema() {
|
||||
return Map.of(
|
||||
"type", "object",
|
||||
"properties", Map.of(
|
||||
"project", Map.of("type", "string", "description", "Project key"),
|
||||
"summary", Map.of("type", "string", "description", "Ticket summary")
|
||||
),
|
||||
"required", List.of("project", "summary")
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(String action, Map<String, Object> arguments) {
|
||||
return Map.of(
|
||||
"key", "VSW-9999",
|
||||
"created", true,
|
||||
"project", arguments.getOrDefault("project", "UNKNOWN"),
|
||||
"summary", arguments.getOrDefault("summary", "New ticket")
|
||||
);
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package net.bquarkz.ai.gateway.providers.jira;
|
||||
|
||||
import net.bquarkz.ai.gateway.tools.contracts.ToolProvider;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class JiraGetTicketProvider implements ToolProvider {
|
||||
@Override
|
||||
public String getName() { return "jira.getTicket"; }
|
||||
|
||||
@Override
|
||||
public String getDescription() { return "Retrieve a Jira ticket by key"; }
|
||||
|
||||
@Override
|
||||
public List<String> getActions() { return List.of("get"); }
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getInputSchema() {
|
||||
return Map.of(
|
||||
"type", "object",
|
||||
"properties", Map.of(
|
||||
"ticket_key", Map.of("type", "string", "description", "Jira ticket key (e.g. VSW-1234)")
|
||||
),
|
||||
"required", List.of("ticket_key")
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(String action, Map<String, Object> arguments) {
|
||||
return Map.of(
|
||||
"key", arguments.getOrDefault("ticket_key", "VSW-1234"),
|
||||
"summary", "Mock ticket — implement gateway policy engine",
|
||||
"status", "Open",
|
||||
"assignee", "claude-agent"
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user