zapdev 0.7.0 → 0.7.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/README.md +3 -3
- package/dist/cli.js +10 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,11 +47,11 @@ Without a TTY (piped / CI), it commits automatically and only pushes when `--pus
|
|
|
47
47
|
|
|
48
48
|
### `zapdev reset`
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
Operates on a git repo, or — when the path is a plain directory — on its **direct child** repos (level 1, non-recursive). For each one: `git fetch --prune`, switch to a branch (chosen interactively, or forced with `--principal` / `--target`), then permanently delete every other local branch and every linked worktree. The principal branch (from `origin/HEAD`) and the branch you switched to are always kept. Ends with an optional `pull`.
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
zapdev reset # child repos of the current directory
|
|
54
|
-
zapdev reset ~/dev # child repos of a
|
|
53
|
+
zapdev reset # the current repo, or the child repos of the current directory
|
|
54
|
+
zapdev reset ~/dev # a repo, or the child repos of a directory
|
|
55
55
|
zapdev reset -p # switch each repo to its principal branch, no prompt
|
|
56
56
|
zapdev reset -t dev # switch each repo to `dev` (or principal if absent)
|
|
57
57
|
```
|
package/dist/cli.js
CHANGED
|
@@ -1718,7 +1718,7 @@ function _getBuiltinFlags(long, short, userNames, userAliases) {
|
|
|
1718
1718
|
// package.json
|
|
1719
1719
|
var package_default = {
|
|
1720
1720
|
name: "zapdev",
|
|
1721
|
-
version: "0.7.
|
|
1721
|
+
version: "0.7.1",
|
|
1722
1722
|
description: "Fast, performant and lightweight git chores and dev tools using your terminal and your own local LLM.",
|
|
1723
1723
|
type: "module",
|
|
1724
1724
|
bin: {
|
|
@@ -2222,13 +2222,14 @@ async function push() {
|
|
|
2222
2222
|
async function pushSetUpstream(branch) {
|
|
2223
2223
|
await git(["push", "-u", "origin", branch]);
|
|
2224
2224
|
}
|
|
2225
|
-
async function
|
|
2226
|
-
|
|
2225
|
+
async function findRepos(path) {
|
|
2226
|
+
if (await isGitRepo(path)) return [path];
|
|
2227
|
+
const entries = await readdir(path, { withFileTypes: true }).catch(() => null);
|
|
2227
2228
|
if (!entries) return [];
|
|
2228
2229
|
const dirs = entries.filter((entry) => entry.isDirectory() && entry.name !== "node_modules");
|
|
2229
2230
|
const repos = await Promise.all(
|
|
2230
2231
|
dirs.map(async (entry) => {
|
|
2231
|
-
const dir = join(
|
|
2232
|
+
const dir = join(path, entry.name);
|
|
2232
2233
|
return await isGitRepo(dir) ? dir : null;
|
|
2233
2234
|
})
|
|
2234
2235
|
);
|
|
@@ -2489,14 +2490,14 @@ var CANCEL = /* @__PURE__ */ Symbol("cancel");
|
|
|
2489
2490
|
var resetCommand = defineCommand({
|
|
2490
2491
|
meta: {
|
|
2491
2492
|
name: "reset",
|
|
2492
|
-
description: "Switch
|
|
2493
|
+
description: "Switch each repo to a branch, then delete all other local branches and worktrees."
|
|
2493
2494
|
},
|
|
2494
2495
|
args: {
|
|
2495
2496
|
path: {
|
|
2496
2497
|
type: "positional",
|
|
2497
2498
|
required: false,
|
|
2498
2499
|
default: ".",
|
|
2499
|
-
description: "
|
|
2500
|
+
description: "A git repo to reset, or a directory whose direct child repos are reset."
|
|
2500
2501
|
},
|
|
2501
2502
|
principal: {
|
|
2502
2503
|
type: "boolean",
|
|
@@ -2528,9 +2529,9 @@ var resetCommand = defineCommand({
|
|
|
2528
2529
|
};
|
|
2529
2530
|
const path = args.path || ".";
|
|
2530
2531
|
if (interactive) intro("zapdev reset");
|
|
2531
|
-
const repos = await
|
|
2532
|
+
const repos = await findRepos(path);
|
|
2532
2533
|
if (repos.length === 0) {
|
|
2533
|
-
log.warn(`No
|
|
2534
|
+
log.warn(`No git repository found at or under ${path}.`);
|
|
2534
2535
|
if (interactive) outro("Nothing to do.");
|
|
2535
2536
|
return;
|
|
2536
2537
|
}
|
|
@@ -2685,7 +2686,7 @@ var commands = {
|
|
|
2685
2686
|
};
|
|
2686
2687
|
var MENU = {
|
|
2687
2688
|
commit: "Stage all changes and commit with an AI-generated message",
|
|
2688
|
-
reset: "Switch
|
|
2689
|
+
reset: "Switch repos to a branch and delete the other branches and worktrees"
|
|
2689
2690
|
};
|
|
2690
2691
|
var menuOptions = Object.keys(MENU).map((value) => ({
|
|
2691
2692
|
value,
|