@simonfestl/husky-cli 1.6.0 → 1.6.2

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.
@@ -9,9 +9,30 @@ 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, fallback to cached config
15
+ let role = config.role || "unknown";
16
+ let permissions = config.permissions || [];
17
+ let roleSource = "cached";
18
+ if (config.apiUrl && config.apiKey) {
19
+ try {
20
+ const res = await fetch(`${config.apiUrl}/api/auth/whoami`, {
21
+ headers: { "x-api-key": config.apiKey },
22
+ });
23
+ if (res.ok) {
24
+ const data = await res.json();
25
+ role = data.role || role;
26
+ permissions = data.permissions || permissions;
27
+ roleSource = "api";
28
+ }
29
+ }
30
+ catch {
31
+ // Fallback to cached role from config
32
+ }
33
+ }
13
34
  if (options.json) {
14
- console.log(JSON.stringify(identity, null, 2));
35
+ console.log(JSON.stringify({ ...identity, role, permissions, roleSource }, null, 2));
15
36
  }
16
37
  else {
17
38
  console.log("\n Worker Identity");
@@ -22,6 +43,11 @@ workerCommand
22
43
  console.log(` User: ${identity.username}`);
23
44
  console.log(` Platform: ${identity.platform}`);
24
45
  console.log(` Version: ${identity.agentVersion}`);
46
+ console.log(" " + "─".repeat(40));
47
+ console.log(` Role: ${role}${roleSource === "cached" ? " (cached)" : ""}`);
48
+ if (permissions.length > 0) {
49
+ console.log(` Perms: ${permissions.join(", ")}`);
50
+ }
25
51
  console.log("");
26
52
  }
27
53
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simonfestl/husky-cli",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "description": "CLI for Huskyv0 Task Orchestration with Claude Agent SDK",
5
5
  "type": "module",
6
6
  "bin": {