@optique/git 0.9.0-dev.268 → 0.9.0-dev.270

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/index.cjs CHANGED
@@ -34,28 +34,18 @@ const logger = (0, __logtape_logtape.getLogger)(["optique", "git"]);
34
34
  * Read-only filesystem interface passed to isomorphic-git.
35
35
  *
36
36
  * This package only performs read operations (validation and listing).
37
- * Write methods are implemented as stubs that throw errors if called,
37
+ * Write methods are implemented as stubs that return rejected promises,
38
38
  * enforcing the read-only contract and preventing accidental writes.
39
39
  */
40
40
  const gitFs = {
41
41
  readFile: node_fs_promises.readFile,
42
- writeFile: () => {
43
- throw new Error("gitFs is read-only: writeFile is disabled.");
44
- },
45
- mkdir: () => {
46
- throw new Error("gitFs is read-only: mkdir is disabled.");
47
- },
48
- rmdir: () => {
49
- throw new Error("gitFs is read-only: rmdir is disabled.");
50
- },
51
- unlink: () => {
52
- throw new Error("gitFs is read-only: unlink is disabled.");
53
- },
42
+ writeFile: () => Promise.reject(/* @__PURE__ */ new Error("gitFs is read-only: writeFile is disabled.")),
43
+ mkdir: () => Promise.reject(/* @__PURE__ */ new Error("gitFs is read-only: mkdir is disabled.")),
44
+ rmdir: () => Promise.reject(/* @__PURE__ */ new Error("gitFs is read-only: rmdir is disabled.")),
45
+ unlink: () => Promise.reject(/* @__PURE__ */ new Error("gitFs is read-only: unlink is disabled.")),
54
46
  readdir: node_fs_promises.readdir,
55
47
  readlink: node_fs_promises.readlink,
56
- symlink: () => {
57
- throw new Error("gitFs is read-only: symlink is disabled.");
58
- },
48
+ symlink: () => Promise.reject(/* @__PURE__ */ new Error("gitFs is read-only: symlink is disabled.")),
59
49
  stat: node_fs_promises.stat,
60
50
  lstat: node_fs_promises.lstat
61
51
  };
@@ -378,7 +368,11 @@ function gitCommit(options) {
378
368
  success: true,
379
369
  value: oid
380
370
  };
381
- } catch {
371
+ } catch (e) {
372
+ if (hasErrorCode(e, "AmbiguousShortOidError")) return {
373
+ success: false,
374
+ error: __optique_core_message.message`Commit SHA ${(0, __optique_core_message.value)(input)} is ambiguous. Provide more characters to disambiguate.`
375
+ };
382
376
  if (errors?.notFound) return {
383
377
  success: false,
384
378
  error: errors.notFound(input)
@@ -448,7 +442,11 @@ function gitRef(options) {
448
442
  success: true,
449
443
  value: oid
450
444
  };
451
- } catch {
445
+ } catch (e) {
446
+ if (hasErrorCode(e, "AmbiguousShortOidError")) return {
447
+ success: false,
448
+ error: __optique_core_message.message`Reference ${(0, __optique_core_message.value)(input)} is ambiguous. Provide more characters to disambiguate.`
449
+ };
452
450
  if (errors?.notFound) return {
453
451
  success: false,
454
452
  error: errors.notFound(input)
package/dist/index.js CHANGED
@@ -12,28 +12,18 @@ const logger = getLogger(["optique", "git"]);
12
12
  * Read-only filesystem interface passed to isomorphic-git.
13
13
  *
14
14
  * This package only performs read operations (validation and listing).
15
- * Write methods are implemented as stubs that throw errors if called,
15
+ * Write methods are implemented as stubs that return rejected promises,
16
16
  * enforcing the read-only contract and preventing accidental writes.
17
17
  */
18
18
  const gitFs = {
19
19
  readFile: fs.readFile,
20
- writeFile: () => {
21
- throw new Error("gitFs is read-only: writeFile is disabled.");
22
- },
23
- mkdir: () => {
24
- throw new Error("gitFs is read-only: mkdir is disabled.");
25
- },
26
- rmdir: () => {
27
- throw new Error("gitFs is read-only: rmdir is disabled.");
28
- },
29
- unlink: () => {
30
- throw new Error("gitFs is read-only: unlink is disabled.");
31
- },
20
+ writeFile: () => Promise.reject(/* @__PURE__ */ new Error("gitFs is read-only: writeFile is disabled.")),
21
+ mkdir: () => Promise.reject(/* @__PURE__ */ new Error("gitFs is read-only: mkdir is disabled.")),
22
+ rmdir: () => Promise.reject(/* @__PURE__ */ new Error("gitFs is read-only: rmdir is disabled.")),
23
+ unlink: () => Promise.reject(/* @__PURE__ */ new Error("gitFs is read-only: unlink is disabled.")),
32
24
  readdir: fs.readdir,
33
25
  readlink: fs.readlink,
34
- symlink: () => {
35
- throw new Error("gitFs is read-only: symlink is disabled.");
36
- },
26
+ symlink: () => Promise.reject(/* @__PURE__ */ new Error("gitFs is read-only: symlink is disabled.")),
37
27
  stat: fs.stat,
38
28
  lstat: fs.lstat
39
29
  };
@@ -356,7 +346,11 @@ function gitCommit(options) {
356
346
  success: true,
357
347
  value: oid
358
348
  };
359
- } catch {
349
+ } catch (e) {
350
+ if (hasErrorCode(e, "AmbiguousShortOidError")) return {
351
+ success: false,
352
+ error: message`Commit SHA ${value(input)} is ambiguous. Provide more characters to disambiguate.`
353
+ };
360
354
  if (errors?.notFound) return {
361
355
  success: false,
362
356
  error: errors.notFound(input)
@@ -426,7 +420,11 @@ function gitRef(options) {
426
420
  success: true,
427
421
  value: oid
428
422
  };
429
- } catch {
423
+ } catch (e) {
424
+ if (hasErrorCode(e, "AmbiguousShortOidError")) return {
425
+ success: false,
426
+ error: message`Reference ${value(input)} is ambiguous. Provide more characters to disambiguate.`
427
+ };
430
428
  if (errors?.notFound) return {
431
429
  success: false,
432
430
  error: errors.notFound(input)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/git",
3
- "version": "0.9.0-dev.268+5fccc2e2",
3
+ "version": "0.9.0-dev.270+b5894625",
4
4
  "description": "Git value parsers for Optique",
5
5
  "keywords": [
6
6
  "CLI",