type-git 0.6.0 → 0.8.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
 
@@ -149,6 +165,9 @@ const lfsStatus = await repo.lfs.status();
149
165
 
150
166
  // Raw escape hatch when needed
151
167
  const result = await repo.raw(['rev-parse', 'HEAD']);
168
+
169
+ // Send data on stdin instead of putting it in argv
170
+ const { stdout: blobId } = await repo.raw(['hash-object', '-w', '--stdin'], { stdin: 'hello' });
152
171
  ```
153
172
 
154
173
  ### Audit Mode
@@ -202,6 +221,96 @@ Runs `git lfs push --object-id origin --stdin`, sending one OID per line and
202
221
  closing standard input. This avoids command-line length limits for large OID lists.
203
222
  Omit `stdin` to pass object IDs as command-line arguments.
204
223
 
224
+ ## Security model
225
+
226
+ type-git checks where an untrusted value, such as a branch name, remote URL or path typed by a
227
+ user, could otherwise turn into a Git option. It does not make every input safe. This section
228
+ lists what each API level checks and what stays the caller's responsibility.
229
+
230
+ **High-level API** (`repo.status()`, `git.clone()`, `repo.fetch()`, …)
231
+
232
+ - Remotes, URLs, refs, paths and other positional operands that start with `-` are refused
233
+ with `GitArgumentError` before Git starts, because Git would parse them as options such as
234
+ `--upload-pack=<command>`. Many path lists are also passed after `--`.
235
+ - Option names come from the typed option fields. A caller's string becomes an option value or
236
+ an operand, not a new option.
237
+ - `git.clone(url, path, { config })` accepts only data-only configuration keys (see
238
+ `CloneConfigSchema`). Keys such as `protocol.ext.allow`, `include.path`, `core.sshCommand`
239
+ or `core.fsmonitor` are refused, because `git clone -c` would apply them to the first fetch.
240
+ Transport keys such as `http.sslVerify`, `http.proxy` and `http.extraHeader` are accepted:
241
+ they cannot run a program, but they decide which server is trusted and what is sent to it.
242
+ - Some options exist to run a program, and they run what you give them. Treat these values
243
+ as code: `config.set()`, `config.add()` and `config.setRaw()` (for example `core.sshCommand`,
244
+ `core.pager`, `gpg.program`), `submodule.foreach()`, `rebase({ exec })`, the merge
245
+ `strategy` (Git runs `git-merge-<strategy>`) and the `credentialHelper` open option.
246
+
247
+ **Strict API** (`strict(repo).command(...)`)
248
+
249
+ - Options are checked against Git's option grammar. Only canonical option names are accepted:
250
+ abbreviations such as `--upload-p` and bundled short options that hide another option, such as
251
+ `-vu`, are refused.
252
+ - An `{ operand }` that starts with `-` is refused wherever Git would read it as an option, for
253
+ example before an explicit `['--']`.
254
+
255
+ **Raw API** (`git.raw(argv)`, `repo.raw(argv)`)
256
+
257
+ - `raw()` passes `argv` to Git unchanged and checks nothing. Build its argv only from trusted
258
+ values. Send untrusted data on standard input with the `stdin` option instead of in argv, but
259
+ only to a command that reads standard input as data, such as `hash-object --stdin` or
260
+ `commit -F -`. Commands that read standard input as instructions, such as `fast-import` or
261
+ `update-ref --stdin`, let that input create or move refs, so do not feed them untrusted input.
262
+
263
+ **Environment**
264
+
265
+ - Spawned Git processes inherit only an allowlist of the parent environment
266
+ (`DEFAULT_ENV_ALLOWLIST`), so other application secrets are not passed on. No variable that
267
+ names a program Git runs, such as `GIT_SSH_COMMAND`, `GIT_ASKPASS`, `GIT_EXTERNAL_DIFF` or
268
+ `GIT_PAGER`, is inherited by default. Opt one in with `inheritEnv: ['GIT_SSH_COMMAND']`, or
269
+ pass it with the `env` option, when you trust the value.
270
+ - `inheritEnv: true` passes the whole parent environment, including application secrets and the
271
+ program-naming variables above. A predicate passed as `inheritEnv` bypasses
272
+ `DEFAULT_ENV_ALLOWLIST` and passes exactly the variables it selects. Use these forms only when
273
+ every variable they can select is trusted.
274
+ - The allowlist does pass `PATH` (which picks the `ssh`, `git-lfs` and `git-remote-*` programs),
275
+ `HOME` (and so `~/.gitconfig`), the proxy variables (whose URLs may hold credentials) and the
276
+ SSH agent variables. An HTTPS-only application can drop the agent with
277
+ `inheritEnv: { remove: ['SSH_AUTH_SOCK', 'SSH_AGENT_PID'] }`.
278
+
279
+ **Untrusted repositories** (`git.open(path, { untrusted: true })`)
280
+
281
+ - Git runs whatever a repository's own configuration and hooks name, such as `core.fsmonitor`,
282
+ hooks, and clean, smudge or diff filters. By default, opening a repository directory that
283
+ someone else controls is as dangerous with type-git as running `git status` in it yourself.
284
+ - With `untrusted: true` (also on `openBare()` and `openRaw()`), every command runs with `-c`
285
+ overrides that point `core.hooksPath` at a path that cannot hold hooks, turn off
286
+ `core.fsmonitor`, refuse the `ext::` transport and set `safe.bareRepository=explicit`.
287
+ Opening fails with `GitError` kind `'UnsafeRepoConfig'` when the repository's own
288
+ configuration (`local` and `worktree` scopes, including included files) sets any key outside a
289
+ closed list of data-only keys. The list covers the usual keys that `git init`, `git clone`,
290
+ `git sparse-checkout` and `git lfs install` write, `branch.<name>.*` and similar; driver keys
291
+ such as `diff.<driver>.textconv` cannot be overridden by name, so they are refused instead.
292
+ The configuration of every populated submodule is checked the same way, because Git runs
293
+ commands such as `status` inside submodules.
294
+ - A key that names a remote, such as `branch.<name>.remote`, must name a remote whose URL the
295
+ repository's configuration sets, and a repository with legacy `.git/remotes/` or
296
+ `.git/branches/` files is refused: Git reads those for remotes the configuration does not
297
+ define, and a name without a URL is read as a path. A custom file system adapter needs
298
+ `readDirectory` for untrusted mode.
299
+ - Remote and submodule URLs in that configuration must be `https`, `http`, `ssh`, `git` or
300
+ scp-style URLs. A local path or `file://` URL would make Git run `upload-pack` or
301
+ `receive-pack` in another repository without the overrides, so its hooks and configuration
302
+ would run unchecked. The same holds for a local path you pass yourself as a remote, so pass
303
+ one only when you trust that repository.
304
+ - The check runs once, when the repository is opened, so nobody else may change the directory
305
+ while you use it. Your own global and system configuration is still trusted. Open a worktree
306
+ by its top-level directory, not its `.git` directory. Untrusted mode needs Git 2.38 or later.
307
+
308
+ **Not covered**
309
+ - A cloned repository does not carry the remote's configuration or hooks. Its `.gitattributes`
310
+ can still select filters that your own configuration defines, and its `.gitmodules` and
311
+ `.lfsconfig` still steer submodule and LFS transfers. The clone `template` option and your
312
+ `init.templateDir` copy hooks into the new repository.
313
+
205
314
  ## Architecture
206
315
 
207
316
  ```
@@ -5,7 +5,8 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkBRFWPLJ7cjs = require('../../chunk-BRFWPLJ7.cjs');
8
+ var _chunkUHZWPYTFcjs = require('../../chunk-UHZWPYTF.cjs');
9
+ require('../../chunk-6HDMSFY7.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 ? _chunkUHZWPYTFcjs.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 _chunkUHZWPYTFcjs.runTailPolling.call(void 0, { adapter, signal, pollInterval, onLine });
297
298
  }
298
299
  async deleteFile(filePath) {
299
300
  const tempDir = this.tempFileDirs.get(filePath);
@@ -307,6 +308,17 @@ var BunFsAdapter = (_class = class {constructor() { _class.prototype.__init.call
307
308
  async deleteDirectory(dirPath) {
308
309
  await _promises.rm.call(void 0, dirPath, { force: true, recursive: true });
309
310
  }
311
+ async readDirectory(dirPath) {
312
+ try {
313
+ return await _promises.readdir.call(void 0, dirPath);
314
+ } catch (error) {
315
+ const code = error.code;
316
+ if (code === "ENOENT" || code === "ENOTDIR") {
317
+ return [];
318
+ }
319
+ throw error;
320
+ }
321
+ }
310
322
  async exists(filePath) {
311
323
  const file = Bun.file(filePath);
312
324
  return await file.exists();
@@ -337,7 +349,7 @@ var BunFsAdapter = (_class = class {constructor() { _class.prototype.__init.call
337
349
  },
338
350
  sleep: (ms) => Bun.sleep(ms)
339
351
  };
340
- return _chunkBRFWPLJ7cjs.createTailPolling.call(void 0, { adapter, signal, pollInterval });
352
+ return _chunkUHZWPYTFcjs.createTailPolling.call(void 0, { adapter, signal, pollInterval });
341
353
  }
342
354
  }, _class);
343
355
 
@@ -348,13 +360,13 @@ function createBunAdapters() {
348
360
  fs: new BunFsAdapter()
349
361
  };
350
362
  }
351
- var TypeGit = class _TypeGit extends _chunkBRFWPLJ7cjs.GitClient {
363
+ var TypeGit = class _TypeGit extends _chunkUHZWPYTFcjs.GitClient {
352
364
  static async create(options) {
353
- return new _TypeGit(await _chunkBRFWPLJ7cjs.createGit.call(void 0, { ...options, adapters: createBunAdapters() }));
365
+ return new _TypeGit(await _chunkUHZWPYTFcjs.createGit.call(void 0, { ...options, adapters: createBunAdapters() }));
354
366
  }
355
367
  constructor(optionsOrGit) {
356
368
  super(
357
- optionsOrGit && "open" in optionsOrGit ? optionsOrGit : _chunkBRFWPLJ7cjs.createGitSync.call(void 0, { ...optionsOrGit, adapters: createBunAdapters() })
369
+ optionsOrGit && "open" in optionsOrGit ? optionsOrGit : _chunkUHZWPYTFcjs.createGitSync.call(void 0, { ...optionsOrGit, adapters: createBunAdapters() })
358
370
  );
359
371
  }
360
372
  };
@@ -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-Cg5wWJnY.cjs';
2
+ import { C as Capabilities, G as Git } from '../../git.d-DqAvRXEf.cjs';
2
3
 
3
4
  /**
4
5
  * Bun ExecAdapter implementation
@@ -28,6 +29,7 @@ declare class BunFsAdapter implements FsAdapter {
28
29
  tail(options: TailOptions): Promise<void>;
29
30
  deleteFile(filePath: string): Promise<void>;
30
31
  deleteDirectory(dirPath: string): Promise<void>;
32
+ readDirectory(dirPath: string): Promise<string[]>;
31
33
  exists(filePath: string): Promise<boolean>;
32
34
  readFile(filePath: string): Promise<string>;
33
35
  writeFile(filePath: string, contents: string): Promise<void>;
@@ -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-DCiFA_CK.js';
2
+ import { C as Capabilities, G as Git } from '../../git.d-DqAvRXEf.cjs';
2
3
 
3
4
  /**
4
5
  * Bun ExecAdapter implementation
@@ -28,6 +29,7 @@ declare class BunFsAdapter implements FsAdapter {
28
29
  tail(options: TailOptions): Promise<void>;
29
30
  deleteFile(filePath: string): Promise<void>;
30
31
  deleteDirectory(dirPath: string): Promise<void>;
32
+ readDirectory(dirPath: string): Promise<string[]>;
31
33
  exists(filePath: string): Promise<boolean>;
32
34
  readFile(filePath: string): Promise<string>;
33
35
  writeFile(filePath: string, contents: string): Promise<void>;
@@ -5,7 +5,8 @@ import {
5
5
  createTailPolling,
6
6
  readBytes,
7
7
  runTailPolling
8
- } from "../../chunk-IYOGHATP.js";
8
+ } from "../../chunk-ADC26634.js";
9
+ import "../../chunk-UAKOSACD.js";
9
10
 
10
11
  // src/adapters/bun/exec.ts
11
12
  function resolveChildEnv(env, inheritEnv) {
@@ -258,7 +259,7 @@ var BunExecAdapter = class {
258
259
  };
259
260
 
260
261
  // src/adapters/bun/fs.ts
261
- import { mkdtemp, rm } from "fs/promises";
262
+ import { mkdtemp, readdir, rm } from "fs/promises";
262
263
  import { tmpdir } from "os";
263
264
  import { join } from "path";
264
265
  var BunFsAdapter = class {
@@ -307,6 +308,17 @@ var BunFsAdapter = class {
307
308
  async deleteDirectory(dirPath) {
308
309
  await rm(dirPath, { force: true, recursive: true });
309
310
  }
311
+ async readDirectory(dirPath) {
312
+ try {
313
+ return await readdir(dirPath);
314
+ } catch (error) {
315
+ const code = error.code;
316
+ if (code === "ENOENT" || code === "ENOTDIR") {
317
+ return [];
318
+ }
319
+ throw error;
320
+ }
321
+ }
310
322
  async exists(filePath) {
311
323
  const file = Bun.file(filePath);
312
324
  return await file.exists();
@@ -5,7 +5,8 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkBRFWPLJ7cjs = require('../../chunk-BRFWPLJ7.cjs');
8
+ var _chunkUHZWPYTFcjs = require('../../chunk-UHZWPYTF.cjs');
9
+ require('../../chunk-6HDMSFY7.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 ? _chunkUHZWPYTFcjs.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 _chunkUHZWPYTFcjs.runTailPolling.call(void 0, { adapter, signal, pollInterval, onLine });
360
361
  }
361
362
  async deleteFile(filePath) {
362
363
  const tempDir = this.tempFileDirs.get(filePath);
@@ -384,6 +385,21 @@ var DenoFsAdapter = (_class = class {constructor() { _class.prototype.__init.cal
384
385
  }
385
386
  }
386
387
  }
388
+ async readDirectory(dirPath) {
389
+ const names = [];
390
+ try {
391
+ for await (const entry of Deno.readDir(dirPath)) {
392
+ names.push(entry.name);
393
+ }
394
+ } catch (error) {
395
+ const notADirectory = Deno.errors.NotADirectory;
396
+ if (error instanceof Deno.errors.NotFound || notADirectory !== void 0 && error instanceof notADirectory) {
397
+ return [];
398
+ }
399
+ throw error;
400
+ }
401
+ return names;
402
+ }
387
403
  async exists(filePath) {
388
404
  try {
389
405
  await Deno.stat(filePath);
@@ -427,7 +443,7 @@ var DenoFsAdapter = (_class = class {constructor() { _class.prototype.__init.cal
427
443
  },
428
444
  sleep: (ms) => delay(ms)
429
445
  };
430
- return _chunkBRFWPLJ7cjs.createTailPolling.call(void 0, { adapter, signal, pollInterval });
446
+ return _chunkUHZWPYTFcjs.createTailPolling.call(void 0, { adapter, signal, pollInterval });
431
447
  }
432
448
  }, _class);
433
449
 
@@ -438,13 +454,13 @@ function createDenoAdapters() {
438
454
  fs: new DenoFsAdapter()
439
455
  };
440
456
  }
441
- var TypeGit = class _TypeGit extends _chunkBRFWPLJ7cjs.GitClient {
457
+ var TypeGit = class _TypeGit extends _chunkUHZWPYTFcjs.GitClient {
442
458
  static async create(options) {
443
- return new _TypeGit(await _chunkBRFWPLJ7cjs.createGit.call(void 0, { ...options, adapters: createDenoAdapters() }));
459
+ return new _TypeGit(await _chunkUHZWPYTFcjs.createGit.call(void 0, { ...options, adapters: createDenoAdapters() }));
444
460
  }
445
461
  constructor(optionsOrGit) {
446
462
  super(
447
- optionsOrGit && "open" in optionsOrGit ? optionsOrGit : _chunkBRFWPLJ7cjs.createGitSync.call(void 0, { ...optionsOrGit, adapters: createDenoAdapters() })
463
+ optionsOrGit && "open" in optionsOrGit ? optionsOrGit : _chunkUHZWPYTFcjs.createGitSync.call(void 0, { ...optionsOrGit, adapters: createDenoAdapters() })
448
464
  );
449
465
  }
450
466
  };
@@ -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-Cg5wWJnY.cjs';
2
+ import { C as Capabilities, G as Git } from '../../git.d-DqAvRXEf.cjs';
2
3
 
3
4
  /**
4
5
  * Deno ExecAdapter implementation
@@ -30,6 +31,7 @@ declare class DenoFsAdapter implements FsAdapter {
30
31
  tail(options: TailOptions): Promise<void>;
31
32
  deleteFile(filePath: string): Promise<void>;
32
33
  deleteDirectory(dirPath: string): Promise<void>;
34
+ readDirectory(dirPath: string): Promise<string[]>;
33
35
  exists(filePath: string): Promise<boolean>;
34
36
  readFile(filePath: string): Promise<string>;
35
37
  writeFile(filePath: string, contents: string): Promise<void>;
@@ -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-DCiFA_CK.js';
2
+ import { C as Capabilities, G as Git } from '../../git.d-DqAvRXEf.cjs';
2
3
 
3
4
  /**
4
5
  * Deno ExecAdapter implementation
@@ -30,6 +31,7 @@ declare class DenoFsAdapter implements FsAdapter {
30
31
  tail(options: TailOptions): Promise<void>;
31
32
  deleteFile(filePath: string): Promise<void>;
32
33
  deleteDirectory(dirPath: string): Promise<void>;
34
+ readDirectory(dirPath: string): Promise<string[]>;
33
35
  exists(filePath: string): Promise<boolean>;
34
36
  readFile(filePath: string): Promise<string>;
35
37
  writeFile(filePath: string, contents: string): Promise<void>;
@@ -5,7 +5,8 @@ import {
5
5
  createTailPolling,
6
6
  readBytes,
7
7
  runTailPolling
8
- } from "../../chunk-IYOGHATP.js";
8
+ } from "../../chunk-ADC26634.js";
9
+ import "../../chunk-UAKOSACD.js";
9
10
 
10
11
  // src/adapters/deno/exec.ts
11
12
  function resolveChildEnvOptions(env, inheritEnv) {
@@ -384,6 +385,21 @@ var DenoFsAdapter = class {
384
385
  }
385
386
  }
386
387
  }
388
+ async readDirectory(dirPath) {
389
+ const names = [];
390
+ try {
391
+ for await (const entry of Deno.readDir(dirPath)) {
392
+ names.push(entry.name);
393
+ }
394
+ } catch (error) {
395
+ const notADirectory = Deno.errors.NotADirectory;
396
+ if (error instanceof Deno.errors.NotFound || notADirectory !== void 0 && error instanceof notADirectory) {
397
+ return [];
398
+ }
399
+ throw error;
400
+ }
401
+ return names;
402
+ }
387
403
  async exists(filePath) {
388
404
  try {
389
405
  await Deno.stat(filePath);
@@ -3,11 +3,12 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkDDWWKTAEcjs = require('../../chunk-DDWWKTAE.cjs');
7
- require('../../chunk-BRFWPLJ7.cjs');
6
+ var _chunkJDCCYWIXcjs = require('../../chunk-JDCCYWIX.cjs');
7
+ require('../../chunk-UHZWPYTF.cjs');
8
+ require('../../chunk-6HDMSFY7.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 = _chunkJDCCYWIXcjs.NodeExecAdapter; exports.NodeFsAdapter = _chunkJDCCYWIXcjs.NodeFsAdapter; exports.TypeGit = _chunkJDCCYWIXcjs.TypeGit; exports.createNodeAdapters = _chunkJDCCYWIXcjs.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-Cg5wWJnY.cjs';
2
+ import { C as Capabilities, G as Git } from '../../git.d-DqAvRXEf.cjs';
2
3
 
3
4
  /**
4
5
  * Options for {@link NodeExecAdapter}.
@@ -50,6 +51,7 @@ declare class NodeFsAdapter implements FsAdapter {
50
51
  tail(options: TailOptions): Promise<void>;
51
52
  deleteFile(filePath: string): Promise<void>;
52
53
  deleteDirectory(dirPath: string): Promise<void>;
54
+ readDirectory(dirPath: string): Promise<string[]>;
53
55
  exists(filePath: string): Promise<boolean>;
54
56
  readFile(filePath: string): Promise<string>;
55
57
  writeFile(filePath: string, contents: string): Promise<void>;
@@ -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-DCiFA_CK.js';
2
+ import { C as Capabilities, G as Git } from '../../git.d-DqAvRXEf.cjs';
2
3
 
3
4
  /**
4
5
  * Options for {@link NodeExecAdapter}.
@@ -50,6 +51,7 @@ declare class NodeFsAdapter implements FsAdapter {
50
51
  tail(options: TailOptions): Promise<void>;
51
52
  deleteFile(filePath: string): Promise<void>;
52
53
  deleteDirectory(dirPath: string): Promise<void>;
54
+ readDirectory(dirPath: string): Promise<string[]>;
53
55
  exists(filePath: string): Promise<boolean>;
54
56
  readFile(filePath: string): Promise<string>;
55
57
  writeFile(filePath: string, contents: string): Promise<void>;
@@ -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-S3EFBFVP.js";
7
+ import "../../chunk-ADC26634.js";
8
+ import "../../chunk-UAKOSACD.js";
8
9
  export {
9
10
  NodeExecAdapter,
10
11
  NodeFsAdapter,