@osdlc/repo-cleaner 0.14.0 → 0.14.2
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 +13 -0
- package/README.md +4 -4
- package/dist/cli.js +1 -1
- package/dist/render.d.ts +1 -1
- package/dist/render.js +31 -4
- package/dist/step-board.js +2 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @osdlc/repo-cleaner
|
|
2
2
|
|
|
3
|
+
## 0.14.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5cba918: `apply` says `skipped`, not `dropped`, for rows it leaves alone, matching the `skip` label on each row: `skipped 12, not deleted: 8 needs-review (name with --row), 4 not-authorized (--allow abandon-unmerged)`. The counts name how to include each kind. The closing prune step reads `prune worktree records`, with the repository on the progress board, instead of a bare `prune`. The JSON receipt and summary keep their `dropped` field.
|
|
8
|
+
|
|
9
|
+
## 0.14.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [a3ef86d]
|
|
14
|
+
- @osdlc/cli-tool@0.15.0
|
|
15
|
+
|
|
3
16
|
## 0.14.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ own bar, empty while it waits, half full while it runs and full with a `✓`
|
|
|
34
34
|
██████████ ✓ delete local_branch feat/a
|
|
35
35
|
█████░░░░░ › delete local_branch feat/b
|
|
36
36
|
░░░░░░░░░░ delete remote_branch origin/feat/b
|
|
37
|
-
░░░░░░░░░░ prune
|
|
37
|
+
░░░░░░░░░░ prune worktree records in /Users/me/work/api
|
|
38
38
|
████████░░░░░░░░░░░░░░░░░░░░░░ 1/4
|
|
39
39
|
```
|
|
40
40
|
|
|
@@ -395,13 +395,13 @@ asks `Delete N items? [y/N]`:
|
|
|
395
395
|
/Users/me/work/api
|
|
396
396
|
delete local_branch fix/login-redirect
|
|
397
397
|
git update-ref -d refs/heads/fix/login-redirect 3f9c2e1d…
|
|
398
|
-
prune
|
|
398
|
+
prune worktree records
|
|
399
399
|
git -C /Users/me/work/api worktree prune
|
|
400
400
|
skip worktree /Users/me/work/api/wt/spike
|
|
401
401
|
needs-review: clean but no clear disposability signal; name it with --row to apply it
|
|
402
402
|
|
|
403
403
|
would delete: 1 local branch
|
|
404
|
-
|
|
404
|
+
skipped 1, not deleted: 1 needs-review (name with --row)
|
|
405
405
|
Delete 2 items? [y/N]
|
|
406
406
|
```
|
|
407
407
|
|
|
@@ -434,7 +434,7 @@ Every run ends with what it did:
|
|
|
434
434
|
|
|
435
435
|
```text
|
|
436
436
|
deleted: 1 worktree, 3 local branches, 2 remote branches, 1 stale worktree pruned
|
|
437
|
-
|
|
437
|
+
skipped 2, not deleted: 1 needs-review (name with --row), 1 duplicate
|
|
438
438
|
status: complete
|
|
439
439
|
```
|
|
440
440
|
|
package/dist/cli.js
CHANGED
|
@@ -207,7 +207,7 @@ const applyCli = () => defineCli({
|
|
|
207
207
|
output: OUTPUT,
|
|
208
208
|
},
|
|
209
209
|
epilogue: `risks: abandon-unmerged, discard-changes, confirm-open-pr
|
|
210
|
-
A row that carries a risk you did not --allow is
|
|
210
|
+
A row that carries a risk you did not --allow is skipped, never deleted.`,
|
|
211
211
|
});
|
|
212
212
|
const terminalConfirm = (question) => (canPrompt() ? askYesNo(question) : null);
|
|
213
213
|
const PAUSE = new Int32Array(new SharedArrayBuffer(4));
|
package/dist/render.d.ts
CHANGED
|
@@ -94,7 +94,7 @@ export interface ApplySummary {
|
|
|
94
94
|
export declare function summarizeReceipt(receipt: Receipt): ApplySummary;
|
|
95
95
|
/** Rows a receipt deletes or prunes, which is what a person is asked to approve. */
|
|
96
96
|
export declare function rowsActedOn(summary: ApplySummary): number;
|
|
97
|
-
/** The closing lines of an apply run: what it deleted,
|
|
97
|
+
/** The closing lines of an apply run: what it deleted, skipped and could not finish. */
|
|
98
98
|
export declare function renderApplySummary(receipt: Receipt): string[];
|
|
99
99
|
/** The word a preview shows for a step: what it does to the row. */
|
|
100
100
|
export declare const STEP_VERB: Record<Step['action'], string>;
|
package/dist/render.js
CHANGED
|
@@ -352,7 +352,27 @@ export function rowsActedOn(summary) {
|
|
|
352
352
|
return d.worktree + d.local_branch + d.remote_branch + summary.pruned;
|
|
353
353
|
}
|
|
354
354
|
const plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
355
|
-
/**
|
|
355
|
+
/**
|
|
356
|
+
* How to include a skipped row next time, for the reasons a person can act
|
|
357
|
+
* on. A `not-authorized` detail is `needs <risk>, <risk>` (see `recheck`).
|
|
358
|
+
*/
|
|
359
|
+
function dropHints(receipt) {
|
|
360
|
+
const risks = new Set();
|
|
361
|
+
for (const d of receipt.dropped) {
|
|
362
|
+
if (d.reason !== 'not-authorized')
|
|
363
|
+
continue;
|
|
364
|
+
for (const risk of d.detail.replace(/^needs /, '').split(', '))
|
|
365
|
+
if (risk)
|
|
366
|
+
risks.add(risk);
|
|
367
|
+
}
|
|
368
|
+
return {
|
|
369
|
+
'needs-review': 'name with --row',
|
|
370
|
+
...(risks.size > 0
|
|
371
|
+
? { 'not-authorized': [...risks].map((r) => `--allow ${r}`).join(', ') }
|
|
372
|
+
: {}),
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
/** The closing lines of an apply run: what it deleted, skipped and could not finish. */
|
|
356
376
|
export function renderApplySummary(receipt) {
|
|
357
377
|
const s = summarizeReceipt(receipt);
|
|
358
378
|
const dry = receipt.status === 'dry-run';
|
|
@@ -372,7 +392,12 @@ export function renderApplySummary(receipt) {
|
|
|
372
392
|
const dropped = Object.entries(s.dropped);
|
|
373
393
|
if (dropped.length > 0) {
|
|
374
394
|
const total = dropped.reduce((n, [, c]) => n + c, 0);
|
|
375
|
-
|
|
395
|
+
const hints = dropHints(receipt);
|
|
396
|
+
const counts = dropped.map(([reason, c]) => {
|
|
397
|
+
const hint = hints[reason];
|
|
398
|
+
return hint === undefined ? `${c} ${reason}` : `${c} ${reason} (${hint})`;
|
|
399
|
+
});
|
|
400
|
+
lines.push(`skipped ${total}, not deleted: ${counts.join(', ')}`);
|
|
376
401
|
}
|
|
377
402
|
if (s.failed > 0) {
|
|
378
403
|
lines.push(`stopped at a failed step; ${plural(s.notRun, 'row', 'rows')} not run`);
|
|
@@ -421,7 +446,9 @@ export function renderPreview(receipt, style = PLAIN) {
|
|
|
421
446
|
for (const s of receipt.steps.filter((s) => s.repo === repo)) {
|
|
422
447
|
const verb = STEP_VERB[s.action];
|
|
423
448
|
const color = actionStyle(style, verb === 'unlock' ? 'review' : verb);
|
|
424
|
-
lines.push(s.row === null
|
|
449
|
+
lines.push(s.row === null
|
|
450
|
+
? ` ${color(pad(verb, 6))} worktree records`
|
|
451
|
+
: ` ${color(pad(verb, 6))} ${row(s.row)}`);
|
|
425
452
|
lines.push(` ${style.muted(stripControls(s.command))}`);
|
|
426
453
|
}
|
|
427
454
|
for (const d of receipt.dropped.filter((d) => d.repo === repo)) {
|
|
@@ -456,7 +483,7 @@ export function renderReceipt(receipt, receiptPath, style = PLAIN, opts = {}) {
|
|
|
456
483
|
// A run shown live has printed its dropped rows and steps already.
|
|
457
484
|
for (const d of opts.steps === false ? [] : receipt.dropped) {
|
|
458
485
|
const shown = stripControls(`${d.category}:${d.id} — ${d.reason} (${d.detail})`);
|
|
459
|
-
lines.push(`${style.review('
|
|
486
|
+
lines.push(`${style.review('skipped ')}${shown}`);
|
|
460
487
|
}
|
|
461
488
|
for (const s of opts.steps === false ? [] : receipt.steps) {
|
|
462
489
|
const what = s.row === null ? s.command : `${s.row.category}:${s.row.id} — ${s.command}`;
|
package/dist/step-board.js
CHANGED
|
@@ -13,8 +13,9 @@ const BAR = 10;
|
|
|
13
13
|
const TOTAL_BAR = 30;
|
|
14
14
|
function label(step) {
|
|
15
15
|
const verb = STEP_VERB[step.action];
|
|
16
|
+
// The closing prune belongs to no row: it clears the repository's stale worktree records.
|
|
16
17
|
if (step.row === null)
|
|
17
|
-
return verb;
|
|
18
|
+
return stripControls(`${verb.padEnd(6)} worktree records in ${step.repo}`);
|
|
18
19
|
return stripControls(`${verb.padEnd(6)} ${step.row.category} ${step.row.id}`);
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** This package's version, from its package.json when it was built. */
|
|
2
|
-
export declare const VERSION = "0.14.
|
|
2
|
+
export declare const VERSION = "0.14.2";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdlc/repo-cleaner",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.2",
|
|
4
4
|
"description": "What has been merged into the default branch, and what can go away. Inventories local branches, worktrees and remote branches across one repository or many, classifying each with the evidence behind the verdict and the command that would act on it. Plans and applies approved deletes, compare-and-swap.",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"author": "sksizer",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"zod": "^4.6.6",
|
|
52
|
-
"@osdlc/
|
|
52
|
+
"@osdlc/cli-tool": "^0.15.0",
|
|
53
53
|
"@osdlc/path-guard": "^0.3.1",
|
|
54
|
+
"@osdlc/command-seam": "^0.14.0",
|
|
54
55
|
"@osdlc/typed-gh": "^0.14.1",
|
|
55
|
-
"@osdlc/cli-tool": "^0.14.0",
|
|
56
56
|
"@osdlc/typed-git": "^0.12.0",
|
|
57
57
|
"@osdlc/ux": "^0.1.1"
|
|
58
58
|
},
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"prettier": "3.9.6",
|
|
64
64
|
"typescript": "~6.0.3",
|
|
65
65
|
"vitest": "^5.0.5",
|
|
66
|
-
"@osdlc/
|
|
67
|
-
"@osdlc/
|
|
66
|
+
"@osdlc/prettier-config": "^0.3.1",
|
|
67
|
+
"@osdlc/tsconfig": "^0.4.1"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"build": "cli-tool-stamp-version && tsc -p tsconfig.build.json",
|