@simonfestl/husky-cli 1.20.0 → 1.21.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/commands/config.js +5 -3
- package/dist/commands/worktree.js +17 -0
- package/package.json +1 -1
package/dist/commands/config.js
CHANGED
|
@@ -77,11 +77,13 @@ export async function fetchAndCacheRole() {
|
|
|
77
77
|
// Session is active - fetch permissions for this session role if needed
|
|
78
78
|
// Check if we have fresh permissions for this session
|
|
79
79
|
const needsPermissionsFetch = !config.roleLastChecked || !config.permissions;
|
|
80
|
-
if (needsPermissionsFetch && config.apiUrl) {
|
|
80
|
+
if (needsPermissionsFetch && config.apiUrl && config.apiKey) {
|
|
81
81
|
try {
|
|
82
|
-
|
|
82
|
+
// Fetch permissions for the session role using API key
|
|
83
|
+
// (Bearer tokens are not accepted by /api/auth/whoami)
|
|
84
|
+
const url = new URL(`/api/auth/permissions/${encodeURIComponent(config.sessionRole)}`, config.apiUrl);
|
|
83
85
|
const res = await fetch(url.toString(), {
|
|
84
|
-
headers: {
|
|
86
|
+
headers: { "x-api-key": config.apiKey },
|
|
85
87
|
});
|
|
86
88
|
if (res.ok) {
|
|
87
89
|
const data = await res.json();
|
|
@@ -732,6 +732,15 @@ worktreeCommand
|
|
|
732
732
|
.option("--json", "Output as JSON")
|
|
733
733
|
.action(async (sessionName, options) => {
|
|
734
734
|
try {
|
|
735
|
+
// Worker role cannot push - must submit for review
|
|
736
|
+
const config = getConfig();
|
|
737
|
+
const role = config.sessionRole || config.role || "";
|
|
738
|
+
if (role === "worker") {
|
|
739
|
+
console.error("Error: Workers cannot push directly.");
|
|
740
|
+
console.error("Submit for review instead: husky task update <id> --status review");
|
|
741
|
+
console.error("The Reviewer agent will push and create the PR.");
|
|
742
|
+
process.exit(1);
|
|
743
|
+
}
|
|
735
744
|
const manager = getManager(options);
|
|
736
745
|
const info = manager.getWorktree(sessionName);
|
|
737
746
|
if (!info) {
|
|
@@ -764,6 +773,14 @@ worktreeCommand
|
|
|
764
773
|
.option("--json", "Output as JSON")
|
|
765
774
|
.action(async (sessionName, options) => {
|
|
766
775
|
const config = getConfig();
|
|
776
|
+
// Worker role cannot create PRs - must submit for review
|
|
777
|
+
const role = config.sessionRole || config.role || "";
|
|
778
|
+
if (role === "worker") {
|
|
779
|
+
console.error("Error: Workers cannot create PRs directly.");
|
|
780
|
+
console.error("Submit for review instead: husky task update <id> --status review");
|
|
781
|
+
console.error("The Reviewer agent will create the PR after code review.");
|
|
782
|
+
process.exit(1);
|
|
783
|
+
}
|
|
767
784
|
try {
|
|
768
785
|
const manager = getManager(options);
|
|
769
786
|
const info = manager.getWorktree(sessionName);
|