@simonfestl/husky-cli 1.6.0 → 1.6.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/commands/worker.js +25 -1
- package/package.json +1 -1
package/dist/commands/worker.js
CHANGED
|
@@ -9,9 +9,28 @@ workerCommand
|
|
|
9
9
|
.description("Show current worker identity")
|
|
10
10
|
.option("--json", "Output as JSON")
|
|
11
11
|
.action(async (options) => {
|
|
12
|
+
const config = getConfig();
|
|
12
13
|
const identity = getWorkerIdentity();
|
|
14
|
+
// Fetch role from API
|
|
15
|
+
let role = "unknown";
|
|
16
|
+
let permissions = [];
|
|
17
|
+
if (config.apiUrl && config.apiKey) {
|
|
18
|
+
try {
|
|
19
|
+
const res = await fetch(`${config.apiUrl}/api/auth/whoami`, {
|
|
20
|
+
headers: { "x-api-key": config.apiKey },
|
|
21
|
+
});
|
|
22
|
+
if (res.ok) {
|
|
23
|
+
const data = await res.json();
|
|
24
|
+
role = data.role || "unknown";
|
|
25
|
+
permissions = data.permissions || [];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// Silently fail - role will show as "unknown"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
13
32
|
if (options.json) {
|
|
14
|
-
console.log(JSON.stringify(identity, null, 2));
|
|
33
|
+
console.log(JSON.stringify({ ...identity, role, permissions }, null, 2));
|
|
15
34
|
}
|
|
16
35
|
else {
|
|
17
36
|
console.log("\n Worker Identity");
|
|
@@ -22,6 +41,11 @@ workerCommand
|
|
|
22
41
|
console.log(` User: ${identity.username}`);
|
|
23
42
|
console.log(` Platform: ${identity.platform}`);
|
|
24
43
|
console.log(` Version: ${identity.agentVersion}`);
|
|
44
|
+
console.log(" " + "─".repeat(40));
|
|
45
|
+
console.log(` Role: ${role}`);
|
|
46
|
+
if (permissions.length > 0) {
|
|
47
|
+
console.log(` Perms: ${permissions.join(", ")}`);
|
|
48
|
+
}
|
|
25
49
|
console.log("");
|
|
26
50
|
}
|
|
27
51
|
});
|