@hasna/connectors 0.5.4 → 0.5.5

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 (3) hide show
  1. package/bin/index.js +106 -30
  2. package/bin/mcp.js +1 -1
  3. package/package.json +1 -1
package/bin/index.js CHANGED
@@ -7281,7 +7281,7 @@ var PRESETS = {
7281
7281
  commerce: { description: "Commerce and finance", connectors: ["stripe", "shopify", "revolut", "mercury", "pandadoc"] }
7282
7282
  };
7283
7283
  var program2 = new Command;
7284
- program2.name("connectors").description("Install API connectors for your project").version("0.5.4").enablePositionalOptions();
7284
+ program2.name("connectors").description("Install API connectors for your project").version("0.5.5").enablePositionalOptions();
7285
7285
  program2.command("interactive", { isDefault: true }).alias("i").description("Interactive connector browser").action(() => {
7286
7286
  if (!isTTY) {
7287
7287
  console.log(`Non-interactive environment detected. Use a subcommand:
@@ -7867,19 +7867,21 @@ Updating ${toUpdate.length} connector(s)...
7867
7867
  }
7868
7868
  process.exit(results.every((r) => r.success) ? 0 : 1);
7869
7869
  });
7870
- program2.command("status").option("--json", "Output as JSON", false).description("Show auth status of installed connectors").action((options) => {
7870
+ program2.command("status").option("--json", "Output as JSON", false).description("Show auth status of all configured connectors (project + global)").action((options) => {
7871
7871
  const installed = getInstalledConnectors();
7872
- if (installed.length === 0) {
7873
- if (options.json) {
7874
- console.log(JSON.stringify([]));
7875
- } else {
7876
- console.log(chalk2.dim("No connectors installed. Run: connectors install <name>"));
7877
- }
7878
- return;
7879
- }
7880
- const statuses = installed.map((name) => {
7881
- const meta = getConnector(name);
7872
+ const configDir = join6(homedir3(), ".connectors");
7873
+ const seen = new Set;
7874
+ const allStatuses = [];
7875
+ function buildStatusEntry(name, source) {
7882
7876
  const auth = getAuthStatus(name);
7877
+ const connectorName = name.startsWith("connect-") ? name : `connect-${name}`;
7878
+ const currentProfileFile = join6(configDir, connectorName, "current_profile");
7879
+ let profile = "default";
7880
+ if (existsSync6(currentProfileFile)) {
7881
+ try {
7882
+ profile = readFileSync5(currentProfileFile, "utf-8").trim() || "default";
7883
+ } catch {}
7884
+ }
7883
7885
  let expiryLabel = null;
7884
7886
  let expired = false;
7885
7887
  if (auth.type === "oauth" && auth.tokenExpiry) {
@@ -7899,43 +7901,117 @@ program2.command("status").option("--json", "Output as JSON", false).description
7899
7901
  }
7900
7902
  return {
7901
7903
  name,
7902
- category: meta?.category || "Unknown",
7903
7904
  authType: auth.type,
7904
7905
  configured: auth.configured,
7906
+ profile,
7905
7907
  expired,
7906
7908
  expiryLabel,
7907
7909
  tokenExpiry: auth.tokenExpiry || null,
7908
- hasRefreshToken: auth.hasRefreshToken || false
7910
+ hasRefreshToken: auth.hasRefreshToken || false,
7911
+ source
7909
7912
  };
7910
- });
7913
+ }
7914
+ for (const name of installed) {
7915
+ seen.add(name);
7916
+ allStatuses.push(buildStatusEntry(name, "project"));
7917
+ }
7918
+ if (existsSync6(configDir)) {
7919
+ try {
7920
+ const globalDirs = readdirSync4(configDir).filter((f) => {
7921
+ if (!f.startsWith("connect-"))
7922
+ return false;
7923
+ try {
7924
+ return statSync3(join6(configDir, f)).isDirectory();
7925
+ } catch {
7926
+ return false;
7927
+ }
7928
+ });
7929
+ for (const dir of globalDirs) {
7930
+ const name = dir.replace("connect-", "");
7931
+ if (seen.has(name))
7932
+ continue;
7933
+ seen.add(name);
7934
+ allStatuses.push(buildStatusEntry(name, "global"));
7935
+ }
7936
+ } catch {}
7937
+ }
7938
+ if (allStatuses.length === 0) {
7939
+ if (options.json) {
7940
+ console.log(JSON.stringify({ configured: [], unconfigured: [], summary: { total: 0, configured: 0, unconfigured: 0 } }, null, 2));
7941
+ } else {
7942
+ console.log(chalk2.dim("No connectors found. Run: connectors install <name>"));
7943
+ }
7944
+ return;
7945
+ }
7946
+ const configuredList = allStatuses.filter((s) => s.configured);
7947
+ const unconfiguredList = allStatuses.filter((s) => !s.configured);
7911
7948
  if (options.json) {
7912
- console.log(JSON.stringify(statuses, null, 2));
7949
+ console.log(JSON.stringify({
7950
+ configured: configuredList,
7951
+ unconfigured: unconfiguredList,
7952
+ summary: {
7953
+ total: allStatuses.length,
7954
+ configured: configuredList.length,
7955
+ unconfigured: unconfiguredList.length
7956
+ }
7957
+ }, null, 2));
7913
7958
  return;
7914
7959
  }
7915
- const nameWidth = Math.max(6, ...statuses.map((s) => s.name.length)) + 2;
7916
- const catWidth = Math.max(10, ...statuses.map((s) => s.category.length)) + 2;
7960
+ const nameWidth = Math.max(6, ...allStatuses.map((s) => s.name.length)) + 2;
7917
7961
  const authWidth = 10;
7918
- console.log(chalk2.bold(`
7919
- Connector Status
7920
- `));
7921
- console.log(` ${chalk2.dim("Name".padEnd(nameWidth))}` + `${chalk2.dim("Category".padEnd(catWidth))}` + `${chalk2.dim("Auth Type".padEnd(authWidth))}` + `${chalk2.dim("Status")}`);
7922
- console.log(chalk2.dim(` ${"\u2500".repeat(nameWidth + catWidth + authWidth + 24)}`));
7923
- for (const s of statuses) {
7962
+ const profileWidth = Math.max(8, ...allStatuses.map((s) => s.profile.length)) + 2;
7963
+ function printRow(s) {
7924
7964
  const authTypeLabel = s.authType === "oauth" ? "OAuth" : s.authType === "apikey" ? "API Key" : "Bearer";
7925
7965
  let statusLabel;
7926
7966
  if (s.configured && s.expired) {
7927
- statusLabel = chalk2.yellow("\u26A0 Token expired");
7967
+ statusLabel = chalk2.yellow("expired");
7928
7968
  } else if (s.configured) {
7929
- statusLabel = chalk2.green("\u2713 Configured");
7969
+ statusLabel = chalk2.green("yes");
7930
7970
  } else {
7931
- statusLabel = chalk2.red("\u2717 Not configured");
7971
+ statusLabel = chalk2.red("no");
7932
7972
  }
7973
+ const profileLabel = s.profile.padEnd(profileWidth);
7933
7974
  let expiryStr = "";
7934
- if (s.expiryLabel && s.configured && !s.expired) {
7935
- expiryStr = ` ${chalk2.dim(s.expiryLabel)}`;
7975
+ if (s.authType === "oauth") {
7976
+ if (s.expired) {
7977
+ expiryStr = chalk2.yellow("Expired");
7978
+ } else if (s.expiryLabel && s.configured) {
7979
+ expiryStr = chalk2.dim(s.expiryLabel);
7980
+ } else {
7981
+ expiryStr = chalk2.dim("-");
7982
+ }
7983
+ } else {
7984
+ expiryStr = chalk2.dim("-");
7985
+ }
7986
+ const sourceLabel = s.source === "global" ? chalk2.dim(" (global)") : "";
7987
+ console.log(` ${chalk2.cyan(s.name.padEnd(nameWidth))}` + `${authTypeLabel.padEnd(authWidth)}` + `${statusLabel.padEnd(16)}` + `${profileLabel}` + `${expiryStr}${sourceLabel}`);
7988
+ }
7989
+ function printHeader() {
7990
+ console.log(` ${chalk2.dim("Name".padEnd(nameWidth))}` + `${chalk2.dim("Auth".padEnd(authWidth))}` + `${chalk2.dim("Configured".padEnd(16))}` + `${chalk2.dim("Profile".padEnd(profileWidth))}` + `${chalk2.dim("Expiry")}`);
7991
+ console.log(chalk2.dim(` ${"\u2500".repeat(nameWidth + authWidth + 16 + profileWidth + 12)}`));
7992
+ }
7993
+ console.log(chalk2.bold(`
7994
+ Connector Status
7995
+ `));
7996
+ if (configuredList.length > 0) {
7997
+ console.log(chalk2.green.bold(` Configured (${configuredList.length})
7998
+ `));
7999
+ printHeader();
8000
+ for (const s of configuredList) {
8001
+ printRow(s);
8002
+ }
8003
+ console.log();
8004
+ }
8005
+ if (unconfiguredList.length > 0) {
8006
+ console.log(chalk2.red.bold(` Unconfigured (${unconfiguredList.length})
8007
+ `));
8008
+ printHeader();
8009
+ for (const s of unconfiguredList) {
8010
+ printRow(s);
7936
8011
  }
7937
- console.log(` ${chalk2.cyan(s.name.padEnd(nameWidth))}` + `${s.category.padEnd(catWidth)}` + `${authTypeLabel.padEnd(authWidth)}` + `${statusLabel}${expiryStr}`);
8012
+ console.log();
7938
8013
  }
8014
+ console.log(chalk2.dim(` Total: ${allStatuses.length} | Configured: ${configuredList.length} | Unconfigured: ${unconfiguredList.length}`));
7939
8015
  console.log();
7940
8016
  });
7941
8017
  program2.command("doctor").option("--json", "Output as JSON", false).description("Check all installed connectors for issues and output a health report").action((options) => {
package/bin/mcp.js CHANGED
@@ -20763,7 +20763,7 @@ async function getConnectorCommandHelp(name, command) {
20763
20763
  loadConnectorVersions();
20764
20764
  var server = new McpServer({
20765
20765
  name: "connectors",
20766
- version: "0.5.4"
20766
+ version: "0.5.5"
20767
20767
  });
20768
20768
  server.registerTool("search_connectors", {
20769
20769
  title: "Search Connectors",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/connectors",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "Open source connector library - Install API connectors with a single command",
5
5
  "type": "module",
6
6
  "bin": {