@learnrudi/cli 1.3.0 → 1.4.0
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 +75 -19
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -199,6 +199,16 @@ __export(src_exports, {
|
|
|
199
199
|
searchPackages: () => searchPackages,
|
|
200
200
|
verifyHash: () => verifyHash
|
|
201
201
|
});
|
|
202
|
+
function getLocalRegistryPaths() {
|
|
203
|
+
if (process.env.USE_LOCAL_REGISTRY !== "true") {
|
|
204
|
+
return [];
|
|
205
|
+
}
|
|
206
|
+
return [
|
|
207
|
+
import_path2.default.join(process.cwd(), "registry", "index.json"),
|
|
208
|
+
import_path2.default.join(process.cwd(), "..", "registry", "index.json"),
|
|
209
|
+
"/Users/hoff/dev/RUDI/registry/index.json"
|
|
210
|
+
];
|
|
211
|
+
}
|
|
202
212
|
async function fetchIndex(options = {}) {
|
|
203
213
|
const { url = DEFAULT_REGISTRY_URL, force = false } = options;
|
|
204
214
|
const localResult = getLocalIndex();
|
|
@@ -276,7 +286,7 @@ function getCacheMtime() {
|
|
|
276
286
|
}
|
|
277
287
|
}
|
|
278
288
|
function getLocalIndex() {
|
|
279
|
-
for (const localPath of
|
|
289
|
+
for (const localPath of getLocalRegistryPaths()) {
|
|
280
290
|
if (import_fs2.default.existsSync(localPath)) {
|
|
281
291
|
try {
|
|
282
292
|
const index = JSON.parse(import_fs2.default.readFileSync(localPath, "utf-8"));
|
|
@@ -367,7 +377,7 @@ function getPackageKinds() {
|
|
|
367
377
|
async function downloadPackage(pkg, destPath, options = {}) {
|
|
368
378
|
const { onProgress } = options;
|
|
369
379
|
const registryPath = pkg.path;
|
|
370
|
-
for (const basePath of
|
|
380
|
+
for (const basePath of getLocalRegistryPaths()) {
|
|
371
381
|
const registryDir = import_path2.default.dirname(basePath);
|
|
372
382
|
const pkgSourcePath = import_path2.default.join(registryDir, registryPath);
|
|
373
383
|
if (import_fs2.default.existsSync(pkgSourcePath)) {
|
|
@@ -608,7 +618,7 @@ async function extractBinaryFromPath(extractedPath, binaryPattern, destPath) {
|
|
|
608
618
|
}
|
|
609
619
|
}
|
|
610
620
|
async function loadToolManifest(toolName) {
|
|
611
|
-
for (const basePath of
|
|
621
|
+
for (const basePath of getLocalRegistryPaths()) {
|
|
612
622
|
const registryDir = import_path2.default.dirname(basePath);
|
|
613
623
|
const manifestPath = import_path2.default.join(registryDir, "catalog", "binaries", `${toolName}.json`);
|
|
614
624
|
if (import_fs2.default.existsSync(manifestPath)) {
|
|
@@ -676,7 +686,7 @@ async function copyDirectory(src, dest) {
|
|
|
676
686
|
}
|
|
677
687
|
}
|
|
678
688
|
}
|
|
679
|
-
var import_fs2, import_path2, import_crypto, DEFAULT_REGISTRY_URL, RUNTIMES_DOWNLOAD_BASE, CACHE_TTL,
|
|
689
|
+
var import_fs2, import_path2, import_crypto, DEFAULT_REGISTRY_URL, RUNTIMES_DOWNLOAD_BASE, CACHE_TTL, PACKAGE_KINDS2, KIND_PLURALS, RUNTIMES_RELEASE_VERSION;
|
|
680
690
|
var init_src2 = __esm({
|
|
681
691
|
"../packages/registry-client/src/index.js"() {
|
|
682
692
|
import_fs2 = __toESM(require("fs"), 1);
|
|
@@ -686,11 +696,6 @@ var init_src2 = __esm({
|
|
|
686
696
|
DEFAULT_REGISTRY_URL = "https://raw.githubusercontent.com/learn-rudi/registry/main/index.json";
|
|
687
697
|
RUNTIMES_DOWNLOAD_BASE = "https://github.com/learn-rudi/registry/releases/download";
|
|
688
698
|
CACHE_TTL = 24 * 60 * 60 * 1e3;
|
|
689
|
-
LOCAL_REGISTRY_PATHS = process.env.USE_LOCAL_REGISTRY === "true" ? [
|
|
690
|
-
import_path2.default.join(process.cwd(), "registry", "index.json"),
|
|
691
|
-
import_path2.default.join(process.cwd(), "..", "registry", "index.json"),
|
|
692
|
-
"/Users/hoff/dev/RUDI/registry/index.json"
|
|
693
|
-
] : [];
|
|
694
699
|
PACKAGE_KINDS2 = ["stack", "prompt", "runtime", "binary", "agent"];
|
|
695
700
|
KIND_PLURALS = {
|
|
696
701
|
binary: "binaries"
|
|
@@ -15611,6 +15616,7 @@ var import_fs5 = __toESM(require("fs"), 1);
|
|
|
15611
15616
|
var import_path5 = __toESM(require("path"), 1);
|
|
15612
15617
|
var import_child_process = require("child_process");
|
|
15613
15618
|
init_src();
|
|
15619
|
+
init_src2();
|
|
15614
15620
|
function checkRuntime(runtime) {
|
|
15615
15621
|
const name = runtime.replace(/^runtime:/, "");
|
|
15616
15622
|
const rudiPath = import_path5.default.join(PATHS.runtimes, name);
|
|
@@ -15760,16 +15766,57 @@ function getVersion(binPath, name) {
|
|
|
15760
15766
|
}
|
|
15761
15767
|
}
|
|
15762
15768
|
function getAvailableDeps() {
|
|
15763
|
-
const
|
|
15769
|
+
const installedRuntimes = scanDirectory(PATHS.runtimes);
|
|
15770
|
+
const installedBinaries = scanDirectory(PATHS.binaries);
|
|
15771
|
+
const commonRuntimes = ["node", "python", "deno", "bun"];
|
|
15772
|
+
const commonBinaries = ["ffmpeg", "ripgrep", "sqlite3", "jq", "yq", "git", "docker", "rg"];
|
|
15773
|
+
const runtimeNames = [.../* @__PURE__ */ new Set([...installedRuntimes, ...commonRuntimes])];
|
|
15774
|
+
const binaryNames = [.../* @__PURE__ */ new Set([...installedBinaries, ...commonBinaries])];
|
|
15775
|
+
const runtimes = runtimeNames.map((name) => ({
|
|
15764
15776
|
name,
|
|
15765
15777
|
...checkRuntime(name)
|
|
15766
15778
|
}));
|
|
15767
|
-
const binaries =
|
|
15779
|
+
const binaries = binaryNames.filter((name) => name !== "rg").map((name) => ({
|
|
15768
15780
|
name,
|
|
15769
15781
|
...checkBinary(name)
|
|
15770
15782
|
}));
|
|
15771
15783
|
return { runtimes, binaries };
|
|
15772
15784
|
}
|
|
15785
|
+
function scanDirectory(dir) {
|
|
15786
|
+
if (!import_fs5.default.existsSync(dir)) return [];
|
|
15787
|
+
try {
|
|
15788
|
+
return import_fs5.default.readdirSync(dir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name);
|
|
15789
|
+
} catch {
|
|
15790
|
+
return [];
|
|
15791
|
+
}
|
|
15792
|
+
}
|
|
15793
|
+
async function getAllDepsFromRegistry() {
|
|
15794
|
+
const index = await fetchIndex();
|
|
15795
|
+
const runtimes = (index.packages?.runtimes?.official || []).map((rt) => {
|
|
15796
|
+
const name = rt.id.replace(/^runtime:/, "");
|
|
15797
|
+
const check = checkRuntime(name);
|
|
15798
|
+
return {
|
|
15799
|
+
name,
|
|
15800
|
+
registryVersion: rt.version,
|
|
15801
|
+
description: rt.description,
|
|
15802
|
+
...check,
|
|
15803
|
+
status: check.available ? check.source === "rudi" ? "installed" : "system" : "available"
|
|
15804
|
+
};
|
|
15805
|
+
});
|
|
15806
|
+
const binaries = (index.packages?.binaries?.official || []).map((bin) => {
|
|
15807
|
+
const name = bin.id.replace(/^binary:/, "");
|
|
15808
|
+
const check = checkBinary(name);
|
|
15809
|
+
return {
|
|
15810
|
+
name,
|
|
15811
|
+
registryVersion: bin.version,
|
|
15812
|
+
description: bin.description,
|
|
15813
|
+
managed: bin.managed !== false,
|
|
15814
|
+
...check,
|
|
15815
|
+
status: check.available ? check.source === "rudi" ? "installed" : "system" : "available"
|
|
15816
|
+
};
|
|
15817
|
+
});
|
|
15818
|
+
return { runtimes, binaries };
|
|
15819
|
+
}
|
|
15773
15820
|
|
|
15774
15821
|
// src/commands/search.js
|
|
15775
15822
|
function pluralizeKind(kind) {
|
|
@@ -17479,7 +17526,7 @@ CREATE TABLE IF NOT EXISTS sessions (
|
|
|
17479
17526
|
project_id TEXT,
|
|
17480
17527
|
|
|
17481
17528
|
-- Origin tracking
|
|
17482
|
-
origin TEXT NOT NULL CHECK (origin IN ('
|
|
17529
|
+
origin TEXT NOT NULL CHECK (origin IN ('rudi', 'provider-import', 'mixed')),
|
|
17483
17530
|
origin_imported_at TEXT,
|
|
17484
17531
|
origin_native_file TEXT,
|
|
17485
17532
|
|
|
@@ -18978,20 +19025,29 @@ async function cmdDoctor(args, flags) {
|
|
|
18978
19025
|
}
|
|
18979
19026
|
console.log("\n\u2699\uFE0F Runtimes");
|
|
18980
19027
|
try {
|
|
18981
|
-
const { runtimes, binaries } = getAvailableDeps();
|
|
19028
|
+
const { runtimes, binaries } = flags.all ? await getAllDepsFromRegistry() : getAvailableDeps();
|
|
18982
19029
|
for (const rt of runtimes) {
|
|
18983
19030
|
const icon = rt.available ? "\u2713" : "\u25CB";
|
|
18984
19031
|
const version = rt.version ? `v${rt.version}` : "";
|
|
18985
|
-
const source = rt.
|
|
19032
|
+
const source = rt.available ? `(${rt.source})` : flags.all ? "available" : "not found";
|
|
18986
19033
|
console.log(` ${icon} ${rt.name}: ${version} ${source}`);
|
|
18987
19034
|
}
|
|
18988
19035
|
console.log("\n\u{1F527} Binaries");
|
|
18989
19036
|
for (const bin of binaries) {
|
|
18990
19037
|
const icon = bin.available ? "\u2713" : "\u25CB";
|
|
18991
19038
|
const version = bin.version ? `v${bin.version}` : "";
|
|
18992
|
-
const
|
|
19039
|
+
const managed = bin.managed === false ? " (external)" : "";
|
|
19040
|
+
const source = bin.available ? `(${bin.source})` : flags.all ? `available${managed}` : "not found";
|
|
18993
19041
|
console.log(` ${icon} ${bin.name}: ${version} ${source}`);
|
|
18994
19042
|
}
|
|
19043
|
+
if (flags.all) {
|
|
19044
|
+
const availableRuntimes = runtimes.filter((r) => !r.available).length;
|
|
19045
|
+
const availableBinaries = binaries.filter((b) => !b.available && b.managed !== false).length;
|
|
19046
|
+
if (availableRuntimes + availableBinaries > 0) {
|
|
19047
|
+
console.log(`
|
|
19048
|
+
Install with: rudi install runtime:<name> or rudi install binary:<name>`);
|
|
19049
|
+
}
|
|
19050
|
+
}
|
|
18995
19051
|
} catch (error) {
|
|
18996
19052
|
console.log(` \u2717 Error checking dependencies: ${error.message}`);
|
|
18997
19053
|
}
|
|
@@ -19170,13 +19226,13 @@ var import_better_sqlite32 = __toESM(require("better-sqlite3"), 1);
|
|
|
19170
19226
|
var import_path14 = __toESM(require("path"), 1);
|
|
19171
19227
|
var import_os4 = __toESM(require("os"), 1);
|
|
19172
19228
|
var import_fs15 = __toESM(require("fs"), 1);
|
|
19173
|
-
var
|
|
19174
|
-
var DB_PATH2 = import_path14.default.join(
|
|
19229
|
+
var RUDI_HOME2 = import_path14.default.join(import_os4.default.homedir(), ".rudi");
|
|
19230
|
+
var DB_PATH2 = import_path14.default.join(RUDI_HOME2, "rudi.db");
|
|
19175
19231
|
var db2 = null;
|
|
19176
19232
|
function getDb2(options = {}) {
|
|
19177
19233
|
if (!db2) {
|
|
19178
|
-
if (!import_fs15.default.existsSync(
|
|
19179
|
-
import_fs15.default.mkdirSync(
|
|
19234
|
+
if (!import_fs15.default.existsSync(RUDI_HOME2)) {
|
|
19235
|
+
import_fs15.default.mkdirSync(RUDI_HOME2, { recursive: true });
|
|
19180
19236
|
}
|
|
19181
19237
|
db2 = new import_better_sqlite32.default(DB_PATH2, {
|
|
19182
19238
|
readonly: options.readonly || false
|