@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 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.0")
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.0";
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.
@@ -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, sym } from "../utils/ui.js";
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: "πŸ“‹ Search & select branches from list",
105
- hint: "type to filter, Space/Tab to toggle",
105
+ label: "πŸ“‹ Select from branch list",
106
+ hint: "Space: toggle β€’ a: select all β€’ i: invert",
106
107
  });
107
108
  options.push({
108
- value: "pattern",
109
- label: "πŸ” Filter by pattern or regex",
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 the other ${totalCount - selectedCount} branches)`,
115
- hint: "flip current selection",
114
+ label: `πŸ”„ Invert selection (i) β€” select other ${totalCount - selectedCount} branch(es)`,
116
115
  });
117
116
  options.push({
118
- value: "all",
119
- label: `🌟 Select ALL branches (${totalCount} branches)`,
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: "πŸ“‹ Search & select branches from list",
126
- hint: "type to filter, Space/Tab to toggle",
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 ALL branches (${totalCount} branches)`,
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
- const promptFn = typeof clack.autocompleteMultiselect === "function"
203
- ? clack.autocompleteMultiselect
204
- : clack.multiselect;
205
- const picked = await promptFn({
206
- message: "Select branches (type to filter, Space/Tab to toggle, Enter to confirm):",
207
- placeholder: "Type branch name or pattern…",
208
- options: allBranches.map((b) => ({
209
- value: b.name,
210
- label: `${sym.branch} ${b.name}`,
211
- hint: b.isRemote
212
- ? `remote/${b.remote} ${b.sha.slice(0, 8)}`
213
- : `local ${b.sha.slice(0, 8)}`,
214
- })),
215
- filter: (input, option) => {
216
- if (!input || !input.trim())
217
- return true;
218
- const query = input.trim().toLowerCase();
219
- const val = String(option.value).toLowerCase();
220
- if (query.startsWith("/") || query.includes("*") || query.includes("?")) {
221
- return matchesBranchPattern(val, query);
222
- }
223
- return val.includes(query);
224
- },
225
- initialValues: Array.from(selectedNames),
226
- required: false,
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samaksh/git-worker",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Safe, composable TypeScript CLI/TUI for applying reviewed file changes across many Git branches",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",