@simonfestl/husky-cli 1.20.1 → 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 +23 -0
- 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
|
*/
|
|
@@ -732,6 +741,13 @@ worktreeCommand
|
|
|
732
741
|
.option("--json", "Output as JSON")
|
|
733
742
|
.action(async (sessionName, options) => {
|
|
734
743
|
try {
|
|
744
|
+
// Worker role cannot push - must submit for review
|
|
745
|
+
if (isWorkerRole()) {
|
|
746
|
+
console.error("Error: Workers cannot push directly.");
|
|
747
|
+
console.error("Submit for review instead: husky task update <id> --status review");
|
|
748
|
+
console.error("The Reviewer agent will push and create the PR.");
|
|
749
|
+
process.exit(1);
|
|
750
|
+
}
|
|
735
751
|
const manager = getManager(options);
|
|
736
752
|
const info = manager.getWorktree(sessionName);
|
|
737
753
|
if (!info) {
|
|
@@ -763,6 +779,13 @@ worktreeCommand
|
|
|
763
779
|
.option("--task-id <id>", "Task ID to update with PR URL")
|
|
764
780
|
.option("--json", "Output as JSON")
|
|
765
781
|
.action(async (sessionName, options) => {
|
|
782
|
+
// Worker role cannot create PRs - must submit for review
|
|
783
|
+
if (isWorkerRole()) {
|
|
784
|
+
console.error("Error: Workers cannot create PRs directly.");
|
|
785
|
+
console.error("Submit for review instead: husky task update <id> --status review");
|
|
786
|
+
console.error("The Reviewer agent will create the PR after code review.");
|
|
787
|
+
process.exit(1);
|
|
788
|
+
}
|
|
766
789
|
const config = getConfig();
|
|
767
790
|
try {
|
|
768
791
|
const manager = getManager(options);
|