zapdev 1.10.0 → 1.12.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.
Files changed (3) hide show
  1. package/README.md +24 -74
  2. package/dist/cli.js +1278 -1381
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -42,7 +42,7 @@ flowchart LR
42
42
  | `ZD_URL` | For `commit` | Complete HTTP(S) Chat Completions endpoint, including its path |
43
43
  | `ZD_MODEL` | For `commit` | Model identifier supported by the endpoint |
44
44
  | `ZD_EFFORT` | For `commit` | Sent as `reasoning_effort`; use a value supported by your model, such as `low`, `medium`, or `high` |
45
- | `ZD_HOOK_TIMEOUT` | No | Deadline per Git hook in seconds (default: `60`); positive numbers from `0.001` to `2147483.647` |
45
+ | `ZD_HOOK_TIMEOUT` | No | Deadline per Git hook in seconds (default: `60`); positive numbers from `0.001` to `2147483.647` |
46
46
 
47
47
  The LLM settings have no defaults, automatic provider detection, or backup models. CLI flags override these settings. Legacy `OLLAMA_*` variables are no longer read.
48
48
 
@@ -110,107 +110,60 @@ Stages all changes, scans them with Gitleaks when installed, generates Conventio
110
110
 
111
111
  - **Inside a Git repository:** uses that repository only, including when launched from a subdirectory. Does not inspect child repositories.
112
112
  - **Outside a Git repository:** processes only direct child repositories. No recursive search; `node_modules` is excluded.
113
- - **Unified review:** generates messages in parallel, then presents every message with its repository name and branch. Repositories with pending changes are shown in bold and underlined when terminal styling is enabled.
113
+ - Folders without their own Git repository remain part of the enclosing repository.
114
+ - **Unified review:** generates messages in parallel, then presents every message with its repository name and branch. Repositories with pending changes are shown in bold when terminal styling is enabled.
114
115
  - **Actions:** commit all, commit only a named repository, edit a named repository's message, or cancel. Editing returns to the review menu.
115
116
 
116
- Repositories with no new changes can still send existing commits. Unselected or cancelled changes remain staged; failed or unselected commit drafts are not pushed. Push confirmation is asked once, followed by a destination input for each eligible repository or subtree.
117
+ Repositories with no new changes can still send existing commits. Unselected or cancelled changes remain staged; failed or unselected commit drafts are not pushed. The branch is chosen before committing, never when pushing. Push confirmation is asked once, only for repositories with a selectable remote; it is omitted when none have one.
117
118
 
118
119
  ```bash
119
120
  zapdev commit
120
121
  ```
121
122
 
122
- | Flag | Description |
123
- | ------------------- | ----------------------------------------------------------------- |
124
- | `--url <url>` | Override the complete Chat Completions endpoint |
125
- | `--model <model>` | Override the model |
126
- | `--effort <effort>` | Override the reasoning effort |
123
+ | Flag | Description |
124
+ | ------------------- | -------------------------------------------------------------------------------- |
125
+ | `--url <url>` | Override the complete Chat Completions endpoint |
126
+ | `--model <model>` | Override the model |
127
+ | `--effort <effort>` | Override the reasoning effort |
127
128
  | `-t, --type <type>` | Force an exact lowercase Conventional Commit type (`feat`, `fix`, `chore`, etc.) |
128
- | `-p, --push` | Skip push confirmation; still ask for each destination branch |
129
- | `-s, --staged` | Commit only changes that are already staged |
130
- | `-y, --yes` | Skip commit review; still confirm push unless `--push` is set |
129
+ | `-p, --push` | Skip push confirmation and push the current branch |
130
+ | `--pull` | Pull fast-forward updates in every repository before staging or message generation |
131
+ | `-s, --staged` | Commit only changes that are already staged |
132
+ | `-y, --yes` | Skip commit review; still confirm push unless `--push` is set |
131
133
 
132
134
  ```bash
133
135
  zapdev commit -t feat # force the type
134
136
  zapdev commit --staged # leave unstaged changes untouched
135
137
  zapdev commit -y # commit automatically, then ask before pushing
136
- zapdev commit -yp # commit automatically, then enter each push destination
138
+ zapdev commit -yp # skip review and push confirmation; choose a branch if protected
139
+ zapdev commit --pull # pull first, then follow the normal commit flow
137
140
  ```
138
141
 
139
142
  Before contacting the LLM endpoint, zapdev runs `gitleaks git --staged --verbose` in each changed repository when Gitleaks is installed. A failed scan skips that repository without sending its diff; when Gitleaks is absent, the scan is skipped. The staged diff is sent to the configured endpoint, which may be remote.
140
143
 
141
144
  Preparation and commit failures are reported per repository while the others continue. A push failure stops all remaining sends. Any failure produces a nonzero exit code.
142
145
 
143
- In a terminal, Git and its hooks display live logs and support native prompts, even with `--yes` (which skips commit review, not native Git prompts). Git controls hook stdin; interactive hooks should read from the terminal, for example `/dev/tty`. Each hook has a 60-second deadline, including time spent answering prompts; override it with `ZD_HOOK_TIMEOUT=120 zapdev commit`.
144
-
145
- Every push asks for a destination branch, even with `--yes --push`. In both modes, prompts start empty and then reuse the previous input across repositories in this run. Press Enter to accept the prefilled name; an empty or cleared input uses the current branch and leaves the next prompt empty. Pushing to `main` is allowed in both modes. Classic pushes use the current branch's upstream remote, or the only configured remote if there is no upstream, and run `git push <remote> HEAD:refs/heads/<input>` without changing local branches or their upstreams. The destination need not exist locally. When no remote can be selected unambiguously, the repository's push is skipped with a warning, without a branch prompt. Git rejections stop the command: no rebase, merge, retry, or force-push.
146
-
147
- Before each destination input, both modes check the presumed remote branch: the previous input, or the current branch when empty. If that branch is missing, the check falls back to the remote's default branch (`HEAD`). Only unpublished local commits trigger a destination input; if neither reference exists, zapdev also asks. Classic mode compares HEAD; subtree mode compares its extracted history. This check cannot anticipate a different destination you would type next. Repositories without new changes do not trigger an LLM call or a new commit.
148
-
149
- Without a TTY, zapdev commits all prepared repositories automatically but cannot push; `--push` reports an error and leaves commits local.
150
-
151
- #### Subtree publication
152
-
153
- Place an optional `zapdev.json` in the directory where you launch zapdev:
154
-
155
- ```json
156
- {
157
- "subtrees": {
158
- "projet-front": "front",
159
- "projet-back": "back"
160
- }
161
- }
162
- ```
163
-
164
- | `zapdev.json` option | Default | Effect |
165
- | ------------------- | ------- | ------ |
166
- | `subtrees` | `{}` | Map repository-relative folders to Git remote names. A nonempty mapping replaces classic push with subtree publication. |
167
-
168
- - **Scope:** only the launch directory's file is read, not parents or child repositories. Its mapping applies to newly committed repositories and repositories without new changes.
169
- - **Configuration:** only `zapdev.json` selects subtree mode; no subtree CLI flag. Missing or empty `subtrees` uses classic push. Invalid configuration stops the command before staging. Replace the removed `isSubtree` option with an explicit mapping.
170
- - **Destinations:** only mapped folders are published, using their configured remotes; folder and remote names need not match. Each changed subtree asks for its own destination branch, initially empty, then prefilled with the previous input across repositories in this run. Press Enter to reuse it, or leave the input empty to use the current branch. `main` is allowed; detached HEAD is refused.
171
- - **Publication:** check the presumed destination branch using the shared unpublished-commit rule above, then run `git subtree push --prefix=<folder> <remote> <input>`. Already published history is skipped without prompting; uncommitted changes are excluded.
172
- - **Failures:** stop all remaining publications, leaving earlier publications intact. No automatic recovery.
146
+ With `--pull`, repositories are pulled one at a time before any staging, secret scan, or message generation. Git uses each current branch's configured upstream. Missing upstreams, divergent history, or conflicting local changes stop the entire flow before staging; no rebase, merge commit, or automatic stash is performed. Earlier successful pulls remain applied.
173
147
 
174
- Interactive runs still ask for confirmation, including with `--yes`; `--push` skips only that confirmation, never the destination inputs. Publication requires a TTY.
175
-
176
- ```bash
177
- zapdev commit # with subtrees configured, ask to publish after committing
178
- zapdev commit -yp # enter a destination for each changed subtree
179
- ```
180
-
181
- ### `zapdev subtree-init`
182
-
183
- Create or extend a repository with squashed subtrees, named remotes, and the matching `zapdev.json`. No gum or LLM configuration required.
148
+ In a terminal, Git and its hooks display live logs and support native prompts, even with `--yes` (which skips commit review, not native Git prompts). Git controls hook stdin; interactive hooks should read from the terminal, for example `/dev/tty`. Each hook has a 60-second deadline, including time spent answering prompts; override it with `ZD_HOOK_TIMEOUT=120 zapdev commit`.
184
149
 
185
- ```bash
186
- zapdev subtree-init my-project \
187
- front=git@github.com:org/front.git \
188
- back=git@github.com:org/back.git \
189
- --origin git@github.com:org/project.git
190
- ```
150
+ Immediately before each selected commit, zapdev asks for a local branch only when the current name exactly matches `main`, `master`, `principal`, `dev`, or `development`, including with `--yes`. The first prompt starts empty; subsequent prompts reuse the previous input across repositories. Press Enter to accept the prefilled name; an empty or cleared input keeps the current branch and leaves the next prompt empty. A different name switches to the existing local branch or creates it from HEAD, without forcing or discarding pending changes. Other branches and repositories with nothing to commit never trigger this prompt. Cancelling stops the remaining commits and all pushes; earlier commits remain local.
191
151
 
192
- | Parameter | Effect |
193
- | --------- | ------ |
194
- | `<directory>` | Repository to create or extend. New repositories start on `main`; existing branches are kept. |
195
- | `<name=url>...` | One or more sources. Each name is both the subtree folder and its Git remote name. |
196
- | `--origin <url>` | Optional parent repository remote; replaces the shell helper's `remote=url` argument. |
152
+ Pushes always target a remote branch with the current local branch's name, with no destination input. They use the current branch's upstream remote, or the only configured remote if there is no upstream, and run `git push <remote> HEAD:refs/heads/<current-branch>`. Missing or ambiguous remotes are skipped with a warning. Pushes check for unpublished commits against that remote branch, falling back to the remote's default branch (`HEAD`) if it is missing. If neither reference exists, pushing is attempted. Already published history is skipped. No rebase, merge, retry, or force-push.
197
153
 
198
- - Requires a clean working tree, including untracked files. Existing folders, conflicting mappings or remote URLs, and a symlinked `zapdev.json` are refused before importing any subtree.
199
- - Detects each source's default branch, falling back to `main` with a warning when unavailable; imports with `git subtree add --squash`.
200
- - Commits the explicit folder-to-remote mapping before imports, preserving existing mappings and other JSON settings. Example: `{"subtrees":{"front":"front","back":"back"}}`.
201
- - Does not push. Git failures stop immediately without rollback; configuration, remotes, and earlier imports remain in place.
154
+ Without a TTY, zapdev commits prepared repositories on nonprotected branches automatically; protected-branch commits are refused and changes remain staged. `--push` can publish without a TTY; without it, commits stay local. Repositories without new changes do not trigger an LLM call, branch prompt, or new commit.
202
155
 
203
156
  ### Zed IDE
204
157
 
205
- For a faster review and commit workflow, review and stage changes from Zed's Git panel, then run `zapdev commit -syp` from a task. The command commits only staged changes, skips commit review and push confirmation, then asks for the push destination.
158
+ For a faster review and commit workflow, review and stage changes from Zed's Git panel, then run `zapdev commit -syp` from a task. The command commits only staged changes, skips commit review and push confirmation, and asks for a branch before committing only if the current branch is protected.
206
159
 
207
160
  Add the following tasks to `.zed/tasks.json`:
208
161
 
209
162
  ```json
210
163
  [
211
164
  {
212
- "label": "Safely commit staged changes.",
213
- "command": "zapdev commit -s",
165
+ "label": "zapdev commit",
166
+ "command": "zapdev commit --yes",
214
167
  "reveal": "always",
215
168
  "hide": "on_success",
216
169
  "reveal_target": "center"
@@ -224,10 +177,7 @@ Add this entry to Zed's `keymap.json` to run the commit task with `ctrl-cmd-ente
224
177
  {
225
178
  "context": "Pane",
226
179
  "bindings": {
227
- "ctrl-cmd-enter": [
228
- "task::Spawn",
229
- { "task_name": "Safely commit staged changes." }
230
- ]
180
+ "ctrl-cmd-enter": ["task::Spawn", { "task_name": "zapdev commit" }]
231
181
  }
232
182
  }
233
183
  ```