@agentskit/cli 0.5.1 → 0.5.2

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.cjs CHANGED
@@ -1042,8 +1042,8 @@ var PROVIDER_ENV_KEYS = {
1042
1042
  };
1043
1043
  var PROVIDER_REACH_URLS = {
1044
1044
  openai: "https://api.openai.com/v1/models",
1045
- anthropic: "https://api.anthropic.com",
1046
- gemini: "https://generativelanguage.googleapis.com",
1045
+ anthropic: "https://api.anthropic.com/v1/messages",
1046
+ gemini: "https://generativelanguage.googleapis.com/v1beta/models",
1047
1047
  ollama: "http://localhost:11434/api/tags"
1048
1048
  };
1049
1049
  async function checkNodeVersion() {
@@ -1131,10 +1131,10 @@ async function checkProviderEnv(provider) {
1131
1131
  const value = process.env[envKey];
1132
1132
  if (!value) {
1133
1133
  return {
1134
- status: "fail",
1134
+ status: "skip",
1135
1135
  name: `${provider} API key`,
1136
- detail: `${envKey} is not set`,
1137
- fix: `export ${envKey}=...`
1136
+ detail: `${envKey} not set`,
1137
+ fix: `export ${envKey}=... (only needed if you use ${provider})`
1138
1138
  };
1139
1139
  }
1140
1140
  if (value.length < 16) {
@@ -1150,7 +1150,11 @@ async function checkProviderEnv(provider) {
1150
1150
  async function checkProviderReachable(provider, fetchImpl = fetch, timeoutMs = 4e3) {
1151
1151
  const url = PROVIDER_REACH_URLS[provider];
1152
1152
  if (!url) {
1153
- return { status: "skip", name: `${provider} reachable`, detail: "No reachability check for this provider" };
1153
+ return { status: "skip", name: `${provider} reachable`, detail: "No reachability check configured" };
1154
+ }
1155
+ const envKey = PROVIDER_ENV_KEYS[provider];
1156
+ if (envKey && !process.env[envKey]) {
1157
+ return { status: "skip", name: `${provider} reachable`, detail: "Skipped \u2014 no API key configured" };
1154
1158
  }
1155
1159
  const controller = new AbortController();
1156
1160
  const timer = setTimeout(() => controller.abort(), timeoutMs);
@@ -1158,12 +1162,18 @@ async function checkProviderReachable(provider, fetchImpl = fetch, timeoutMs = 4
1158
1162
  const res = await fetchImpl(url, {
1159
1163
  method: "GET",
1160
1164
  signal: controller.signal
1161
- // No auth — we just want to confirm DNS + network reach.
1162
1165
  });
1166
+ if (res.status >= 200 && res.status < 400) {
1167
+ return { status: "pass", name: `${provider} reachable`, detail: `${url} \u2192 ${res.status} OK` };
1168
+ }
1169
+ if (res.status === 401 || res.status === 403 || res.status === 405) {
1170
+ return { status: "pass", name: `${provider} reachable`, detail: `${url} \u2192 ${res.status} (host reachable)` };
1171
+ }
1163
1172
  return {
1164
- status: "pass",
1173
+ status: "warn",
1165
1174
  name: `${provider} reachable`,
1166
- detail: `${url} \u2192 HTTP ${res.status}`
1175
+ detail: `${url} \u2192 HTTP ${res.status}`,
1176
+ fix: "Host reachable but returned unexpected status \u2014 check provider docs"
1167
1177
  };
1168
1178
  } catch (err) {
1169
1179
  const reason = err.name === "AbortError" ? `timeout after ${timeoutMs}ms` : err.message;
@@ -1221,41 +1231,69 @@ async function runDoctor(options = {}) {
1221
1231
  };
1222
1232
  }
1223
1233
  var ICON = {
1224
- pass: "\u2713",
1225
- warn: "!",
1226
- fail: "\u2717",
1227
- skip: "\xB7"
1234
+ pass: "\u2714",
1235
+ warn: "\u26A0",
1236
+ fail: "\u2718",
1237
+ skip: "\u25CB"
1228
1238
  };
1229
1239
  function renderReport(report, opts = {}) {
1230
1240
  const color = opts.color ?? true;
1231
1241
  const c = (code, text) => color ? `\x1B[${code}m${text}\x1B[0m` : text;
1232
1242
  const colorFor = {
1233
1243
  pass: (t) => c("32", t),
1244
+ // green
1234
1245
  warn: (t) => c("33", t),
1246
+ // yellow
1235
1247
  fail: (t) => c("31", t),
1248
+ // red
1236
1249
  skip: (t) => c("90", t)
1250
+ // dim
1237
1251
  };
1238
1252
  const lines = [];
1239
1253
  lines.push("");
1240
- lines.push(c("1", "agentskit doctor"));
1254
+ lines.push(` ${c("1;36", "\u26A1 AgentsKit Doctor")}`);
1255
+ lines.push(` ${c("90", "\u2500".repeat(50))}`);
1241
1256
  lines.push("");
1257
+ const groups = {
1258
+ "Environment": [],
1259
+ "Providers": [],
1260
+ "Network": []
1261
+ };
1242
1262
  for (const r of report.results) {
1243
- const icon = colorFor[r.status](ICON[r.status]);
1244
- const name = r.name.padEnd(28);
1245
- const detail = r.detail ? c("90", r.detail) : "";
1246
- lines.push(` ${icon} ${name} ${detail}`);
1247
- if (r.fix && (r.status === "fail" || r.status === "warn")) {
1248
- lines.push(` ${c("90", "\u21B3 " + r.fix)}`);
1263
+ if (r.name.includes("reachable")) {
1264
+ groups["Network"].push(r);
1265
+ } else if (r.name.includes("API key")) {
1266
+ groups["Providers"].push(r);
1267
+ } else {
1268
+ groups["Environment"].push(r);
1249
1269
  }
1250
1270
  }
1251
- lines.push("");
1252
- const summary = [
1253
- `${report.pass} pass`,
1254
- report.warn > 0 ? colorFor.warn(`${report.warn} warn`) : `${report.warn} warn`,
1255
- report.fail > 0 ? colorFor.fail(`${report.fail} fail`) : `${report.fail} fail`,
1256
- `${report.skip} skip`
1257
- ].join(" \xB7 ");
1258
- lines.push(` ${c("1", "Summary:")} ${summary}`);
1271
+ for (const [group, results] of Object.entries(groups)) {
1272
+ if (results.length === 0) continue;
1273
+ lines.push(` ${c("1", group)}`);
1274
+ for (const r of results) {
1275
+ const icon = colorFor[r.status](ICON[r.status]);
1276
+ const name = r.name.padEnd(28);
1277
+ const detail = r.detail ? c("90", r.detail) : "";
1278
+ lines.push(` ${icon} ${name} ${detail}`);
1279
+ if (r.fix && r.status !== "pass") {
1280
+ lines.push(` ${c("90", "\u21B3 " + r.fix)}`);
1281
+ }
1282
+ }
1283
+ lines.push("");
1284
+ }
1285
+ lines.push(` ${c("90", "\u2500".repeat(50))}`);
1286
+ const parts = [];
1287
+ if (report.pass > 0) parts.push(colorFor.pass(`${report.pass} passed`));
1288
+ if (report.warn > 0) parts.push(colorFor.warn(`${report.warn} warnings`));
1289
+ if (report.fail > 0) parts.push(colorFor.fail(`${report.fail} failed`));
1290
+ if (report.skip > 0) parts.push(colorFor.skip(`${report.skip} skipped`));
1291
+ lines.push(` ${parts.join(" \xB7 ")}`);
1292
+ if (report.fail === 0) {
1293
+ lines.push(` ${c("32", "\u2714 Ready to build agents.")}`);
1294
+ } else {
1295
+ lines.push(` ${c("31", "\u2718 Fix the issues above before continuing.")}`);
1296
+ }
1259
1297
  lines.push("");
1260
1298
  return lines.join("\n");
1261
1299
  }