zapdev 1.11.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 +20 -70
  2. package/dist/cli.js +1253 -1366
  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,96 +110,49 @@ 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. The branch is chosen before committing, never when pushing. Push confirmation is asked once.
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 and push the current 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
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
 
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.
147
+
143
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`.
144
149
 
145
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.
146
151
 
147
- Pushes always target a remote branch with the current local branch's name, with no destination input. 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/<current-branch>`. Ambiguous remotes are skipped with a warning. Both modes 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, publication is attempted. Classic mode compares HEAD; subtree mode compares its extracted history. Already published history is skipped. No rebase, merge, retry, or force-push.
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.
148
153
 
149
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.
150
155
 
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. All subtrees use the parent repository's current branch name. The parent itself is not pushed. Detached HEAD is refused.
171
- - **Publication:** check each subtree using the shared unpublished-commit rule above, then run `git subtree push --prefix=<folder> <remote> <current-branch>`. Subtrees without unpublished commits are skipped without creating remote branches; uncommitted changes are excluded.
172
- - **Failures:** stop all remaining publications, leaving earlier publications intact. No automatic recovery.
173
-
174
- Interactive runs still ask for publication confirmation, including with `--yes`; `--push` skips that confirmation. The commit and branch-selection flow is identical to classic mode.
175
-
176
- ```bash
177
- zapdev commit # with subtrees configured, ask to publish after committing
178
- zapdev commit -yp # publish changed subtrees on the parent's current branch
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.
184
-
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
- ```
191
-
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. |
197
-
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.
202
-
203
156
  ### Zed IDE
204
157
 
205
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.
@@ -209,8 +162,8 @@ Add the following tasks to `.zed/tasks.json`:
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
  ```