dsh-plugin-toolkit 0.20.19 → 0.20.20
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/CHANGELOG.md +18 -0
- package/README.md +2 -2
- package/lib/cli.mjs +4 -4
- package/lib/release.mjs +33 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## 0.20.20
|
|
2
|
+
|
|
3
|
+
- **A repeated `release --pr` is a no-op when the committed index already
|
|
4
|
+
carries the version.** The resume path noticed that the same version with the
|
|
5
|
+
same publish time needed no index write, but it still entered the PR
|
|
6
|
+
sequence; `git commit` then failed because there was nothing staged, and the
|
|
7
|
+
run stopped with a `market/<version>` branch left behind. An unchanged index
|
|
8
|
+
that is already committed now ends the release after the registry wait: it
|
|
9
|
+
prints `<index> already carried <version>; nothing to commit`, exits `0`,
|
|
10
|
+
leaves `git log -1` alone, and creates no branch even with `--pr` or
|
|
11
|
+
`--merge`. An entry that an earlier run without `--pr` wrote but did not
|
|
12
|
+
commit still goes through the branch and PR so the release is finished. A
|
|
13
|
+
different publish time still stops with both timestamps named. Three
|
|
14
|
+
consecutive CLI runs now assert exit `0` and an unchanged `git log -1`, and a
|
|
15
|
+
checked-in one-second-mismatch fixture pins the failure through the CLI as
|
|
16
|
+
well: exit `1`, both timestamps in the error, and no `market/<version>`
|
|
17
|
+
branch.
|
|
18
|
+
|
|
1
19
|
## 0.20.19
|
|
2
20
|
|
|
3
21
|
- **`audit --home` expands `~` and `~\` before the scan, and a bare flag is
|
package/README.md
CHANGED
|
@@ -976,7 +976,7 @@ The install reports success and nothing shows up. In this order:
|
|
|
976
976
|
3. Create and push the tag, which starts the plugin's release workflow.
|
|
977
977
|
4. Poll the registry until it actually serves that version, reporting each wait.
|
|
978
978
|
5. Write the index entry with the publish time **the registry reports**, not the local clock. It waits for `time[version]` specifically: the abbreviated registry document has no `time` field, and an entry with a null timestamp is rejected by the market checker.
|
|
979
|
-
6. With `--pr`: commit that entry on `market/<version>`, push it, and open the pull request. With `--merge` as well: wait for `gh pr checks` to settle, then squash-merge.
|
|
979
|
+
6. With `--pr`: commit that entry on `market/<version>`, push it, and open the pull request. With `--merge` as well: wait for `gh pr checks` to settle, then squash-merge. When the committed index already carries this version with the same publish time there is nothing to commit, so the branch and PR steps are skipped instead of failing at `git commit`. An entry written by an earlier run without `--pr` is still uncommitted, so a later `--pr` run commits it and opens the PR.
|
|
980
980
|
|
|
981
981
|
```sh
|
|
982
982
|
npx dsh-plugin release . --pr --merge
|
|
@@ -990,7 +990,7 @@ checks settled after 1s (1 look(s))
|
|
|
990
990
|
merged
|
|
991
991
|
```
|
|
992
992
|
|
|
993
|
-
Without `--pr` it prints the `git add` / `gh pr create` commands instead of running them; `--dry-run` prints the whole sequence before anything happens. A re-run after a failure is safe: when the tag already points at HEAD it is reused rather than recreated, the release continues with the registry wait, and the same version with the same publish time is a no-op.
|
|
993
|
+
Without `--pr` it prints the `git add` / `gh pr create` commands instead of running them; `--dry-run` prints the whole sequence before anything happens. A re-run after a failure is safe: when the tag already points at HEAD it is reused rather than recreated, the release continues with the registry wait, and the same version with the same publish time is a no-op once the index entry is committed. A no-op release prints `<index> already carried <version>; nothing to commit`, exits `0`, leaves `git log -1` unchanged, and creates no `market/<version>` branch, even when `--pr` or `--merge` is passed. A different publish time is not a no-op: the release stops at `index`, names the indexed and registry timestamps in the error, exits `1`, and creates no `market/<version>` branch.
|
|
994
994
|
|
|
995
995
|
If that tag points at another commit, the release does not move it. It exits `1`
|
|
996
996
|
and names the tag, the commit it points at, HEAD, and the recovery:
|
package/lib/cli.mjs
CHANGED
|
@@ -694,13 +694,13 @@ export async function run(argv, io = console, deps = {}) {
|
|
|
694
694
|
}
|
|
695
695
|
|
|
696
696
|
io.log(`tagged ${result.tag}, npm served ${name}@${version} after ${Math.round(result.waitedMs / 1000)}s`);
|
|
697
|
-
if (result.indexUpdate !== null && result.
|
|
697
|
+
if (result.indexUpdate !== null && result.pullRequest !== undefined) {
|
|
698
|
+
io.log(`updated ${result.indexUpdate.file} on ${result.pullRequest.branch}`);
|
|
699
|
+
} else if (result.indexUpdate !== null && result.indexUpdate.unchanged === true) {
|
|
698
700
|
io.log(`${result.indexUpdate.file} already carried ${version}; nothing to commit`);
|
|
699
|
-
} else if (result.indexUpdate !== null
|
|
701
|
+
} else if (result.indexUpdate !== null) {
|
|
700
702
|
io.log(`updated ${result.indexUpdate.file} — commit it and open the PR:`);
|
|
701
703
|
io.log(` git add ${result.indexUpdate.file} && git commit -m "market: ${version}" && gh pr create --fill`);
|
|
702
|
-
} else if (result.indexUpdate !== null) {
|
|
703
|
-
io.log(`updated ${result.indexUpdate.file} on ${result.pullRequest.branch}`);
|
|
704
704
|
} else {
|
|
705
705
|
io.log('no market/index.json here, so only the tag and the publish happened');
|
|
706
706
|
}
|
package/lib/release.mjs
CHANGED
|
@@ -81,6 +81,25 @@ export function workingTreeIsClean(dir, run) {
|
|
|
81
81
|
return (run ?? ((args) => git(dir, args)))(['status', '--porcelain']) === '';
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* True when the index file has a staged, unstaged, or untracked change.
|
|
86
|
+
*
|
|
87
|
+
* "The index already carries the version" and "the index has nothing to
|
|
88
|
+
* commit" are different states: a run without `--pr` writes the entry and
|
|
89
|
+
* leaves it uncommitted, and a later `--pr` run must carry that entry into the
|
|
90
|
+
* pull request rather than skipping it as a no-op.
|
|
91
|
+
*/
|
|
92
|
+
function indexHasChanges(dir, indexFile, run) {
|
|
93
|
+
try {
|
|
94
|
+
const status = (run ?? ((args) => git(dir, args)))(['status', '--porcelain', '--', indexFile]);
|
|
95
|
+
return status !== '';
|
|
96
|
+
} catch {
|
|
97
|
+
// If git cannot answer, do not claim there is nothing to commit: let the PR
|
|
98
|
+
// sequence report the real failure instead of silently dropping the entry.
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
84
103
|
/** The paths git would carry into the tag, so the message can name them. */
|
|
85
104
|
export function dirtyPaths(dir, limit = 3, run) {
|
|
86
105
|
const status = (run ?? ((args) => git(dir, args)))(['status', '--porcelain']);
|
|
@@ -278,13 +297,25 @@ export async function release(options) {
|
|
|
278
297
|
indexUpdate,
|
|
279
298
|
};
|
|
280
299
|
|
|
281
|
-
if (options.pr !== true || indexUpdate === null) return result;
|
|
282
|
-
|
|
283
300
|
// The index change is one line, but it still needs a branch, a pull request,
|
|
284
301
|
// a green CI and a merge; doing that by hand is where "forgot to open the PR"
|
|
285
302
|
// happens.
|
|
286
303
|
const ghRunner = options.gh ?? defaultGh(indexRoot);
|
|
287
304
|
const marketGit = options.marketGit ?? (indexRoot === root ? options.git : ((args) => git(indexRoot, args)));
|
|
305
|
+
|
|
306
|
+
if (options.pr !== true || indexUpdate === null) return result;
|
|
307
|
+
|
|
308
|
+
// An unchanged index is the resume path: a previous run already wrote the
|
|
309
|
+
// same version with the same publish time. When that entry is committed there
|
|
310
|
+
// is nothing to commit, so opening a branch would fail at `git commit` and
|
|
311
|
+
// leave a branch behind for a release that is already finished. An entry
|
|
312
|
+
// written by a run without `--pr` is still uncommitted, so it must go through
|
|
313
|
+
// the PR sequence even though this run did not change the file again.
|
|
314
|
+
// Git accepts `/` on every platform; `path.relative` uses `\` on Windows and
|
|
315
|
+
// a backslash in a pathspec is an escape, so normalise before passing it on.
|
|
316
|
+
const indexPathForGit = (path.relative(indexRoot, indexPath) || indexPathFile).split(path.sep).join('/');
|
|
317
|
+
if (indexUpdate.unchanged === true && indexHasChanges(indexRoot, indexPathForGit, marketGit) === false) return result;
|
|
318
|
+
|
|
288
319
|
const pull = await openIndexPr({
|
|
289
320
|
dir: indexRoot,
|
|
290
321
|
git: marketGit,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-toolkit",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.20",
|
|
4
4
|
"description": "Preflight, release and test DeepSeek Harness plugins: check a folder or any GitHub repository, wait for npm to actually serve the version, and keep the market index honest.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|