@vibe-agent-toolkit/utils 0.2.0-rc.1 → 0.2.0-rc.10
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 +69 -23
- package/dist/asset-reference.js +3 -11
- package/dist/asset-reference.js.map +1 -1
- package/dist/compare-code-units.d.ts +28 -0
- package/dist/compare-code-units.d.ts.map +1 -0
- package/dist/compare-code-units.js +33 -0
- package/dist/compare-code-units.js.map +1 -0
- package/dist/crawl-timing.d.ts +657 -0
- package/dist/crawl-timing.d.ts.map +1 -0
- package/dist/crawl-timing.js +765 -0
- package/dist/crawl-timing.js.map +1 -0
- package/dist/crawl.d.ts +2 -4
- package/dist/crawl.d.ts.map +1 -1
- package/dist/crawl.js +2 -4
- package/dist/crawl.js.map +1 -1
- package/dist/dirent-kind.d.ts +83 -0
- package/dist/dirent-kind.d.ts.map +1 -0
- package/dist/dirent-kind.js +129 -0
- package/dist/dirent-kind.js.map +1 -0
- package/dist/entrypoint.d.ts +54 -0
- package/dist/entrypoint.d.ts.map +1 -0
- package/dist/entrypoint.js +71 -0
- package/dist/entrypoint.js.map +1 -0
- package/dist/env-flag.d.ts +51 -0
- package/dist/env-flag.d.ts.map +1 -0
- package/dist/env-flag.js +62 -0
- package/dist/env-flag.js.map +1 -0
- package/dist/errors/errno.d.ts +51 -0
- package/dist/errors/errno.d.ts.map +1 -0
- package/dist/errors/errno.js +112 -0
- package/dist/errors/errno.js.map +1 -0
- package/dist/errors/vat-error.d.ts +60 -0
- package/dist/errors/vat-error.d.ts.map +1 -0
- package/dist/errors/vat-error.js +86 -0
- package/dist/errors/vat-error.js.map +1 -0
- package/dist/file-crawler.d.ts +60 -0
- package/dist/file-crawler.d.ts.map +1 -1
- package/dist/file-crawler.js +133 -29
- package/dist/file-crawler.js.map +1 -1
- package/dist/fs/file-hash.d.ts.map +1 -1
- package/dist/fs/file-hash.js +0 -1
- package/dist/fs/file-hash.js.map +1 -1
- package/dist/fs-utils.d.ts +422 -191
- package/dist/fs-utils.d.ts.map +1 -1
- package/dist/fs-utils.js +534 -204
- package/dist/fs-utils.js.map +1 -1
- package/dist/fs.d.ts +5 -2
- package/dist/fs.d.ts.map +1 -1
- package/dist/fs.js +9 -7
- package/dist/fs.js.map +1 -1
- package/dist/git-run.d.ts +167 -0
- package/dist/git-run.d.ts.map +1 -0
- package/dist/git-run.js +154 -0
- package/dist/git-run.js.map +1 -0
- package/dist/git-snapshot.d.ts +199 -0
- package/dist/git-snapshot.d.ts.map +1 -0
- package/dist/git-snapshot.js +250 -0
- package/dist/git-snapshot.js.map +1 -0
- package/dist/git-tracker.d.ts +166 -3
- package/dist/git-tracker.d.ts.map +1 -1
- package/dist/git-tracker.js +250 -22
- package/dist/git-tracker.js.map +1 -1
- package/dist/git-utils.d.ts +84 -1
- package/dist/git-utils.d.ts.map +1 -1
- package/dist/git-utils.js +208 -82
- package/dist/git-utils.js.map +1 -1
- package/dist/git.d.ts +13 -4
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +12 -4
- package/dist/git.js.map +1 -1
- package/dist/gitignore-checker.d.ts.map +1 -1
- package/dist/gitignore-checker.js +15 -6
- package/dist/gitignore-checker.js.map +1 -1
- package/dist/glob/glob-pattern.js +5 -5
- package/dist/glob/glob-pattern.js.map +1 -1
- package/dist/index.d.ts +32 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +95 -50
- package/dist/index.js.map +1 -1
- package/dist/listing-refusal.d.ts +112 -0
- package/dist/listing-refusal.d.ts.map +1 -0
- package/dist/listing-refusal.js +105 -0
- package/dist/listing-refusal.js.map +1 -0
- package/dist/path-containment.d.ts +64 -0
- package/dist/path-containment.d.ts.map +1 -0
- package/dist/path-containment.js +111 -0
- package/dist/path-containment.js.map +1 -0
- package/dist/path-core.d.ts +113 -18
- package/dist/path-core.d.ts.map +1 -1
- package/dist/path-core.js +139 -23
- package/dist/path-core.js.map +1 -1
- package/dist/path-utils.d.ts.map +1 -1
- package/dist/path-utils.js +42 -47
- package/dist/path-utils.js.map +1 -1
- package/dist/path.d.ts +1 -1
- package/dist/path.d.ts.map +1 -1
- package/dist/path.js +1 -1
- package/dist/path.js.map +1 -1
- package/dist/process.d.ts +7 -0
- package/dist/process.d.ts.map +1 -1
- package/dist/process.js +7 -0
- package/dist/process.js.map +1 -1
- package/dist/project-utils.d.ts.map +1 -1
- package/dist/project-utils.js +15 -9
- package/dist/project-utils.js.map +1 -1
- package/dist/project.d.ts +7 -5
- package/dist/project.d.ts.map +1 -1
- package/dist/project.js +7 -5
- package/dist/project.js.map +1 -1
- package/dist/safe-exec.d.ts +40 -11
- package/dist/safe-exec.d.ts.map +1 -1
- package/dist/safe-exec.js +111 -25
- package/dist/safe-exec.js.map +1 -1
- package/dist/skill-targets.d.ts +2 -2
- package/dist/skill-targets.js +2 -2
- package/dist/skill-test/auth-resolver.d.ts +10 -2
- package/dist/skill-test/auth-resolver.d.ts.map +1 -1
- package/dist/skill-test/auth-resolver.js +26 -11
- package/dist/skill-test/auth-resolver.js.map +1 -1
- package/dist/skill-test/index.d.ts +1 -1
- package/dist/skill-test/index.d.ts.map +1 -1
- package/dist/skill-test/index.js +1 -1
- package/dist/skill-test/index.js.map +1 -1
- package/dist/skill-test/spawn-claude.d.ts +30 -1
- package/dist/skill-test/spawn-claude.d.ts.map +1 -1
- package/dist/skill-test/spawn-claude.js +71 -5
- package/dist/skill-test/spawn-claude.js.map +1 -1
- package/dist/skill-test/transcript.d.ts +41 -2
- package/dist/skill-test/transcript.d.ts.map +1 -1
- package/dist/skill-test/transcript.js +55 -10
- package/dist/skill-test/transcript.js.map +1 -1
- package/dist/spawn-hardened.js +0 -1
- package/dist/spawn-hardened.js.map +1 -1
- package/dist/stdio-blocking.js +13 -14
- package/dist/stdio-blocking.js.map +1 -1
- package/dist/test-helpers.d.ts +135 -100
- package/dist/test-helpers.d.ts.map +1 -1
- package/dist/test-helpers.js +224 -146
- package/dist/test-helpers.js.map +1 -1
- package/dist/testing/executables.d.ts +32 -0
- package/dist/testing/executables.d.ts.map +1 -0
- package/dist/testing/executables.js +70 -0
- package/dist/testing/executables.js.map +1 -0
- package/dist/testing/hostile-tree.d.ts +79 -0
- package/dist/testing/hostile-tree.d.ts.map +1 -0
- package/dist/testing/hostile-tree.js +164 -0
- package/dist/testing/hostile-tree.js.map +1 -0
- package/dist/testing/platform-gates.d.ts +31 -0
- package/dist/testing/platform-gates.d.ts.map +1 -0
- package/dist/testing/platform-gates.js +31 -0
- package/dist/testing/platform-gates.js.map +1 -0
- package/dist/testing/temp-dir.d.ts +255 -0
- package/dist/testing/temp-dir.d.ts.map +1 -0
- package/dist/testing/temp-dir.js +363 -0
- package/dist/testing/temp-dir.js.map +1 -0
- package/dist/testing.d.ts +94 -3
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +119 -3
- package/dist/testing.js.map +1 -1
- package/dist/text-content.d.ts +197 -0
- package/dist/text-content.d.ts.map +1 -0
- package/dist/text-content.js +354 -0
- package/dist/text-content.js.map +1 -0
- package/dist/text-file.d.ts +45 -0
- package/dist/text-file.d.ts.map +1 -0
- package/dist/text-file.js +51 -0
- package/dist/text-file.js.map +1 -0
- package/dist/text.d.ts +16 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +16 -0
- package/dist/text.js.map +1 -0
- package/dist/timing-dump.d.ts +136 -0
- package/dist/timing-dump.d.ts.map +1 -0
- package/dist/timing-dump.js +229 -0
- package/dist/timing-dump.js.map +1 -0
- package/dist/windows-shell.d.ts +0 -1
- package/dist/windows-shell.d.ts.map +1 -1
- package/dist/windows-shell.js +0 -1
- package/dist/windows-shell.js.map +1 -1
- package/dist/zod-introspection.js +2 -2
- package/dist/zod-introspection.js.map +1 -1
- package/eslint/README.md +223 -49
- package/eslint/index.cjs +111 -97
- package/eslint/index.d.cts +16 -6
- package/eslint/rules/callee-name.cjs +23 -0
- package/eslint/rules/commands-import-boundary.cjs +148 -0
- package/eslint/rules/dead-import.cjs +1 -1
- package/eslint/rules/dirent-type-needs-symlink-check.cjs +282 -0
- package/eslint/rules/eslint-rule-factory.cjs +5 -2
- package/eslint/rules/exempt-path-matcher.cjs +2 -1
- package/eslint/rules/explicit-zod-strictness.cjs +120 -0
- package/eslint/rules/no-bare-dynamic-import-path.cjs +5 -1
- package/eslint/rules/no-bare-executable-spawn.cjs +70 -0
- package/eslint/rules/no-bare-symlink-in-tests.cjs +213 -0
- package/eslint/rules/no-blind-catch.cjs +171 -0
- package/eslint/rules/no-child-process-execSync.cjs +8 -0
- package/eslint/rules/no-decaying-referent.cjs +217 -0
- package/eslint/rules/no-dotdot-containment.cjs +160 -0
- package/eslint/rules/no-file-url-string-concat.cjs +4 -1
- package/eslint/rules/no-fragile-entrypoint-guard.cjs +228 -0
- package/eslint/rules/no-fs-mkdirSync.cjs +8 -0
- package/eslint/rules/no-fs-promises-cp.cjs +7 -0
- package/eslint/rules/no-fs-realpathSync.cjs +8 -0
- package/eslint/rules/no-hardcoded-path-split.cjs +29 -18
- package/eslint/rules/no-io-in-unit-tier.cjs +129 -0
- package/eslint/rules/no-literal-process-exit.cjs +129 -0
- package/eslint/rules/no-manual-path-normalize.cjs +136 -107
- package/eslint/rules/no-os-tmpdir.cjs +8 -0
- package/eslint/rules/no-path-operations-in-comparisons.cjs +7 -2
- package/eslint/rules/no-path-sep-in-strings.cjs +7 -2
- package/eslint/rules/no-path-startswith.cjs +7 -2
- package/eslint/rules/no-process-exit-in-phase.cjs +127 -0
- package/eslint/rules/no-raw-node-path.cjs +563 -0
- package/eslint/rules/no-raw-text-decode.cjs +305 -0
- package/eslint/rules/no-registry-count-pin.cjs +255 -0
- package/eslint/rules/no-self-package-import.cjs +168 -0
- package/eslint/rules/no-test-scoped-functions.cjs +10 -3
- package/eslint/rules/no-unix-shell-commands.cjs +6 -2
- package/eslint/rules/no-unsafe-root-join.cjs +23 -2
- package/eslint/rules/no-url-pathname-for-fs.cjs +5 -1
- package/eslint/rules/no-version-literal.cjs +151 -0
- package/eslint/rules/prefer-startswith-over-regex.cjs +9 -0
- package/eslint/rules/require-justified-skip.cjs +8 -2
- package/eslint/rules/safe-import.cjs +1 -1
- package/package.json +16 -16
- package/dist/link-auth/build-headers.d.ts +0 -34
- package/dist/link-auth/build-headers.d.ts.map +0 -1
- package/dist/link-auth/build-headers.js +0 -58
- package/dist/link-auth/build-headers.js.map +0 -1
- package/dist/link-auth/expand-macro.d.ts +0 -38
- package/dist/link-auth/expand-macro.d.ts.map +0 -1
- package/dist/link-auth/expand-macro.js +0 -133
- package/dist/link-auth/expand-macro.js.map +0 -1
- package/dist/link-auth/macros.yaml +0 -50
- package/dist/link-auth/resolve-token.d.ts +0 -83
- package/dist/link-auth/resolve-token.d.ts.map +0 -1
- package/dist/link-auth/resolve-token.js +0 -101
- package/dist/link-auth/resolve-token.js.map +0 -1
- package/dist/link-auth/resolve.d.ts +0 -102
- package/dist/link-auth/resolve.d.ts.map +0 -1
- package/dist/link-auth/resolve.js +0 -66
- package/dist/link-auth/resolve.js.map +0 -1
- package/dist/link-auth/rewrite.d.ts +0 -52
- package/dist/link-auth/rewrite.d.ts.map +0 -1
- package/dist/link-auth/rewrite.js +0 -102
- package/dist/link-auth/rewrite.js.map +0 -1
- package/dist/link-auth/select-provider.d.ts +0 -30
- package/dist/link-auth/select-provider.d.ts.map +0 -1
- package/dist/link-auth/select-provider.js +0 -55
- package/dist/link-auth/select-provider.js.map +0 -1
- package/dist/link-auth/template.d.ts +0 -40
- package/dist/link-auth/template.d.ts.map +0 -1
- package/dist/link-auth/template.js +0 -89
- package/dist/link-auth/template.js.map +0 -1
- package/dist/link-auth/transforms.d.ts +0 -46
- package/dist/link-auth/transforms.d.ts.map +0 -1
- package/dist/link-auth/transforms.js +0 -52
- package/dist/link-auth/transforms.js.map +0 -1
- package/dist/template-entry.d.ts +0 -10
- package/dist/template-entry.d.ts.map +0 -1
- package/dist/template-entry.js +0 -10
- package/dist/template-entry.js.map +0 -1
- package/dist/template.d.ts +0 -7
- package/dist/template.d.ts.map +0 -1
- package/dist/template.js +0 -18
- package/dist/template.js.map +0 -1
- package/eslint/rules/no-path-join.cjs +0 -14
- package/eslint/rules/no-path-relative.cjs +0 -14
- package/eslint/rules/no-path-resolve.cjs +0 -14
- package/eslint/rules/path-function-rule-factory.cjs +0 -496
package/dist/path-core.d.ts
CHANGED
|
@@ -10,6 +10,26 @@
|
|
|
10
10
|
* `mkdirSyncReal`, `resolveFromImportMeta`, `dynamicImportPath`) live in
|
|
11
11
|
* `./path-utils.ts` and are exposed via the `./fs` entry.
|
|
12
12
|
*/
|
|
13
|
+
import { VatError } from './errors/vat-error.js';
|
|
14
|
+
/**
|
|
15
|
+
* Thrown by {@link safePath.joinUnderRoot} when the joined path would land
|
|
16
|
+
* outside its root.
|
|
17
|
+
*
|
|
18
|
+
* A class with a code rather than a prefixed sentence: three packages used to
|
|
19
|
+
* recognise this refusal with `error.message.startsWith('safePath.joinUnderRoot:')`,
|
|
20
|
+
* which is a contract on prose. Dispatch with
|
|
21
|
+
* `isVatError(error, PathEscapesRootError.code)` — it survives the `src`/`dist`
|
|
22
|
+
* boundary that `instanceof` does not.
|
|
23
|
+
*/
|
|
24
|
+
export declare class PathEscapesRootError extends VatError {
|
|
25
|
+
/** The code every instance carries, for `isVatError(error, PathEscapesRootError.code)`. */
|
|
26
|
+
static readonly code = "PATH_ESCAPES_ROOT";
|
|
27
|
+
/**
|
|
28
|
+
* @param root - The root the path had to stay under
|
|
29
|
+
* @param detail - Which segment, or which result, escaped it
|
|
30
|
+
*/
|
|
31
|
+
constructor(root: string, detail: string);
|
|
32
|
+
}
|
|
13
33
|
/**
|
|
14
34
|
* Check if a path is absolute
|
|
15
35
|
*
|
|
@@ -44,8 +64,9 @@ export declare function isAbsoluteAnyPlatform(p: string): boolean;
|
|
|
44
64
|
/**
|
|
45
65
|
* True if `p` contains a `..` parent-directory traversal segment.
|
|
46
66
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
67
|
+
* Backslashes are read as separators on every host (the input is author-written
|
|
68
|
+
* config), then each `/`-delimited segment is inspected — so a `..` is caught
|
|
69
|
+
* regardless of the separator the author typed. A containment guard
|
|
49
70
|
* for config-supplied relative paths (skill `files:` dest values, glob magic
|
|
50
71
|
* remainders) that must never climb above their anchor directory.
|
|
51
72
|
*
|
|
@@ -56,13 +77,66 @@ export declare function isAbsoluteAnyPlatform(p: string): boolean;
|
|
|
56
77
|
* hasParentTraversalSegment('a..b/c') // false (".." must be a whole segment)
|
|
57
78
|
*/
|
|
58
79
|
export declare function hasParentTraversalSegment(p: string): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* True when a root-relative path — as `safePath.relative(root, p)` spells it —
|
|
82
|
+
* names something the root does not contain.
|
|
83
|
+
*
|
|
84
|
+
* The three shapes `path.relative` can return for an outsider: the parent
|
|
85
|
+
* itself (`..`), a climb through it (`../x`), and, on Windows only, an
|
|
86
|
+
* absolute path (a target on another drive has no relative spelling). A name
|
|
87
|
+
* that merely BEGINS with two dots (`..notes.md`) is a member and reads as one;
|
|
88
|
+
* the bare `startsWith('..')` this replaces refused it, dropped the file from
|
|
89
|
+
* the package and unlinked the reference, at exit 0.
|
|
90
|
+
*
|
|
91
|
+
* ⚠️ **Lexical, on purpose.** This classifies a relative path that was already
|
|
92
|
+
* computed; it does not ask the filesystem, so a symlink inside the root that
|
|
93
|
+
* points outside reads as inside here. That is the right answer for the
|
|
94
|
+
* callers that own no root to ask about — a projection identity, a permission
|
|
95
|
+
* pattern, a report relativizer — and the WRONG one for a delete or copy sink,
|
|
96
|
+
* which must ask {@link isUnderRoot} from `@vibe-agent-toolkit/utils` instead.
|
|
97
|
+
* The empty relative (the root itself) is not an escape; whether equality is
|
|
98
|
+
* acceptable is the caller's question and is asked beside this one.
|
|
99
|
+
*
|
|
100
|
+
* @param normalizedRelative - A forward-slashed root-relative path
|
|
101
|
+
* @returns True when the root does not contain it
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* relativeEscapesRoot(safePath.relative(root, p)) // the whole idiom
|
|
105
|
+
* relativeEscapesRoot('../x') // true
|
|
106
|
+
* relativeEscapesRoot('..notes.md') // false — a member whose name starts with dots
|
|
107
|
+
*/
|
|
108
|
+
export declare function relativeEscapesRoot(normalizedRelative: string): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* True when `name` can only ever be ONE directory entry under whatever it is
|
|
111
|
+
* joined to: non-empty, not `.` or `..`, no separator of either platform, no
|
|
112
|
+
* NUL, no drive-letter prefix.
|
|
113
|
+
*
|
|
114
|
+
* The check for a caller-controlled NAME — a skill name from a manifest, a
|
|
115
|
+
* session id, a positional the user typed — that is about to become
|
|
116
|
+
* `join(root, name)`. A name is not a path: `..cache` and `a..b` are legitimate
|
|
117
|
+
* entries, and `includes('..')` refused them while `startsWith` let `x/../..`
|
|
118
|
+
* through. The question is whether the join can land anywhere but directly
|
|
119
|
+
* under `root`, and that is answered by the segment's shape alone, with no
|
|
120
|
+
* filesystem — which is also why this belongs beside the path helpers rather
|
|
121
|
+
* than beside {@link isUnderRoot}, which is the check for a PATH.
|
|
122
|
+
*
|
|
123
|
+
* @param name - The proposed entry name
|
|
124
|
+
* @returns True when `join(root, name)` is a direct child of `root`
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* isSingleFsSegment('my-skill') // true
|
|
128
|
+
* isSingleFsSegment('..cache') // true — dots inside a name are just dots
|
|
129
|
+
* isSingleFsSegment('../victim') // false
|
|
130
|
+
* isSingleFsSegment('..') // false
|
|
131
|
+
*/
|
|
132
|
+
export declare function isSingleFsSegment(name: string): boolean;
|
|
59
133
|
/**
|
|
60
134
|
* Compute a `ValidationIssue.location`: an absolute source file path made
|
|
61
135
|
* relative to the scan/project root, forward-slashed.
|
|
62
136
|
*
|
|
63
137
|
* This is the ONE relativizer every VAT validation lane uses. `location` is
|
|
64
138
|
* contractually project-relative (see `ValidationIssue` in
|
|
65
|
-
* `@vibe-agent-toolkit/
|
|
139
|
+
* `@vibe-agent-toolkit/schema`), so producers must route through here
|
|
66
140
|
* rather than emitting `skillPath` directly — absolute locations leak the
|
|
67
141
|
* developer's home directory into CI logs and make `validation.allow` globs,
|
|
68
142
|
* which match against `location`, unwritable.
|
|
@@ -115,23 +189,42 @@ export declare function toAbsolutePath(p: string, baseDir: string): string;
|
|
|
115
189
|
*/
|
|
116
190
|
export declare function getRelativePath(from: string, to: string): string;
|
|
117
191
|
/**
|
|
118
|
-
* Convert a path
|
|
192
|
+
* Convert a NATIVE path — one the filesystem, `path.*`, `readdir` or git
|
|
193
|
+
* handed you — to forward slashes.
|
|
119
194
|
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
195
|
+
* Converts only where a backslash is a separator (win32). On POSIX a backslash is a
|
|
196
|
+
* legal filename character, so `docs/x\y.md` is one file and is returned
|
|
197
|
+
* unchanged: converting it would invent a phantom `docs/x/` directory and, in
|
|
198
|
+
* {@link safePath.joinUnderRoot}, turn an `x\..\..` NAME into a climb.
|
|
123
199
|
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
200
|
+
* For AUTHOR-WRITTEN text — an href, a glob, a config value, a CLI argument,
|
|
201
|
+
* an archive entry name — whose backslashes must read as separators on every
|
|
202
|
+
* host, use {@link toForwardSlashAnyPlatform}.
|
|
126
203
|
*
|
|
127
|
-
* @
|
|
128
|
-
*
|
|
129
|
-
* // Returns: 'C:/Users/docs/README.md'
|
|
204
|
+
* @param p - A native path
|
|
205
|
+
* @returns The path with forward slashes (identity on POSIX)
|
|
130
206
|
*
|
|
131
|
-
*
|
|
132
|
-
* //
|
|
207
|
+
* @example
|
|
208
|
+
* toForwardSlash('C:\\Users\\docs\\README.md') // win32: 'C:/Users/docs/README.md'
|
|
209
|
+
* toForwardSlash('docs/x\\y.md') // POSIX: 'docs/x\\y.md' (unchanged)
|
|
133
210
|
*/
|
|
134
211
|
export declare function toForwardSlash(p: string): string;
|
|
212
|
+
/**
|
|
213
|
+
* Convert every backslash to a forward slash, on every host.
|
|
214
|
+
*
|
|
215
|
+
* For AUTHOR-WRITTEN text that may carry Windows spellings regardless of where
|
|
216
|
+
* VAT runs — markdown hrefs, globs, config values, CLI arguments, zip entry
|
|
217
|
+
* names — and for containment guards that must refuse `..\x` everywhere.
|
|
218
|
+
* Never use it on a path read from the filesystem or git: on POSIX that
|
|
219
|
+
* backslash is part of a filename. Use {@link toForwardSlash} for those.
|
|
220
|
+
*
|
|
221
|
+
* @param text - Author-written path text
|
|
222
|
+
* @returns The text with every backslash replaced by `/`
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* toForwardSlashAnyPlatform('..\\evil') // '../evil' on every host
|
|
226
|
+
*/
|
|
227
|
+
export declare function toForwardSlashAnyPlatform(text: string): string;
|
|
135
228
|
/**
|
|
136
229
|
* Normalize text to Unicode NFC — the form in which two *visually identical*
|
|
137
230
|
* filenames compare equal.
|
|
@@ -166,12 +259,14 @@ export declare function toNfc(value: string): string;
|
|
|
166
259
|
* Cross-platform safe path operations.
|
|
167
260
|
*
|
|
168
261
|
* Wraps Node's `path.join()`, `path.resolve()`, and `path.relative()` to always
|
|
169
|
-
* return forward-slash paths
|
|
262
|
+
* return forward-slash paths (converted through {@link toForwardSlash}, so a
|
|
263
|
+
* backslash inside a POSIX filename survives). On Windows, the native `path.*` functions return
|
|
170
264
|
* backslashes, which causes bugs when paths are used as Map keys, compared as
|
|
171
265
|
* strings, or matched with glob patterns.
|
|
172
266
|
*
|
|
173
267
|
* **Use these instead of importing from `node:path` directly.**
|
|
174
|
-
* ESLint
|
|
268
|
+
* An ESLint rule enforces this — see `no-raw-node-path` (its `functions` option
|
|
269
|
+
* table maps each of `join`/`resolve`/`relative` to its `safePath.*` replacement).
|
|
175
270
|
*
|
|
176
271
|
* @example
|
|
177
272
|
* ```typescript
|
|
@@ -182,7 +277,7 @@ export declare function toNfc(value: string): string;
|
|
|
182
277
|
* safePath.resolve('/project', './docs') // → '/project/docs'
|
|
183
278
|
* safePath.relative('/project/docs', '/project') // → '..'
|
|
184
279
|
* safePath.joinUnderRoot('/harness', 'skill-abc') // → '/harness/skill-abc'
|
|
185
|
-
* safePath.joinUnderRoot('/harness', '../escape') // throws
|
|
280
|
+
* safePath.joinUnderRoot('/harness', '../escape') // throws PathEscapesRootError
|
|
186
281
|
* ```
|
|
187
282
|
*/
|
|
188
283
|
export declare const safePath: {
|
|
@@ -210,7 +305,7 @@ export declare const safePath: {
|
|
|
210
305
|
* skill-test staging code was vulnerable to on Windows.
|
|
211
306
|
*
|
|
212
307
|
* @returns Forward-slash absolute path guaranteed to be inside `root`.
|
|
213
|
-
* @throws {
|
|
308
|
+
* @throws {PathEscapesRootError} If the resolved path would escape `root`.
|
|
214
309
|
*
|
|
215
310
|
* @example
|
|
216
311
|
* ```typescript
|
package/dist/path-core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-core.d.ts","sourceRoot":"","sources":["../src/path-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAExD;AAED
|
|
1
|
+
{"version":3,"file":"path-core.d.ts","sourceRoot":"","sources":["../src/path-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;;;;;;;;GASG;AACH,qBAAa,oBAAqB,SAAQ,QAAQ;IAChD,2FAA2F;IAC3F,MAAM,CAAC,QAAQ,CAAC,IAAI,uBAAuB;IAE3C;;;OAGG;gBACS,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAGzC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED;;;;;;;;;;;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MAAM;IAI1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;mCACiB,MAAM,eAAe,MAAM,EAAE,KAAG,MAAM;CAiClD,CAAC"}
|
package/dist/path-core.js
CHANGED
|
@@ -11,6 +11,28 @@
|
|
|
11
11
|
* `./path-utils.ts` and are exposed via the `./fs` entry.
|
|
12
12
|
*/
|
|
13
13
|
import path from 'node:path';
|
|
14
|
+
import { VatError } from './errors/vat-error.js';
|
|
15
|
+
/**
|
|
16
|
+
* Thrown by {@link safePath.joinUnderRoot} when the joined path would land
|
|
17
|
+
* outside its root.
|
|
18
|
+
*
|
|
19
|
+
* A class with a code rather than a prefixed sentence: three packages used to
|
|
20
|
+
* recognise this refusal with `error.message.startsWith('safePath.joinUnderRoot:')`,
|
|
21
|
+
* which is a contract on prose. Dispatch with
|
|
22
|
+
* `isVatError(error, PathEscapesRootError.code)` — it survives the `src`/`dist`
|
|
23
|
+
* boundary that `instanceof` does not.
|
|
24
|
+
*/
|
|
25
|
+
export class PathEscapesRootError extends VatError {
|
|
26
|
+
/** The code every instance carries, for `isVatError(error, PathEscapesRootError.code)`. */
|
|
27
|
+
static code = 'PATH_ESCAPES_ROOT';
|
|
28
|
+
/**
|
|
29
|
+
* @param root - The root the path had to stay under
|
|
30
|
+
* @param detail - Which segment, or which result, escaped it
|
|
31
|
+
*/
|
|
32
|
+
constructor(root, detail) {
|
|
33
|
+
super(PathEscapesRootError.code, `safePath.joinUnderRoot: ${detail} escapes root "${root}".`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
14
36
|
/**
|
|
15
37
|
* Check if a path is absolute
|
|
16
38
|
*
|
|
@@ -49,8 +71,9 @@ export function isAbsoluteAnyPlatform(p) {
|
|
|
49
71
|
/**
|
|
50
72
|
* True if `p` contains a `..` parent-directory traversal segment.
|
|
51
73
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
74
|
+
* Backslashes are read as separators on every host (the input is author-written
|
|
75
|
+
* config), then each `/`-delimited segment is inspected — so a `..` is caught
|
|
76
|
+
* regardless of the separator the author typed. A containment guard
|
|
54
77
|
* for config-supplied relative paths (skill `files:` dest values, glob magic
|
|
55
78
|
* remainders) that must never climb above their anchor directory.
|
|
56
79
|
*
|
|
@@ -61,7 +84,74 @@ export function isAbsoluteAnyPlatform(p) {
|
|
|
61
84
|
* hasParentTraversalSegment('a..b/c') // false (".." must be a whole segment)
|
|
62
85
|
*/
|
|
63
86
|
export function hasParentTraversalSegment(p) {
|
|
64
|
-
|
|
87
|
+
// eslint-disable-next-line local/no-dotdot-containment -- this IS the one lexical `..`-segment test the rule points to; it classifies a config-supplied RELATIVE spelling before any root exists to ask the filesystem about. Sinks use isUnderRoot().
|
|
88
|
+
return toForwardSlashAnyPlatform(p).split('/').includes('..');
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* True when a root-relative path — as `safePath.relative(root, p)` spells it —
|
|
92
|
+
* names something the root does not contain.
|
|
93
|
+
*
|
|
94
|
+
* The three shapes `path.relative` can return for an outsider: the parent
|
|
95
|
+
* itself (`..`), a climb through it (`../x`), and, on Windows only, an
|
|
96
|
+
* absolute path (a target on another drive has no relative spelling). A name
|
|
97
|
+
* that merely BEGINS with two dots (`..notes.md`) is a member and reads as one;
|
|
98
|
+
* the bare `startsWith('..')` this replaces refused it, dropped the file from
|
|
99
|
+
* the package and unlinked the reference, at exit 0.
|
|
100
|
+
*
|
|
101
|
+
* ⚠️ **Lexical, on purpose.** This classifies a relative path that was already
|
|
102
|
+
* computed; it does not ask the filesystem, so a symlink inside the root that
|
|
103
|
+
* points outside reads as inside here. That is the right answer for the
|
|
104
|
+
* callers that own no root to ask about — a projection identity, a permission
|
|
105
|
+
* pattern, a report relativizer — and the WRONG one for a delete or copy sink,
|
|
106
|
+
* which must ask {@link isUnderRoot} from `@vibe-agent-toolkit/utils` instead.
|
|
107
|
+
* The empty relative (the root itself) is not an escape; whether equality is
|
|
108
|
+
* acceptable is the caller's question and is asked beside this one.
|
|
109
|
+
*
|
|
110
|
+
* @param normalizedRelative - A forward-slashed root-relative path
|
|
111
|
+
* @returns True when the root does not contain it
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* relativeEscapesRoot(safePath.relative(root, p)) // the whole idiom
|
|
115
|
+
* relativeEscapesRoot('../x') // true
|
|
116
|
+
* relativeEscapesRoot('..notes.md') // false — a member whose name starts with dots
|
|
117
|
+
*/
|
|
118
|
+
export function relativeEscapesRoot(normalizedRelative) {
|
|
119
|
+
// eslint-disable-next-line local/no-dotdot-containment -- this IS the one lexical relative-path classifier the rule points to; every former copy of this pair now calls here. Sinks use isUnderRoot().
|
|
120
|
+
return normalizedRelative === '..' || normalizedRelative.startsWith('../') || isAbsoluteAnyPlatform(normalizedRelative);
|
|
121
|
+
}
|
|
122
|
+
/** A Windows drive-relative spelling (`C:`) — `path.resolve` sends it to that drive's cwd. */
|
|
123
|
+
const DRIVE_RELATIVE = /^[A-Za-z]:/u;
|
|
124
|
+
/**
|
|
125
|
+
* True when `name` can only ever be ONE directory entry under whatever it is
|
|
126
|
+
* joined to: non-empty, not `.` or `..`, no separator of either platform, no
|
|
127
|
+
* NUL, no drive-letter prefix.
|
|
128
|
+
*
|
|
129
|
+
* The check for a caller-controlled NAME — a skill name from a manifest, a
|
|
130
|
+
* session id, a positional the user typed — that is about to become
|
|
131
|
+
* `join(root, name)`. A name is not a path: `..cache` and `a..b` are legitimate
|
|
132
|
+
* entries, and `includes('..')` refused them while `startsWith` let `x/../..`
|
|
133
|
+
* through. The question is whether the join can land anywhere but directly
|
|
134
|
+
* under `root`, and that is answered by the segment's shape alone, with no
|
|
135
|
+
* filesystem — which is also why this belongs beside the path helpers rather
|
|
136
|
+
* than beside {@link isUnderRoot}, which is the check for a PATH.
|
|
137
|
+
*
|
|
138
|
+
* @param name - The proposed entry name
|
|
139
|
+
* @returns True when `join(root, name)` is a direct child of `root`
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* isSingleFsSegment('my-skill') // true
|
|
143
|
+
* isSingleFsSegment('..cache') // true — dots inside a name are just dots
|
|
144
|
+
* isSingleFsSegment('../victim') // false
|
|
145
|
+
* isSingleFsSegment('..') // false
|
|
146
|
+
*/
|
|
147
|
+
export function isSingleFsSegment(name) {
|
|
148
|
+
return (name !== '' &&
|
|
149
|
+
name !== '.' &&
|
|
150
|
+
name !== '..' &&
|
|
151
|
+
!name.includes('/') &&
|
|
152
|
+
!name.includes('\\') &&
|
|
153
|
+
!name.includes('\0') &&
|
|
154
|
+
!DRIVE_RELATIVE.test(name));
|
|
65
155
|
}
|
|
66
156
|
/**
|
|
67
157
|
* Compute a `ValidationIssue.location`: an absolute source file path made
|
|
@@ -69,7 +159,7 @@ export function hasParentTraversalSegment(p) {
|
|
|
69
159
|
*
|
|
70
160
|
* This is the ONE relativizer every VAT validation lane uses. `location` is
|
|
71
161
|
* contractually project-relative (see `ValidationIssue` in
|
|
72
|
-
* `@vibe-agent-toolkit/
|
|
162
|
+
* `@vibe-agent-toolkit/schema`), so producers must route through here
|
|
73
163
|
* rather than emitting `skillPath` directly — absolute locations leak the
|
|
74
164
|
* developer's home directory into CI logs and make `validation.allow` globs,
|
|
75
165
|
* which match against `location`, unwritable.
|
|
@@ -133,25 +223,49 @@ export function getRelativePath(from, to) {
|
|
|
133
223
|
// Calculate relative path from source directory to target file
|
|
134
224
|
return toForwardSlash(path.relative(fromDir, to));
|
|
135
225
|
}
|
|
226
|
+
/** True on hosts (win32) where a backslash is a path separator; everywhere else it is a filename character. */
|
|
227
|
+
const BACKSLASH_IS_NATIVE_SEPARATOR = path.sep === '\\';
|
|
136
228
|
/**
|
|
137
|
-
* Convert a path
|
|
229
|
+
* Convert a NATIVE path — one the filesystem, `path.*`, `readdir` or git
|
|
230
|
+
* handed you — to forward slashes.
|
|
138
231
|
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
232
|
+
* Converts only where a backslash is a separator (win32). On POSIX a backslash is a
|
|
233
|
+
* legal filename character, so `docs/x\y.md` is one file and is returned
|
|
234
|
+
* unchanged: converting it would invent a phantom `docs/x/` directory and, in
|
|
235
|
+
* {@link safePath.joinUnderRoot}, turn an `x\..\..` NAME into a climb.
|
|
142
236
|
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
237
|
+
* For AUTHOR-WRITTEN text — an href, a glob, a config value, a CLI argument,
|
|
238
|
+
* an archive entry name — whose backslashes must read as separators on every
|
|
239
|
+
* host, use {@link toForwardSlashAnyPlatform}.
|
|
145
240
|
*
|
|
146
|
-
* @
|
|
147
|
-
*
|
|
148
|
-
* // Returns: 'C:/Users/docs/README.md'
|
|
241
|
+
* @param p - A native path
|
|
242
|
+
* @returns The path with forward slashes (identity on POSIX)
|
|
149
243
|
*
|
|
150
|
-
*
|
|
151
|
-
* //
|
|
244
|
+
* @example
|
|
245
|
+
* toForwardSlash('C:\\Users\\docs\\README.md') // win32: 'C:/Users/docs/README.md'
|
|
246
|
+
* toForwardSlash('docs/x\\y.md') // POSIX: 'docs/x\\y.md' (unchanged)
|
|
152
247
|
*/
|
|
153
248
|
export function toForwardSlash(p) {
|
|
154
|
-
return p
|
|
249
|
+
return BACKSLASH_IS_NATIVE_SEPARATOR ? toForwardSlashAnyPlatform(p) : p;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Convert every backslash to a forward slash, on every host.
|
|
253
|
+
*
|
|
254
|
+
* For AUTHOR-WRITTEN text that may carry Windows spellings regardless of where
|
|
255
|
+
* VAT runs — markdown hrefs, globs, config values, CLI arguments, zip entry
|
|
256
|
+
* names — and for containment guards that must refuse `..\x` everywhere.
|
|
257
|
+
* Never use it on a path read from the filesystem or git: on POSIX that
|
|
258
|
+
* backslash is part of a filename. Use {@link toForwardSlash} for those.
|
|
259
|
+
*
|
|
260
|
+
* @param text - Author-written path text
|
|
261
|
+
* @returns The text with every backslash replaced by `/`
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* toForwardSlashAnyPlatform('..\\evil') // '../evil' on every host
|
|
265
|
+
*/
|
|
266
|
+
export function toForwardSlashAnyPlatform(text) {
|
|
267
|
+
// eslint-disable-next-line local/no-manual-path-normalize -- this IS the converter the rule's autofix writes; it cannot call itself.
|
|
268
|
+
return text.replaceAll('\\', '/');
|
|
155
269
|
}
|
|
156
270
|
/**
|
|
157
271
|
* Normalize text to Unicode NFC — the form in which two *visually identical*
|
|
@@ -189,12 +303,14 @@ export function toNfc(value) {
|
|
|
189
303
|
* Cross-platform safe path operations.
|
|
190
304
|
*
|
|
191
305
|
* Wraps Node's `path.join()`, `path.resolve()`, and `path.relative()` to always
|
|
192
|
-
* return forward-slash paths
|
|
306
|
+
* return forward-slash paths (converted through {@link toForwardSlash}, so a
|
|
307
|
+
* backslash inside a POSIX filename survives). On Windows, the native `path.*` functions return
|
|
193
308
|
* backslashes, which causes bugs when paths are used as Map keys, compared as
|
|
194
309
|
* strings, or matched with glob patterns.
|
|
195
310
|
*
|
|
196
311
|
* **Use these instead of importing from `node:path` directly.**
|
|
197
|
-
* ESLint
|
|
312
|
+
* An ESLint rule enforces this — see `no-raw-node-path` (its `functions` option
|
|
313
|
+
* table maps each of `join`/`resolve`/`relative` to its `safePath.*` replacement).
|
|
198
314
|
*
|
|
199
315
|
* @example
|
|
200
316
|
* ```typescript
|
|
@@ -205,7 +321,7 @@ export function toNfc(value) {
|
|
|
205
321
|
* safePath.resolve('/project', './docs') // → '/project/docs'
|
|
206
322
|
* safePath.relative('/project/docs', '/project') // → '..'
|
|
207
323
|
* safePath.joinUnderRoot('/harness', 'skill-abc') // → '/harness/skill-abc'
|
|
208
|
-
* safePath.joinUnderRoot('/harness', '../escape') // throws
|
|
324
|
+
* safePath.joinUnderRoot('/harness', '../escape') // throws PathEscapesRootError
|
|
209
325
|
* ```
|
|
210
326
|
*/
|
|
211
327
|
export const safePath = {
|
|
@@ -239,7 +355,7 @@ export const safePath = {
|
|
|
239
355
|
* skill-test staging code was vulnerable to on Windows.
|
|
240
356
|
*
|
|
241
357
|
* @returns Forward-slash absolute path guaranteed to be inside `root`.
|
|
242
|
-
* @throws {
|
|
358
|
+
* @throws {PathEscapesRootError} If the resolved path would escape `root`.
|
|
243
359
|
*
|
|
244
360
|
* @example
|
|
245
361
|
* ```typescript
|
|
@@ -255,12 +371,12 @@ export const safePath = {
|
|
|
255
371
|
// BEFORE resolving, so the error message can name the offending segment.
|
|
256
372
|
for (const seg of segments) {
|
|
257
373
|
if (path.isAbsolute(seg)) {
|
|
258
|
-
throw new
|
|
374
|
+
throw new PathEscapesRootError(root, `segment "${seg}" is absolute and`);
|
|
259
375
|
}
|
|
260
376
|
// Windows drive-letter check for POSIX hosts (path.isAbsolute won't catch
|
|
261
377
|
// 'C:\...' on POSIX, but node's path.win32.isAbsolute does).
|
|
262
378
|
if (path.win32.isAbsolute(seg)) {
|
|
263
|
-
throw new
|
|
379
|
+
throw new PathEscapesRootError(root, `segment "${seg}" contains a Windows drive letter and`);
|
|
264
380
|
}
|
|
265
381
|
}
|
|
266
382
|
const resolvedRoot = path.resolve(root);
|
|
@@ -275,7 +391,7 @@ export const safePath = {
|
|
|
275
391
|
// which would match '/rootEvil' when root is '/root').
|
|
276
392
|
const rootPrefix = fwdRoot.endsWith('/') ? fwdRoot : `${fwdRoot}/`;
|
|
277
393
|
if (fwdResult !== fwdRoot && !fwdResult.startsWith(rootPrefix)) {
|
|
278
|
-
throw new
|
|
394
|
+
throw new PathEscapesRootError(fwdRoot, `result "${fwdResult}"`);
|
|
279
395
|
}
|
|
280
396
|
return fwdResult;
|
|
281
397
|
},
|
package/dist/path-core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-core.js","sourceRoot":"","sources":["../src/path-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAAC,CAAS;IACtC,OAAO,IAAI,CAAC,UAAU,CAAC,C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AAO,SAAS,CAAC;IACnB,CAAC;CACO,CAAC"}
|
package/dist/path-utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-utils.d.ts","sourceRoot":"","sources":["../src/path-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"path-utils.d.ts","sourceRoot":"","sources":["../src/path-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,SAAS,CAAC;AAQlD;;;;;;;;;;GAUG;AACH,cAAc,gBAAgB,CAAC;AAmC/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,aAAa,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAqBxD;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,GACxC,MAAM,CAIR;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAQ1F;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAGhF"}
|
package/dist/path-utils.js
CHANGED
|
@@ -2,6 +2,7 @@ import { mkdirSync, realpathSync } from 'node:fs';
|
|
|
2
2
|
import { tmpdir } from 'node:os';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
5
|
+
import { isPathAbsentError } from './errors/errno.js';
|
|
5
6
|
import { safePath } from './path-core.js';
|
|
6
7
|
/**
|
|
7
8
|
* Re-export every pure path helper so the package barrel keeps exposing the
|
|
@@ -15,6 +16,42 @@ import { safePath } from './path-core.js';
|
|
|
15
16
|
* `test/path-fs-subpaths.test.ts`).
|
|
16
17
|
*/
|
|
17
18
|
export * from './path-core.js';
|
|
19
|
+
/**
|
|
20
|
+
* `realpathSync.native(target)`, or `target` itself when there is nothing at
|
|
21
|
+
* that path to canonicalize.
|
|
22
|
+
*
|
|
23
|
+
* Absence is the ONLY failure answered with the lexical path: `normalizePath`
|
|
24
|
+
* is documented to accept a path that does not exist, and a path that does not
|
|
25
|
+
* exist has no realpath. Everything else — `EACCES` on an ancestor, `ELOOP` on
|
|
26
|
+
* a symlink cycle, `ENAMETOOLONG` — is the filesystem refusing a path that IS
|
|
27
|
+
* there. Those used to come back as the lexical spelling with nothing to say
|
|
28
|
+
* so, which put a lexical path where every caller compares canonical ones: a
|
|
29
|
+
* containment check judged such a path by the spelling the OS had just refused
|
|
30
|
+
* to resolve. They stay loud.
|
|
31
|
+
*
|
|
32
|
+
* The JS `realpathSync` is asked before absence is concluded, because the
|
|
33
|
+
* native call can fail where the JS walk succeeds — Node's docs note that on a
|
|
34
|
+
* musl libc without procfs the native `realpath(3)` cannot work at all, and it
|
|
35
|
+
* reports that as `ENOENT` for a path that exists. Only when both agree that
|
|
36
|
+
* nothing is there is the lexical path the answer.
|
|
37
|
+
*/
|
|
38
|
+
function realpathOrSelf(target) {
|
|
39
|
+
try {
|
|
40
|
+
return realpathSync.native(target);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
if (!isPathAbsentError(error))
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
return realpathSync(target);
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
if (isPathAbsentError(error))
|
|
51
|
+
return target;
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
18
55
|
/**
|
|
19
56
|
* Normalize any path (resolve short names on Windows)
|
|
20
57
|
*
|
|
@@ -65,21 +102,9 @@ export function normalizePath(...paths) {
|
|
|
65
102
|
else {
|
|
66
103
|
resolved = path.resolve(...paths);
|
|
67
104
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
catch {
|
|
73
|
-
// Fallback to regular realpathSync
|
|
74
|
-
try {
|
|
75
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- Safe: resolved is from path.resolve
|
|
76
|
-
return realpathSync(resolved);
|
|
77
|
-
}
|
|
78
|
-
catch {
|
|
79
|
-
// Last resort: return resolved path (better than original input)
|
|
80
|
-
return resolved;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
105
|
+
// Native OS realpath first (resolves Windows short names); a path that is not
|
|
106
|
+
// there is answered with `resolved` — better than the original input.
|
|
107
|
+
return realpathOrSelf(resolved);
|
|
83
108
|
}
|
|
84
109
|
/**
|
|
85
110
|
* Get normalized temp directory path
|
|
@@ -107,22 +132,7 @@ export function normalizePath(...paths) {
|
|
|
107
132
|
* ```
|
|
108
133
|
*/
|
|
109
134
|
export function normalizedTmpdir() {
|
|
110
|
-
|
|
111
|
-
try {
|
|
112
|
-
// Use native OS realpath for better Windows compatibility
|
|
113
|
-
return realpathSync.native(temp);
|
|
114
|
-
}
|
|
115
|
-
catch {
|
|
116
|
-
// Fallback to regular realpathSync
|
|
117
|
-
try {
|
|
118
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- Safe: temp is from tmpdir()
|
|
119
|
-
return realpathSync(temp);
|
|
120
|
-
}
|
|
121
|
-
catch {
|
|
122
|
-
// Last resort: return original
|
|
123
|
-
return temp;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
135
|
+
return realpathOrSelf(tmpdir());
|
|
126
136
|
}
|
|
127
137
|
/**
|
|
128
138
|
* Create directory and return normalized path
|
|
@@ -156,23 +166,8 @@ export function normalizedTmpdir() {
|
|
|
156
166
|
* ```
|
|
157
167
|
*/
|
|
158
168
|
export function mkdirSyncReal(dirPath, options) {
|
|
159
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- This IS the mkdirSyncReal() implementation
|
|
160
169
|
mkdirSync(dirPath, options);
|
|
161
|
-
|
|
162
|
-
// Use native OS realpath for better Windows compatibility
|
|
163
|
-
return realpathSync.native(dirPath);
|
|
164
|
-
}
|
|
165
|
-
catch {
|
|
166
|
-
// Fallback to regular realpathSync
|
|
167
|
-
try {
|
|
168
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- Safe: dirPath is function parameter
|
|
169
|
-
return realpathSync(dirPath);
|
|
170
|
-
}
|
|
171
|
-
catch {
|
|
172
|
-
// Last resort: return original
|
|
173
|
-
return dirPath;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
170
|
+
return realpathOrSelf(dirPath);
|
|
176
171
|
}
|
|
177
172
|
/**
|
|
178
173
|
* Resolve an OS-native absolute path from an ESM module's `import.meta.url` and
|
package/dist/path-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-utils.js","sourceRoot":"","sources":["../src/path-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAExD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,cAAc,gBAAgB,CAAC;AAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,aAAa,CAAC,GAAG,KAAe;IAC9C,4DAA4D;IAC5D,IAAI,KAAK,CAAC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EAAsE;IACtE,OAAO,cAAc,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAe,EACf,OAAyC;IAEzC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAE5B,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,qBAAqB,CAAC,aAAqB,EAAE,GAAG,QAAkB;IAChF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,gFAAgF;QAChF,OAAO,aAAa,CAAC,aAAa,CAAC,CAAC;IACtC,CAAC;IACD,iFAAiF;IACjF,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;IAC5C,OAAO,aAAa,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAc,OAAe;IAClE,MAAM,GAAG,GAAY,MAAM,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;IAC/D,OAAO,GAAQ,CAAC;AAClB,CAAC"}
|
package/dist/path.d.ts
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
* If you need `normalizedTmpdir`, `mkdirSyncReal`, or `normalizePath`, those
|
|
9
9
|
* touch the filesystem — import them from `@vibe-agent-toolkit/utils/fs`.
|
|
10
10
|
*/
|
|
11
|
-
export { safePath, toForwardSlash, toNfc, isAbsolutePath, isAbsoluteAnyPlatform, hasParentTraversalSegment, toAbsolutePath, getRelativePath, issueLocation, } from './path-core.js';
|
|
11
|
+
export { PathEscapesRootError, safePath, toForwardSlash, toForwardSlashAnyPlatform, toNfc, isAbsolutePath, isAbsoluteAnyPlatform, hasParentTraversalSegment, isSingleFsSegment, relativeEscapesRoot, toAbsolutePath, getRelativePath, issueLocation, } from './path-core.js';
|
|
12
12
|
//# sourceMappingURL=path.d.ts.map
|
package/dist/path.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,QAAQ,EACR,cAAc,EACd,KAAK,EACL,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,cAAc,EACd,eAAe,EACf,aAAa,GACd,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,oBAAoB,EACpB,QAAQ,EACR,cAAc,EACd,yBAAyB,EACzB,KAAK,EACL,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,GACd,MAAM,gBAAgB,CAAC"}
|
package/dist/path.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
* If you need `normalizedTmpdir`, `mkdirSyncReal`, or `normalizePath`, those
|
|
9
9
|
* touch the filesystem — import them from `@vibe-agent-toolkit/utils/fs`.
|
|
10
10
|
*/
|
|
11
|
-
export { safePath, toForwardSlash, toNfc, isAbsolutePath, isAbsoluteAnyPlatform, hasParentTraversalSegment, toAbsolutePath, getRelativePath, issueLocation, } from './path-core.js';
|
|
11
|
+
export { PathEscapesRootError, safePath, toForwardSlash, toForwardSlashAnyPlatform, toNfc, isAbsolutePath, isAbsoluteAnyPlatform, hasParentTraversalSegment, isSingleFsSegment, relativeEscapesRoot, toAbsolutePath, getRelativePath, issueLocation, } from './path-core.js';
|
|
12
12
|
//# sourceMappingURL=path.js.map
|
package/dist/path.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.js","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,QAAQ,EACR,cAAc,EACd,KAAK,EACL,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,cAAc,EACd,eAAe,EACf,aAAa,GACd,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,oBAAoB,EACpB,QAAQ,EACR,cAAc,EACd,yBAAyB,EACzB,KAAK,EACL,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,GACd,MAAM,gBAAgB,CAAC"}
|