@hasna/connectors 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/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.1").enablePositionalOptions();
7284
+ program2.name("connectors").description("Install API connectors for your project").version("0.5.2").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:
@@ -8744,7 +8744,9 @@ program2.command("whoami").option("--json", "Output as JSON", false).description
8744
8744
  let configured = 0;
8745
8745
  let unconfigured = 0;
8746
8746
  const connectorDetails = [];
8747
+ const seen = new Set;
8747
8748
  for (const name of installed) {
8749
+ seen.add(name);
8748
8750
  const auth = getAuthStatus(name);
8749
8751
  if (auth.configured)
8750
8752
  configured++;
@@ -8758,7 +8760,38 @@ program2.command("whoami").option("--json", "Output as JSON", false).description
8758
8760
  profile = readFileSync5(currentProfileFile, "utf-8").trim() || "default";
8759
8761
  } catch {}
8760
8762
  }
8761
- connectorDetails.push({ name, configured: auth.configured, authType: auth.type, profile });
8763
+ connectorDetails.push({ name, configured: auth.configured, authType: auth.type, profile, source: "project" });
8764
+ }
8765
+ if (existsSync6(configDir)) {
8766
+ try {
8767
+ const globalDirs = readdirSync4(configDir).filter((f) => {
8768
+ if (!f.startsWith("connect-"))
8769
+ return false;
8770
+ try {
8771
+ return statSync3(join6(configDir, f)).isDirectory();
8772
+ } catch {
8773
+ return false;
8774
+ }
8775
+ });
8776
+ for (const dir of globalDirs) {
8777
+ const name = dir.replace("connect-", "");
8778
+ if (seen.has(name))
8779
+ continue;
8780
+ const auth = getAuthStatus(name);
8781
+ if (!auth.configured)
8782
+ continue;
8783
+ seen.add(name);
8784
+ configured++;
8785
+ const currentProfileFile = join6(configDir, dir, "current_profile");
8786
+ let profile = "default";
8787
+ if (existsSync6(currentProfileFile)) {
8788
+ try {
8789
+ profile = readFileSync5(currentProfileFile, "utf-8").trim() || "default";
8790
+ } catch {}
8791
+ }
8792
+ connectorDetails.push({ name, configured: true, authType: auth.type, profile, source: "global" });
8793
+ }
8794
+ } catch {}
8762
8795
  }
8763
8796
  if (options.json) {
8764
8797
  console.log(JSON.stringify({
@@ -8779,17 +8812,34 @@ Connectors Setup
8779
8812
  console.log(` Config: ${configDir}${existsSync6(configDir) ? "" : chalk2.dim(" (not created yet)")}`);
8780
8813
  console.log(` Installed: ${installed.length} connector${installed.length !== 1 ? "s" : ""}`);
8781
8814
  console.log(` Configured: ${chalk2.green(String(configured))} ready, ${unconfigured > 0 ? chalk2.red(String(unconfigured)) : chalk2.dim("0")} need auth`);
8782
- if (connectorDetails.length > 0) {
8815
+ const projectConnectors = connectorDetails.filter((c) => c.source === "project");
8816
+ const globalConnectors = connectorDetails.filter((c) => c.source === "global");
8817
+ if (projectConnectors.length > 0) {
8818
+ console.log(chalk2.bold(`
8819
+ Project Connectors:
8820
+ `));
8821
+ const nameWidth = Math.max(10, ...projectConnectors.map((c) => c.name.length)) + 2;
8822
+ for (const c of projectConnectors) {
8823
+ const status = c.configured ? chalk2.green("\u2713") : chalk2.red("\u2717");
8824
+ const profileLabel = c.profile !== "default" ? chalk2.dim(` [${c.profile}]`) : "";
8825
+ console.log(` ${status} ${chalk2.cyan(c.name.padEnd(nameWidth))}${c.authType.padEnd(8)}${profileLabel}`);
8826
+ }
8827
+ }
8828
+ if (globalConnectors.length > 0) {
8783
8829
  console.log(chalk2.bold(`
8784
- Connectors:
8830
+ Global Connectors`) + chalk2.dim(" (~/.connectors)") + chalk2.bold(`:
8785
8831
  `));
8786
- const nameWidth = Math.max(10, ...connectorDetails.map((c) => c.name.length)) + 2;
8787
- for (const c of connectorDetails) {
8832
+ const nameWidth = Math.max(10, ...globalConnectors.map((c) => c.name.length)) + 2;
8833
+ for (const c of globalConnectors) {
8788
8834
  const status = c.configured ? chalk2.green("\u2713") : chalk2.red("\u2717");
8789
8835
  const profileLabel = c.profile !== "default" ? chalk2.dim(` [${c.profile}]`) : "";
8790
8836
  console.log(` ${status} ${chalk2.cyan(c.name.padEnd(nameWidth))}${c.authType.padEnd(8)}${profileLabel}`);
8791
8837
  }
8792
8838
  }
8839
+ if (connectorDetails.length === 0) {
8840
+ console.log(chalk2.dim(`
8841
+ No connectors installed or configured.`));
8842
+ }
8793
8843
  console.log();
8794
8844
  });
8795
8845
  program2.command("test").argument("[connector]", "Connector to test (default: all installed)").option("--json", "Output as JSON", false).option("--timeout <ms>", "Request timeout in milliseconds", "10000").description("Verify API credentials by making a real request to the connector's API").action(async (connector, 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.1"
20766
+ version: "0.5.2"
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.1",
3
+ "version": "0.5.2",
4
4
  "description": "Open source connector library - Install API connectors with a single command",
5
5
  "type": "module",
6
6
  "bin": {