@mmnto/cli 1.112.0 → 1.113.1
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/dist/commands/doctor-estate.d.ts +5 -0
- package/dist/commands/doctor-estate.d.ts.map +1 -1
- package/dist/commands/doctor-estate.js +33 -5
- package/dist/commands/doctor-estate.js.map +1 -1
- package/dist/commands/doctor-estate.test.js +152 -0
- package/dist/commands/doctor-estate.test.js.map +1 -1
- package/dist/commands/doctor.d.ts +7 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +78 -10
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/doctor.test.js +197 -3
- package/dist/commands/doctor.test.js.map +1 -1
- package/dist/commands/init-templates.d.ts +2 -2
- package/dist/commands/init-templates.d.ts.map +1 -1
- package/dist/commands/init-templates.js +2 -2
- package/dist/commands/wt.d.ts +100 -0
- package/dist/commands/wt.d.ts.map +1 -0
- package/dist/commands/wt.js +625 -0
- package/dist/commands/wt.js.map +1 -0
- package/dist/commands/wt.test.d.ts +21 -0
- package/dist/commands/wt.test.d.ts.map +1 -0
- package/dist/commands/wt.test.js +884 -0
- package/dist/commands/wt.test.js.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `totem wt create|remove|list` — worktree lifecycle verbs with VERIFIED
|
|
3
|
+
* removal (mmnto-ai/totem#2580 slice-2).
|
|
4
|
+
*
|
|
5
|
+
* The reason this exists is one git behaviour: `git worktree remove` exits 0
|
|
6
|
+
* on a removal that leaves the directory standing, and a husk that nobody
|
|
7
|
+
* notices is the failure class the slice-1 estate sensor keeps finding. So the
|
|
8
|
+
* removal verb never trusts an exit code — it removes, verifies absence,
|
|
9
|
+
* finishes the residue if anything is left, re-verifies, and only then touches
|
|
10
|
+
* the registry. Exit 0 means the directory is gone, and nothing else does.
|
|
11
|
+
*
|
|
12
|
+
* Three disciplines run through every verb here:
|
|
13
|
+
* - **Record-first.** `create` writes the `~/.totem/worktrees.json` entry
|
|
14
|
+
* BEFORE invoking git. A phantom entry fails visibly (`wt list` prints it
|
|
15
|
+
* `missing`); an unrecorded worktree fails invisibly, which is exactly the
|
|
16
|
+
* class this issue exists for.
|
|
17
|
+
* - **Check-first.** A path is passed to `git worktree remove` only when
|
|
18
|
+
* git's own list names it (the `author-sandbox.ts:112` precedent). A path
|
|
19
|
+
* git does not track never reaches a git removal verb, and a path that is
|
|
20
|
+
* in NEITHER git's list nor the registry is never touched at all.
|
|
21
|
+
* - **Accounting, not classification.** `wt list` reports what was recorded
|
|
22
|
+
* plus whether it is on disk. Deciding whether a worktree is active or
|
|
23
|
+
* stale stays with `totem doctor --estate` — derive-once, one sensor.
|
|
24
|
+
*
|
|
25
|
+
* Classification of what a seat may delete is deliberately narrow at the ECL
|
|
26
|
+
* boundary: untracked content under `<wt>/.totem/orchestration/**` blocks
|
|
27
|
+
* removal outright, with no bypass flag (the operator ruling — a bypass would
|
|
28
|
+
* re-open the silently-deleted-ECL hole this verb closes).
|
|
29
|
+
*/
|
|
30
|
+
import type { ResidueRemovalResult } from '@mmnto/totem';
|
|
31
|
+
/**
|
|
32
|
+
* The core barrel, imported dynamically inside each command (mmnto-ai/totem#2339).
|
|
33
|
+
* The `--help` cold-start protection is index.ts's lazy per-action
|
|
34
|
+
* `await import('./commands/wt.js')`; the dynamic imports HERE (core, and
|
|
35
|
+
* `./mail.js` for seat resolution) keep this module itself light so that lazy
|
|
36
|
+
* load stays cheap. Only types cross the boundary statically — erased at build.
|
|
37
|
+
*/
|
|
38
|
+
type Core = typeof import('@mmnto/totem');
|
|
39
|
+
/** The injected exec seam — structurally `safeExec`, so tests pass a spy. */
|
|
40
|
+
export type WtExecFn = Core['safeExec'];
|
|
41
|
+
/** Injected residue finish, so the still-present failure arm is reachable in tests. */
|
|
42
|
+
export type WtResidueFn = (dir: string) => Promise<ResidueRemovalResult>;
|
|
43
|
+
export interface WtCreateOptions {
|
|
44
|
+
slug: string;
|
|
45
|
+
/** Container root override — highest precedence. */
|
|
46
|
+
root?: string;
|
|
47
|
+
/** Seat override; default is `resolveSelfSender` against the home repo. */
|
|
48
|
+
seat?: string;
|
|
49
|
+
/** Branch override; default `feat/<ticket>-<slug>` or `wt/<slug>`. */
|
|
50
|
+
branch?: string;
|
|
51
|
+
ticket?: string;
|
|
52
|
+
json?: boolean;
|
|
53
|
+
/** Test seam — production callers use `process.cwd()`. */
|
|
54
|
+
cwdForTest?: string;
|
|
55
|
+
/** Test seam — production callers use `process.env`. */
|
|
56
|
+
envForTest?: NodeJS.ProcessEnv;
|
|
57
|
+
/** Test seam — canned git. */
|
|
58
|
+
execForTest?: WtExecFn;
|
|
59
|
+
/** Test seam — pins `createdAt`. */
|
|
60
|
+
nowForTest?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface WtRemoveOptions {
|
|
63
|
+
/** Absolute path, relative path, or a unique recorded basename. */
|
|
64
|
+
target: string;
|
|
65
|
+
json?: boolean;
|
|
66
|
+
cwdForTest?: string;
|
|
67
|
+
execForTest?: WtExecFn;
|
|
68
|
+
/** Test seam — production callers use `removeWorktreeResidue`. */
|
|
69
|
+
residueForTest?: WtResidueFn;
|
|
70
|
+
}
|
|
71
|
+
export interface WtListOptions {
|
|
72
|
+
json?: boolean;
|
|
73
|
+
/** Test seam — pins every `age-days`. */
|
|
74
|
+
nowForTest?: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Create a worktree at `<root>/<repo>-<seat>-<slug>` on a NEW branch.
|
|
78
|
+
*
|
|
79
|
+
* `git worktree add -b` always: an existing branch is a hard error in v1 (the
|
|
80
|
+
* ruling), so a create can never silently adopt someone else's in-flight work.
|
|
81
|
+
* The registry entry is written first and rolled back best-effort on a git
|
|
82
|
+
* failure; a rollback that ALSO fails names the phantom entry loudly rather
|
|
83
|
+
* than leaving the operator to discover it from `wt list`.
|
|
84
|
+
*/
|
|
85
|
+
export declare function wtCreateCommand(options: WtCreateOptions): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Remove a worktree and PROVE it is gone. Exit 0 is granted only by a
|
|
88
|
+
* no-follow existence probe returning absent; every failure path retains the
|
|
89
|
+
* registry entry so the problem stays visible in `wt list`.
|
|
90
|
+
*/
|
|
91
|
+
export declare function wtRemoveCommand(options: WtRemoveOptions): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Accounting only: what was recorded, and whether it is on disk. Whether a
|
|
94
|
+
* worktree is active or stale is NOT decided here — that classification lives
|
|
95
|
+
* in the slice-1 sensor (`totem doctor --estate`), and duplicating it would
|
|
96
|
+
* mint a second, drifting answer to the same question.
|
|
97
|
+
*/
|
|
98
|
+
export declare function wtListCommand(options?: WtListOptions): Promise<void>;
|
|
99
|
+
export {};
|
|
100
|
+
//# sourceMappingURL=wt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wt.d.ts","sourceRoot":"","sources":["../../src/commands/wt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAMH,OAAO,KAAK,EAAE,oBAAoB,EAAiB,MAAM,cAAc,CAAC;AAsCxE;;;;;;GAMG;AACH,KAAK,IAAI,GAAG,cAAc,cAAc,CAAC,CAAC;AAE1C,6EAA6E;AAC7E,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;AAExC,uFAAuF;AACvF,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAEzE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;IA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