type-git 0.6.0 → 0.7.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.
package/README.md CHANGED
@@ -89,19 +89,35 @@ import { TypeGit } from 'type-git/node';
89
89
  const git = await TypeGit.create({ useLegacyVersion: true });
90
90
  ```
91
91
 
92
- ### Typed CLI commands
92
+ ### Typed CLI commands (`type-git/strict`)
93
93
 
94
- Use `command()` for registered CLI operations, including ones without a parsed convenience method:
94
+ For registered CLI operations without a parsed convenience method, import `strict` from
95
+ `type-git/strict`. It wraps a client or repository and adds a grammar-checked `command()`:
95
96
 
96
97
  ```typescript
97
- const hash = await git.command('hash-object', [['--stdin']], { stdin: 'hello' });
98
- await repo.command('remote add', [{ operand: 'origin' }, { operand: '/path/to/upstream' }]);
98
+ import { strict } from 'type-git/strict';
99
+
100
+ const strictGit = strict(git);
101
+ const hash = await strictGit.command('hash-object', [['--stdin']], { stdin: 'hello' });
102
+
103
+ const strictRepo = strict(repo);
104
+ await strictRepo.command('remote add', [{ operand: 'origin' }, { operand: '/path/to/upstream' }]);
105
+ await strictRepo.status(); // every other method is still available
99
106
  ```
100
107
 
101
108
  Option tuples and operand objects retain ordering and repeated flags. Literal combinations are
102
- checked against declarative rules; dynamic input is validated at runtime. The result contains
103
- raw stdout, stderr, and exit status. See the [API design and pinned baselines](docs/design/typed-command-api.md)
104
- and [coverage ledger](docs/design/command-coverage.md) for the currently registered scopes and remaining audit work.
109
+ checked against Git's option grammar at compile time; dynamic input is validated at runtime,
110
+ including probes of the selected Git executable where its parser behavior differs between
111
+ builds. The result contains raw stdout, stderr, and exit status. See the
112
+ [API design and pinned baselines](docs/design/typed-command-api.md) and
113
+ [coverage ledger](docs/design/command-coverage.md) for the registered scopes and remaining audit
114
+ work.
115
+
116
+ The grammar catalogue is large, so it lives only in `type-git/strict`. The main entry point
117
+ (`type-git`, `type-git/node`, `type-git/bun`, `type-git/deno`) keeps `raw()`, the high-level API,
118
+ and the runtime checks against argument injection, and neither its bundle nor its type
119
+ declarations include the catalogue. For an application that only calls high-level methods such
120
+ as `repo.status()`, the bundled size is about 180 KB minified instead of about 1.6 MB.
105
121
 
106
122
  ### Advanced Usage
107
123
 
@@ -5,7 +5,8 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkBRFWPLJ7cjs = require('../../chunk-BRFWPLJ7.cjs');
8
+ var _chunkNBX6BNQFcjs = require('../../chunk-NBX6BNQF.cjs');
9
+ require('../../chunk-MFY7MGIJ.cjs');
9
10
 
10
11
  // src/adapters/bun/exec.ts
11
12
  function resolveChildEnv(env, inheritEnv) {
@@ -116,7 +117,7 @@ var BunExecAdapter = class {
116
117
  let stderr = "";
117
118
  if (binary) {
118
119
  [stdout, stderr] = await Promise.all([
119
- proc.stdout ? _chunkBRFWPLJ7cjs.readBytes.call(void 0, proc.stdout) : Promise.resolve(new Uint8Array(0)),
120
+ proc.stdout ? _chunkNBX6BNQFcjs.readBytes.call(void 0, proc.stdout) : Promise.resolve(new Uint8Array(0)),
120
121
  proc.stderr ? readStream(proc.stderr, _optionalChain([handlers, 'optionalAccess', _4 => _4.onStderr])) : Promise.resolve("")
121
122
  ]);
122
123
  } else if (_optionalChain([handlers, 'optionalAccess', _5 => _5.onStdout]) || _optionalChain([handlers, 'optionalAccess', _6 => _6.onStderr])) {
@@ -293,7 +294,7 @@ var BunFsAdapter = (_class = class {constructor() { _class.prototype.__init.call
293
294
  },
294
295
  sleep: (ms) => Bun.sleep(ms)
295
296
  };
296
- await _chunkBRFWPLJ7cjs.runTailPolling.call(void 0, { adapter, signal, pollInterval, onLine });
297
+ await _chunkNBX6BNQFcjs.runTailPolling.call(void 0, { adapter, signal, pollInterval, onLine });
297
298
  }
298
299
  async deleteFile(filePath) {
299
300
  const tempDir = this.tempFileDirs.get(filePath);
@@ -337,7 +338,7 @@ var BunFsAdapter = (_class = class {constructor() { _class.prototype.__init.call
337
338
  },
338
339
  sleep: (ms) => Bun.sleep(ms)
339
340
  };
340
- return _chunkBRFWPLJ7cjs.createTailPolling.call(void 0, { adapter, signal, pollInterval });
341
+ return _chunkNBX6BNQFcjs.createTailPolling.call(void 0, { adapter, signal, pollInterval });
341
342
  }
342
343
  }, _class);
343
344
 
@@ -348,13 +349,13 @@ function createBunAdapters() {
348
349
  fs: new BunFsAdapter()
349
350
  };
350
351
  }
351
- var TypeGit = class _TypeGit extends _chunkBRFWPLJ7cjs.GitClient {
352
+ var TypeGit = class _TypeGit extends _chunkNBX6BNQFcjs.GitClient {
352
353
  static async create(options) {
353
- return new _TypeGit(await _chunkBRFWPLJ7cjs.createGit.call(void 0, { ...options, adapters: createBunAdapters() }));
354
+ return new _TypeGit(await _chunkNBX6BNQFcjs.createGit.call(void 0, { ...options, adapters: createBunAdapters() }));
354
355
  }
355
356
  constructor(optionsOrGit) {
356
357
  super(
357
- optionsOrGit && "open" in optionsOrGit ? optionsOrGit : _chunkBRFWPLJ7cjs.createGitSync.call(void 0, { ...optionsOrGit, adapters: createBunAdapters() })
358
+ optionsOrGit && "open" in optionsOrGit ? optionsOrGit : _chunkNBX6BNQFcjs.createGitSync.call(void 0, { ...optionsOrGit, adapters: createBunAdapters() })
358
359
  );
359
360
  }
360
361
  };
@@ -1,4 +1,5 @@
1
- import { E as ExecAdapter, C as Capabilities, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, e as CreateGitOptions, G as GitClient, f as Git } from '../../client.d-D9Lqi1a2.cjs';
1
+ import { E as ExecAdapter, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, C as CreateGitOptions, G as GitClient } from '../../client.d-PRQCR2_T.cjs';
2
+ import { C as Capabilities, G as Git } from '../../git.d-DrhCzWEn.cjs';
2
3
 
3
4
  /**
4
5
  * Bun ExecAdapter implementation
@@ -1,4 +1,5 @@
1
- import { E as ExecAdapter, C as Capabilities, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, e as CreateGitOptions, G as GitClient, f as Git } from '../../client.d-D9Lqi1a2.cjs';
1
+ import { E as ExecAdapter, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, C as CreateGitOptions, G as GitClient } from '../../client.d-Cs32YZX6.js';
2
+ import { C as Capabilities, G as Git } from '../../git.d-DrhCzWEn.cjs';
2
3
 
3
4
  /**
4
5
  * Bun ExecAdapter implementation
@@ -5,7 +5,8 @@ import {
5
5
  createTailPolling,
6
6
  readBytes,
7
7
  runTailPolling
8
- } from "../../chunk-IYOGHATP.js";
8
+ } from "../../chunk-YIWTIIXH.js";
9
+ import "../../chunk-5NI3KM5Z.js";
9
10
 
10
11
  // src/adapters/bun/exec.ts
11
12
  function resolveChildEnv(env, inheritEnv) {
@@ -5,7 +5,8 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkBRFWPLJ7cjs = require('../../chunk-BRFWPLJ7.cjs');
8
+ var _chunkNBX6BNQFcjs = require('../../chunk-NBX6BNQF.cjs');
9
+ require('../../chunk-MFY7MGIJ.cjs');
9
10
 
10
11
  // src/adapters/deno/exec.ts
11
12
  function resolveChildEnvOptions(env, inheritEnv) {
@@ -140,7 +141,7 @@ var DenoExecAdapter = class {
140
141
  let stderr = "";
141
142
  if (binary) {
142
143
  [stdout, stderr] = await Promise.all([
143
- child.stdout ? _chunkBRFWPLJ7cjs.readBytes.call(void 0, child.stdout) : Promise.resolve(new Uint8Array(0)),
144
+ child.stdout ? _chunkNBX6BNQFcjs.readBytes.call(void 0, child.stdout) : Promise.resolve(new Uint8Array(0)),
144
145
  child.stderr ? readStream(child.stderr, _optionalChain([handlers, 'optionalAccess', _4 => _4.onStderr])) : Promise.resolve("")
145
146
  ]);
146
147
  } else if (_optionalChain([handlers, 'optionalAccess', _5 => _5.onStdout]) || _optionalChain([handlers, 'optionalAccess', _6 => _6.onStderr])) {
@@ -356,7 +357,7 @@ var DenoFsAdapter = (_class = class {constructor() { _class.prototype.__init.cal
356
357
  },
357
358
  sleep: (ms) => delay(ms)
358
359
  };
359
- await _chunkBRFWPLJ7cjs.runTailPolling.call(void 0, { adapter, signal, pollInterval, onLine });
360
+ await _chunkNBX6BNQFcjs.runTailPolling.call(void 0, { adapter, signal, pollInterval, onLine });
360
361
  }
361
362
  async deleteFile(filePath) {
362
363
  const tempDir = this.tempFileDirs.get(filePath);
@@ -427,7 +428,7 @@ var DenoFsAdapter = (_class = class {constructor() { _class.prototype.__init.cal
427
428
  },
428
429
  sleep: (ms) => delay(ms)
429
430
  };
430
- return _chunkBRFWPLJ7cjs.createTailPolling.call(void 0, { adapter, signal, pollInterval });
431
+ return _chunkNBX6BNQFcjs.createTailPolling.call(void 0, { adapter, signal, pollInterval });
431
432
  }
432
433
  }, _class);
433
434
 
@@ -438,13 +439,13 @@ function createDenoAdapters() {
438
439
  fs: new DenoFsAdapter()
439
440
  };
440
441
  }
441
- var TypeGit = class _TypeGit extends _chunkBRFWPLJ7cjs.GitClient {
442
+ var TypeGit = class _TypeGit extends _chunkNBX6BNQFcjs.GitClient {
442
443
  static async create(options) {
443
- return new _TypeGit(await _chunkBRFWPLJ7cjs.createGit.call(void 0, { ...options, adapters: createDenoAdapters() }));
444
+ return new _TypeGit(await _chunkNBX6BNQFcjs.createGit.call(void 0, { ...options, adapters: createDenoAdapters() }));
444
445
  }
445
446
  constructor(optionsOrGit) {
446
447
  super(
447
- optionsOrGit && "open" in optionsOrGit ? optionsOrGit : _chunkBRFWPLJ7cjs.createGitSync.call(void 0, { ...optionsOrGit, adapters: createDenoAdapters() })
448
+ optionsOrGit && "open" in optionsOrGit ? optionsOrGit : _chunkNBX6BNQFcjs.createGitSync.call(void 0, { ...optionsOrGit, adapters: createDenoAdapters() })
448
449
  );
449
450
  }
450
451
  };
@@ -1,4 +1,5 @@
1
- import { E as ExecAdapter, C as Capabilities, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, e as CreateGitOptions, G as GitClient, f as Git } from '../../client.d-D9Lqi1a2.cjs';
1
+ import { E as ExecAdapter, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, C as CreateGitOptions, G as GitClient } from '../../client.d-PRQCR2_T.cjs';
2
+ import { C as Capabilities, G as Git } from '../../git.d-DrhCzWEn.cjs';
2
3
 
3
4
  /**
4
5
  * Deno ExecAdapter implementation
@@ -1,4 +1,5 @@
1
- import { E as ExecAdapter, C as Capabilities, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, e as CreateGitOptions, G as GitClient, f as Git } from '../../client.d-D9Lqi1a2.cjs';
1
+ import { E as ExecAdapter, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, C as CreateGitOptions, G as GitClient } from '../../client.d-Cs32YZX6.js';
2
+ import { C as Capabilities, G as Git } from '../../git.d-DrhCzWEn.cjs';
2
3
 
3
4
  /**
4
5
  * Deno ExecAdapter implementation
@@ -5,7 +5,8 @@ import {
5
5
  createTailPolling,
6
6
  readBytes,
7
7
  runTailPolling
8
- } from "../../chunk-IYOGHATP.js";
8
+ } from "../../chunk-YIWTIIXH.js";
9
+ import "../../chunk-5NI3KM5Z.js";
9
10
 
10
11
  // src/adapters/deno/exec.ts
11
12
  function resolveChildEnvOptions(env, inheritEnv) {
@@ -3,11 +3,12 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkDDWWKTAEcjs = require('../../chunk-DDWWKTAE.cjs');
7
- require('../../chunk-BRFWPLJ7.cjs');
6
+ var _chunkX3F6MDXQcjs = require('../../chunk-X3F6MDXQ.cjs');
7
+ require('../../chunk-NBX6BNQF.cjs');
8
+ require('../../chunk-MFY7MGIJ.cjs');
8
9
 
9
10
 
10
11
 
11
12
 
12
13
 
13
- exports.NodeExecAdapter = _chunkDDWWKTAEcjs.NodeExecAdapter; exports.NodeFsAdapter = _chunkDDWWKTAEcjs.NodeFsAdapter; exports.TypeGit = _chunkDDWWKTAEcjs.TypeGit; exports.createNodeAdapters = _chunkDDWWKTAEcjs.createNodeAdapters;
14
+ exports.NodeExecAdapter = _chunkX3F6MDXQcjs.NodeExecAdapter; exports.NodeFsAdapter = _chunkX3F6MDXQcjs.NodeFsAdapter; exports.TypeGit = _chunkX3F6MDXQcjs.TypeGit; exports.createNodeAdapters = _chunkX3F6MDXQcjs.createNodeAdapters;
@@ -1,4 +1,5 @@
1
- import { E as ExecAdapter, C as Capabilities, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, e as CreateGitOptions, G as GitClient, f as Git } from '../../client.d-D9Lqi1a2.cjs';
1
+ import { E as ExecAdapter, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, C as CreateGitOptions, G as GitClient } from '../../client.d-PRQCR2_T.cjs';
2
+ import { C as Capabilities, G as Git } from '../../git.d-DrhCzWEn.cjs';
2
3
 
3
4
  /**
4
5
  * Options for {@link NodeExecAdapter}.
@@ -1,4 +1,5 @@
1
- import { E as ExecAdapter, C as Capabilities, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, e as CreateGitOptions, G as GitClient, f as Git } from '../../client.d-D9Lqi1a2.cjs';
1
+ import { E as ExecAdapter, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, C as CreateGitOptions, G as GitClient } from '../../client.d-Cs32YZX6.js';
2
+ import { C as Capabilities, G as Git } from '../../git.d-DrhCzWEn.cjs';
2
3
 
3
4
  /**
4
5
  * Options for {@link NodeExecAdapter}.
@@ -3,8 +3,9 @@ import {
3
3
  NodeFsAdapter,
4
4
  TypeGit,
5
5
  createNodeAdapters
6
- } from "../../chunk-FHV2WOQG.js";
7
- import "../../chunk-IYOGHATP.js";
6
+ } from "../../chunk-IAJF67MB.js";
7
+ import "../../chunk-YIWTIIXH.js";
8
+ import "../../chunk-5NI3KM5Z.js";
8
9
  export {
9
10
  NodeExecAdapter,
10
11
  NodeFsAdapter,