@llmist/cli 8.0.0 → 8.1.1
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/cli.js +76 -10
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -79,7 +79,7 @@ import { Command, InvalidArgumentError as InvalidArgumentError2 } from "commande
|
|
|
79
79
|
// package.json
|
|
80
80
|
var package_default = {
|
|
81
81
|
name: "@llmist/cli",
|
|
82
|
-
version: "8.
|
|
82
|
+
version: "8.1.0",
|
|
83
83
|
description: "CLI for llmist - run LLM agents from the command line",
|
|
84
84
|
type: "module",
|
|
85
85
|
main: "dist/cli.js",
|
|
@@ -843,11 +843,39 @@ function isExternalPackageSpecifier(specifier) {
|
|
|
843
843
|
function parseGadgetSpecifier(specifier) {
|
|
844
844
|
if (specifier.startsWith("git+")) {
|
|
845
845
|
const url = specifier.slice(4);
|
|
846
|
-
|
|
846
|
+
let baseUrl;
|
|
847
|
+
let ref;
|
|
848
|
+
let preset;
|
|
849
|
+
if (url.includes("#")) {
|
|
850
|
+
const hashIndex = url.indexOf("#");
|
|
851
|
+
baseUrl = url.slice(0, hashIndex);
|
|
852
|
+
const refAndPreset = url.slice(hashIndex + 1);
|
|
853
|
+
if (refAndPreset.includes(":")) {
|
|
854
|
+
const colonIndex = refAndPreset.indexOf(":");
|
|
855
|
+
ref = refAndPreset.slice(0, colonIndex);
|
|
856
|
+
preset = refAndPreset.slice(colonIndex + 1);
|
|
857
|
+
} else {
|
|
858
|
+
ref = refAndPreset;
|
|
859
|
+
}
|
|
860
|
+
} else {
|
|
861
|
+
const gitExtIndex = url.indexOf(".git");
|
|
862
|
+
if (gitExtIndex !== -1) {
|
|
863
|
+
const afterGit = url.slice(gitExtIndex + 4);
|
|
864
|
+
if (afterGit.startsWith(":")) {
|
|
865
|
+
baseUrl = url.slice(0, gitExtIndex + 4);
|
|
866
|
+
preset = afterGit.slice(1);
|
|
867
|
+
} else {
|
|
868
|
+
baseUrl = url;
|
|
869
|
+
}
|
|
870
|
+
} else {
|
|
871
|
+
baseUrl = url;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
847
874
|
return {
|
|
848
875
|
type: "git",
|
|
849
876
|
package: baseUrl,
|
|
850
|
-
version: ref
|
|
877
|
+
version: ref,
|
|
878
|
+
preset
|
|
851
879
|
};
|
|
852
880
|
}
|
|
853
881
|
const npmMatch = specifier.match(
|
|
@@ -936,14 +964,18 @@ async function installGitPackage(spec, cacheDir) {
|
|
|
936
964
|
const message = error instanceof Error ? error.message : String(error);
|
|
937
965
|
throw new Error(`Failed to install dependencies for '${spec.package}': ${message}`);
|
|
938
966
|
}
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
967
|
+
const packageJson = JSON.parse(fs5.readFileSync(path4.join(cacheDir, "package.json"), "utf-8"));
|
|
968
|
+
if (packageJson.scripts?.build) {
|
|
969
|
+
try {
|
|
942
970
|
execSync("bun run build", { cwd: cacheDir, stdio: "inherit" });
|
|
971
|
+
} catch (error) {
|
|
972
|
+
const entryPoint = packageJson.llmist?.gadgets || "./dist/index.js";
|
|
973
|
+
const entryPointPath = path4.join(cacheDir, entryPoint);
|
|
974
|
+
if (!fs5.existsSync(entryPointPath)) {
|
|
975
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
976
|
+
throw new Error(`Failed to build package '${spec.package}': ${message}`);
|
|
977
|
+
}
|
|
943
978
|
}
|
|
944
|
-
} catch (error) {
|
|
945
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
946
|
-
throw new Error(`Failed to build package '${spec.package}': ${message}`);
|
|
947
979
|
}
|
|
948
980
|
}
|
|
949
981
|
}
|
|
@@ -1019,7 +1051,41 @@ async function loadExternalGadgets(specifier, forceInstall = false) {
|
|
|
1019
1051
|
const message = error instanceof Error ? error.message : String(error);
|
|
1020
1052
|
throw new Error(`Failed to import '${specifier}': ${message}`);
|
|
1021
1053
|
}
|
|
1022
|
-
let gadgets =
|
|
1054
|
+
let gadgets = [];
|
|
1055
|
+
if (manifest?.factory) {
|
|
1056
|
+
const exportsObj = exports;
|
|
1057
|
+
if (spec.preset && typeof exportsObj.createGadgetsByPreset === "function") {
|
|
1058
|
+
const result = await exportsObj.createGadgetsByPreset(
|
|
1059
|
+
spec.preset
|
|
1060
|
+
);
|
|
1061
|
+
gadgets = extractGadgetsFromModule(result);
|
|
1062
|
+
gadgetNames = null;
|
|
1063
|
+
} else if (gadgetNames && typeof exportsObj.createGadgetsByName === "function") {
|
|
1064
|
+
const result = await exportsObj.createGadgetsByName(
|
|
1065
|
+
gadgetNames
|
|
1066
|
+
);
|
|
1067
|
+
gadgets = extractGadgetsFromModule(result);
|
|
1068
|
+
gadgetNames = null;
|
|
1069
|
+
} else {
|
|
1070
|
+
const factoryNames = [
|
|
1071
|
+
"createGadgets",
|
|
1072
|
+
"createDhalsimGadgets",
|
|
1073
|
+
"createAllGadgets",
|
|
1074
|
+
"gadgets",
|
|
1075
|
+
"default"
|
|
1076
|
+
];
|
|
1077
|
+
for (const name of factoryNames) {
|
|
1078
|
+
if (typeof exportsObj[name] === "function") {
|
|
1079
|
+
const result = await exportsObj[name]();
|
|
1080
|
+
gadgets = extractGadgetsFromModule(result);
|
|
1081
|
+
if (gadgets.length > 0) break;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
if (gadgets.length === 0) {
|
|
1087
|
+
gadgets = extractGadgetsFromModule(exports);
|
|
1088
|
+
}
|
|
1023
1089
|
if (gadgetNames) {
|
|
1024
1090
|
const gadgetSet = new Set(gadgetNames.map((n) => n.toLowerCase()));
|
|
1025
1091
|
gadgets = gadgets.filter((g) => {
|