@herouucn/opencode-commandcode 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/plugin.ts +5 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herouucn/opencode-commandcode",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Inject Command Code API provider into opencode — access Claude, GPT, Gemini, DeepSeek, Qwen, Kimi, GLM, MiniMax & Step via unified Command Code API. / 将 Command Code API provider 注入 opencode —— 通过统一的 Command Code API 使用 Claude、GPT、Gemini、DeepSeek、Qwen、Kimi、GLM、MiniMax 和 Step 模型。",
5
5
  "keywords": [
6
6
  "ai",
package/plugin.ts CHANGED
@@ -108,13 +108,11 @@ function readBundledVersion(): string | null {
108
108
  export default async function commandcodePlugin() {
109
109
  return {
110
110
  config: async (config: Record<string, unknown>) => {
111
- if (!(config as Record<string, unknown>).provider) {
112
- (config as Record<string, unknown>).provider = { commandcode: {} };
113
- }
114
- const cc = (
115
- (config as Record<string, unknown>).provider as Record<string, Record<string, unknown>>
116
- )?.commandcode as Record<string, unknown> | undefined;
117
- if (!cc) return;
111
+ const providers = ((config as Record<string, unknown>).provider ??= {}) as Record<
112
+ string,
113
+ Record<string, unknown>
114
+ >;
115
+ const cc = (providers.commandcode ??= {}) as Record<string, unknown>;
118
116
 
119
117
  const pluginCfg = loadPluginConfig();
120
118
  const debug = pluginCfg.debugStartupLogs === true;