@learnrudi/cli 1.9.3 → 1.9.4
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 +46 -13
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3937,8 +3937,23 @@ function findBinary(command, kind = "binary") {
|
|
|
3937
3937
|
return { found: false, path: null, source: null };
|
|
3938
3938
|
}
|
|
3939
3939
|
function getAgentStatus(agent) {
|
|
3940
|
-
const
|
|
3941
|
-
const
|
|
3940
|
+
const rudiPath = import_path7.default.join(import_core12.PATHS.agents, agent.id, "node_modules", ".bin", agent.id);
|
|
3941
|
+
const rudiInstalled = import_fs10.default.existsSync(rudiPath);
|
|
3942
|
+
let globalPath = null;
|
|
3943
|
+
let globalInstalled = false;
|
|
3944
|
+
if (!rudiInstalled) {
|
|
3945
|
+
try {
|
|
3946
|
+
const which = (0, import_child_process7.execSync)(`which ${agent.id} 2>/dev/null`, { encoding: "utf-8" }).trim();
|
|
3947
|
+
if (which && !which.includes(".rudi/bins") && !which.includes(".rudi/shims")) {
|
|
3948
|
+
globalPath = which;
|
|
3949
|
+
globalInstalled = true;
|
|
3950
|
+
}
|
|
3951
|
+
} catch {
|
|
3952
|
+
}
|
|
3953
|
+
}
|
|
3954
|
+
const installed = rudiInstalled || globalInstalled;
|
|
3955
|
+
const activePath = rudiInstalled ? rudiPath : globalPath;
|
|
3956
|
+
const source = rudiInstalled ? "rudi" : globalInstalled ? "global" : null;
|
|
3942
3957
|
let authenticated = false;
|
|
3943
3958
|
if (agent.credentialType === "keychain") {
|
|
3944
3959
|
authenticated = checkKeychain(agent.keychainService);
|
|
@@ -3946,16 +3961,18 @@ function getAgentStatus(agent) {
|
|
|
3946
3961
|
authenticated = fileExists(agent.credentialPath);
|
|
3947
3962
|
}
|
|
3948
3963
|
let version = null;
|
|
3949
|
-
if (installed) {
|
|
3950
|
-
version = getVersion(
|
|
3964
|
+
if (installed && activePath) {
|
|
3965
|
+
version = getVersion(activePath, "--version");
|
|
3951
3966
|
}
|
|
3952
3967
|
return {
|
|
3953
3968
|
id: agent.id,
|
|
3954
3969
|
name: agent.name,
|
|
3955
3970
|
installed,
|
|
3971
|
+
source,
|
|
3972
|
+
// 'rudi' | 'global' | null
|
|
3956
3973
|
authenticated,
|
|
3957
3974
|
version,
|
|
3958
|
-
path:
|
|
3975
|
+
path: activePath,
|
|
3959
3976
|
ready: installed && authenticated
|
|
3960
3977
|
};
|
|
3961
3978
|
}
|
|
@@ -4045,10 +4062,10 @@ function printStatus(status, filter) {
|
|
|
4045
4062
|
console.log("-".repeat(50));
|
|
4046
4063
|
for (const agent of status.agents) {
|
|
4047
4064
|
const installIcon = agent.installed ? "\x1B[32m\u2713\x1B[0m" : "\x1B[31m\u2717\x1B[0m";
|
|
4048
|
-
const authIcon = agent.authenticated ? "\x1B[32m\u2713\x1B[0m" : "\x1B[33m\u25CB\x1B[0m";
|
|
4049
4065
|
const version = agent.version ? `v${agent.version}` : "";
|
|
4050
|
-
|
|
4051
|
-
console.log(`
|
|
4066
|
+
const source = agent.source ? `(${agent.source})` : "";
|
|
4067
|
+
console.log(` ${installIcon} ${agent.name} ${version} ${source}`);
|
|
4068
|
+
console.log(` Installed: ${agent.installed ? "yes" : "no"}, Auth: ${agent.authenticated ? "yes" : "no"}, Ready: ${agent.ready ? "yes" : "no"}`);
|
|
4052
4069
|
}
|
|
4053
4070
|
console.log("");
|
|
4054
4071
|
}
|
|
@@ -4183,6 +4200,8 @@ async function cmdCheck(args, flags) {
|
|
|
4183
4200
|
kind,
|
|
4184
4201
|
name,
|
|
4185
4202
|
installed: false,
|
|
4203
|
+
source: null,
|
|
4204
|
+
// 'rudi' | 'global' | null
|
|
4186
4205
|
authenticated: null,
|
|
4187
4206
|
// Only for agents
|
|
4188
4207
|
ready: false,
|
|
@@ -4191,11 +4210,25 @@ async function cmdCheck(args, flags) {
|
|
|
4191
4210
|
};
|
|
4192
4211
|
switch (kind) {
|
|
4193
4212
|
case "agent": {
|
|
4194
|
-
const
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4213
|
+
const rudiPath = import_path8.default.join(import_core13.PATHS.agents, name, "node_modules", ".bin", name);
|
|
4214
|
+
const rudiInstalled = import_fs11.default.existsSync(rudiPath);
|
|
4215
|
+
let globalPath = null;
|
|
4216
|
+
let globalInstalled = false;
|
|
4217
|
+
if (!rudiInstalled) {
|
|
4218
|
+
try {
|
|
4219
|
+
const which = (0, import_child_process8.execSync)(`which ${name} 2>/dev/null`, { encoding: "utf-8" }).trim();
|
|
4220
|
+
if (which && !which.includes(".rudi/bins") && !which.includes(".rudi/shims")) {
|
|
4221
|
+
globalPath = which;
|
|
4222
|
+
globalInstalled = true;
|
|
4223
|
+
}
|
|
4224
|
+
} catch {
|
|
4225
|
+
}
|
|
4226
|
+
}
|
|
4227
|
+
result.installed = rudiInstalled || globalInstalled;
|
|
4228
|
+
result.path = rudiInstalled ? rudiPath : globalPath;
|
|
4229
|
+
result.source = rudiInstalled ? "rudi" : globalInstalled ? "global" : null;
|
|
4230
|
+
if (result.installed && result.path) {
|
|
4231
|
+
result.version = getVersion2(result.path);
|
|
4199
4232
|
}
|
|
4200
4233
|
const cred = AGENT_CREDENTIALS[name];
|
|
4201
4234
|
if (cred) {
|