@vibe-agent-toolkit/utils 0.2.0-rc.10 → 0.2.0-rc.12
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 +112 -10
- package/dist/archive/archive.d.ts +129 -0
- package/dist/archive/archive.d.ts.map +1 -0
- package/dist/archive/archive.js +223 -0
- package/dist/archive/archive.js.map +1 -0
- package/dist/archive/entries.d.ts +132 -0
- package/dist/archive/entries.d.ts.map +1 -0
- package/dist/archive/entries.js +223 -0
- package/dist/archive/entries.js.map +1 -0
- package/dist/archive/limits.d.ts +39 -0
- package/dist/archive/limits.d.ts.map +1 -0
- package/dist/archive/limits.js +59 -0
- package/dist/archive/limits.js.map +1 -0
- package/dist/archive/records.d.ts +14 -0
- package/dist/archive/records.d.ts.map +1 -0
- package/dist/archive/records.js +3 -0
- package/dist/archive/records.js.map +1 -0
- package/dist/archive/tar-reader.d.ts +18 -0
- package/dist/archive/tar-reader.d.ts.map +1 -0
- package/dist/archive/tar-reader.js +173 -0
- package/dist/archive/tar-reader.js.map +1 -0
- package/dist/archive/zip-reader.d.ts +76 -0
- package/dist/archive/zip-reader.d.ts.map +1 -0
- package/dist/archive/zip-reader.js +376 -0
- package/dist/archive/zip-reader.js.map +1 -0
- package/dist/archive.d.ts +14 -0
- package/dist/archive.d.ts.map +1 -0
- package/dist/archive.js +12 -0
- package/dist/archive.js.map +1 -0
- package/dist/asset-reference.d.ts +17 -1
- package/dist/asset-reference.d.ts.map +1 -1
- package/dist/asset-reference.js +31 -7
- package/dist/asset-reference.js.map +1 -1
- package/dist/dirent-kind.d.ts +13 -40
- package/dist/dirent-kind.d.ts.map +1 -1
- package/dist/dirent-kind.js +21 -69
- package/dist/dirent-kind.js.map +1 -1
- package/dist/entrypoint.d.ts +2 -2
- package/dist/entrypoint.d.ts.map +1 -1
- package/dist/entrypoint.js +4 -3
- package/dist/entrypoint.js.map +1 -1
- package/dist/env-flag.d.ts +13 -5
- package/dist/env-flag.d.ts.map +1 -1
- package/dist/env-flag.js +13 -5
- package/dist/env-flag.js.map +1 -1
- package/dist/errors/confirmed-absent.d.ts +41 -0
- package/dist/errors/confirmed-absent.d.ts.map +1 -0
- package/dist/errors/confirmed-absent.js +43 -0
- package/dist/errors/confirmed-absent.js.map +1 -0
- package/dist/errors/errno-table.d.ts +177 -0
- package/dist/errors/errno-table.d.ts.map +1 -0
- package/dist/errors/errno-table.js +343 -0
- package/dist/errors/errno-table.js.map +1 -0
- package/dist/errors/fs-boundary.d.ts +36 -0
- package/dist/errors/fs-boundary.d.ts.map +1 -0
- package/dist/errors/fs-boundary.js +121 -0
- package/dist/errors/fs-boundary.js.map +1 -0
- package/dist/errors/fs-fault.d.ts +176 -0
- package/dist/errors/fs-fault.d.ts.map +1 -0
- package/dist/errors/fs-fault.js +215 -0
- package/dist/errors/fs-fault.js.map +1 -0
- package/dist/errors/git-errno.d.ts +13 -0
- package/dist/errors/git-errno.d.ts.map +1 -0
- package/dist/errors/git-errno.js +45 -0
- package/dist/errors/git-errno.js.map +1 -0
- package/dist/errors/path-present.d.ts +72 -0
- package/dist/errors/path-present.d.ts.map +1 -0
- package/dist/errors/path-present.js +110 -0
- package/dist/errors/path-present.js.map +1 -0
- package/dist/errors/rag-index-empty.d.ts +16 -0
- package/dist/errors/rag-index-empty.d.ts.map +1 -0
- package/dist/errors/rag-index-empty.js +16 -0
- package/dist/errors/rag-index-empty.js.map +1 -0
- package/dist/errors/suppressed-faults.d.ts +34 -0
- package/dist/errors/suppressed-faults.d.ts.map +1 -0
- package/dist/errors/suppressed-faults.js +66 -0
- package/dist/errors/suppressed-faults.js.map +1 -0
- package/dist/file-crawler.d.ts +13 -18
- package/dist/file-crawler.d.ts.map +1 -1
- package/dist/file-crawler.js +140 -24
- package/dist/file-crawler.js.map +1 -1
- package/dist/fs-utils.d.ts +75 -50
- package/dist/fs-utils.d.ts.map +1 -1
- package/dist/fs-utils.js +148 -158
- package/dist/fs-utils.js.map +1 -1
- package/dist/fs.d.ts +5 -4
- package/dist/fs.d.ts.map +1 -1
- package/dist/fs.js +5 -4
- package/dist/fs.js.map +1 -1
- package/dist/git-snapshot.d.ts +25 -17
- package/dist/git-snapshot.d.ts.map +1 -1
- package/dist/git-snapshot.js +65 -11
- package/dist/git-snapshot.js.map +1 -1
- package/dist/git-tracker.d.ts +11 -3
- package/dist/git-tracker.d.ts.map +1 -1
- package/dist/git-tracker.js +29 -6
- package/dist/git-tracker.js.map +1 -1
- package/dist/git-utils.d.ts.map +1 -1
- package/dist/git-utils.js +7 -35
- package/dist/git-utils.js.map +1 -1
- package/dist/git.d.ts +1 -1
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +1 -1
- package/dist/git.js.map +1 -1
- package/dist/gitignore-checker.d.ts.map +1 -1
- package/dist/gitignore-checker.js +5 -4
- package/dist/gitignore-checker.js.map +1 -1
- package/dist/in-order.d.ts +93 -0
- package/dist/in-order.d.ts.map +1 -0
- package/dist/in-order.js +165 -0
- package/dist/in-order.js.map +1 -0
- package/dist/index.d.ts +20 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -4
- package/dist/index.js.map +1 -1
- package/dist/kill-process-tree.d.ts +43 -0
- package/dist/kill-process-tree.d.ts.map +1 -0
- package/dist/kill-process-tree.js +48 -0
- package/dist/kill-process-tree.js.map +1 -0
- package/dist/link-following.d.ts +115 -0
- package/dist/link-following.d.ts.map +1 -0
- package/dist/link-following.js +283 -0
- package/dist/link-following.js.map +1 -0
- package/dist/listing-refusal.d.ts +44 -0
- package/dist/listing-refusal.d.ts.map +1 -1
- package/dist/listing-refusal.js +79 -2
- package/dist/listing-refusal.js.map +1 -1
- package/dist/name-fold.d.ts +25 -0
- package/dist/name-fold.d.ts.map +1 -0
- package/dist/name-fold.js +40 -0
- package/dist/name-fold.js.map +1 -0
- package/dist/path-containment.d.ts +17 -0
- package/dist/path-containment.d.ts.map +1 -1
- package/dist/path-containment.js +28 -5
- package/dist/path-containment.js.map +1 -1
- package/dist/path-utils.d.ts +14 -17
- package/dist/path-utils.d.ts.map +1 -1
- package/dist/path-utils.js +37 -55
- package/dist/path-utils.js.map +1 -1
- package/dist/process.d.ts +2 -0
- package/dist/process.d.ts.map +1 -1
- package/dist/process.js +2 -0
- package/dist/process.js.map +1 -1
- package/dist/project-utils.d.ts.map +1 -1
- package/dist/project-utils.js +8 -9
- package/dist/project-utils.js.map +1 -1
- package/dist/safe-exec.d.ts +6 -2
- package/dist/safe-exec.d.ts.map +1 -1
- package/dist/safe-exec.js +1 -1
- package/dist/safe-exec.js.map +1 -1
- package/dist/skill-targets.d.ts.map +1 -1
- package/dist/skill-targets.js +3 -1
- package/dist/skill-targets.js.map +1 -1
- package/dist/skill-test/spawn-claude.d.ts +0 -15
- package/dist/skill-test/spawn-claude.d.ts.map +1 -1
- package/dist/skill-test/spawn-claude.js +11 -50
- package/dist/skill-test/spawn-claude.js.map +1 -1
- package/dist/special-file.d.ts +18 -0
- package/dist/special-file.d.ts.map +1 -0
- package/dist/special-file.js +21 -0
- package/dist/special-file.js.map +1 -0
- package/dist/terminating-signals.d.ts +129 -0
- package/dist/terminating-signals.d.ts.map +1 -0
- package/dist/terminating-signals.js +210 -0
- package/dist/terminating-signals.js.map +1 -0
- package/dist/test-helpers.d.ts +9 -5
- package/dist/test-helpers.d.ts.map +1 -1
- package/dist/test-helpers.js +18 -21
- package/dist/test-helpers.js.map +1 -1
- package/dist/test-scratch-guard.d.ts +34 -0
- package/dist/test-scratch-guard.d.ts.map +1 -0
- package/dist/test-scratch-guard.js +45 -0
- package/dist/test-scratch-guard.js.map +1 -0
- package/dist/testing/archive-fixtures.d.ts +147 -0
- package/dist/testing/archive-fixtures.d.ts.map +1 -0
- package/dist/testing/archive-fixtures.js +449 -0
- package/dist/testing/archive-fixtures.js.map +1 -0
- package/dist/testing/executables.d.ts +6 -0
- package/dist/testing/executables.d.ts.map +1 -1
- package/dist/testing/executables.js +20 -9
- package/dist/testing/executables.js.map +1 -1
- package/dist/testing/fault-fs-preload.d.ts +16 -0
- package/dist/testing/fault-fs-preload.d.ts.map +1 -0
- package/dist/testing/fault-fs-preload.js +22 -0
- package/dist/testing/fault-fs-preload.js.map +1 -0
- package/dist/testing/fault-fs.d.ts +115 -0
- package/dist/testing/fault-fs.d.ts.map +1 -0
- package/dist/testing/fault-fs.js +411 -0
- package/dist/testing/fault-fs.js.map +1 -0
- package/dist/testing/fault-spec.d.ts +83 -0
- package/dist/testing/fault-spec.d.ts.map +1 -0
- package/dist/testing/fault-spec.js +132 -0
- package/dist/testing/fault-spec.js.map +1 -0
- package/dist/testing/hostile-tree.d.ts.map +1 -1
- package/dist/testing/hostile-tree.js +3 -4
- package/dist/testing/hostile-tree.js.map +1 -1
- package/dist/testing/platform-gates.d.ts +8 -0
- package/dist/testing/platform-gates.d.ts.map +1 -1
- package/dist/testing/platform-gates.js +24 -0
- package/dist/testing/platform-gates.js.map +1 -1
- package/dist/testing/temp-dir.d.ts +31 -0
- package/dist/testing/temp-dir.d.ts.map +1 -1
- package/dist/testing/temp-dir.js +63 -0
- package/dist/testing/temp-dir.js.map +1 -1
- package/dist/testing/tier-timeout.d.ts +34 -0
- package/dist/testing/tier-timeout.d.ts.map +1 -0
- package/dist/testing/tier-timeout.js +45 -0
- package/dist/testing/tier-timeout.js.map +1 -0
- package/dist/testing/tree-snapshot.d.ts +71 -0
- package/dist/testing/tree-snapshot.d.ts.map +1 -0
- package/dist/testing/tree-snapshot.js +163 -0
- package/dist/testing/tree-snapshot.js.map +1 -0
- package/dist/testing.d.ts +6 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +8 -1
- package/dist/testing.js.map +1 -1
- package/dist/text-content.d.ts +29 -0
- package/dist/text-content.d.ts.map +1 -1
- package/dist/text-content.js +64 -0
- package/dist/text-content.js.map +1 -1
- package/dist/text-file.d.ts +58 -6
- package/dist/text-file.d.ts.map +1 -1
- package/dist/text-file.js +111 -11
- package/dist/text-file.js.map +1 -1
- package/dist/text.d.ts +1 -1
- package/dist/text.d.ts.map +1 -1
- package/dist/text.js +1 -1
- package/dist/text.js.map +1 -1
- package/dist/timing-dump.d.ts.map +1 -1
- package/dist/timing-dump.js +2 -10
- package/dist/timing-dump.js.map +1 -1
- package/dist/tree-change/apply-decisions.d.ts +101 -0
- package/dist/tree-change/apply-decisions.d.ts.map +1 -0
- package/dist/tree-change/apply-decisions.js +139 -0
- package/dist/tree-change/apply-decisions.js.map +1 -0
- package/dist/tree-change/apply.d.ts +98 -0
- package/dist/tree-change/apply.d.ts.map +1 -0
- package/dist/tree-change/apply.js +364 -0
- package/dist/tree-change/apply.js.map +1 -0
- package/dist/tree-change/copy-decisions.d.ts +58 -0
- package/dist/tree-change/copy-decisions.d.ts.map +1 -0
- package/dist/tree-change/copy-decisions.js +66 -0
- package/dist/tree-change/copy-decisions.js.map +1 -0
- package/dist/tree-change/copy-tree.d.ts +125 -0
- package/dist/tree-change/copy-tree.d.ts.map +1 -0
- package/dist/tree-change/copy-tree.js +279 -0
- package/dist/tree-change/copy-tree.js.map +1 -0
- package/dist/tree-change/files.d.ts +167 -0
- package/dist/tree-change/files.d.ts.map +1 -0
- package/dist/tree-change/files.js +423 -0
- package/dist/tree-change/files.js.map +1 -0
- package/dist/tree-change/followed-walk.d.ts +54 -0
- package/dist/tree-change/followed-walk.d.ts.map +1 -0
- package/dist/tree-change/followed-walk.js +81 -0
- package/dist/tree-change/followed-walk.js.map +1 -0
- package/dist/tree-change/host-chain.d.ts +48 -0
- package/dist/tree-change/host-chain.d.ts.map +1 -0
- package/dist/tree-change/host-chain.js +85 -0
- package/dist/tree-change/host-chain.js.map +1 -0
- package/dist/tree-change/identity-compare.d.ts +61 -0
- package/dist/tree-change/identity-compare.d.ts.map +1 -0
- package/dist/tree-change/identity-compare.js +115 -0
- package/dist/tree-change/identity-compare.js.map +1 -0
- package/dist/tree-change/identity.d.ts +62 -0
- package/dist/tree-change/identity.d.ts.map +1 -0
- package/dist/tree-change/identity.js +152 -0
- package/dist/tree-change/identity.js.map +1 -0
- package/dist/tree-change/index.d.ts +24 -0
- package/dist/tree-change/index.d.ts.map +1 -0
- package/dist/tree-change/index.js +14 -0
- package/dist/tree-change/index.js.map +1 -0
- package/dist/tree-change/link-chain.d.ts +180 -0
- package/dist/tree-change/link-chain.d.ts.map +1 -0
- package/dist/tree-change/link-chain.js +377 -0
- package/dist/tree-change/link-chain.js.map +1 -0
- package/dist/tree-change/link-containment.d.ts +105 -0
- package/dist/tree-change/link-containment.d.ts.map +1 -0
- package/dist/tree-change/link-containment.js +196 -0
- package/dist/tree-change/link-containment.js.map +1 -0
- package/dist/tree-change/link-walk.d.ts +49 -0
- package/dist/tree-change/link-walk.d.ts.map +1 -0
- package/dist/tree-change/link-walk.js +69 -0
- package/dist/tree-change/link-walk.js.map +1 -0
- package/dist/tree-change/plan.d.ts +206 -0
- package/dist/tree-change/plan.d.ts.map +1 -0
- package/dist/tree-change/plan.js +320 -0
- package/dist/tree-change/plan.js.map +1 -0
- package/dist/tree-change/readable-tree.d.ts +44 -0
- package/dist/tree-change/readable-tree.d.ts.map +1 -0
- package/dist/tree-change/readable-tree.js +52 -0
- package/dist/tree-change/readable-tree.js.map +1 -0
- package/dist/tree-change/rollback-error.d.ts +29 -0
- package/dist/tree-change/rollback-error.d.ts.map +1 -0
- package/dist/tree-change/rollback-error.js +31 -0
- package/dist/tree-change/rollback-error.js.map +1 -0
- package/dist/tree-change/staging-names.d.ts +27 -0
- package/dist/tree-change/staging-names.d.ts.map +1 -0
- package/dist/tree-change/staging-names.js +40 -0
- package/dist/tree-change/staging-names.js.map +1 -0
- package/dist/tree-change/tree-walk.d.ts +81 -0
- package/dist/tree-change/tree-walk.d.ts.map +1 -0
- package/dist/tree-change/tree-walk.js +212 -0
- package/dist/tree-change/tree-walk.js.map +1 -0
- package/dist/win32-namespace.d.ts +24 -0
- package/dist/win32-namespace.d.ts.map +1 -0
- package/dist/win32-namespace.js +31 -0
- package/dist/win32-namespace.js.map +1 -0
- package/dist/yaml/surgical-yaml.d.ts +12 -3
- package/dist/yaml/surgical-yaml.d.ts.map +1 -1
- package/dist/yaml/surgical-yaml.js +16 -6
- package/dist/yaml/surgical-yaml.js.map +1 -1
- package/eslint/README.md +12 -4
- package/eslint/rules/fs-binding-scan.cjs +278 -0
- package/eslint/rules/no-adhoc-errno.cjs +364 -0
- package/eslint/rules/no-bare-symlink-in-tests.cjs +2 -3
- package/eslint/rules/no-blind-catch.cjs +1 -1
- package/eslint/rules/no-destructive-fs.cjs +359 -0
- package/eslint/rules/no-existssync.cjs +70 -0
- package/eslint/rules/no-fragile-entrypoint-guard.cjs +3 -2
- package/eslint/rules/no-link-following-fs.cjs +68 -0
- package/eslint/rules/no-literal-process-exit.cjs +96 -8
- package/eslint/rules/no-literal-test-timeout.cjs +214 -0
- package/eslint/rules/no-raw-signal-listener.cjs +224 -0
- package/eslint/rules/no-stdout-outside-writer.cjs +135 -0
- package/package.json +10 -2
- package/dist/errors/errno.d.ts +0 -51
- package/dist/errors/errno.d.ts.map +0 -1
- package/dist/errors/errno.js +0 -112
- package/dist/errors/errno.js.map +0 -1
- package/eslint/rules/no-fs-promises-cp.cjs +0 -43
package/dist/git-snapshot.d.ts
CHANGED
|
@@ -27,15 +27,9 @@
|
|
|
27
27
|
* level, not. `vibe-validate` accepts this cost on every commit it gates; a VAT
|
|
28
28
|
* lane that adopts it inherits the same trade rather than a different one.
|
|
29
29
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* `120000`. Two links with the same relative target but different resolutions
|
|
34
|
-
* therefore share an OID while a consumer that follows them reads two different
|
|
35
|
-
* documents. {@link GitSnapshotEntry.isSymlink} is computed here precisely so
|
|
36
|
-
* that a consumer keying work off `oid` can exclude them — see
|
|
37
|
-
* `packages/resources/src/content-key.ts`, whose standing rule is that a git SHA
|
|
38
|
-
* may be a *lookup hint whose miss is free* and must never be the key itself.
|
|
30
|
+
* No blob OID is carried: one OID can name two different working-tree byte
|
|
31
|
+
* strings (clean/smudge, `working-tree-encoding`, `eol`), so nothing may stand
|
|
32
|
+
* an OID in for a read — see `packages/resources/src/content-key.ts`.
|
|
39
33
|
*
|
|
40
34
|
* ## ⚠️ Two consumers want the SAME snapshot — see {@link withGitSnapshotCache}
|
|
41
35
|
*
|
|
@@ -45,20 +39,20 @@
|
|
|
45
39
|
* makes that one snapshot. Everything outside the bracket still pays per call,
|
|
46
40
|
* deliberately.
|
|
47
41
|
*/
|
|
42
|
+
import { VatError } from './errors/vat-error.js';
|
|
43
|
+
/**
|
|
44
|
+
* The `VatError` code of a snapshot git refused because a file in the
|
|
45
|
+
* repository is one the OS will not let it read — the INPUT's refusal, never
|
|
46
|
+
* a defect in VAT and never "not a git repository".
|
|
47
|
+
*/
|
|
48
|
+
export declare const GIT_SNAPSHOT_UNREADABLE_CODE = "GIT_SNAPSHOT_UNREADABLE";
|
|
48
49
|
/** One path in a {@link GitTreeSnapshot}, located absolutely. */
|
|
49
50
|
export interface GitSnapshotEntry {
|
|
50
51
|
/** Absolute, forward-slashed path, resolved against the repository root. */
|
|
51
52
|
absolutePath: string;
|
|
52
|
-
/**
|
|
53
|
-
* Blob OID for this path's **on-disk** bytes.
|
|
54
|
-
*
|
|
55
|
-
* Equal OIDs mean equal bytes, which is what makes this usable as a lookup
|
|
56
|
-
* hint. It is NOT usable as a content key — see the module docstring.
|
|
57
|
-
*/
|
|
58
|
-
oid: string;
|
|
59
53
|
/** Git's six-digit mode, verbatim: `100644`, `100755`, `120000`, `160000`. */
|
|
60
54
|
mode: string;
|
|
61
|
-
/** Mode `120000`.
|
|
55
|
+
/** Mode `120000`. */
|
|
62
56
|
isSymlink: boolean;
|
|
63
57
|
/**
|
|
64
58
|
* Mode `160000` — a submodule.
|
|
@@ -196,4 +190,18 @@ export declare function freshGitTreeSnapshot(options: {
|
|
|
196
190
|
* your own question instead
|
|
197
191
|
*/
|
|
198
192
|
export declare function peekGitTreeSnapshot(cwd: string): GitTreeSnapshot | undefined;
|
|
193
|
+
/**
|
|
194
|
+
* Why git could not snapshot `cwd`'s repository, when the cause is a file in it
|
|
195
|
+
* the OS will not read; `undefined` when it is not (or `cwd` is no repository).
|
|
196
|
+
*
|
|
197
|
+
* A snapshot runs `git add --all`, which hashes every un-ignored file — so one
|
|
198
|
+
* unreadable file anywhere, referenced by nothing, refuses the whole snapshot.
|
|
199
|
+
* `getGitTreeSnapshot` answers that with the same `null` as "no repository" and
|
|
200
|
+
* keeps git's stderr to itself, so this asks the question again on the failure
|
|
201
|
+
* path only: list what `git add --all` would read, and open each.
|
|
202
|
+
*
|
|
203
|
+
* @param cwd - Any directory inside the repository whose snapshot was refused
|
|
204
|
+
* @returns The refusal naming the unreadable paths, repository-relative
|
|
205
|
+
*/
|
|
206
|
+
export declare function unreadableSnapshotRefusal(cwd: string): VatError | undefined;
|
|
199
207
|
//# sourceMappingURL=git-snapshot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-snapshot.d.ts","sourceRoot":"","sources":["../src/git-snapshot.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"git-snapshot.d.ts","sourceRoot":"","sources":["../src/git-snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAQH,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAKjD;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,4BAA4B,CAAC;AAKtE,iEAAiE;AACjE,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,YAAY,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,iCAAiC;AACjC,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,cAAc,EAAE,MAAM,CAAC;IACvB,kDAAkD;IAClD,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B;AAuBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAEvD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,eAAe,GAAG,IAAI,CA2BhF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,eAAe,GAAG,IAAI,CAErF;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAY5E;AA+BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAgB3E"}
|
package/dist/git-snapshot.js
CHANGED
|
@@ -27,15 +27,9 @@
|
|
|
27
27
|
* level, not. `vibe-validate` accepts this cost on every commit it gates; a VAT
|
|
28
28
|
* lane that adopts it inherits the same trade rather than a different one.
|
|
29
29
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* `120000`. Two links with the same relative target but different resolutions
|
|
34
|
-
* therefore share an OID while a consumer that follows them reads two different
|
|
35
|
-
* documents. {@link GitSnapshotEntry.isSymlink} is computed here precisely so
|
|
36
|
-
* that a consumer keying work off `oid` can exclude them — see
|
|
37
|
-
* `packages/resources/src/content-key.ts`, whose standing rule is that a git SHA
|
|
38
|
-
* may be a *lookup hint whose miss is free* and must never be the key itself.
|
|
30
|
+
* No blob OID is carried: one OID can name two different working-tree byte
|
|
31
|
+
* strings (clean/smudge, `working-tree-encoding`, `eol`), so nothing may stand
|
|
32
|
+
* an OID in for a read — see `packages/resources/src/content-key.ts`.
|
|
39
33
|
*
|
|
40
34
|
* ## ⚠️ Two consumers want the SAME snapshot — see {@link withGitSnapshotCache}
|
|
41
35
|
*
|
|
@@ -46,9 +40,21 @@
|
|
|
46
40
|
* deliberately.
|
|
47
41
|
*/
|
|
48
42
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
43
|
+
import { closeSync, lstatSync, openSync } from 'node:fs';
|
|
49
44
|
import { getGitTreeSnapshot, GIT_MODE_GITLINK, GIT_MODE_SYMLINK } from '@vibe-validate/git';
|
|
50
|
-
import {
|
|
45
|
+
import { fsFaultOf, isPathAbsentError } from './errors/errno-table.js';
|
|
46
|
+
import { VatError } from './errors/vat-error.js';
|
|
47
|
+
import { gitFindRoot, gitLsFiles } from './git-utils.js';
|
|
48
|
+
import { toForwardSlash } from './path-core.js';
|
|
51
49
|
import { safePath } from './path-utils.js';
|
|
50
|
+
/**
|
|
51
|
+
* The `VatError` code of a snapshot git refused because a file in the
|
|
52
|
+
* repository is one the OS will not let it read — the INPUT's refusal, never
|
|
53
|
+
* a defect in VAT and never "not a git repository".
|
|
54
|
+
*/
|
|
55
|
+
export const GIT_SNAPSHOT_UNREADABLE_CODE = 'GIT_SNAPSHOT_UNREADABLE';
|
|
56
|
+
/** How many unreadable paths a refusal names before it summarizes the rest. */
|
|
57
|
+
const NAMED_UNREADABLE_PATHS = 5;
|
|
52
58
|
/**
|
|
53
59
|
* The snapshots taken inside the bracket now open, keyed by repository root.
|
|
54
60
|
*
|
|
@@ -240,11 +246,59 @@ function takeSnapshot(cwd, repositoryRoot) {
|
|
|
240
246
|
repositoryRoot,
|
|
241
247
|
entries: snapshot.entries.map((entry) => ({
|
|
242
248
|
absolutePath: safePath.resolve(repositoryRoot, entry.path),
|
|
243
|
-
oid: entry.oid,
|
|
244
249
|
mode: entry.mode,
|
|
245
250
|
isSymlink: entry.mode === GIT_MODE_SYMLINK,
|
|
246
251
|
isSubmodule: entry.mode === GIT_MODE_GITLINK,
|
|
247
252
|
})),
|
|
248
253
|
};
|
|
249
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* Why git could not snapshot `cwd`'s repository, when the cause is a file in it
|
|
257
|
+
* the OS will not read; `undefined` when it is not (or `cwd` is no repository).
|
|
258
|
+
*
|
|
259
|
+
* A snapshot runs `git add --all`, which hashes every un-ignored file — so one
|
|
260
|
+
* unreadable file anywhere, referenced by nothing, refuses the whole snapshot.
|
|
261
|
+
* `getGitTreeSnapshot` answers that with the same `null` as "no repository" and
|
|
262
|
+
* keeps git's stderr to itself, so this asks the question again on the failure
|
|
263
|
+
* path only: list what `git add --all` would read, and open each.
|
|
264
|
+
*
|
|
265
|
+
* @param cwd - Any directory inside the repository whose snapshot was refused
|
|
266
|
+
* @returns The refusal naming the unreadable paths, repository-relative
|
|
267
|
+
*/
|
|
268
|
+
export function unreadableSnapshotRefusal(cwd) {
|
|
269
|
+
const root = gitFindRoot(cwd);
|
|
270
|
+
if (root === null)
|
|
271
|
+
return undefined;
|
|
272
|
+
// A directory git could not list is a warning to `git add`, not a refusal of
|
|
273
|
+
// the snapshot, so it is not this function's cause to report.
|
|
274
|
+
const listed = gitLsFiles({ cwd: root, includeUntracked: true, unreadable: { degrade: () => undefined } });
|
|
275
|
+
if (listed === null)
|
|
276
|
+
return undefined;
|
|
277
|
+
const unreadable = listed.filter((relative) => !gitCanRead(safePath.join(root, relative)));
|
|
278
|
+
if (unreadable.length === 0)
|
|
279
|
+
return undefined;
|
|
280
|
+
const named = unreadable.slice(0, NAMED_UNREADABLE_PATHS).map((relative) => toForwardSlash(relative)).join(', ');
|
|
281
|
+
const more = unreadable.length > NAMED_UNREADABLE_PATHS ? ` and ${unreadable.length - NAMED_UNREADABLE_PATHS} more` : '';
|
|
282
|
+
return new VatError(GIT_SNAPSHOT_UNREADABLE_CODE, `git could not snapshot the repository at ${toForwardSlash(root)}: the OS will not let it read ${named}${more}. `
|
|
283
|
+
+ 'A snapshot reads every file git does not ignore, so fix the permissions, or add the path to .gitignore.');
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Whether `git add` can read `path`: a regular file it can open, or anything it
|
|
287
|
+
* does not read as bytes (a symlink, a gone tracked file, a submodule).
|
|
288
|
+
*/
|
|
289
|
+
function gitCanRead(path) {
|
|
290
|
+
try {
|
|
291
|
+
if (!lstatSync(path).isFile())
|
|
292
|
+
return true;
|
|
293
|
+
closeSync(openSync(path, 'r'));
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
catch (error) {
|
|
297
|
+
if (isPathAbsentError(error))
|
|
298
|
+
return true;
|
|
299
|
+
if (fsFaultOf(error) !== undefined)
|
|
300
|
+
return false;
|
|
301
|
+
throw error;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
250
304
|
//# sourceMappingURL=git-snapshot.js.map
|
package/dist/git-snapshot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-snapshot.js","sourceRoot":"","sources":["../src/git-snapshot.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"git-snapshot.js","sourceRoot":"","sources":["../src/git-snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE5F,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,UAAU,EAA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,CAC9G,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,UAAU,CAAC,IAAY;IAC9B,IAAI,CAAC;QACH,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE;YAAE,OAAO,IAAI,CAAC;QAC3C,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,iBAAiB,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAC1C,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QACjD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/git-tracker.d.ts
CHANGED
|
@@ -119,6 +119,8 @@ export declare class GitTracker {
|
|
|
119
119
|
* spawns.
|
|
120
120
|
*/
|
|
121
121
|
initialize(options?: GitTrackerInitOptions): Promise<void>;
|
|
122
|
+
/** The synchronous body of {@link initialize}. */
|
|
123
|
+
private initializeNow;
|
|
122
124
|
/**
|
|
123
125
|
* The active set read off a snapshot this process has ALREADY taken — or
|
|
124
126
|
* `null` to say "ask git yourself".
|
|
@@ -268,20 +270,26 @@ export declare class GitTracker {
|
|
|
268
270
|
*
|
|
269
271
|
* @param absolutePath - Absolute path to check
|
|
270
272
|
* @param knownToExist - The caller's own answer to the existence question, when
|
|
271
|
-
* it has already asked. Supplying it skips this method's
|
|
273
|
+
* it has already asked. Supplying it skips this method's own probe, which
|
|
272
274
|
* is otherwise paid once per path that is absent from the active set — i.e.
|
|
273
275
|
* once per ignored path, and the projection's `filesystem` extent enumerates
|
|
274
276
|
* all of them (11,108 calls on an 8,496-path adopter tree).
|
|
275
277
|
*
|
|
276
|
-
* **It must mean what
|
|
278
|
+
* **It must mean what that probe means: the path resolves, following
|
|
277
279
|
* symlinks.** A caller holding only an `lstat` result has a DIFFERENT fact —
|
|
278
|
-
* `lstat` succeeds on a dangling symlink where
|
|
280
|
+
* `lstat` succeeds on a dangling symlink where the probe answers absent —
|
|
279
281
|
* and must narrow it to `exists && symlinkResolves !== false` rather than
|
|
280
282
|
* pass the `lstat` boolean through, or dangling symlinks silently stop
|
|
281
283
|
* falling back to `git check-ignore` and start reporting as ignored.
|
|
282
284
|
* Omit it and nothing changes.
|
|
283
285
|
*/
|
|
284
286
|
isIgnoredByActiveSet(absolutePath: string, knownToExist?: boolean): boolean;
|
|
287
|
+
/**
|
|
288
|
+
* Whether something resolves at `path` (inside the project), its links read beneath the project
|
|
289
|
+
* root first. A probe the OS refuses, or a chain VAT will not follow, has no answer here: the set
|
|
290
|
+
* cannot vouch for it, so git is asked (`isIgnored`), as for an absent path.
|
|
291
|
+
*/
|
|
292
|
+
private isPresent;
|
|
285
293
|
private isWithinProjectRoot;
|
|
286
294
|
/**
|
|
287
295
|
* Check if a file is ignored by git.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-tracker.d.ts","sourceRoot":"","sources":["../src/git-tracker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"git-tracker.d.ts","sourceRoot":"","sources":["../src/git-tracker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgBH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;;;OAWG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAS;IAC/C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmC;IACzD,6FAA6F;IAC7F,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA0B;IACpD,oFAAoF;IACpF,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA0B;IAC1D;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S,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,mBAAmB,EAAE,MAAM,CAAA;KAAE;IAQrF;;OAEG;IACH,KAAK,IAAI,IAAI;CAUd"}
|
package/dist/git-tracker.js
CHANGED
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
* Problem: Calling git check-ignore on every file is expensive (spawns process each time).
|
|
5
5
|
* Solution: Cache results and pre-populate with git ls-files (tracked + untracked non-ignored).
|
|
6
6
|
*/
|
|
7
|
-
import { existsSync } from 'node:fs';
|
|
8
7
|
import { dirname } from 'node:path';
|
|
9
8
|
import { CRAWL_SHARED_GIT_TRACKER_ID, crawlTimingStart, recordSharedPass, } from './crawl-timing.js';
|
|
9
|
+
import { linkResolutionFault } from './errors/fs-fault.js';
|
|
10
10
|
import { peekGitTreeSnapshot } from './git-snapshot.js';
|
|
11
11
|
import { gitLsFiles, isGitIgnored } from './git-utils.js';
|
|
12
|
+
import { promised } from './in-order.js';
|
|
13
|
+
import { followedKindSync } from './link-following.js';
|
|
12
14
|
import { safePath, toForwardSlash } from './path-utils.js';
|
|
13
15
|
/**
|
|
14
16
|
* Git tracking cache service.
|
|
@@ -109,7 +111,13 @@ export class GitTracker {
|
|
|
109
111
|
* work, and charging it would inflate `calls` with questions rather than
|
|
110
112
|
* spawns.
|
|
111
113
|
*/
|
|
112
|
-
|
|
114
|
+
initialize(options) {
|
|
115
|
+
// Promise-shaped for its callers, synchronous underneath (`gitLsFiles` is a
|
|
116
|
+
// sync spawn); a failure is a rejection, never a synchronous throw.
|
|
117
|
+
return promised(() => this.initializeNow(options));
|
|
118
|
+
}
|
|
119
|
+
/** The synchronous body of {@link initialize}. */
|
|
120
|
+
initializeNow(options) {
|
|
113
121
|
if (this.initialized) {
|
|
114
122
|
return;
|
|
115
123
|
}
|
|
@@ -359,14 +367,14 @@ export class GitTracker {
|
|
|
359
367
|
*
|
|
360
368
|
* @param absolutePath - Absolute path to check
|
|
361
369
|
* @param knownToExist - The caller's own answer to the existence question, when
|
|
362
|
-
* it has already asked. Supplying it skips this method's
|
|
370
|
+
* it has already asked. Supplying it skips this method's own probe, which
|
|
363
371
|
* is otherwise paid once per path that is absent from the active set — i.e.
|
|
364
372
|
* once per ignored path, and the projection's `filesystem` extent enumerates
|
|
365
373
|
* all of them (11,108 calls on an 8,496-path adopter tree).
|
|
366
374
|
*
|
|
367
|
-
* **It must mean what
|
|
375
|
+
* **It must mean what that probe means: the path resolves, following
|
|
368
376
|
* symlinks.** A caller holding only an `lstat` result has a DIFFERENT fact —
|
|
369
|
-
* `lstat` succeeds on a dangling symlink where
|
|
377
|
+
* `lstat` succeeds on a dangling symlink where the probe answers absent —
|
|
370
378
|
* and must narrow it to `exists && symlinkResolves !== false` rather than
|
|
371
379
|
* pass the `lstat` boolean through, or dangling symlinks silently stop
|
|
372
380
|
* falling back to `git check-ignore` and start reporting as ignored.
|
|
@@ -392,12 +400,27 @@ export class GitTracker {
|
|
|
392
400
|
}
|
|
393
401
|
// Absent from the active set. That means "ignored" only for a path that is
|
|
394
402
|
// actually there; otherwise the set has no opinion and git must be asked.
|
|
395
|
-
const present = knownToExist ??
|
|
403
|
+
const present = knownToExist ?? this.isPresent(normalized);
|
|
396
404
|
if (!present) {
|
|
397
405
|
return this.isIgnored(absolutePath);
|
|
398
406
|
}
|
|
399
407
|
return true;
|
|
400
408
|
}
|
|
409
|
+
/**
|
|
410
|
+
* Whether something resolves at `path` (inside the project), its links read beneath the project
|
|
411
|
+
* root first. A probe the OS refuses, or a chain VAT will not follow, has no answer here: the set
|
|
412
|
+
* cannot vouch for it, so git is asked (`isIgnored`), as for an absent path.
|
|
413
|
+
*/
|
|
414
|
+
isPresent(path) {
|
|
415
|
+
try {
|
|
416
|
+
return followedKindSync(path, this.projectRoot) !== 'absent';
|
|
417
|
+
}
|
|
418
|
+
catch (error) {
|
|
419
|
+
// A bug (no errno) stays loud: `linkResolutionFault` rethrows it.
|
|
420
|
+
linkResolutionFault(error);
|
|
421
|
+
return false;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
401
424
|
isWithinProjectRoot(normalizedAbsolutePath) {
|
|
402
425
|
const root = this.normalizedProjectRoot;
|
|
403
426
|
if (normalizedAbsolutePath === root) {
|
package/dist/git-tracker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-tracker.js","sourceRoot":"","sources":["../src/git-tracker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"git-tracker.js","sourceRoot":"","sources":["../src/git-tracker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EACL,2BAA2B,EAC3B,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAqB3D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,UAAU;IACJ,WAAW,CAAS;IACpB,qBAAqB,CAAS;IAC9B,KAAK,GAAyB,IAAI,GAAG,EAAE,CAAC;IACzD,6FAA6F;IAC5E,SAAS,GAAgB,IAAI,GAAG,EAAE,CAAC;IACpD,oFAAoF;IACnE,eAAe,GAAgB,IAAI,GAAG,EAAE,CAAC;IAC1D;;;;OAIG;IACc,UAAU,GAAwB,IAAI,GAAG,EAAE,CAAC;IAC7D;;;;;;;;;;;;;;;;;;;OAmBG;IACc,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I,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAChC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC3B,CAAC;CACF"}
|
package/dist/git-utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-utils.d.ts","sourceRoot":"","sources":["../src/git-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"git-utils.d.ts","sourceRoot":"","sources":["../src/git-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAA0C,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAqBrG;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAW7F;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,iBAAiB;IAChC,qFAAqF;IACrF,UAAU,EAAE,gBAAgB,CAAC;CAC9B;AAkDD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAmB3D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG;IACtD,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,GAAG,MAAM,EAAE,GAAG,IAAI,CAqBlB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,iBAAiB,GAAG;IACvD,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GAAG,MAAM,EAAE,GAAG,IAAI,CAiBlB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAE,MAAsB,GAAG,OAAO,CAiDnF"}
|
package/dist/git-utils.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* Centralized git command wrapper.
|
|
3
3
|
* All git commands should go through this module for consistency and testability.
|
|
4
4
|
*/
|
|
5
|
-
import { existsSync } from 'node:fs';
|
|
6
5
|
import { dirname, parse } from 'node:path';
|
|
6
|
+
import { errnoForGitReason } from './errors/git-errno.js';
|
|
7
|
+
import { entryPresentIn } from './errors/path-present.js';
|
|
7
8
|
import { directoryRefusalFor, listingFailure } from './fs-utils.js';
|
|
8
9
|
import { lookupGitRoot, rememberGitRoot } from './git-root-cache.js';
|
|
9
10
|
import { runGit } from './git-run.js';
|
|
@@ -22,39 +23,9 @@ import { safePath } from './path-utils.js';
|
|
|
22
23
|
*
|
|
23
24
|
* Anchored to the line so an unrelated warning naming a directory in passing
|
|
24
25
|
* is not read as a refusal. The reason after the colon is `strerror` text —
|
|
25
|
-
* see
|
|
26
|
+
* see `errnoForGitReason`.
|
|
26
27
|
*/
|
|
27
28
|
const UNLISTABLE_DIRECTORY_LINE = /^warning: could not open directory '(.+?)\/?': (.*)$/gm;
|
|
28
|
-
/**
|
|
29
|
-
* C-locale `strerror` text → errno, for the reasons git can print here.
|
|
30
|
-
*
|
|
31
|
-
* git does not print the errno name, only its message; every listing below
|
|
32
|
-
* runs with `LC_ALL=C` so the message is the C-locale one and this table can
|
|
33
|
-
* be short. An unlisted reason is still a refusal — it becomes `UNKNOWN`, the
|
|
34
|
-
* same answer `listingFailure` gives an error carrying no errno — because
|
|
35
|
-
* dropping the line would reinstate the silent gap for exactly the errnos
|
|
36
|
-
* nobody thought of.
|
|
37
|
-
*
|
|
38
|
-
* The two ABSENCE reasons are listed so that `listingFailure` — the one owner
|
|
39
|
-
* of the absent/unreadable split — can recognise them and the line can be
|
|
40
|
-
* skipped: git prints "No such file or directory" for an untracked directory
|
|
41
|
-
* deleted between its parent's `readdir` and its own `opendir` (a concurrent
|
|
42
|
-
* `rm -rf tmp/`), and the walk route treats that same race as "no longer in
|
|
43
|
-
* the population" rather than as a refusal. Left unmapped it read as an
|
|
44
|
-
* `UNKNOWN` refusal, and the git route aborted a run the walk completed.
|
|
45
|
-
*/
|
|
46
|
-
const STRERROR_TO_ERRNO = new Map([
|
|
47
|
-
['Permission denied', 'EACCES'],
|
|
48
|
-
['Too many open files', 'EMFILE'],
|
|
49
|
-
['Too many open files in system', 'ENFILE'],
|
|
50
|
-
['Too many levels of symbolic links', 'ELOOP'],
|
|
51
|
-
['Resource temporarily unavailable', 'EAGAIN'],
|
|
52
|
-
['Input/output error', 'EIO'],
|
|
53
|
-
['Stale file handle', 'ESTALE'],
|
|
54
|
-
['Stale NFS file handle', 'ESTALE'],
|
|
55
|
-
['No such file or directory', 'ENOENT'],
|
|
56
|
-
['Not a directory', 'ENOTDIR'],
|
|
57
|
-
]);
|
|
58
29
|
/**
|
|
59
30
|
* The directories a git listing was REFUSED, read off its stderr.
|
|
60
31
|
*
|
|
@@ -75,7 +46,7 @@ export function unlistableDirectoriesIn(stderr) {
|
|
|
75
46
|
if (directory === '' || seen.has(directory))
|
|
76
47
|
continue;
|
|
77
48
|
seen.add(directory);
|
|
78
|
-
const listing = listingFailure({ code:
|
|
49
|
+
const listing = listingFailure({ code: errnoForGitReason((match[2] ?? '').trim()) });
|
|
79
50
|
if (listing.outcome === 'unreadable')
|
|
80
51
|
refusals.push({ directory, code: listing.code });
|
|
81
52
|
}
|
|
@@ -142,8 +113,9 @@ export function gitFindRoot(startDir) {
|
|
|
142
113
|
if (memoized !== undefined)
|
|
143
114
|
return rememberGitRoot(climbed, memoized);
|
|
144
115
|
climbed.push(currentDir);
|
|
145
|
-
|
|
146
|
-
|
|
116
|
+
// Climbed from inside a crawled tree (a skill directory an audit found, a plugin install's
|
|
117
|
+
// source), so `.git` may be a planted link: its chain is read before the kernel follows it.
|
|
118
|
+
if (entryPresentIn(currentDir, '.git')) {
|
|
147
119
|
return rememberGitRoot(climbed, currentDir);
|
|
148
120
|
}
|
|
149
121
|
currentDir = dirname(currentDir);
|
package/dist/git-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-utils.js","sourceRoot":"","sources":["../src/git-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"git-utils.js","sourceRoot":"","sources":["../src/git-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAyB,MAAM,sBAAsB,CAAC;AACrG,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;;;;;;;;;;;;;GAcG;AACH,MAAM,yBAAyB,GAAG,wDAAwD,CAAC;AAG3F;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAc;IACpD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,QAAQ,GAA0C,EAAE,CAAC;IAC3D,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAAC,EAAE,CAAC;QAC/D,MAAM,S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,6DAA6D;YAC7D,sEAAsE;YACtE,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAChC,MAAM;YACR,CAAC;YACD,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/git.d.ts
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
export { runGit, runGitOrThrow, type GitRunOptions, type GitRunResult, } from './git-run.js';
|
|
26
26
|
export { gitFindRoot, gitLsFiles, gitLsOthers, isGitIgnored } from './git-utils.js';
|
|
27
27
|
export type { RefuseListingContext, UnreadablePolicy } from './listing-refusal.js';
|
|
28
|
-
export { freshGitTreeSnapshot, gitTreeSnapshot, peekGitTreeSnapshot, withGitSnapshotCache, type GitSnapshotEntry, type GitTreeSnapshot, } from './git-snapshot.js';
|
|
28
|
+
export { freshGitTreeSnapshot, GIT_SNAPSHOT_UNREADABLE_CODE, gitTreeSnapshot, peekGitTreeSnapshot, unreadableSnapshotRefusal, withGitSnapshotCache, type GitSnapshotEntry, type GitTreeSnapshot, } from './git-snapshot.js';
|
|
29
29
|
export { loadGitignoreRules } from './gitignore-checker.js';
|
|
30
30
|
export { GitTracker, type GitTrackerInitOptions } from './git-tracker.js';
|
|
31
31
|
export { isGitUrl, nonInteractiveGitOverrides, parseGitUrl, type NonInteractiveGitOverrides, type ParsedGitUrl, } from './git-url.js';
|
package/dist/git.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACL,MAAM,EACN,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAA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ED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
export { runGit, runGitOrThrow, } from './git-run.js';
|
|
26
26
|
export { gitFindRoot, gitLsFiles, gitLsOthers, isGitIgnored } from './git-utils.js';
|
|
27
|
-
export { freshGitTreeSnapshot, gitTreeSnapshot, peekGitTreeSnapshot, withGitSnapshotCache, } from './git-snapshot.js';
|
|
27
|
+
export { freshGitTreeSnapshot, GIT_SNAPSHOT_UNREADABLE_CODE, gitTreeSnapshot, peekGitTreeSnapshot, unreadableSnapshotRefusal, withGitSnapshotCache, } from './git-snapshot.js';
|
|
28
28
|
export { loadGitignoreRules } from './gitignore-checker.js';
|
|
29
29
|
export { GitTracker } from './git-tracker.js';
|
|
30
30
|
export { isGitUrl, nonInteractiveGitOverrides, parseGitUrl, } from './git-url.js';
|
package/dist/git.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACL,MAAM,EACN,aAAa,GAGd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAKpF,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,GAGrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAA8B,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EACL,QAAQ,EACR,0BAA0B,EAC1B,WAAW,GAGZ,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACL,MAAM,EACN,aAAa,GAGd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAKpF,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,GAGrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAA8B,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EACL,QAAQ,EACR,0BAA0B,EAC1B,WAAW,GAGZ,MAAM,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitignore-checker.d.ts","sourceRoot":"","sources":["../src/gitignore-checker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"gitignore-checker.d.ts","sourceRoot":"","sources":["../src/gitignore-checker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAe,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAO7C;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA+CnF"}
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* @deprecated This module uses pattern-based checking which doesn't respect tracked files.
|
|
6
6
|
* Use git-utils.ts for authoritative git commands (gitFindRoot, isGitIgnored, gitLsFiles).
|
|
7
7
|
*/
|
|
8
|
-
import fs from 'node:fs';
|
|
9
8
|
import path from 'node:path';
|
|
10
9
|
import ignore from 'ignore';
|
|
11
|
-
import { isPathAbsentError } from './errors/errno.js';
|
|
10
|
+
import { isPathAbsentError } from './errors/errno-table.js';
|
|
11
|
+
import { followedKindSync } from './link-following.js';
|
|
12
12
|
import { safePath, toForwardSlash } from './path-utils.js';
|
|
13
13
|
import { readTextContentSync } from './text-file.js';
|
|
14
14
|
/**
|
|
@@ -41,7 +41,8 @@ export function loadGitignoreRules(gitRoot, baseDir) {
|
|
|
41
41
|
// Load .gitignore files from git root down to baseDir
|
|
42
42
|
for (const dir of dirsToCheck) {
|
|
43
43
|
const gitignorePath = safePath.join(dir, '.gitignore');
|
|
44
|
-
|
|
44
|
+
// Committed content: a `.gitignore` that is a link is read only once its chain beneath the repository is.
|
|
45
|
+
if (followedKindSync(gitignorePath, resolvedGitRoot) !== 'absent') {
|
|
45
46
|
try {
|
|
46
47
|
// Through the decoding seam. A `.gitignore` written by PowerShell's `>`
|
|
47
48
|
// is UTF-16LE, and `readFileSync(p, 'utf-8')` would hand `ignore` a
|
|
@@ -50,7 +51,7 @@ export function loadGitignoreRules(gitRoot, baseDir) {
|
|
|
50
51
|
ig.add(readTextContentSync(gitignorePath).text);
|
|
51
52
|
}
|
|
52
53
|
catch (error) {
|
|
53
|
-
// Gone between
|
|
54
|
+
// Gone between the probe and the read: no rules here. A `.gitignore`
|
|
54
55
|
// the OS refuses to read (`EACCES`), or one that is a directory
|
|
55
56
|
// (`EISDIR`), holds rules this checker cannot honour — and a crawl that
|
|
56
57
|
// quietly proceeded without them enumerated the ignored tree with
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitignore-checker.js","sourceRoot":"","sources":["../src/gitignore-checker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"gitignore-checker.js","sourceRoot":"","sources":["../src/gitignore-checker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,MAAuB,MAAM,QAAQ,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAG,cAAc,EAAE,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