@alfe.ai/integrations 0.0.25 → 0.0.26
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 +13 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { execFile, spawn } from "node:child_process";
|
|
2
2
|
import { promisify } from "node:util";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
|
-
import { homedir, tmpdir } from "node:os";
|
|
4
|
+
import { homedir, platform, tmpdir } from "node:os";
|
|
5
5
|
import { closeSync, cpSync, existsSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { buildConfigValidationSchema, parseManifestFile } from "@alfe.ai/integration-manifest";
|
|
7
7
|
import { createLogger } from "@auriclabs/logger";
|
|
@@ -663,6 +663,7 @@ function buildHookEnv(options, additionalEnv) {
|
|
|
663
663
|
* 3. Default → "bash"
|
|
664
664
|
*/
|
|
665
665
|
function resolveInterpreter(scriptPath) {
|
|
666
|
+
const isWindows = platform() === "win32";
|
|
666
667
|
try {
|
|
667
668
|
const fd = openSync(scriptPath, "r");
|
|
668
669
|
const buf = Buffer.alloc(256);
|
|
@@ -678,8 +679,13 @@ function resolveInterpreter(scriptPath) {
|
|
|
678
679
|
args: [...parts.slice(1), scriptPath]
|
|
679
680
|
};
|
|
680
681
|
}
|
|
682
|
+
const cmd = shebang.split(/\s+/)[0];
|
|
683
|
+
if (isWindows && cmd.startsWith("/")) return {
|
|
684
|
+
command: cmd.split("/").pop() ?? cmd,
|
|
685
|
+
args: [scriptPath]
|
|
686
|
+
};
|
|
681
687
|
return {
|
|
682
|
-
command:
|
|
688
|
+
command: cmd,
|
|
683
689
|
args: [scriptPath]
|
|
684
690
|
};
|
|
685
691
|
}
|
|
@@ -689,7 +695,7 @@ function resolveInterpreter(scriptPath) {
|
|
|
689
695
|
args: [scriptPath]
|
|
690
696
|
};
|
|
691
697
|
if (scriptPath.endsWith(".py")) return {
|
|
692
|
-
command: "python3",
|
|
698
|
+
command: isWindows ? "python" : "python3",
|
|
693
699
|
args: [scriptPath]
|
|
694
700
|
};
|
|
695
701
|
return {
|
|
@@ -1064,7 +1070,7 @@ var IntegrationManager = class {
|
|
|
1064
1070
|
await applier.applyConfig(integrationId, interpolatedConfig);
|
|
1065
1071
|
configApplied = true;
|
|
1066
1072
|
}
|
|
1067
|
-
const mcpServers = manifest.mcp_servers;
|
|
1073
|
+
const mcpServers = manifest.mcp_servers ?? [];
|
|
1068
1074
|
if (mcpServers.length > 0) {
|
|
1069
1075
|
const secretEntries = this.secrets.get(integrationId);
|
|
1070
1076
|
const interpolatedServers = interpolateMcpServerEnvs(mcpServers, {
|
|
@@ -1364,11 +1370,11 @@ var IntegrationManager = class {
|
|
|
1364
1370
|
const manifestPath = join(installPath, "alfe-integration.yaml");
|
|
1365
1371
|
if (!existsSync(manifestPath)) continue;
|
|
1366
1372
|
try {
|
|
1367
|
-
const
|
|
1368
|
-
if (
|
|
1373
|
+
const commands = parseManifestFile(manifestPath).commands ?? [];
|
|
1374
|
+
if (commands.length === 0) continue;
|
|
1369
1375
|
result.push({
|
|
1370
1376
|
integrationId: entry.id,
|
|
1371
|
-
commands:
|
|
1377
|
+
commands: commands.map((cmd) => ({
|
|
1372
1378
|
name: cmd.name,
|
|
1373
1379
|
handler: cmd.handler,
|
|
1374
1380
|
resolvedPath: join(installPath, cmd.handler),
|
package/package.json
CHANGED