refactor: remove glabPath and ghPath options from providers and update related code

This commit is contained in:
Lauren ten Hoor
2026-02-09 22:33:46 +08:00
parent 7a29da4c83
commit 3a2e739a62
12 changed files with 40 additions and 75 deletions

View File

@@ -170,9 +170,7 @@ export function createProjectRegisterTool(api: OpenClawPluginApi) {
const repoPath = resolveRepoPath(repo);
// 3. Create provider and verify it works
const glabPath = (api.pluginConfig as Record<string, unknown>)?.glabPath as string | undefined;
const ghPath = (api.pluginConfig as Record<string, unknown>)?.ghPath as string | undefined;
const { provider, type: providerType } = createProvider({ glabPath, ghPath, repoPath });
const { provider, type: providerType } = createProvider({ repo });
const healthy = await provider.healthCheck();
if (!healthy) {

View File

@@ -11,7 +11,6 @@ import { type StateLabel } from "../issue-provider.js";
import { createProvider } from "../providers/index.js";
import { log as auditLog } from "../audit.js";
import { detectContext, generateGuardrails } from "../context-guard.js";
import { resolveRepoPath } from "../utils.js";
export function createQueueStatusTool(api: OpenClawPluginApi) {
return (ctx: ToolContext) => ({
@@ -69,11 +68,8 @@ export function createQueueStatusTool(api: OpenClawPluginApi) {
const project = getProject(data, pid);
if (!project) continue;
const repoPath = resolveRepoPath(project.repo);
const { provider } = createProvider({
glabPath: (api.pluginConfig as Record<string, unknown>)?.glabPath as string | undefined,
ghPath: (api.pluginConfig as Record<string, unknown>)?.ghPath as string | undefined,
repoPath,
repo: project.repo,
});
// Fetch queue counts from issue tracker

View File

@@ -11,7 +11,6 @@ import { readProjects, updateWorker, getSessionForModel } from "../projects.js";
import { type StateLabel } from "../issue-provider.js";
import { createProvider } from "../providers/index.js";
import { log as auditLog } from "../audit.js";
import { resolveRepoPath } from "../utils.js";
export function createSessionHealthTool(api: OpenClawPluginApi) {
return (ctx: ToolContext) => ({
@@ -48,11 +47,8 @@ export function createSessionHealthTool(api: OpenClawPluginApi) {
let fixesApplied = 0;
for (const [groupId, project] of Object.entries(data.projects)) {
const repoPath = resolveRepoPath(project.repo);
const { provider } = createProvider({
glabPath: (api.pluginConfig as Record<string, unknown>)?.glabPath as string | undefined,
ghPath: (api.pluginConfig as Record<string, unknown>)?.ghPath as string | undefined,
repoPath,
repo: project.repo,
});
for (const role of ["dev", "qa"] as const) {

View File

@@ -16,6 +16,7 @@ import { log as auditLog } from "../audit.js";
import { dispatchTask } from "../dispatch.js";
import { type StateLabel } from "../issue-provider.js";
import { createProvider } from "../providers/index.js";
import { resolveRepoPath } from "../utils.js";
import {
deactivateWorker,
getProject,
@@ -24,7 +25,6 @@ import {
readProjects,
} from "../projects.js";
import type { ToolContext } from "../types.js";
import { resolveRepoPath } from "../utils.js";
const execFileAsync = promisify(execFile);
@@ -105,17 +105,12 @@ export function createTaskCompleteTool(api: OpenClawPluginApi) {
);
}
const repoPath = resolveRepoPath(project.repo);
const { provider } = createProvider({
glabPath: (api.pluginConfig as Record<string, unknown>)?.glabPath as
| string
| undefined,
ghPath: (api.pluginConfig as Record<string, unknown>)?.ghPath as
| string
| undefined,
repoPath,
repo: project.repo,
});
const repoPath = resolveRepoPath(project.repo);
const output: Record<string, unknown> = {
success: true,
project: project.name,

View File

@@ -13,7 +13,6 @@ import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import { jsonResult } from "openclaw/plugin-sdk";
import type { ToolContext } from "../types.js";
import { readProjects } from "../projects.js";
import { resolveRepoPath } from "../utils.js";
import { createProvider } from "../providers/index.js";
import { log as auditLog } from "../audit.js";
import type { StateLabel } from "../issue-provider.js";
@@ -95,12 +94,8 @@ The issue is created with a state label (defaults to "Planning"). Returns the cr
}
// 2. Create provider
const repoPath = resolveRepoPath(project.repo);
const config = api.pluginConfig as Record<string, unknown> | undefined;
const { provider, type: providerType } = createProvider({
glabPath: config?.glabPath as string | undefined,
ghPath: config?.ghPath as string | undefined,
repoPath,
repo: project.repo,
});
// 3. Create the issue

View File

@@ -17,7 +17,6 @@ import { selectModel } from "../model-selector.js";
import { getProject, getWorker, readProjects } from "../projects.js";
import type { ToolContext } from "../types.js";
import { detectContext, generateGuardrails } from "../context-guard.js";
import { resolveRepoPath } from "../utils.js";
export function createTaskPickupTool(api: OpenClawPluginApi) {
return (ctx: ToolContext) => ({
@@ -96,15 +95,8 @@ export function createTaskPickupTool(api: OpenClawPluginApi) {
}
// 3. Fetch issue and verify state
const repoPath = resolveRepoPath(project.repo);
const { provider } = createProvider({
glabPath: (api.pluginConfig as Record<string, unknown>)?.glabPath as
| string
| undefined,
ghPath: (api.pluginConfig as Record<string, unknown>)?.ghPath as
| string
| undefined,
repoPath,
repo: project.repo,
});
const issue = await provider.getIssue(issueId);