zapdev 0.5.0 → 0.7.0
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 +27 -27
- package/dist/cli.js +2718 -0
- package/dist/index.js +4 -3762
- package/package.json +12 -13
package/README.md
CHANGED
|
@@ -1,29 +1,25 @@
|
|
|
1
1
|
# zapdev
|
|
2
2
|
|
|
3
|
-
**zapdev** — a lightweight TypeScript
|
|
3
|
+
**zapdev** — a lightweight TypeScript CLI that makes small, repetitive git chores fast and precise.
|
|
4
4
|
|
|
5
5
|
## Requirements
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Node.js >= 20 and git.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
|
|
12
|
+
npm install -g zapdev # installs the `zapdev` command globally
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
> If `zapdev: command not found`, Bun's global bin is not on your `PATH`. Add it (zsh):
|
|
16
|
-
>
|
|
17
|
-
> ```sh
|
|
18
|
-
> echo 'export PATH="$HOME/.bun/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc
|
|
19
|
-
> ```
|
|
20
|
-
|
|
21
15
|
Or run it once without installing:
|
|
22
16
|
|
|
23
17
|
```bash
|
|
24
|
-
|
|
18
|
+
npx zapdev commit
|
|
25
19
|
```
|
|
26
20
|
|
|
21
|
+
> For daily use, prefer the global install: `npx` adds resolution overhead on every run.
|
|
22
|
+
|
|
27
23
|
## Usage
|
|
28
24
|
|
|
29
25
|
Run `zapdev` with no command to pick one from an interactive menu (falls back to usage output without a TTY).
|
|
@@ -49,22 +45,25 @@ zapdev commit -t feat # force the type; the model still writes scope + desc
|
|
|
49
45
|
|
|
50
46
|
Without a TTY (piped / CI), it commits automatically and only pushes when `--push` is set.
|
|
51
47
|
|
|
52
|
-
### `zapdev
|
|
48
|
+
### `zapdev reset`
|
|
53
49
|
|
|
54
|
-
|
|
50
|
+
Scans a directory for its **direct child** git 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`.
|
|
55
51
|
|
|
56
52
|
```bash
|
|
57
|
-
zapdev
|
|
58
|
-
zapdev
|
|
53
|
+
zapdev reset # child repos of the current directory
|
|
54
|
+
zapdev reset ~/dev # child repos of a specific directory
|
|
55
|
+
zapdev reset -p # switch each repo to its principal branch, no prompt
|
|
56
|
+
zapdev reset -t dev # switch each repo to `dev` (or principal if absent)
|
|
59
57
|
```
|
|
60
58
|
|
|
61
59
|
| Flag | Description |
|
|
62
60
|
| --- | --- |
|
|
63
|
-
| `-
|
|
64
|
-
| `-
|
|
65
|
-
|
|
|
61
|
+
| `-p, --principal` | Switch every repo to its resolved principal branch (`origin/HEAD`) |
|
|
62
|
+
| `-t, --target <branch>` | Switch every repo to `<branch>`, falling back to the principal one |
|
|
63
|
+
| `--pull` | Pull the checked-out branch after reset without asking |
|
|
64
|
+
| `-y, --yes` | Non-interactive: switch and delete without confirmation |
|
|
66
65
|
|
|
67
|
-
Deletion
|
|
66
|
+
Deletion is permanent: branches via `git branch -D` (force), worktrees via `git worktree remove --force`. Worktrees are removed first so the branches they held become deletable. Without a TTY, pass `--yes` — otherwise the destructive step is refused. `node_modules` is never scanned.
|
|
68
67
|
|
|
69
68
|
## Configuration
|
|
70
69
|
|
|
@@ -78,20 +77,21 @@ Deletion uses `git branch -D` (force). Without a TTY (or with `--yes`), every no
|
|
|
78
77
|
From a clone:
|
|
79
78
|
|
|
80
79
|
```bash
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
npm install
|
|
81
|
+
npm run zapdev # build then run the CLI in dev
|
|
82
|
+
npm run typecheck # tsc --noEmit
|
|
83
|
+
npm run lint # eslint
|
|
84
|
+
npm run test # vitest
|
|
85
|
+
npm run build # bundle to dist/ (esbuild)
|
|
87
86
|
```
|
|
88
87
|
|
|
89
|
-
`
|
|
88
|
+
`npm link` (after `npm run build`) exposes the local `zapdev` binary on your PATH.
|
|
90
89
|
|
|
91
90
|
## Project structure
|
|
92
91
|
|
|
93
|
-
- `src/index.ts` —
|
|
92
|
+
- `src/index.ts` — bin launcher; enables the V8 compile cache, then loads `cli.js`.
|
|
93
|
+
- `src/cli.ts` — CLI entry (Citty); registers subcommands, defaults to `commit`.
|
|
94
94
|
- `src/commands/` — one file per command.
|
|
95
95
|
- `src/lib/` — pure logic (`config`, `commit-message`, `branches`, unit-tested) and side effects (`git`, `ollama`); shared helpers (`errors`).
|
|
96
|
-
- `src/prompts/` — LLM prompts as `.md` files, imported as text (`
|
|
96
|
+
- `src/prompts/` — LLM prompts as `.md` files, imported as text (esbuild `.md` text loader) and inlined into the bundle at build time.
|
|
97
97
|
- `src/types/` — shared type declarations (one file per domain) and ambient module declarations.
|