@samaksh/git-worker 0.2.0 β 0.2.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/cli/index.js +1 -1
- package/dist/services/workspace/manager.js +1 -1
- package/dist/stages/select.js +44 -50
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -7,7 +7,7 @@ const program = new Command();
|
|
|
7
7
|
program
|
|
8
8
|
.name("git-worker")
|
|
9
9
|
.description("Safe, composable CLI/TUI for applying reviewed file changes across many Git branches")
|
|
10
|
-
.version("0.2.
|
|
10
|
+
.version("0.2.1")
|
|
11
11
|
.option("-r, --repo <path>", "Repository path or remote URL (default: current directory)")
|
|
12
12
|
.option("-c, --cached", "Select from previously cloned and cached repositories")
|
|
13
13
|
.option("-b, --branch <pattern>", "Branch pattern β glob (uat/*) or regex (/uat.*/)")
|
|
@@ -6,7 +6,7 @@ import { join, resolve, normalize } from "path";
|
|
|
6
6
|
import { simpleGit, CheckRepoActions } from "simple-git";
|
|
7
7
|
import { homedir } from "os";
|
|
8
8
|
import { createHash } from "crypto";
|
|
9
|
-
const GIT_WORKER_VERSION = "0.2.
|
|
9
|
+
const GIT_WORKER_VERSION = "0.2.1";
|
|
10
10
|
const LOCK_FILE = ".git-worker-lock";
|
|
11
11
|
/**
|
|
12
12
|
* Extract a human-readable repository name from a remote URL or file path.
|
package/dist/stages/select.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ok, err } from "../core/types.js";
|
|
2
2
|
import { workspaceError, inputCancelledError } from "../core/errors.js";
|
|
3
|
-
import { clack, sectionHeader, statusLine
|
|
3
|
+
import { clack, sectionHeader, statusLine } from "../utils/ui.js";
|
|
4
|
+
import inquirer from "inquirer";
|
|
4
5
|
import chalk from "chalk";
|
|
5
6
|
/**
|
|
6
7
|
* Matches a branch name against a pattern.
|
|
@@ -101,43 +102,42 @@ export const selectTargetsStage = async (context, deps) => {
|
|
|
101
102
|
});
|
|
102
103
|
options.push({
|
|
103
104
|
value: "list",
|
|
104
|
-
label: "π
|
|
105
|
-
hint: "
|
|
105
|
+
label: "π Select from branch list",
|
|
106
|
+
hint: "Space: toggle β’ a: select all β’ i: invert",
|
|
106
107
|
});
|
|
107
108
|
options.push({
|
|
108
|
-
value: "
|
|
109
|
-
label:
|
|
110
|
-
hint: "glob (uat/*) or regex (/uat.*/)",
|
|
109
|
+
value: "all",
|
|
110
|
+
label: `π Select all (a) β all ${totalCount} branches`,
|
|
111
111
|
});
|
|
112
112
|
options.push({
|
|
113
113
|
value: "invert",
|
|
114
|
-
label: `π Invert selection (select
|
|
115
|
-
hint: "flip current selection",
|
|
114
|
+
label: `π Invert selection (i) β select other ${totalCount - selectedCount} branch(es)`,
|
|
116
115
|
});
|
|
117
116
|
options.push({
|
|
118
|
-
value: "
|
|
119
|
-
label:
|
|
117
|
+
value: "pattern",
|
|
118
|
+
label: "π Filter by pattern or regex",
|
|
119
|
+
hint: "glob (uat/*) or regex (/uat.*/)",
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
else {
|
|
123
123
|
options.push({
|
|
124
124
|
value: "list",
|
|
125
|
-
label: "π
|
|
126
|
-
hint: "
|
|
127
|
-
});
|
|
128
|
-
options.push({
|
|
129
|
-
value: "pattern",
|
|
130
|
-
label: "π Filter by pattern or regex",
|
|
131
|
-
hint: "glob (uat/*) or regex (/uat.*/)",
|
|
125
|
+
label: "π Select from branch list",
|
|
126
|
+
hint: "Space: toggle β’ a: select all β’ i: invert",
|
|
132
127
|
});
|
|
133
128
|
options.push({
|
|
134
129
|
value: "all",
|
|
135
|
-
label: `π Select
|
|
130
|
+
label: `π Select all (a) β all ${totalCount} branches`,
|
|
136
131
|
hint: "select every branch in repository",
|
|
137
132
|
});
|
|
138
133
|
options.push({
|
|
139
134
|
value: "invert",
|
|
140
|
-
label: `π Invert selection (select all ${totalCount} branches
|
|
135
|
+
label: `π Invert selection (i) β select all ${totalCount} branches`,
|
|
136
|
+
});
|
|
137
|
+
options.push({
|
|
138
|
+
value: "pattern",
|
|
139
|
+
label: "π Filter by pattern or regex",
|
|
140
|
+
hint: "glob (uat/*) or regex (/uat.*/)",
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
const previewText = selectedCount > 0
|
|
@@ -199,39 +199,33 @@ export const selectTargetsStage = async (context, deps) => {
|
|
|
199
199
|
continue;
|
|
200
200
|
}
|
|
201
201
|
if (choice === "list") {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
maxItems: 12,
|
|
228
|
-
});
|
|
229
|
-
if (clack.isCancel(picked)) {
|
|
202
|
+
try {
|
|
203
|
+
const { picked } = await inquirer.prompt([
|
|
204
|
+
{
|
|
205
|
+
type: "checkbox",
|
|
206
|
+
name: "picked",
|
|
207
|
+
message: "Select branches to process:",
|
|
208
|
+
pageSize: 15,
|
|
209
|
+
choices: allBranches.map((b) => ({
|
|
210
|
+
name: `${b.name} (${b.isRemote ? `remote/${b.remote}` : "local"} ${b.sha.slice(0, 8)})`,
|
|
211
|
+
value: b.name,
|
|
212
|
+
checked: selectedNames.has(b.name),
|
|
213
|
+
})),
|
|
214
|
+
},
|
|
215
|
+
]);
|
|
216
|
+
selectedNames = new Set(picked);
|
|
217
|
+
statusLine("ok", `Selection updated: ${selectedNames.size} branch(es) selected`);
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
catch (e) {
|
|
221
|
+
if (e.isTtyError ||
|
|
222
|
+
e.name === "ExitPromptError" ||
|
|
223
|
+
e.message?.includes("force closed") ||
|
|
224
|
+
e.message?.includes("User force closed")) {
|
|
225
|
+
return err(inputCancelledError("Branch selection cancelled"));
|
|
226
|
+
}
|
|
230
227
|
continue;
|
|
231
228
|
}
|
|
232
|
-
selectedNames = new Set(picked);
|
|
233
|
-
statusLine("ok", `Selection updated: ${selectedNames.size} branch(es) selected`);
|
|
234
|
-
continue;
|
|
235
229
|
}
|
|
236
230
|
}
|
|
237
231
|
branches = allBranches.filter((b) => selectedNames.has(b.name));
|
package/package.json
CHANGED