@vibe-agent-toolkit/utils 0.2.0-rc.11 → 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 +111 -9
- 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 +2 -0
- package/dist/env-flag.d.ts.map +1 -1
- package/dist/env-flag.js +2 -0
- 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 +4 -4
- package/dist/fs.d.ts.map +1 -1
- package/dist/fs.js +4 -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 +3 -1
- package/dist/path-containment.d.ts.map +1 -1
- package/dist/path-containment.js +13 -7
- 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-file.d.ts +14 -1
- package/dist/text-file.d.ts.map +1 -1
- package/dist/text-file.js +41 -8
- package/dist/text-file.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 +3 -16
- 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
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one presence predicate: is something at this path — asked so that "I could
|
|
3
|
+
* not look" can never read as "nothing there".
|
|
4
|
+
*
|
|
5
|
+
* `existsSync` answers `false` for `ENOENT` and equally for `EACCES` (a parent the
|
|
6
|
+
* process may not search), `ELOOP` and every other errno, so a refused path goes on
|
|
7
|
+
* as an absent one. Here only the classifier's `absent` class can answer `false`;
|
|
8
|
+
* anything else is thrown classified (`local/no-existssync` points every caller here).
|
|
9
|
+
*/
|
|
10
|
+
import { type SideOfPath } from './fs-fault.js';
|
|
11
|
+
/** How a presence probe treats a link: see {@link pathPresent}. */
|
|
12
|
+
export type PresenceMode = 'entry' | {
|
|
13
|
+
readonly follow: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Whether something is at `path`, asked the way the caller will USE the answer — so
|
|
17
|
+
* neither choice is defaulted, and neither is inferred from `side`.
|
|
18
|
+
*
|
|
19
|
+
* `mode` — what counts as there:
|
|
20
|
+
* - `'entry'` (`lstat`): is there a directory entry at all, a dangling link
|
|
21
|
+
* included? Right before writing there — `existsSync` calls a dangling link
|
|
22
|
+
* absent, and the copy then trips over it.
|
|
23
|
+
* - `{ follow: within }` (`stat`): does it resolve to something that can be read? Right
|
|
24
|
+
* before reading or staging from it — a dangling link is absent, so the caller
|
|
25
|
+
* refuses it by its own "not there" message instead of failing later. `within` is the
|
|
26
|
+
* tree the path is crawled in (the operator's own input, or the path itself when it IS
|
|
27
|
+
* the operator's own): every link beneath it is read by its text before the kernel
|
|
28
|
+
* follows it (`link-following.ts`), and a chain VAT will not hand the kernel is a fault
|
|
29
|
+
* on `side`, of class `refused`.
|
|
30
|
+
*
|
|
31
|
+
* `absence` — how far a "nothing there" answer is believed:
|
|
32
|
+
* - `'confirmed'`: only once the parent's listing agrees (`requireConfirmedAbsent`).
|
|
33
|
+
* Right when a wrong "absent" would silently do less or overwrite: a place about to
|
|
34
|
+
* be written, an output the run itself made, a part of a package whose absence
|
|
35
|
+
* means "install without it".
|
|
36
|
+
* - `'probe'`: the probe's own word. Right when the caller refuses or skips an absent
|
|
37
|
+
* path by its own "not there" — a wrong answer is then loud or harmless — and the
|
|
38
|
+
* listing is not worth one more read of the parent per probe.
|
|
39
|
+
*
|
|
40
|
+
* A `stat`/`lstat` the OS refuses is a classified fault on the caller's side, never
|
|
41
|
+
* "absent"; so is an absence the listing contradicts. Origin `content` is recorded
|
|
42
|
+
* for every path, a typed one included (`vat claude plugin install`'s source): the
|
|
43
|
+
* only fault raised here is about what is on disk at the path, and a typed path that
|
|
44
|
+
* is simply absent answers `false` for the caller to refuse in its own words.
|
|
45
|
+
*
|
|
46
|
+
* @param sideOf - The caller's side of each path the probe may touch — `path` itself, each
|
|
47
|
+
* component a followed probe walks beneath `within`, and (`'confirmed'`) the parent it lists:
|
|
48
|
+
* `source` for one it reads or stages from, `destination` for one it is about to write or that
|
|
49
|
+
* the run itself wrote. A refusal is charged to the side of the path the OS refused.
|
|
50
|
+
* @throws {FsFaultError} when the OS refuses the probe, or (`'confirmed'`) the parent lists what it called absent
|
|
51
|
+
*/
|
|
52
|
+
export declare function pathPresent(path: string, mode: PresenceMode, sideOf: SideOfPath, absence: 'confirmed' | 'probe'): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Whether `name` is in the directory `dir`, its link followed — the probe of each level of a
|
|
55
|
+
* root-discovery walk (`project-utils.ts`, `git-utils.ts`). Those walks climb from inside CRAWLED
|
|
56
|
+
* trees (`vat audit` asks `findProjectRoot` of every skill directory it finds), so the entry can be
|
|
57
|
+
* a link the tree's author planted.
|
|
58
|
+
*
|
|
59
|
+
* Answered by the link-chain walk ALONE — `lstat` and `readlink`, the kernel never asked to follow
|
|
60
|
+
* anything: `dir` is taken as spelled (the walk is already standing in it), and the entry's chain
|
|
61
|
+
* is read from there. A chain that ends at a file or a directory is present; one that leads to
|
|
62
|
+
* nothing (absent, a dangle, a cycle) is not; one through a network or device path is a `refused`
|
|
63
|
+
* fault on `source`, as a probe the OS refused is — never "absent". Neither `dir` nor its ancestors
|
|
64
|
+
* are resolved by the kernel: a crawled directory's own chain is not this probe's to follow, and a
|
|
65
|
+
* refused resolution of a corpus root stays the refusal of the lane that resolves it. A `dir` whose
|
|
66
|
+
* spelling holds a NUL holds nothing (no filesystem has such a name), and the walk goes on to its
|
|
67
|
+
* parent.
|
|
68
|
+
*
|
|
69
|
+
* @throws FsFaultError on `source` when the OS refuses a probe or the chain is one VAT will not follow
|
|
70
|
+
*/
|
|
71
|
+
export declare function entryPresentIn(dir: string, name: string): boolean;
|
|
72
|
+
//# sourceMappingURL=path-present.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-present.d.ts","sourceRoot":"","sources":["../../src/errors/path-present.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH,OAAO,EAAkC,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhF,mEAAmE;AACnE,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,GAAG,OAAO,CAazH;AAKD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAYjE"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one presence predicate: is something at this path — asked so that "I could
|
|
3
|
+
* not look" can never read as "nothing there".
|
|
4
|
+
*
|
|
5
|
+
* `existsSync` answers `false` for `ENOENT` and equally for `EACCES` (a parent the
|
|
6
|
+
* process may not search), `ELOOP` and every other errno, so a refused path goes on
|
|
7
|
+
* as an absent one. Here only the classifier's `absent` class can answer `false`;
|
|
8
|
+
* anything else is thrown classified (`local/no-existssync` points every caller here).
|
|
9
|
+
*/
|
|
10
|
+
import { lstatSync } from 'node:fs';
|
|
11
|
+
import { requireFollowedStatSync } from '../link-following.js';
|
|
12
|
+
import { safePath } from '../path-core.js';
|
|
13
|
+
import { LinkChainRefusedError, walkHostChain } from '../tree-change/host-chain.js';
|
|
14
|
+
import { HOST_PATH_FLAVOR } from '../tree-change/link-chain.js';
|
|
15
|
+
import { requireConfirmedAbsent } from './confirmed-absent.js';
|
|
16
|
+
import { isPathAbsentError, isUnresolvableLinkError } from './errno-table.js';
|
|
17
|
+
import { classifyFsFault, refusedPathOf } from './fs-fault.js';
|
|
18
|
+
/**
|
|
19
|
+
* Whether something is at `path`, asked the way the caller will USE the answer — so
|
|
20
|
+
* neither choice is defaulted, and neither is inferred from `side`.
|
|
21
|
+
*
|
|
22
|
+
* `mode` — what counts as there:
|
|
23
|
+
* - `'entry'` (`lstat`): is there a directory entry at all, a dangling link
|
|
24
|
+
* included? Right before writing there — `existsSync` calls a dangling link
|
|
25
|
+
* absent, and the copy then trips over it.
|
|
26
|
+
* - `{ follow: within }` (`stat`): does it resolve to something that can be read? Right
|
|
27
|
+
* before reading or staging from it — a dangling link is absent, so the caller
|
|
28
|
+
* refuses it by its own "not there" message instead of failing later. `within` is the
|
|
29
|
+
* tree the path is crawled in (the operator's own input, or the path itself when it IS
|
|
30
|
+
* the operator's own): every link beneath it is read by its text before the kernel
|
|
31
|
+
* follows it (`link-following.ts`), and a chain VAT will not hand the kernel is a fault
|
|
32
|
+
* on `side`, of class `refused`.
|
|
33
|
+
*
|
|
34
|
+
* `absence` — how far a "nothing there" answer is believed:
|
|
35
|
+
* - `'confirmed'`: only once the parent's listing agrees (`requireConfirmedAbsent`).
|
|
36
|
+
* Right when a wrong "absent" would silently do less or overwrite: a place about to
|
|
37
|
+
* be written, an output the run itself made, a part of a package whose absence
|
|
38
|
+
* means "install without it".
|
|
39
|
+
* - `'probe'`: the probe's own word. Right when the caller refuses or skips an absent
|
|
40
|
+
* path by its own "not there" — a wrong answer is then loud or harmless — and the
|
|
41
|
+
* listing is not worth one more read of the parent per probe.
|
|
42
|
+
*
|
|
43
|
+
* A `stat`/`lstat` the OS refuses is a classified fault on the caller's side, never
|
|
44
|
+
* "absent"; so is an absence the listing contradicts. Origin `content` is recorded
|
|
45
|
+
* for every path, a typed one included (`vat claude plugin install`'s source): the
|
|
46
|
+
* only fault raised here is about what is on disk at the path, and a typed path that
|
|
47
|
+
* is simply absent answers `false` for the caller to refuse in its own words.
|
|
48
|
+
*
|
|
49
|
+
* @param sideOf - The caller's side of each path the probe may touch — `path` itself, each
|
|
50
|
+
* component a followed probe walks beneath `within`, and (`'confirmed'`) the parent it lists:
|
|
51
|
+
* `source` for one it reads or stages from, `destination` for one it is about to write or that
|
|
52
|
+
* the run itself wrote. A refusal is charged to the side of the path the OS refused.
|
|
53
|
+
* @throws {FsFaultError} when the OS refuses the probe, or (`'confirmed'`) the parent lists what it called absent
|
|
54
|
+
*/
|
|
55
|
+
export function pathPresent(path, mode, sideOf, absence) {
|
|
56
|
+
const ctx = { origin: 'content', action: 'examine the path', path };
|
|
57
|
+
try {
|
|
58
|
+
if (mode === 'entry')
|
|
59
|
+
lstatSync(path);
|
|
60
|
+
else
|
|
61
|
+
requireFollowedStatSync(path, mode.follow);
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
// Followed, a chain that leads to nothing — a dangle or a cycle — is absent, as a missing path is.
|
|
66
|
+
const absent = mode === 'entry' ? isPathAbsentError(error) : isUnresolvableLinkError(error);
|
|
67
|
+
if (!absent)
|
|
68
|
+
throw classifyFsFault(error, { ...ctx, side: sideOf(refusedPathOf(error, path)) });
|
|
69
|
+
if (absence === 'confirmed')
|
|
70
|
+
requireConfirmedAbsent(path, error, ctx, { follows: mode !== 'entry', sideOf });
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** The NUL no filesystem name can hold. */
|
|
75
|
+
const NUL = String.fromCodePoint(0);
|
|
76
|
+
/**
|
|
77
|
+
* Whether `name` is in the directory `dir`, its link followed — the probe of each level of a
|
|
78
|
+
* root-discovery walk (`project-utils.ts`, `git-utils.ts`). Those walks climb from inside CRAWLED
|
|
79
|
+
* trees (`vat audit` asks `findProjectRoot` of every skill directory it finds), so the entry can be
|
|
80
|
+
* a link the tree's author planted.
|
|
81
|
+
*
|
|
82
|
+
* Answered by the link-chain walk ALONE — `lstat` and `readlink`, the kernel never asked to follow
|
|
83
|
+
* anything: `dir` is taken as spelled (the walk is already standing in it), and the entry's chain
|
|
84
|
+
* is read from there. A chain that ends at a file or a directory is present; one that leads to
|
|
85
|
+
* nothing (absent, a dangle, a cycle) is not; one through a network or device path is a `refused`
|
|
86
|
+
* fault on `source`, as a probe the OS refused is — never "absent". Neither `dir` nor its ancestors
|
|
87
|
+
* are resolved by the kernel: a crawled directory's own chain is not this probe's to follow, and a
|
|
88
|
+
* refused resolution of a corpus root stays the refusal of the lane that resolves it. A `dir` whose
|
|
89
|
+
* spelling holds a NUL holds nothing (no filesystem has such a name), and the walk goes on to its
|
|
90
|
+
* parent.
|
|
91
|
+
*
|
|
92
|
+
* @throws FsFaultError on `source` when the OS refuses a probe or the chain is one VAT will not follow
|
|
93
|
+
*/
|
|
94
|
+
export function entryPresentIn(dir, name) {
|
|
95
|
+
if (dir.includes(NUL))
|
|
96
|
+
return false;
|
|
97
|
+
const path = safePath.join(dir, name);
|
|
98
|
+
const ctx = { side: 'source', origin: 'content', action: 'examine the path', path };
|
|
99
|
+
let chain;
|
|
100
|
+
try {
|
|
101
|
+
chain = walkHostChain(path, { flavor: HOST_PATH_FLAVOR, root: safePath.resolve(dir), outside: 'follow' });
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
throw classifyFsFault(error, ctx);
|
|
105
|
+
}
|
|
106
|
+
if (chain.kind === 'refused')
|
|
107
|
+
throw classifyFsFault(new LinkChainRefusedError(path, chain.refusal), ctx);
|
|
108
|
+
return chain.kind === 'resolved';
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=path-present.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-present.js","sourceRoot":"","sources":["../../src/errors/path-present.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAkB,MAAM,8BAA8B,CAAC;AAEhF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAA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KAAK,CAAC;IACpC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACtC,MAAM,GAAG,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAW,CAAC;IAC7F,IAAI,KAAgB,CAAC;IACrB,IAAI,CAAC;QACH,KAAK,GAAG,aAAa,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC5G,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,eAAe,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACpC,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,MAAM,eAAe,CAAC,IAAI,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC;IACzG,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `VatError` code a RAG query over an index with no chunk table throws.
|
|
3
|
+
*
|
|
4
|
+
* Here rather than beside its thrower (`@vibe-agent-toolkit/rag-lancedb`)
|
|
5
|
+
* because its reader is the CLI's refusal map, which loads for every command:
|
|
6
|
+
* importing it from the optional RAG backend would load that backend with it.
|
|
7
|
+
* One constant, imported on both sides, so the thrower and the map cannot drift.
|
|
8
|
+
*/
|
|
9
|
+
export declare const RAG_INDEX_EMPTY_CODE = "RAG_INDEX_EMPTY";
|
|
10
|
+
/**
|
|
11
|
+
* The `VatError` code for a RAG database whose table LanceDB cannot open — its
|
|
12
|
+
* files are damaged or truncated. The store is the caller's input, unreadable;
|
|
13
|
+
* kept here for the same reason as {@link RAG_INDEX_EMPTY_CODE}.
|
|
14
|
+
*/
|
|
15
|
+
export declare const RAG_DATABASE_UNREADABLE_CODE = "RAG_DATABASE_UNREADABLE";
|
|
16
|
+
//# sourceMappingURL=rag-index-empty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rag-index-empty.d.ts","sourceRoot":"","sources":["../../src/errors/rag-index-empty.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `VatError` code a RAG query over an index with no chunk table throws.
|
|
3
|
+
*
|
|
4
|
+
* Here rather than beside its thrower (`@vibe-agent-toolkit/rag-lancedb`)
|
|
5
|
+
* because its reader is the CLI's refusal map, which loads for every command:
|
|
6
|
+
* importing it from the optional RAG backend would load that backend with it.
|
|
7
|
+
* One constant, imported on both sides, so the thrower and the map cannot drift.
|
|
8
|
+
*/
|
|
9
|
+
export const RAG_INDEX_EMPTY_CODE = 'RAG_INDEX_EMPTY';
|
|
10
|
+
/**
|
|
11
|
+
* The `VatError` code for a RAG database whose table LanceDB cannot open — its
|
|
12
|
+
* files are damaged or truncated. The store is the caller's input, unreadable;
|
|
13
|
+
* kept here for the same reason as {@link RAG_INDEX_EMPTY_CODE}.
|
|
14
|
+
*/
|
|
15
|
+
export const RAG_DATABASE_UNREADABLE_CODE = 'RAG_DATABASE_UNREADABLE';
|
|
16
|
+
//# sourceMappingURL=rag-index-empty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rag-index-empty.js","sourceRoot":"","sources":["../../src/errors/rag-index-empty.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAEtD;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Faults raised while a failure was already being handled — a temporary
|
|
3
|
+
* directory or a staged tree that would not go away after the work failed.
|
|
4
|
+
*
|
|
5
|
+
* The failure is rethrown UNCHANGED: never wrapped, never given a `cause`, never
|
|
6
|
+
* mutated (it may be frozen, shared, or carry a classified fault of its own that
|
|
7
|
+
* a cause walk must find first). The later fault is recorded beside it instead,
|
|
8
|
+
* off the cause chain, so it can never pose as the failure's classification, and
|
|
9
|
+
* a reporter reads it back with {@link suppressedFaultsOf} to name what was left.
|
|
10
|
+
*
|
|
11
|
+
* A reader walks the thrown value's cause chain (bounded, each error once), so a
|
|
12
|
+
* record made on a failure survives a wrapper thrown in its place — a
|
|
13
|
+
* rollback-incomplete error, a verb boundary's re-wrap. The walk only reads: it
|
|
14
|
+
* never decides the failure's classification.
|
|
15
|
+
*
|
|
16
|
+
* The record is keyed by the error object in a `WeakMap` held under a
|
|
17
|
+
* `Symbol.for` key on `globalThis`, so a `dist` copy and a `src` copy of this
|
|
18
|
+
* module share one record (the reason `VatError` brands with `Symbol.for`).
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Record `fault` as raised while `error` was being handled. A thrown value that is
|
|
22
|
+
* not an object cannot carry a record: the fault is then a process warning, so it
|
|
23
|
+
* is still never silent.
|
|
24
|
+
*/
|
|
25
|
+
export declare function recordSuppressedFault(error: unknown, fault: unknown): void;
|
|
26
|
+
/**
|
|
27
|
+
* The faults recorded against `error`, and against every error on its cause chain,
|
|
28
|
+
* while each was being handled — outermost error first, each one's oldest first —
|
|
29
|
+
* each a leftover a report names as a warning. Empty when nothing was recorded.
|
|
30
|
+
*
|
|
31
|
+
* @param error - What a catch received
|
|
32
|
+
*/
|
|
33
|
+
export declare function suppressedFaultsOf(error: unknown): readonly unknown[];
|
|
34
|
+
//# sourceMappingURL=suppressed-faults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suppressed-faults.d.ts","sourceRoot":"","sources":["../../src/errors/suppressed-faults.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAkBH;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAQ1E;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,OAAO,EAAE,CAUrE"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Faults raised while a failure was already being handled — a temporary
|
|
3
|
+
* directory or a staged tree that would not go away after the work failed.
|
|
4
|
+
*
|
|
5
|
+
* The failure is rethrown UNCHANGED: never wrapped, never given a `cause`, never
|
|
6
|
+
* mutated (it may be frozen, shared, or carry a classified fault of its own that
|
|
7
|
+
* a cause walk must find first). The later fault is recorded beside it instead,
|
|
8
|
+
* off the cause chain, so it can never pose as the failure's classification, and
|
|
9
|
+
* a reporter reads it back with {@link suppressedFaultsOf} to name what was left.
|
|
10
|
+
*
|
|
11
|
+
* A reader walks the thrown value's cause chain (bounded, each error once), so a
|
|
12
|
+
* record made on a failure survives a wrapper thrown in its place — a
|
|
13
|
+
* rollback-incomplete error, a verb boundary's re-wrap. The walk only reads: it
|
|
14
|
+
* never decides the failure's classification.
|
|
15
|
+
*
|
|
16
|
+
* The record is keyed by the error object in a `WeakMap` held under a
|
|
17
|
+
* `Symbol.for` key on `globalThis`, so a `dist` copy and a `src` copy of this
|
|
18
|
+
* module share one record (the reason `VatError` brands with `Symbol.for`).
|
|
19
|
+
*/
|
|
20
|
+
const REGISTRY_KEY = Symbol.for('vat.suppressed-faults');
|
|
21
|
+
/** Bound on the cause walk: a malformed chain must not hang an error path. */
|
|
22
|
+
const MAX_CAUSE_DEPTH = 10;
|
|
23
|
+
function registry() {
|
|
24
|
+
const holder = globalThis;
|
|
25
|
+
const existing = holder[REGISTRY_KEY];
|
|
26
|
+
if (existing !== undefined)
|
|
27
|
+
return existing;
|
|
28
|
+
const created = new WeakMap();
|
|
29
|
+
holder[REGISTRY_KEY] = created;
|
|
30
|
+
return created;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Record `fault` as raised while `error` was being handled. A thrown value that is
|
|
34
|
+
* not an object cannot carry a record: the fault is then a process warning, so it
|
|
35
|
+
* is still never silent.
|
|
36
|
+
*/
|
|
37
|
+
export function recordSuppressedFault(error, fault) {
|
|
38
|
+
if (typeof error !== 'object' || error === null) {
|
|
39
|
+
process.emitWarning(fault instanceof Error ? fault.message : String(fault), 'VatSuppressedFault');
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const faults = registry().get(error);
|
|
43
|
+
if (faults === undefined)
|
|
44
|
+
registry().set(error, [fault]);
|
|
45
|
+
else
|
|
46
|
+
faults.push(fault);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The faults recorded against `error`, and against every error on its cause chain,
|
|
50
|
+
* while each was being handled — outermost error first, each one's oldest first —
|
|
51
|
+
* each a leftover a report names as a warning. Empty when nothing was recorded.
|
|
52
|
+
*
|
|
53
|
+
* @param error - What a catch received
|
|
54
|
+
*/
|
|
55
|
+
export function suppressedFaultsOf(error) {
|
|
56
|
+
const faults = [];
|
|
57
|
+
const seen = new Set();
|
|
58
|
+
let link = error;
|
|
59
|
+
for (let depth = 0; depth < MAX_CAUSE_DEPTH && typeof link === 'object' && link !== null && !seen.has(link); depth++) {
|
|
60
|
+
seen.add(link);
|
|
61
|
+
faults.push(...(registry().get(link) ?? []));
|
|
62
|
+
link = link.cause;
|
|
63
|
+
}
|
|
64
|
+
return faults;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=suppressed-faults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suppressed-faults.js","sourceRoot":"","sources":["../../src/errors/suppressed-faults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,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,eAAe,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;QACrH,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACf,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAC7C,IAAI,GAAI,IAA4B,CAAC,KAAK,CAAC;IAC7C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/file-crawler.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type UnreadablePolicy } from './listing-refusal.js';
|
|
2
|
-
export type
|
|
3
|
-
export { DirectoryListingRefusedError, type RefuseListingContext, refusedListingMessage, settleRefusal, type UnreadablePolicy, } from './listing-refusal.js';
|
|
2
|
+
export { rootListingRefusal, type DirectoryRefusal } from './fs-utils.js';
|
|
3
|
+
export { DirectoryListingRefusedError, onCrawlOutput, type RefuseListingContext, refusedListingMessage, settleCrawlRefusal, settleRefusal, type UnreadablePolicy, } from './listing-refusal.js';
|
|
4
4
|
/**
|
|
5
5
|
* Options for directory crawling
|
|
6
6
|
*/
|
|
@@ -29,6 +29,15 @@ export interface CrawlOptions {
|
|
|
29
29
|
* DIVERGENCE block below), so it would have none to report.
|
|
30
30
|
*/
|
|
31
31
|
onSymlinkNotFollowed?: (path: string) => void;
|
|
32
|
+
/**
|
|
33
|
+
* The trees the calling verb WRITES — its output and the staging it builds it in — or `[]`
|
|
34
|
+
* for a verb that only reads: the one declaration of which side a fault is on. A fault at
|
|
35
|
+
* (or a refused listing of) a directory that is, lies in, or holds one of them — the base of
|
|
36
|
+
* a project a build writes into included — is the destination's; anything else is on the
|
|
37
|
+
* `unreadable` policy's side (`source` when the policy degrades). Required: only the caller
|
|
38
|
+
* knows.
|
|
39
|
+
*/
|
|
40
|
+
outputs: readonly string[];
|
|
32
41
|
/** Return absolute paths in results (default: true) */
|
|
33
42
|
absolute?: boolean;
|
|
34
43
|
/** Only return files (not directories) - default: true */
|
|
@@ -155,24 +164,10 @@ export declare function crawlPathFilter(include: readonly string[], exclude: rea
|
|
|
155
164
|
* baseDir: '/project',
|
|
156
165
|
* include: ['**\/*.md'],
|
|
157
166
|
* exclude: ['**\/node_modules/**'],
|
|
167
|
+
* unreadable: { refuse: { root: '/project', remedy: 'Fix the permissions.', side: 'source' } },
|
|
168
|
+
* outputs: [],
|
|
158
169
|
* });
|
|
159
170
|
*/
|
|
160
171
|
export declare function crawlDirectory(options: CrawlOptions): Promise<string[]>;
|
|
161
|
-
/**
|
|
162
|
-
* Crawl a directory tree and return matching files (synchronous)
|
|
163
|
-
*
|
|
164
|
-
* Uses picomatch for glob pattern matching (same as Vitest)
|
|
165
|
-
* Cross-platform compatible
|
|
166
|
-
*
|
|
167
|
-
* @param options - Crawl options
|
|
168
|
-
* @returns Array of matching file paths
|
|
169
|
-
*
|
|
170
|
-
* @example
|
|
171
|
-
* const files = crawlDirectorySync({
|
|
172
|
-
* baseDir: '/project',
|
|
173
|
-
* include: ['**\/*.md'],
|
|
174
|
-
* exclude: ['**\/node_modules/**'],
|
|
175
|
-
* });
|
|
176
|
-
*/
|
|
177
172
|
export declare function crawlDirectorySync(options: CrawlOptions): string[];
|
|
178
173
|
//# sourceMappingURL=file-crawler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-crawler.d.ts","sourceRoot":"","sources":["../src/file-crawler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-crawler.d.ts","sourceRoot":"","sources":["../src/file-crawler.ts"],"names":[],"mappings":"AAeA,OAAO,EAA4D,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGvH,OAAO,EAAE,kBAAkB,EAAE,KAAK,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