@osdlc/typed-git 0.7.0 → 0.7.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/dist/sync.d.ts CHANGED
@@ -2,18 +2,18 @@
2
2
  * `Git` — the synchronous client, bound to one working directory and one
3
3
  * {@link CommandRunner}.
4
4
  *
5
- * Synchronous on purpose: sequential git one-shots gain nothing from being
6
- * awaited, and staying sync keeps a caller's call graph uncolored. Reach for
7
- * `AsyncGit` when the caller must not block, when calls fan out concurrently,
8
- * or when the work should run against a non-CLI backend.
5
+ * It is synchronous on purpose. Git calls run one after another gain nothing
6
+ * from being awaited, and a sync client does not force its callers to be
7
+ * async. Use `AsyncGit` when the caller must not block, when calls run
8
+ * concurrently, or when the work should run against a non-CLI backend.
9
9
  *
10
- * The contract — declared absence returns a value, everything else throws,
11
- * `try` inspects, `raw` bypasses — is stated once in `./index.ts`. Each verb's
12
- * own absence codes and parsing live in `./verbs.ts`.
10
+ * The contract is stated once in `./index.ts`: a declared absence returns a
11
+ * value, everything else throws, `try` reports instead of throwing, and `raw`
12
+ * skips the checks. Each verb's absence codes and parsing live in
13
+ * `./verbs.ts`.
13
14
  *
14
- * Deliberately NOT here: any control-plane protocol with its own conflict
15
- * semantics (a lease service's CAS ref primitives, say) — that is not
16
- * general git.
15
+ * Not here: any protocol with its own conflict rules, such as a lease
16
+ * service's compare-and-swap ref operations. That is not general git.
17
17
  */
18
18
  import { type CommandResult, type CommandRunner } from '@osdlc/command-seam';
19
19
  import { type Soft, type TriedSync } from './outcome.ts';
@@ -22,13 +22,13 @@ import { type AddOptions, type AheadBehind, type CommitOptions, type CheckoutOpt
22
22
  /**
23
23
  * Per-call concerns that are not part of the operation itself.
24
24
  *
25
- * The synchronous twin of `GitCallOptions`, minus `signal`: a `spawnSync`
26
- * child cannot be cancelled mid-flight, so offering an `AbortSignal` here
27
- * would be a promise the seam cannot keep. `timeoutMs` is the sync answer.
25
+ * The synchronous counterpart of `GitCallOptions`, without `signal`. A
26
+ * `spawnSync` child cannot be cancelled while it runs, so an `AbortSignal`
27
+ * here would do nothing. Use `timeoutMs` instead.
28
28
  */
29
29
  export interface GitSyncCallOptions {
30
30
  /**
31
- * Hard cap on the call, enforced by the runner. Without it there is no cap.
31
+ * Time limit for the call, enforced by the runner. Without it there is no cap.
32
32
  * An invalid value throws, as in command-seam (`RangeError` for 0, negative
33
33
  * or NaN; `TypeError` for a non-number).
34
34
  */
@@ -53,18 +53,18 @@ export declare class Git {
53
53
  private tried;
54
54
  private softened;
55
55
  /**
56
- * `gitDir` / `workTree` name which repository this client drives, as
57
- * `--git-dir` / `--work-tree` prefixed onto every invocation — the way to
58
- * operate on a repo that is not the process's own tree (a bare store, or a
59
- * checkout whose `.git` lives elsewhere).
56
+ * `gitDir` / `workTree` name the repository this client works on. They are
57
+ * added to every call as `--git-dir` / `--work-tree`. Use them for a repo
58
+ * that is not the process's own tree, such as a bare store or a checkout
59
+ * whose `.git` lives elsewhere.
60
60
  *
61
- * They are a property of the client, not of any one call, because "which
62
- * repository" binds the client the same way `cwd` does. `AsyncGit` takes
63
- * them on its backend instead (`cliBackend({ gitDir })`): a non-CLI backend
64
- * has no `--git-dir` to receive, so the option belongs to the thing that
65
- * spawns git, and for the sync client that thing is the client.
61
+ * They belong to the client, not to one call, because the repository is
62
+ * fixed for the client the same way `cwd` is. `AsyncGit` takes them on its
63
+ * backend instead (`cliBackend({ gitDir })`). A non-CLI backend has no
64
+ * `--git-dir` to receive, so the option goes on whatever spawns git. For
65
+ * the sync client, that is the client itself.
66
66
  *
67
- * `env` is the same idea for the environment — see `cliBackend` in
67
+ * `env` works the same way for the environment. See `cliBackend` in
68
68
  * `backend.ts`.
69
69
  *
70
70
  * This client takes a `runner`, where `AsyncGit` takes a `backend`. The
@@ -81,15 +81,15 @@ export declare class Git {
81
81
  env?: Record<string, string> | undefined;
82
82
  });
83
83
  /**
84
- * The same client rooted at a different directory — same runner, same repo
85
- * binding, same client-level `env`.
84
+ * The same client in a different directory, with the same runner,
85
+ * repository options and client-level `env`.
86
86
  */
87
87
  at(cwd: string): Git;
88
88
  /**
89
- * The whole surface again, reporting failure instead of throwing:
89
+ * Every method again, returning the failure instead of throwing.
90
90
  * `git.try.topLevel()` is a `Result<string | null, GitFailure>`: `{ ok: true, value }`
91
91
  * or `{ ok: false, error }` with a classified {@link GitFailure}.
92
- * A declared absence is `ok: true` — see `./outcome.ts`.
92
+ * A declared absence is `ok: true`. See `./outcome.ts`.
93
93
  *
94
94
  * The type leaves out `raw`, `rawChecked` and `at`, but at runtime the proxy
95
95
  * wraps them too: `git.try.raw(argv)` returns `{ ok: true, value }`. Call
@@ -97,42 +97,40 @@ export declare class Git {
97
97
  */
98
98
  get try(): TriedSync<Git>;
99
99
  /**
100
- * The tolerant door: each verb with an absence value (`null`, `[]` or
101
- * `false`) returns that value when git fails instead of throwing. For
102
- * callers that treat "could not ask" the same as "nothing there" —
103
- * `git.soft.resolveRef(x)` is `null` for a missing ref and for a broken
104
- * repo alike. Use `try` when the failure itself matters.
100
+ * Each verb with an absence value (`null`, `[]` or `false`) returns that
101
+ * value when git fails, instead of throwing. It is for callers that treat
102
+ * "could not ask" the same as "nothing there": `git.soft.resolveRef(x)` is
103
+ * `null` both for a missing ref and for a broken repo. Use `try` when the
104
+ * failure itself matters.
105
105
  *
106
106
  * As with `try`, the proxy also wraps `raw`, `rawChecked` and `at` at
107
107
  * runtime, though the type leaves them out.
108
108
  */
109
109
  get soft(): Soft<Git>;
110
- /** Unchecked passthrough for verbs not yet lifted into the API. */
110
+ /** Runs any git argv without checking the exit code. For git commands that have no verb here. */
111
111
  raw(argv: string[], opts?: GitSyncCallOptions & {
112
112
  input?: string | undefined;
113
113
  }): CommandResult;
114
114
  /**
115
- * Checked passthrough — throws the classified failure on a non-zero exit, and on
116
- * output cut short at the output cap or a timeout, as every verb does.
115
+ * Runs any git argv and throws the classified failure on a non-zero exit, or
116
+ * on output cut short at the output cap or a timeout, as every verb does.
117
117
  *
118
- * `CommandFailed.message` interpolates stderr only, and several git commands
119
- * write the sentence that explains the failure to stdout instead — a
120
- * rejecting hook, `commit` on a clean tree, `apply --check`. Report
121
- * `e.detail`, which reads both.
118
+ * Several git commands write the reason for a failure to stdout, not stderr:
119
+ * a rejecting hook, `commit` on a clean tree, `apply --check`. Report
120
+ * `e.failure.detail`, which holds both streams.
122
121
  */
123
122
  rawChecked(argv: string[], opts?: GitSyncCallOptions & {
124
123
  input?: string | undefined;
125
124
  }): CommandResult;
126
- /** The verb's argv behind this client's repository binding. */
125
+ /** The verb's argv, after this client's `--git-dir` / `--work-tree` flags. */
127
126
  private argv;
128
127
  private runOpts;
129
- /** Run one verb from the table and gate its result. */
128
+ /** Run one verb from the table and check its result with `gate`. */
130
129
  private exec;
131
130
  /** A file's content at a rev (`git show <rev>:<relPath>`), null if absent. */
132
131
  showAtRev(rev: string, relPath: string, opts?: GitSyncCallOptions): string | null;
133
132
  /**
134
- * Trimmed `git rev-parse <args>` output — the escape hatch for a query no
135
- * dedicated verb covers. See `revParse` in `verbs.ts`; for a ref, prefer
133
+ * Trimmed `git rev-parse <args>` output, for a query no other verb covers. See `revParse` in `verbs.ts`; for a ref, prefer
136
134
  * {@link Git.resolveRef}.
137
135
  *
138
136
  * Variadic. Call options go last, as an object:
@@ -146,11 +144,11 @@ export declare class Git {
146
144
  */
147
145
  resolveRef(ref: string, opts?: GitSyncCallOptions): string | null;
148
146
  /**
149
- * True iff this repository has any history — `resolveRef("HEAD") !== null`.
147
+ * True iff this repository has any history: `resolveRef("HEAD") !== null`.
150
148
  *
151
- * The repository-health probe. False means an unborn HEAD only; an
152
- * unreadable store throws rather than reading as empty, which is why this is
153
- * not `objectExists("HEAD")`.
149
+ * Use it to check that a repository is readable. False means only an unborn
150
+ * HEAD. An unreadable store throws rather than reading as empty, which is
151
+ * why this is not `objectExists("HEAD")`.
154
152
  */
155
153
  hasHistory(opts?: GitSyncCallOptions): boolean;
156
154
  /**
@@ -181,9 +179,9 @@ export declare class Git {
181
179
  * The primary checkout that owns this working directory, or null when it is
182
180
  * not inside a repository at all.
183
181
  *
184
- * Correct when the cwd is a linked worktree, which is what makes it worth a
185
- * method: `gitCommonDir()` is worktree-aware and absolute, so its parent is
186
- * the primary checkout in both cases. Callers kept rediscovering that pair.
182
+ * It is correct when the cwd is a linked worktree too. `gitCommonDir()` is
183
+ * worktree-aware and absolute, so its parent is the primary checkout in
184
+ * both cases.
187
185
  */
188
186
  mainCheckout(opts?: GitSyncCallOptions): string | null;
189
187
  /** Current branch shortname, or null when detached. Throws outside a repo. */
@@ -221,7 +219,7 @@ export declare class Git {
221
219
  /**
222
220
  * `ls-remote` rows for a remote (optionally pattern-filtered). `[]` means
223
221
  * the remote has no matching refs; an unreachable remote throws.
224
- * `timeoutMs` guards the network call.
222
+ * `timeoutMs` limits the network call.
225
223
  */
226
224
  lsRemote(remote: string, pattern?: string | undefined, opts?: GitSyncCallOptions & LsRemoteOptions): RemoteRef[];
227
225
  /**
@@ -329,8 +327,8 @@ export declare class Git {
329
327
  * The coordinate (`owner`, `repo`, `host`, `port`) a remote's URL names, or
330
328
  * null when no such remote exists or its URL names no project. Any host: see
331
329
  * {@link parseRemoteUrl}. Outside a repository it throws, like
332
- * {@link Git.remoteGetUrl}. A composite helper, not a verb: it parses after
333
- * the verb runs, so it is written once per client.
330
+ * {@link Git.remoteGetUrl}. It is a helper, not a verb: it parses after the
331
+ * verb runs, so each client has its own copy.
334
332
  */
335
333
  remoteOwnerRepo(remote?: string, opts?: GitSyncCallOptions): RemoteCoordinate | null;
336
334
  /** `git fetch <remote> [refspec…]`. See {@link FetchOptions} for the flags. */
@@ -339,11 +337,11 @@ export declare class Git {
339
337
  add(paths: string[], opts?: GitSyncCallOptions & AddOptions): void;
340
338
  /**
341
339
  * Commit with an inline message, a message file or a stdin message (exactly
342
- * one). A failing hook throws; git writes hook output to stdout, which
343
- * `e.detail` reads.
340
+ * one). A failing hook throws. git writes hook output to stdout, which
341
+ * `e.failure.detail` includes.
344
342
  */
345
343
  commit(opts: GitSyncCallOptions & CommitOptions): void;
346
- /** `git config <key> <value>` — the twin of {@link Git.configGet}. */
344
+ /** `git config <key> <value>`, the write counterpart of {@link Git.configGet}. */
347
345
  configSet(key: string, value: string, opts?: GitSyncCallOptions & ConfigSetOptions): void;
348
346
  /** `git init [path]`; `path` defaults to this client's `cwd`. */
349
347
  init(path?: string | undefined, opts?: GitSyncCallOptions & InitOptions): void;
@@ -357,7 +355,7 @@ export declare class Git {
357
355
  clone(url: string, dest?: string | undefined, opts?: GitSyncCallOptions & CloneOptions): void;
358
356
  /**
359
357
  * Push a refspec. A {@link ForceLease} pins `--force-with-lease`, which means
360
- * "nobody has touched this since I looked". `{forceWithLease: true}` adds the
358
+ * "push only if the remote ref is still where I saw it". `{forceWithLease: true}` adds the
361
359
  * bare flag, which is the unsafe form: it compares against the
362
360
  * remote-tracking ref, which a fetch in this same process may have just
363
361
  * updated. See `push` in `verbs.ts`.
@@ -414,8 +412,8 @@ export declare class Git {
414
412
  rebaseContinue(opts?: GitSyncCallOptions): RebaseOutcome;
415
413
  /**
416
414
  * What merging `theirs` into `ours` would do — no index, no checkout, no
417
- * worktree. The cheap way to ask "would this conflict, and where", and the
418
- * merged `tree` it returns is real enough to build a commit from.
415
+ * worktree. It is the cheap way to ask "would this conflict, and where". The
416
+ * merged `tree` it returns is a real object you can build a commit from.
419
417
  */
420
418
  mergeTree(ours: string, theirs: string, opts?: MergeTreeOptions & GitSyncCallOptions): MergeTreeOutcome;
421
419
  /**
package/dist/sync.js CHANGED
@@ -2,18 +2,18 @@
2
2
  * `Git` — the synchronous client, bound to one working directory and one
3
3
  * {@link CommandRunner}.
4
4
  *
5
- * Synchronous on purpose: sequential git one-shots gain nothing from being
6
- * awaited, and staying sync keeps a caller's call graph uncolored. Reach for
7
- * `AsyncGit` when the caller must not block, when calls fan out concurrently,
8
- * or when the work should run against a non-CLI backend.
5
+ * It is synchronous on purpose. Git calls run one after another gain nothing
6
+ * from being awaited, and a sync client does not force its callers to be
7
+ * async. Use `AsyncGit` when the caller must not block, when calls run
8
+ * concurrently, or when the work should run against a non-CLI backend.
9
9
  *
10
- * The contract — declared absence returns a value, everything else throws,
11
- * `try` inspects, `raw` bypasses — is stated once in `./index.ts`. Each verb's
12
- * own absence codes and parsing live in `./verbs.ts`.
10
+ * The contract is stated once in `./index.ts`: a declared absence returns a
11
+ * value, everything else throws, `try` reports instead of throwing, and `raw`
12
+ * skips the checks. Each verb's absence codes and parsing live in
13
+ * `./verbs.ts`.
13
14
  *
14
- * Deliberately NOT here: any control-plane protocol with its own conflict
15
- * semantics (a lease service's CAS ref primitives, say) — that is not
16
- * general git.
15
+ * Not here: any protocol with its own conflict rules, such as a lease
16
+ * service's compare-and-swap ref operations. That is not general git.
17
17
  */
18
18
  import { dirname } from 'node:path';
19
19
  import { resolveRunner, } from '@osdlc/command-seam';
@@ -32,18 +32,18 @@ export class Git {
32
32
  tried;
33
33
  softened;
34
34
  /**
35
- * `gitDir` / `workTree` name which repository this client drives, as
36
- * `--git-dir` / `--work-tree` prefixed onto every invocation — the way to
37
- * operate on a repo that is not the process's own tree (a bare store, or a
38
- * checkout whose `.git` lives elsewhere).
35
+ * `gitDir` / `workTree` name the repository this client works on. They are
36
+ * added to every call as `--git-dir` / `--work-tree`. Use them for a repo
37
+ * that is not the process's own tree, such as a bare store or a checkout
38
+ * whose `.git` lives elsewhere.
39
39
  *
40
- * They are a property of the client, not of any one call, because "which
41
- * repository" binds the client the same way `cwd` does. `AsyncGit` takes
42
- * them on its backend instead (`cliBackend({ gitDir })`): a non-CLI backend
43
- * has no `--git-dir` to receive, so the option belongs to the thing that
44
- * spawns git, and for the sync client that thing is the client.
40
+ * They belong to the client, not to one call, because the repository is
41
+ * fixed for the client the same way `cwd` is. `AsyncGit` takes them on its
42
+ * backend instead (`cliBackend({ gitDir })`). A non-CLI backend has no
43
+ * `--git-dir` to receive, so the option goes on whatever spawns git. For
44
+ * the sync client, that is the client itself.
45
45
  *
46
- * `env` is the same idea for the environment — see `cliBackend` in
46
+ * `env` works the same way for the environment. See `cliBackend` in
47
47
  * `backend.ts`.
48
48
  *
49
49
  * This client takes a `runner`, where `AsyncGit` takes a `backend`. The
@@ -61,8 +61,8 @@ export class Git {
61
61
  this.env = opts.env;
62
62
  }
63
63
  /**
64
- * The same client rooted at a different directory — same runner, same repo
65
- * binding, same client-level `env`.
64
+ * The same client in a different directory, with the same runner,
65
+ * repository options and client-level `env`.
66
66
  */
67
67
  at(cwd) {
68
68
  return new Git(cwd, {
@@ -73,10 +73,10 @@ export class Git {
73
73
  });
74
74
  }
75
75
  /**
76
- * The whole surface again, reporting failure instead of throwing:
76
+ * Every method again, returning the failure instead of throwing.
77
77
  * `git.try.topLevel()` is a `Result<string | null, GitFailure>`: `{ ok: true, value }`
78
78
  * or `{ ok: false, error }` with a classified {@link GitFailure}.
79
- * A declared absence is `ok: true` — see `./outcome.ts`.
79
+ * A declared absence is `ok: true`. See `./outcome.ts`.
80
80
  *
81
81
  * The type leaves out `raw`, `rawChecked` and `at`, but at runtime the proxy
82
82
  * wraps them too: `git.try.raw(argv)` returns `{ ok: true, value }`. Call
@@ -86,11 +86,11 @@ export class Git {
86
86
  return (this.tried ??= triedSync(this));
87
87
  }
88
88
  /**
89
- * The tolerant door: each verb with an absence value (`null`, `[]` or
90
- * `false`) returns that value when git fails instead of throwing. For
91
- * callers that treat "could not ask" the same as "nothing there" —
92
- * `git.soft.resolveRef(x)` is `null` for a missing ref and for a broken
93
- * repo alike. Use `try` when the failure itself matters.
89
+ * Each verb with an absence value (`null`, `[]` or `false`) returns that
90
+ * value when git fails, instead of throwing. It is for callers that treat
91
+ * "could not ask" the same as "nothing there": `git.soft.resolveRef(x)` is
92
+ * `null` both for a missing ref and for a broken repo. Use `try` when the
93
+ * failure itself matters.
94
94
  *
95
95
  * As with `try`, the proxy also wraps `raw`, `rawChecked` and `at` at
96
96
  * runtime, though the type leaves them out.
@@ -100,28 +100,27 @@ export class Git {
100
100
  return (this.softened ??= softSync(this, SOFT_TABLE));
101
101
  }
102
102
  // ── escape hatch ──────────────────────────────────────────────────────────
103
- /** Unchecked passthrough for verbs not yet lifted into the API. */
103
+ /** Runs any git argv without checking the exit code. For git commands that have no verb here. */
104
104
  raw(argv, opts = {}) {
105
105
  return this.runner.run(this.argv(argv), this.runOpts(opts));
106
106
  }
107
107
  /**
108
- * Checked passthrough — throws the classified failure on a non-zero exit, and on
109
- * output cut short at the output cap or a timeout, as every verb does.
108
+ * Runs any git argv and throws the classified failure on a non-zero exit, or
109
+ * on output cut short at the output cap or a timeout, as every verb does.
110
110
  *
111
- * `CommandFailed.message` interpolates stderr only, and several git commands
112
- * write the sentence that explains the failure to stdout instead — a
113
- * rejecting hook, `commit` on a clean tree, `apply --check`. Report
114
- * `e.detail`, which reads both.
111
+ * Several git commands write the reason for a failure to stdout, not stderr:
112
+ * a rejecting hook, `commit` on a clean tree, `apply --check`. Report
113
+ * `e.failure.detail`, which holds both streams.
115
114
  */
116
115
  rawChecked(argv, opts = {}) {
117
- // Through the gate, like `AsyncGit.rawChecked`: the seam's `runChecked`
118
- // checks the exit code only, so it would pass cut-short output.
116
+ // Through `gate`, like `AsyncGit.rawChecked`. The seam's `runChecked`
117
+ // checks only the exit code, so it would accept cut-short output.
119
118
  const verb = { argv, absent: [], parse: (r) => r };
120
119
  if (opts.input !== undefined)
121
120
  verb.input = opts.input;
122
121
  return this.exec(verb, opts);
123
122
  }
124
- /** The verb's argv behind this client's repository binding. */
123
+ /** The verb's argv, after this client's `--git-dir` / `--work-tree` flags. */
125
124
  argv(argv) {
126
125
  const prefix = repoPrefix(this.boundGitDir, this.workTree);
127
126
  return prefix.length === 0 ? argv : [...prefix, ...argv];
@@ -140,7 +139,7 @@ export class Git {
140
139
  run.input = opts.input;
141
140
  return run;
142
141
  }
143
- /** Run one verb from the table and gate its result. */
142
+ /** Run one verb from the table and check its result with `gate`. */
144
143
  exec(verb, opts = {}) {
145
144
  const run = this.runOpts(opts);
146
145
  if (verb.input !== undefined)
@@ -158,8 +157,7 @@ export class Git {
158
157
  return this.exec(v.showAtRev(rev, relPath), opts);
159
158
  }
160
159
  /**
161
- * Trimmed `git rev-parse <args>` output — the escape hatch for a query no
162
- * dedicated verb covers. See `revParse` in `verbs.ts`; for a ref, prefer
160
+ * Trimmed `git rev-parse <args>` output, for a query no other verb covers. See `revParse` in `verbs.ts`; for a ref, prefer
163
161
  * {@link Git.resolveRef}.
164
162
  *
165
163
  * Variadic. Call options go last, as an object:
@@ -178,11 +176,11 @@ export class Git {
178
176
  return this.exec(v.resolveRef(ref), opts);
179
177
  }
180
178
  /**
181
- * True iff this repository has any history — `resolveRef("HEAD") !== null`.
179
+ * True iff this repository has any history: `resolveRef("HEAD") !== null`.
182
180
  *
183
- * The repository-health probe. False means an unborn HEAD only; an
184
- * unreadable store throws rather than reading as empty, which is why this is
185
- * not `objectExists("HEAD")`.
181
+ * Use it to check that a repository is readable. False means only an unborn
182
+ * HEAD. An unreadable store throws rather than reading as empty, which is
183
+ * why this is not `objectExists("HEAD")`.
186
184
  */
187
185
  hasHistory(opts = {}) {
188
186
  return this.resolveRef('HEAD', opts) !== null;
@@ -225,9 +223,9 @@ export class Git {
225
223
  * The primary checkout that owns this working directory, or null when it is
226
224
  * not inside a repository at all.
227
225
  *
228
- * Correct when the cwd is a linked worktree, which is what makes it worth a
229
- * method: `gitCommonDir()` is worktree-aware and absolute, so its parent is
230
- * the primary checkout in both cases. Callers kept rediscovering that pair.
226
+ * It is correct when the cwd is a linked worktree too. `gitCommonDir()` is
227
+ * worktree-aware and absolute, so its parent is the primary checkout in
228
+ * both cases.
231
229
  */
232
230
  mainCheckout(opts = {}) {
233
231
  const common = this.gitCommonDir(opts);
@@ -294,7 +292,7 @@ export class Git {
294
292
  /**
295
293
  * `ls-remote` rows for a remote (optionally pattern-filtered). `[]` means
296
294
  * the remote has no matching refs; an unreachable remote throws.
297
- * `timeoutMs` guards the network call.
295
+ * `timeoutMs` limits the network call.
298
296
  */
299
297
  lsRemote(remote, pattern, opts = {}) {
300
298
  return this.exec(v.lsRemote(remote, pattern, opts), opts);
@@ -458,8 +456,8 @@ export class Git {
458
456
  * The coordinate (`owner`, `repo`, `host`, `port`) a remote's URL names, or
459
457
  * null when no such remote exists or its URL names no project. Any host: see
460
458
  * {@link parseRemoteUrl}. Outside a repository it throws, like
461
- * {@link Git.remoteGetUrl}. A composite helper, not a verb: it parses after
462
- * the verb runs, so it is written once per client.
459
+ * {@link Git.remoteGetUrl}. It is a helper, not a verb: it parses after the
460
+ * verb runs, so each client has its own copy.
463
461
  */
464
462
  remoteOwnerRepo(remote = 'origin', opts = {}) {
465
463
  const url = this.remoteGetUrl(remote, opts);
@@ -476,13 +474,13 @@ export class Git {
476
474
  }
477
475
  /**
478
476
  * Commit with an inline message, a message file or a stdin message (exactly
479
- * one). A failing hook throws; git writes hook output to stdout, which
480
- * `e.detail` reads.
477
+ * one). A failing hook throws. git writes hook output to stdout, which
478
+ * `e.failure.detail` includes.
481
479
  */
482
480
  commit(opts) {
483
481
  this.exec(v.commit(opts), opts);
484
482
  }
485
- /** `git config <key> <value>` — the twin of {@link Git.configGet}. */
483
+ /** `git config <key> <value>`, the write counterpart of {@link Git.configGet}. */
486
484
  configSet(key, value, opts = {}) {
487
485
  this.exec(v.configSet(key, value, opts), opts);
488
486
  }
@@ -502,7 +500,7 @@ export class Git {
502
500
  }
503
501
  /**
504
502
  * Push a refspec. A {@link ForceLease} pins `--force-with-lease`, which means
505
- * "nobody has touched this since I looked". `{forceWithLease: true}` adds the
503
+ * "push only if the remote ref is still where I saw it". `{forceWithLease: true}` adds the
506
504
  * bare flag, which is the unsafe form: it compares against the
507
505
  * remote-tracking ref, which a fetch in this same process may have just
508
506
  * updated. See `push` in `verbs.ts`.
@@ -580,8 +578,8 @@ export class Git {
580
578
  }
581
579
  /**
582
580
  * What merging `theirs` into `ours` would do — no index, no checkout, no
583
- * worktree. The cheap way to ask "would this conflict, and where", and the
584
- * merged `tree` it returns is real enough to build a commit from.
581
+ * worktree. It is the cheap way to ask "would this conflict, and where". The
582
+ * merged `tree` it returns is a real object you can build a commit from.
585
583
  */
586
584
  mergeTree(ours, theirs, opts = {}) {
587
585
  return this.exec(v.mergeTree(ours, theirs, opts), opts);
package/dist/testing.d.ts CHANGED
@@ -4,9 +4,9 @@
4
4
  * A separate subpath, not part of the package entry: production code should
5
5
  * not be able to reach `mkdtemp` through a git client.
6
6
  *
7
- * Deliberately general. Conventions that belong to one consuming project — a
8
- * particular directory layout, its own ref namespace — go in that project's
9
- * own wrapper around these helpers, not here.
7
+ * It is general on purpose. Conventions that belong to one consuming project,
8
+ * such as a directory layout or a ref namespace, go in that project's own
9
+ * wrapper around these helpers, not here.
10
10
  */
11
11
  import { Git } from './sync.ts';
12
12
  /**
@@ -39,8 +39,8 @@ export interface GitFixture {
39
39
  readonly dir: string;
40
40
  /**
41
41
  * A client rooted at {@link GitFixture.dir}, carrying the fixture identity
42
- * as its client-level `env` — so every call through it, a suite's own
43
- * included, runs under the pinned identity.
42
+ * as its client-level `env`, so every call through it runs under the pinned
43
+ * identity, a suite's own calls included.
44
44
  */
45
45
  readonly git: Git;
46
46
  /** Write files (paths relative to `dir`), stage everything, and commit. */
@@ -48,7 +48,7 @@ export interface GitFixture {
48
48
  /** Remove the temp directory. Idempotent. */
49
49
  cleanup(): void;
50
50
  }
51
- /** Shared knobs for choosing where a fixture lands and who authors it. */
51
+ /** Shared options for where a fixture is made and who authors it. */
52
52
  interface FixtureLocation {
53
53
  /**
54
54
  * Use this exact directory rather than making one. `cleanup()` still removes
@@ -57,8 +57,8 @@ interface FixtureLocation {
57
57
  dir?: string | undefined;
58
58
  /**
59
59
  * Make the temp directory under this parent instead of `os.tmpdir()`, so two
60
- * related repositories share one parent — a store and its worker, an origin
61
- * and its clone.
60
+ * related repositories share one parent, such as a store and its worker, or
61
+ * an origin and its clone.
62
62
  */
63
63
  parent?: string | undefined;
64
64
  /** Prefix for the generated directory name. */
@@ -97,10 +97,10 @@ export interface OriginAndCheckout {
97
97
  cleanup(): void;
98
98
  }
99
99
  /**
100
- * An origin repository with one commit, plus a clone of it — the shape a test
101
- * of fetch/push/worktree behaviour needs.
100
+ * An origin repository with one commit, plus a clone of it. Tests of fetch,
101
+ * push and worktree behaviour need this setup.
102
102
  *
103
- * Reach for {@link makeBareAndWorker} instead when the second repo must have
103
+ * Use {@link makeBareAndWorker} instead when the second repo must have
104
104
  * its own history rather than the origin's.
105
105
  */
106
106
  export declare function makeOriginAndCheckout(opts?: MakeOriginAndCheckoutOptions): OriginAndCheckout;
@@ -135,7 +135,7 @@ export interface BareAndWorker {
135
135
  *
136
136
  * Not a clone: the worker is `git init`ed on its own and given a remote, so it
137
137
  * starts with no history and no upstream tracking, and its first push is a
138
- * genuine publish into an empty store.
138
+ * real first push into an empty store.
139
139
  *
140
140
  * Both repositories land under one parent, so a suite deletes one directory.
141
141
  * `cleanup()` deletes that whole parent, also one the caller passed in; see
package/dist/testing.js CHANGED
@@ -4,9 +4,9 @@
4
4
  * A separate subpath, not part of the package entry: production code should
5
5
  * not be able to reach `mkdtemp` through a git client.
6
6
  *
7
- * Deliberately general. Conventions that belong to one consuming project — a
8
- * particular directory layout, its own ref namespace — go in that project's
9
- * own wrapper around these helpers, not here.
7
+ * It is general on purpose. Conventions that belong to one consuming project,
8
+ * such as a directory layout or a ref namespace, go in that project's own
9
+ * wrapper around these helpers, not here.
10
10
  */
11
11
  import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
12
12
  import { tmpdir } from 'node:os';
@@ -45,9 +45,9 @@ function fixtureDir(opts, fallbackPrefix) {
45
45
  /**
46
46
  * Wrap an existing directory that already holds a repository.
47
47
  *
48
- * The identity is bound as the client's `env` rather than threaded onto each
49
- * call, so every call the fixture makes runs under it — the internal
50
- * `rev-parse` in `commit()` included.
48
+ * The identity is set as the client's `env` rather than passed on each call,
49
+ * so every call the fixture makes runs under it, including the `rev-parse`
50
+ * inside `commit()`.
51
51
  */
52
52
  function fixtureAt(dir, opts = {}) {
53
53
  const identity = opts.identity ?? IDENTITY;
@@ -103,10 +103,10 @@ export function makeGitFixture(opts = {}) {
103
103
  return fixtureAt(dir, at);
104
104
  }
105
105
  /**
106
- * An origin repository with one commit, plus a clone of it — the shape a test
107
- * of fetch/push/worktree behaviour needs.
106
+ * An origin repository with one commit, plus a clone of it. Tests of fetch,
107
+ * push and worktree behaviour need this setup.
108
108
  *
109
- * Reach for {@link makeBareAndWorker} instead when the second repo must have
109
+ * Use {@link makeBareAndWorker} instead when the second repo must have
110
110
  * its own history rather than the origin's.
111
111
  */
112
112
  export function makeOriginAndCheckout(opts = {}) {
@@ -119,7 +119,7 @@ export function makeOriginAndCheckout(opts = {}) {
119
119
  });
120
120
  origin.commit('initial', opts.files ?? { 'README.md': 'fixture\n' });
121
121
  const dir = fixtureDir({ parent: opts.parent }, 'typed-git-checkout-');
122
- // `Git.clone` runs from `cwd` (see sync.ts) — `dir` isn't a repository yet, so this call makes it the checkout below.
122
+ // `Git.clone` runs from `cwd` (see sync.ts). `dir` is not a repository yet; this clone makes it the checkout.
123
123
  new Git(dir).clone(origin.dir, '.', { quiet: true, branch });
124
124
  const checkout = fixtureAt(dir, { identity: opts.identity });
125
125
  return {
@@ -136,7 +136,7 @@ export function makeOriginAndCheckout(opts = {}) {
136
136
  *
137
137
  * Not a clone: the worker is `git init`ed on its own and given a remote, so it
138
138
  * starts with no history and no upstream tracking, and its first push is a
139
- * genuine publish into an empty store.
139
+ * real first push into an empty store.
140
140
  *
141
141
  * Both repositories land under one parent, so a suite deletes one directory.
142
142
  * `cleanup()` deletes that whole parent, also one the caller passed in; see