@simonfestl/husky-cli 1.21.0 → 1.21.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/worktree.js +12 -6
- package/package.json +1 -1
|
@@ -12,6 +12,15 @@ export const worktreeCommand = new Command("worktree")
|
|
|
12
12
|
function getProjectDir(options) {
|
|
13
13
|
return options.project ? path.resolve(options.project) : process.cwd();
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Check if current session has worker role.
|
|
17
|
+
* Workers have restricted permissions (cannot push/create PRs directly).
|
|
18
|
+
*/
|
|
19
|
+
function isWorkerRole() {
|
|
20
|
+
const config = getConfig();
|
|
21
|
+
const role = config.sessionRole || config.role || "";
|
|
22
|
+
return role === "worker";
|
|
23
|
+
}
|
|
15
24
|
/**
|
|
16
25
|
* Get a WorktreeManager instance.
|
|
17
26
|
*/
|
|
@@ -733,9 +742,7 @@ worktreeCommand
|
|
|
733
742
|
.action(async (sessionName, options) => {
|
|
734
743
|
try {
|
|
735
744
|
// Worker role cannot push - must submit for review
|
|
736
|
-
|
|
737
|
-
const role = config.sessionRole || config.role || "";
|
|
738
|
-
if (role === "worker") {
|
|
745
|
+
if (isWorkerRole()) {
|
|
739
746
|
console.error("Error: Workers cannot push directly.");
|
|
740
747
|
console.error("Submit for review instead: husky task update <id> --status review");
|
|
741
748
|
console.error("The Reviewer agent will push and create the PR.");
|
|
@@ -772,15 +779,14 @@ worktreeCommand
|
|
|
772
779
|
.option("--task-id <id>", "Task ID to update with PR URL")
|
|
773
780
|
.option("--json", "Output as JSON")
|
|
774
781
|
.action(async (sessionName, options) => {
|
|
775
|
-
const config = getConfig();
|
|
776
782
|
// Worker role cannot create PRs - must submit for review
|
|
777
|
-
|
|
778
|
-
if (role === "worker") {
|
|
783
|
+
if (isWorkerRole()) {
|
|
779
784
|
console.error("Error: Workers cannot create PRs directly.");
|
|
780
785
|
console.error("Submit for review instead: husky task update <id> --status review");
|
|
781
786
|
console.error("The Reviewer agent will create the PR after code review.");
|
|
782
787
|
process.exit(1);
|
|
783
788
|
}
|
|
789
|
+
const config = getConfig();
|
|
784
790
|
try {
|
|
785
791
|
const manager = getManager(options);
|
|
786
792
|
const info = manager.getWorktree(sessionName);
|