@telefonica/ai-sdlc-opencode-plugin-v1-dev 1.0.5 → 1.0.6

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.
package/dist/index.js CHANGED
@@ -130,7 +130,7 @@ function createAuthHook(flavor) {
130
130
  provider: flavor.providerID,
131
131
  async loader(auth) {
132
132
  const creds = await auth();
133
- if (!creds || creds.type !== "api") return {};
133
+ if (creds?.type !== "api") return {};
134
134
  const url = creds.metadata?.["url"];
135
135
  return {
136
136
  baseURL: url ? normalizeProviderURL(url) : void 0,
@@ -163,7 +163,7 @@ async function fromAuthFile(providerID) {
163
163
  try {
164
164
  const raw = await readFile(authFilePath(), "utf8");
165
165
  const entry = JSON.parse(raw)[providerID];
166
- if (!entry || entry.type !== "api") return {};
166
+ if (entry?.type !== "api") return {};
167
167
  return {
168
168
  apiKey: entry.key,
169
169
  baseURL: entry.metadata?.["url"]
package/dist/tui.js CHANGED
@@ -84,14 +84,16 @@ function toEntry(providerName, result) {
84
84
  //#region src/components.tsx
85
85
  function barColor(entry, theme) {
86
86
  const pct = entry.thresholdPercent ?? 0;
87
- return pct >= PLUGIN_UI.exceededPercent ? theme.error : pct >= PLUGIN_UI.warningPercent ? theme.warning : theme.success;
87
+ if (pct >= PLUGIN_UI.exceededPercent) return theme.error;
88
+ if (pct >= PLUGIN_UI.warningPercent) return theme.warning;
89
+ return theme.success;
88
90
  }
89
91
  function valuesLine(entry) {
90
92
  if (entry.error != null) return PLUGIN_COPY.usageUnavailable(entry.error);
91
93
  return PLUGIN_COPY.usageValues(entry.spend ?? 0, entry.budget ?? null);
92
94
  }
93
95
  function UsagePanel(props) {
94
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(For, {
96
+ return /* @__PURE__ */ jsx(For, {
95
97
  each: props.entries,
96
98
  children: (entry) => /* @__PURE__ */ jsxs("box", {
97
99
  flexDirection: "column",
@@ -102,7 +104,7 @@ function UsagePanel(props) {
102
104
  }),
103
105
  /* @__PURE__ */ jsx("text", {
104
106
  fg: !entry.connected || entry.error != null ? props.theme.error : void 0,
105
- children: !entry.connected ? PLUGIN_COPY.notConnected(props.connectCommand) : valuesLine(entry)
107
+ children: entry.connected ? valuesLine(entry) : PLUGIN_COPY.notConnected(props.connectCommand)
106
108
  }),
107
109
  entry.connected && entry.error == null && entry.percent != null && /* @__PURE__ */ jsx("text", {
108
110
  fg: barColor(entry, props.theme),
@@ -121,7 +123,7 @@ function UsagePanel(props) {
121
123
  })] })
122
124
  ]
123
125
  })
124
- }) });
126
+ });
125
127
  }
126
128
  //#endregion
127
129
  //#region src/tui.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telefonica/ai-sdlc-opencode-plugin-v1-dev",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "OpenCode 1.x plugin (dev environment): CDO.AI provider registration, model discovery, and budget panel",
5
5
  "type": "module",
6
6
  "exports": {