refactor(plugin): remove AI slop and clean verbose comments
This commit is contained in:
@@ -21,14 +21,12 @@ import { startTmuxCheck } from "./tools"
|
||||
let activePluginDispose: PluginDispose | null = null
|
||||
|
||||
const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||
// Initialize config context for plugin runtime (prevents warnings from hooks)
|
||||
initConfigContext("opencode", null)
|
||||
log("[OhMyOpenCodePlugin] ENTRY - plugin loading", {
|
||||
directory: ctx.directory,
|
||||
})
|
||||
logLegacyPluginStartupWarning()
|
||||
|
||||
// Detect conflicting skill plugins (e.g., opencode-skills)
|
||||
const skillPluginCheck = detectExternalSkillPlugin(ctx.directory)
|
||||
if (skillPluginCheck.detected && skillPluginCheck.pluginName) {
|
||||
console.warn(getSkillPluginConflictWarning(skillPluginCheck.pluginName))
|
||||
@@ -126,7 +124,4 @@ export type {
|
||||
BuiltinCommandName,
|
||||
} from "./config"
|
||||
|
||||
// NOTE: Do NOT export functions from main index.ts!
|
||||
// OpenCode treats ALL exports as plugin instances and calls them.
|
||||
// Config error utilities are available via "./shared/config-errors" for internal use only.
|
||||
export type { ConfigLoadError } from "./shared/config-errors"
|
||||
|
||||
@@ -38,7 +38,6 @@ export async function applyCommandConfig(params: {
|
||||
const includeClaudeCommands = params.pluginConfig.claude_code?.commands ?? true;
|
||||
const includeClaudeSkills = params.pluginConfig.claude_code?.skills ?? true;
|
||||
|
||||
// Detect conflicting skill plugins
|
||||
const externalSkillPlugin = detectExternalSkillPlugin(params.ctx.directory);
|
||||
if (includeClaudeSkills && externalSkillPlugin.detected) {
|
||||
log(getSkillPluginConflictWarning(externalSkillPlugin.pluginName!));
|
||||
|
||||
@@ -6,6 +6,10 @@ import { log } from "../shared";
|
||||
|
||||
type McpEntry = Record<string, unknown>;
|
||||
|
||||
function isDisabledMcpEntry(value: unknown): value is McpEntry & { enabled: false } {
|
||||
return typeof value === "object" && value !== null && (value as McpEntry).enabled === false;
|
||||
}
|
||||
|
||||
function captureUserDisabledMcps(
|
||||
userMcp: Record<string, unknown> | undefined
|
||||
): Set<string> {
|
||||
@@ -13,12 +17,7 @@ function captureUserDisabledMcps(
|
||||
if (!userMcp) return disabled;
|
||||
|
||||
for (const [name, value] of Object.entries(userMcp)) {
|
||||
if (
|
||||
value &&
|
||||
typeof value === "object" &&
|
||||
"enabled" in value &&
|
||||
(value as McpEntry).enabled === false
|
||||
) {
|
||||
if (isDisabledMcpEntry(value)) {
|
||||
disabled.add(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,8 +153,6 @@ export function createSessionHooks(args: {
|
||||
}
|
||||
}
|
||||
|
||||
// Model fallback hook (configurable via model_fallback config + disabled_hooks)
|
||||
// This handles automatic model switching when model errors occur
|
||||
const isModelFallbackConfigEnabled = pluginConfig.model_fallback ?? false
|
||||
const modelFallback = isModelFallbackConfigEnabled && isHookEnabled("model-fallback")
|
||||
? safeHook("model-fallback", () =>
|
||||
|
||||
@@ -41,7 +41,6 @@ export function normalizeToolArgSchemas<TDefinition extends Pick<ToolDefinition,
|
||||
return toolDefinition
|
||||
}
|
||||
|
||||
// Schema keywords unsupported by Gemini — strip them from MCP tool schemas
|
||||
const UNSUPPORTED_SCHEMA_KEYWORDS = new Set(["contentEncoding", "contentMediaType"])
|
||||
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
|
||||
@@ -126,7 +126,7 @@ describe("scheduleDeferredModelOverride", () => {
|
||||
})
|
||||
|
||||
test("should fall back to setTimeout when message never appears", async () => {
|
||||
//#given — no message inserted
|
||||
//#given no message inserted
|
||||
|
||||
//#when
|
||||
const { scheduleDeferredModelOverride } = await import("./ultrawork-db-model-override")
|
||||
|
||||
Reference in New Issue
Block a user