@simonfestl/husky-cli 1.15.0 ā 1.15.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/lib/permissions.js +28 -1
- package/package.json +1 -1
package/dist/lib/permissions.js
CHANGED
|
@@ -13,6 +13,25 @@ import { ExplainTopic } from "./error-hints.js";
|
|
|
13
13
|
export function checkPermission(permission) {
|
|
14
14
|
return hasPermission(permission);
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Permission-specific hints for workers
|
|
18
|
+
*/
|
|
19
|
+
const workerPermissionHints = {
|
|
20
|
+
"task:done": [
|
|
21
|
+
"",
|
|
22
|
+
"š” As a worker, you cannot mark tasks as done directly.",
|
|
23
|
+
" Instead, submit your work for review:",
|
|
24
|
+
"",
|
|
25
|
+
" 1. Set the task to review status:",
|
|
26
|
+
" husky task update <id> --status review",
|
|
27
|
+
"",
|
|
28
|
+
" 2. Or notify the supervisor:",
|
|
29
|
+
" husky task message <id> -m \"Ready for review. PR: <url>\"",
|
|
30
|
+
"",
|
|
31
|
+
" The supervisor will review your work and either forward it to",
|
|
32
|
+
" the review agent or get back to you with feedback.",
|
|
33
|
+
],
|
|
34
|
+
};
|
|
16
35
|
/**
|
|
17
36
|
* Require a specific permission, exit with error if not granted.
|
|
18
37
|
* Use this at the start of command handlers to enforce RBAC.
|
|
@@ -28,7 +47,15 @@ export function requirePermission(permission) {
|
|
|
28
47
|
else {
|
|
29
48
|
console.error("Run 'husky config test' to refresh your role and permissions.");
|
|
30
49
|
}
|
|
31
|
-
|
|
50
|
+
// Show role-specific hints for certain permissions
|
|
51
|
+
if (role === "worker" && workerPermissionHints[permission]) {
|
|
52
|
+
for (const line of workerPermissionHints[permission]) {
|
|
53
|
+
console.error(line);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
console.error(`\nš” For configuration help: husky explain ${ExplainTopic.CONFIG}`);
|
|
58
|
+
}
|
|
32
59
|
process.exit(1);
|
|
33
60
|
}
|
|
34
61
|
}
|