@vibe-agent-toolkit/utils 0.2.0-rc.1 → 0.2.0-rc.11
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 +57 -0
- package/dist/env-flag.d.ts.map +1 -0
- package/dist/env-flag.js +68 -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 +6 -2
- package/dist/fs.d.ts.map +1 -1
- package/dist/fs.js +10 -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 +79 -0
- package/dist/path-containment.d.ts.map +1 -0
- package/dist/path-containment.js +128 -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 +226 -0
- package/dist/text-content.d.ts.map +1 -0
- package/dist/text-content.js +418 -0
- package/dist/text-content.js.map +1 -0
- package/dist/text-file.d.ts +84 -0
- package/dist/text-file.d.ts.map +1 -0
- package/dist/text-file.js +118 -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 +230 -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-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,MAA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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"}
|
package/dist/process.d.ts
CHANGED
|
@@ -10,5 +10,12 @@
|
|
|
10
10
|
export { type StdioBlockingResult, makeStdioBlocking, describeStdioBlocking, } from './stdio-blocking.js';
|
|
11
11
|
export { type SafeExecOptions, type SafeExecResult, CommandExecutionError, safeExecSync, safeExecResult, isToolAvailable, getToolVersion, hasShellSyntax, safeExecFromString, } from './safe-exec.js';
|
|
12
12
|
export { spawnHardened } from './spawn-hardened.js';
|
|
13
|
+
/**
|
|
14
|
+
* On `./process` because "is this process running me as its entry script?" is a
|
|
15
|
+
* question about the process, and because every package that has a bin or a
|
|
16
|
+
* build script needs it — including ones that must not depend on the private
|
|
17
|
+
* `dev-tools` package, which is where it used to live.
|
|
18
|
+
*/
|
|
19
|
+
export { isEntrypoint } from './entrypoint.js';
|
|
13
20
|
export { shouldUseShell, windowsShellQuote, buildWindowsShellLine, isPathLike, resolveShellCommandToken, } from './windows-shell.js';
|
|
14
21
|
//# sourceMappingURL=process.d.ts.map
|
package/dist/process.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../src/process.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,KAAK,mBAAmB,EACxB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,wBAAwB,GACzB,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../src/process.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,KAAK,mBAAmB,EACxB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,wBAAwB,GACzB,MAAM,oBAAoB,CAAC"}
|
package/dist/process.js
CHANGED
|
@@ -10,5 +10,12 @@
|
|
|
10
10
|
export { makeStdioBlocking, describeStdioBlocking, } from './stdio-blocking.js';
|
|
11
11
|
export { CommandExecutionError, safeExecSync, safeExecResult, isToolAvailable, getToolVersion, hasShellSyntax, safeExecFromString, } from './safe-exec.js';
|
|
12
12
|
export { spawnHardened } from './spawn-hardened.js';
|
|
13
|
+
/**
|
|
14
|
+
* On `./process` because "is this process running me as its entry script?" is a
|
|
15
|
+
* question about the process, and because every package that has a bin or a
|
|
16
|
+
* build script needs it — including ones that must not depend on the private
|
|
17
|
+
* `dev-tools` package, which is where it used to live.
|
|
18
|
+
*/
|
|
19
|
+
export { isEntrypoint } from './entrypoint.js';
|
|
13
20
|
export { shouldUseShell, windowsShellQuote, buildWindowsShellLine, isPathLike, resolveShellCommandToken, } from './windows-shell.js';
|
|
14
21
|
//# sourceMappingURL=process.js.map
|
package/dist/process.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.js","sourceRoot":"","sources":["../src/process.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAEL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAGL,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,wBAAwB,GACzB,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"process.js","sourceRoot":"","sources":["../src/process.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAEL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAGL,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,wBAAwB,GACzB,MAAM,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-utils.d.ts","sourceRoot":"","sources":["../src/project-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"project-utils.d.ts","sourceRoot":"","sources":["../src/project-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW9D;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyBrE;AAgBD;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAG7C;AAkED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK/D"}
|
package/dist/project-utils.js
CHANGED
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
* fallbacks — a caller with no root must decide one rather than silently
|
|
7
7
|
* falling back to an absolute path.
|
|
8
8
|
*/
|
|
9
|
-
import { existsSync
|
|
9
|
+
import { existsSync } from 'node:fs';
|
|
10
10
|
import { dirname, parse } from 'node:path';
|
|
11
|
+
import { isPathAbsentError } from './errors/errno.js';
|
|
11
12
|
import { resetGitRootCache } from './git-root-cache.js';
|
|
12
13
|
import { safePath } from './path-utils.js';
|
|
14
|
+
import { readTextContentSync } from './text-file.js';
|
|
13
15
|
const CONFIG_FILENAME = 'vibe-agent-toolkit.config.yaml';
|
|
14
16
|
const PACKAGE_JSON_FILENAME = 'package.json';
|
|
15
17
|
/**
|
|
@@ -26,7 +28,6 @@ export function findConfigFile(startDir) {
|
|
|
26
28
|
const root = parse(current).root;
|
|
27
29
|
while (true) {
|
|
28
30
|
const candidate = safePath.join(current, CONFIG_FILENAME);
|
|
29
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- walk-up is intentional
|
|
30
31
|
if (existsSync(candidate))
|
|
31
32
|
return candidate;
|
|
32
33
|
if (current === root)
|
|
@@ -51,17 +52,24 @@ export function findNodeWorkspaceRoot(startDir) {
|
|
|
51
52
|
let current = safePath.resolve(startDir);
|
|
52
53
|
while (current !== dirname(current)) {
|
|
53
54
|
const pkgPath = safePath.join(current, PACKAGE_JSON_FILENAME);
|
|
54
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- walk-up is intentional
|
|
55
55
|
if (existsSync(pkgPath)) {
|
|
56
56
|
try {
|
|
57
|
-
//
|
|
58
|
-
|
|
57
|
+
// Through the decoding seam: this is the ADOPTER's manifest, not ours,
|
|
58
|
+
// and a UTF-8 BOM in front of `{` makes `JSON.parse` throw — which the
|
|
59
|
+
// `catch` below would silently report as "not the workspace root".
|
|
60
|
+
const parsed = JSON.parse(readTextContentSync(pkgPath).text);
|
|
59
61
|
if (typeof parsed === 'object' && parsed !== null && 'workspaces' in parsed) {
|
|
60
62
|
return current;
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
|
-
catch {
|
|
64
|
-
//
|
|
65
|
+
catch (error) {
|
|
66
|
+
// Not JSON: not a manifest this walk can read, so skip it and keep
|
|
67
|
+
// walking up. Gone between `existsSync` and the read counts the same. A
|
|
68
|
+
// manifest the OS refused (`EACCES`), or a directory named
|
|
69
|
+
// `package.json` (`EISDIR`), is neither — reading past it would make
|
|
70
|
+
// the walk settle on the WRONG root, silently.
|
|
71
|
+
if (!(error instanceof SyntaxError) && !isPathAbsentError(error))
|
|
72
|
+
throw error;
|
|
65
73
|
}
|
|
66
74
|
}
|
|
67
75
|
current = dirname(current);
|
|
@@ -123,7 +131,6 @@ function configWalkPhase(startDir, visited) {
|
|
|
123
131
|
return { kind: 'found', configRoot: cached.configRoot };
|
|
124
132
|
}
|
|
125
133
|
visited.push(current);
|
|
126
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- walk-up is intentional
|
|
127
134
|
if (existsSync(safePath.join(current, CONFIG_FILENAME))) {
|
|
128
135
|
const entry = { configRoot: current };
|
|
129
136
|
propagateCache(visited, entry);
|
|
@@ -143,7 +150,6 @@ function configWalkPhase(startDir, visited) {
|
|
|
143
150
|
function gitWalkPhase(startDir, visited) {
|
|
144
151
|
let current = safePath.resolve(startDir);
|
|
145
152
|
while (true) {
|
|
146
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- walk-up is intentional
|
|
147
153
|
if (existsSync(safePath.join(current, '.git'))) {
|
|
148
154
|
const entry = { configRoot: current };
|
|
149
155
|
propagateCache(visited, entry);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-utils.js","sourceRoot":"","sources":["../src/project-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"project-utils.js","sourceRoot":"","sources":["../src/project-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;A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cAAc,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;YAC9C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,GAAG,MAAM,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,WAAW,GAAG,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACvD,IAAI,WAAW,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,WAAW,CAAC,UAAU,CAAC;IAChE,OAAO,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC"}
|
package/dist/project.d.ts
CHANGED
|
@@ -14,11 +14,13 @@
|
|
|
14
14
|
* they largely are not, for the reasons documented on the guard test in
|
|
15
15
|
* `test/package-exports.test.ts`. But the question that decides whether an entry
|
|
16
16
|
* should exist is "how heavy is the only remaining door?" With `./project` gone,
|
|
17
|
-
* the sole route to these functions was the `.` barrel, which
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* the sole route to these functions was the `.` barrel, which at the time reached
|
|
18
|
+
* five third-party packages. A consumer that avoids the barrel on graph-weight
|
|
19
|
+
* grounds — which is the entire premise of this package's subpath layout — could
|
|
20
|
+
* no longer reach a capability whose own code imports nothing but `node:fs` and
|
|
21
|
+
* `node:path`. The barrel is dependency-free today, which generalizes the
|
|
22
|
+
* argument rather than retiring it: every domain that carries weight is its own
|
|
23
|
+
* entry, and reaching a pure one must not cost a neighbour's graph.
|
|
22
24
|
*
|
|
23
25
|
* The functions remain VAT-shaped and are documented as such in README.md: they
|
|
24
26
|
* look for `vibe-agent-toolkit.config.yaml`, then `.git/`. If your notion of a
|
package/dist/project.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,sBAAsB,GACvB,MAAM,oBAAoB,CAAC"}
|
package/dist/project.js
CHANGED
|
@@ -14,11 +14,13 @@
|
|
|
14
14
|
* they largely are not, for the reasons documented on the guard test in
|
|
15
15
|
* `test/package-exports.test.ts`. But the question that decides whether an entry
|
|
16
16
|
* should exist is "how heavy is the only remaining door?" With `./project` gone,
|
|
17
|
-
* the sole route to these functions was the `.` barrel, which
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* the sole route to these functions was the `.` barrel, which at the time reached
|
|
18
|
+
* five third-party packages. A consumer that avoids the barrel on graph-weight
|
|
19
|
+
* grounds — which is the entire premise of this package's subpath layout — could
|
|
20
|
+
* no longer reach a capability whose own code imports nothing but `node:fs` and
|
|
21
|
+
* `node:path`. The barrel is dependency-free today, which generalizes the
|
|
22
|
+
* argument rather than retiring it: every domain that carries weight is its own
|
|
23
|
+
* entry, and reaching a pure one must not cost a neighbour's graph.
|
|
22
24
|
*
|
|
23
25
|
* The functions remain VAT-shaped and are documented as such in README.md: they
|
|
24
26
|
* look for `vibe-agent-toolkit.config.yaml`, then `.git/`. If your notion of a
|
package/dist/project.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,sBAAsB,GACvB,MAAM,oBAAoB,CAAC"}
|
package/dist/safe-exec.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VatError } from './errors/vat-error.js';
|
|
1
2
|
/**
|
|
2
3
|
* Options for safe command execution
|
|
3
4
|
*/
|
|
@@ -6,7 +7,12 @@ export interface SafeExecOptions {
|
|
|
6
7
|
encoding?: BufferEncoding;
|
|
7
8
|
/** Standard I/O configuration */
|
|
8
9
|
stdio?: 'pipe' | 'ignore' | 'inherit' | Array<'pipe' | 'ignore' | 'inherit'>;
|
|
9
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* The child's complete environment. It **replaces** `process.env` rather than
|
|
12
|
+
* merging with it, so a partial object is a partial environment — build one
|
|
13
|
+
* by spreading (`{ ...process.env, ... }`). A `git` child cannot get here at
|
|
14
|
+
* all — `runGit()` owns that, and this function refuses it.
|
|
15
|
+
*/
|
|
10
16
|
env?: NodeJS.ProcessEnv;
|
|
11
17
|
/** Working directory */
|
|
12
18
|
cwd?: string;
|
|
@@ -14,6 +20,24 @@ export interface SafeExecOptions {
|
|
|
14
20
|
maxBuffer?: number;
|
|
15
21
|
/** Timeout in milliseconds */
|
|
16
22
|
timeout?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Run `git` here instead of refusing it — for an argv the **operator supplied**
|
|
25
|
+
* rather than one VAT composed.
|
|
26
|
+
*
|
|
27
|
+
* {@link refuseGit} exists because only the caller knows whether a git command
|
|
28
|
+
* means the path it was handed or the repository it stands in, and VAT's own
|
|
29
|
+
* call sites must say. That reasoning does not reach a command a user
|
|
30
|
+
* configured: VAT neither composed it nor knows what it means, and refusing it
|
|
31
|
+
* blocks a legitimate configuration rather than preventing a mistake.
|
|
32
|
+
*
|
|
33
|
+
* ⚠️ Setting this makes the git environment **your** problem. The one caller
|
|
34
|
+
* that does — `link-auth`'s `defaultRunCommand` — strips every `GIT_*` key
|
|
35
|
+
* case-insensitively before spawning, which is stricter than {@link runGit}'s
|
|
36
|
+
* targeted scrub, not looser. Do not set it to silence the error.
|
|
37
|
+
*
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
allowGit?: boolean;
|
|
17
41
|
}
|
|
18
42
|
/**
|
|
19
43
|
* Result of a safe command execution
|
|
@@ -33,7 +57,7 @@ export interface SafeExecResult {
|
|
|
33
57
|
/**
|
|
34
58
|
* Error thrown when command execution fails
|
|
35
59
|
*/
|
|
36
|
-
export declare class CommandExecutionError extends
|
|
60
|
+
export declare class CommandExecutionError extends VatError {
|
|
37
61
|
readonly status: number;
|
|
38
62
|
readonly stdout: Buffer | string;
|
|
39
63
|
readonly stderr: Buffer | string;
|
|
@@ -46,7 +70,11 @@ export declare class CommandExecutionError extends Error {
|
|
|
46
70
|
* - Resolves PATH once using pure Node.js (which package)
|
|
47
71
|
* - Executes with absolute path and shell: false
|
|
48
72
|
* - No shell interpreter = no command injection risk
|
|
49
|
-
* - Supports custom env vars
|
|
73
|
+
* - Supports custom env vars
|
|
74
|
+
*
|
|
75
|
+
* ⛔ **Not for `git`** — it throws. "Safe" here means shell-injection-safe and
|
|
76
|
+
* says nothing about `GIT_DIR`/`GIT_INDEX_FILE`, which silently decide which
|
|
77
|
+
* repository a git command answers about. Use `runGit()`.
|
|
50
78
|
*
|
|
51
79
|
* @param command - Command name (e.g., 'git', 'gitleaks', 'node')
|
|
52
80
|
* @param args - Array of arguments
|
|
@@ -59,14 +87,11 @@ export declare class CommandExecutionError extends Error {
|
|
|
59
87
|
* safeExecSync('gitleaks', ['--version'], { stdio: 'ignore' });
|
|
60
88
|
*
|
|
61
89
|
* @example
|
|
62
|
-
* // Git with custom env
|
|
63
|
-
* safeExecSync('git', ['add', '--all'], {
|
|
64
|
-
* env: { ...process.env, GIT_INDEX_FILE: tempFile }
|
|
65
|
-
* });
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
90
|
* // Get output as string
|
|
69
91
|
* const version = safeExecSync('node', ['--version'], { encoding: 'utf8' });
|
|
92
|
+
*
|
|
93
|
+
* @throws {Error} When `command` is git — use `runGit()` instead, which owns the
|
|
94
|
+
* inherited-environment problem this helper cannot see
|
|
70
95
|
*/
|
|
71
96
|
export declare function safeExecSync(command: string, args?: string[], options?: SafeExecOptions): Buffer | string;
|
|
72
97
|
/**
|
|
@@ -81,12 +106,14 @@ export declare function safeExecSync(command: string, args?: string[], options?:
|
|
|
81
106
|
* @returns Detailed execution result
|
|
82
107
|
*
|
|
83
108
|
* @example
|
|
84
|
-
* const result = safeExecResult('
|
|
109
|
+
* const result = safeExecResult('gh', ['pr', 'list']);
|
|
85
110
|
* if (result.success) {
|
|
86
111
|
* console.log(result.stdout.toString());
|
|
87
112
|
* } else {
|
|
88
113
|
* console.error(`Failed: ${result.stderr.toString()}`);
|
|
89
114
|
* }
|
|
115
|
+
*
|
|
116
|
+
* @throws {Error} When `command` is git — use `runGit()` instead
|
|
90
117
|
*/
|
|
91
118
|
export declare function safeExecResult(command: string, args?: string[], options?: SafeExecOptions): SafeExecResult;
|
|
92
119
|
/**
|
|
@@ -183,9 +210,11 @@ export declare function hasShellSyntax(commandString: string): {
|
|
|
183
210
|
* @example
|
|
184
211
|
* ```typescript
|
|
185
212
|
* // ✅ Simple commands (these work)
|
|
186
|
-
* safeExecFromString('git status');
|
|
187
213
|
* safeExecFromString('pnpm test --watch');
|
|
188
214
|
* safeExecFromString('gh pr view 123');
|
|
215
|
+
*
|
|
216
|
+
* // ❌ git is refused here too — the string form is not a back door around
|
|
217
|
+
* // the chokepoint. Use runGit(['status'], { cwd }).
|
|
189
218
|
* ```
|
|
190
219
|
*
|
|
191
220
|
* @example
|
package/dist/safe-exec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-exec.d.ts","sourceRoot":"","sources":["../src/safe-exec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"safe-exec.d.ts","sourceRoot":"","sources":["../src/safe-exec.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE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