@vibe-agent-toolkit/utils 0.1.42 → 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 +81 -19
- 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 +214 -24
- 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 +628 -38
- package/dist/fs-utils.d.ts.map +1 -1
- package/dist/fs-utils.js +770 -71
- package/dist/fs-utils.js.map +1 -1
- package/dist/fs.d.ts +5 -1
- package/dist/fs.d.ts.map +1 -1
- package/dist/fs.js +9 -1
- package/dist/fs.js.map +1 -1
- package/dist/git-root-cache.d.ts +44 -0
- package/dist/git-root-cache.d.ts.map +1 -0
- package/dist/git-root-cache.js +68 -0
- package/dist/git-root-cache.js.map +1 -0
- 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 +95 -1
- package/dist/git-utils.d.ts.map +1 -1
- package/dist/git-utils.js +227 -81
- 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 +33 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +113 -33
- 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/numeric-args.d.ts +24 -0
- package/dist/numeric-args.d.ts.map +1 -0
- package/dist/numeric-args.js +37 -0
- package/dist/numeric-args.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 +143 -18
- package/dist/path-core.d.ts.map +1 -1
- package/dist/path-core.js +171 -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 +7 -1
- package/dist/project-utils.d.ts.map +1 -1
- package/dist/project-utils.js +24 -10
- 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 +130 -79
- package/dist/test-helpers.d.ts.map +1 -1
- package/dist/test-helpers.js +229 -124
- 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 +224 -50
- 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 +62 -12
- package/eslint/rules/dirent-type-needs-symlink-check.cjs +282 -0
- package/eslint/rules/eslint-rule-factory.cjs +21 -3
- 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 +146 -96
- 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 +33 -1
- 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 -417
|
@@ -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;AACrC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,eAAe,GAAG,gCAAgC,CAAC;AACzD,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAE7C;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,IAAI,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzC,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAA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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,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAQjD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,kEAAkE;IAClE,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,KAAK,CAAC,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC,CAAC;IAC7E;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,wBAAwB;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,EAAE,OAAO,CAA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CAAC,aAAa,EAAE,MAAM,GAAG;IACrD,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CA0CA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,eAAoB,GAC5B,MAAM,GAAG,MAAM,CAyBjB"}
|
package/dist/safe-exec.js
CHANGED
|
@@ -1,21 +1,55 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process';
|
|
2
2
|
import which from 'which';
|
|
3
|
+
import { isPathAbsentError } from './errors/errno.js';
|
|
4
|
+
import { VatError } from './errors/vat-error.js';
|
|
5
|
+
import { runGit } from './git-run.js';
|
|
3
6
|
import { buildWindowsShellLine, resolveShellCommandToken, shouldUseShell, } from './windows-shell.js';
|
|
4
7
|
/**
|
|
5
8
|
* Error thrown when command execution fails
|
|
6
9
|
*/
|
|
7
|
-
export class CommandExecutionError extends
|
|
10
|
+
export class CommandExecutionError extends VatError {
|
|
8
11
|
status;
|
|
9
12
|
stdout;
|
|
10
13
|
stderr;
|
|
11
14
|
constructor(message, status, stdout, stderr) {
|
|
12
|
-
super(message);
|
|
13
|
-
this.name = 'CommandExecutionError';
|
|
15
|
+
super('COMMAND_EXECUTION', message);
|
|
14
16
|
this.status = status;
|
|
15
17
|
this.stdout = stdout;
|
|
16
18
|
this.stderr = stderr;
|
|
17
19
|
}
|
|
18
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Refuse `git` here, and say where it belongs.
|
|
23
|
+
*
|
|
24
|
+
* "Safe" in this module's name has always meant *shell-injection*-safe: PATH
|
|
25
|
+
* resolved once, no shell interpreter. It says nothing about the environment,
|
|
26
|
+
* and `git` is the one command for which the environment silently decides which
|
|
27
|
+
* repository the answer describes — `GIT_DIR` and `GIT_INDEX_FILE`, exported
|
|
28
|
+
* into every child of a `git` hook, override the `cwd` passed here. The failure
|
|
29
|
+
* is a well-formed answer about the wrong repository at exit 0, so no caller
|
|
30
|
+
* discovers it by testing.
|
|
31
|
+
*
|
|
32
|
+
* A refusal rather than a silent scrub, because the two meanings are not
|
|
33
|
+
* interchangeable: only the caller knows whether it means the path it passed or
|
|
34
|
+
* the repository it stands in, and guessing on their behalf would be wrong half
|
|
35
|
+
* the time in a way nothing reports. {@link runGit} makes them say.
|
|
36
|
+
*
|
|
37
|
+
* @param command - The command about to be spawned
|
|
38
|
+
* @throws {Error} When the command is git
|
|
39
|
+
*/
|
|
40
|
+
function isGitCommand(command) {
|
|
41
|
+
const name = command.toLowerCase().replace(/\.(exe|cmd)$/, '');
|
|
42
|
+
return name === 'git' || name.endsWith('/git') || name.endsWith(String.raw `\git`);
|
|
43
|
+
}
|
|
44
|
+
function refuseGit(command) {
|
|
45
|
+
if (!isGitCommand(command))
|
|
46
|
+
return;
|
|
47
|
+
throw new Error('Use runGit() from @vibe-agent-toolkit/utils/git to run git, not safeExecSync/safeExecResult.\n' +
|
|
48
|
+
" runGit(args, { cwd }) — about a path you were handed (scrubs the inherited\n" +
|
|
49
|
+
' GIT_DIR/GIT_INDEX_FILE that would override cwd)\n' +
|
|
50
|
+
' runGit(args, { ambient: true }) — about the repository this process stands in\n' +
|
|
51
|
+
'Inside a git hook the difference decides which repository you read — or write.');
|
|
52
|
+
}
|
|
19
53
|
/**
|
|
20
54
|
* Resolve command, build spawn options, and execute via spawnSync.
|
|
21
55
|
*
|
|
@@ -31,6 +65,8 @@ export class CommandExecutionError extends Error {
|
|
|
31
65
|
* value. Passing the raw command here used to break silently on `C:\Program Files\…`.
|
|
32
66
|
*/
|
|
33
67
|
function resolveAndSpawn(command, args, options) {
|
|
68
|
+
if (options.allowGit !== true)
|
|
69
|
+
refuseGit(command);
|
|
34
70
|
const commandPath = which.sync(command);
|
|
35
71
|
const useShell = shouldUseShell(commandPath);
|
|
36
72
|
const spawnOptions = {
|
|
@@ -46,7 +82,6 @@ function resolveAndSpawn(command, args, options) {
|
|
|
46
82
|
return spawnSync(commandPath, args, spawnOptions);
|
|
47
83
|
}
|
|
48
84
|
const shellLine = buildWindowsShellLine(resolveShellCommandToken(command, commandPath), args);
|
|
49
|
-
// eslint-disable-next-line sonarjs/os-command -- Windows DEP0190 workaround: command resolved via which.sync(); args are per-arg shell-quoted via windowsShellQuote()
|
|
50
85
|
return spawnSync(shellLine, { ...spawnOptions, shell: true });
|
|
51
86
|
}
|
|
52
87
|
/**
|
|
@@ -56,7 +91,11 @@ function resolveAndSpawn(command, args, options) {
|
|
|
56
91
|
* - Resolves PATH once using pure Node.js (which package)
|
|
57
92
|
* - Executes with absolute path and shell: false
|
|
58
93
|
* - No shell interpreter = no command injection risk
|
|
59
|
-
* - Supports custom env vars
|
|
94
|
+
* - Supports custom env vars
|
|
95
|
+
*
|
|
96
|
+
* ⛔ **Not for `git`** — it throws. "Safe" here means shell-injection-safe and
|
|
97
|
+
* says nothing about `GIT_DIR`/`GIT_INDEX_FILE`, which silently decide which
|
|
98
|
+
* repository a git command answers about. Use `runGit()`.
|
|
60
99
|
*
|
|
61
100
|
* @param command - Command name (e.g., 'git', 'gitleaks', 'node')
|
|
62
101
|
* @param args - Array of arguments
|
|
@@ -69,14 +108,11 @@ function resolveAndSpawn(command, args, options) {
|
|
|
69
108
|
* safeExecSync('gitleaks', ['--version'], { stdio: 'ignore' });
|
|
70
109
|
*
|
|
71
110
|
* @example
|
|
72
|
-
* // Git with custom env
|
|
73
|
-
* safeExecSync('git', ['add', '--all'], {
|
|
74
|
-
* env: { ...process.env, GIT_INDEX_FILE: tempFile }
|
|
75
|
-
* });
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
111
|
* // Get output as string
|
|
79
112
|
* const version = safeExecSync('node', ['--version'], { encoding: 'utf8' });
|
|
113
|
+
*
|
|
114
|
+
* @throws {Error} When `command` is git — use `runGit()` instead, which owns the
|
|
115
|
+
* inherited-environment problem this helper cannot see
|
|
80
116
|
*/
|
|
81
117
|
export function safeExecSync(command, args = [], options = {}) {
|
|
82
118
|
const result = resolveAndSpawn(command, args, options);
|
|
@@ -102,14 +138,22 @@ export function safeExecSync(command, args = [], options = {}) {
|
|
|
102
138
|
* @returns Detailed execution result
|
|
103
139
|
*
|
|
104
140
|
* @example
|
|
105
|
-
* const result = safeExecResult('
|
|
141
|
+
* const result = safeExecResult('gh', ['pr', 'list']);
|
|
106
142
|
* if (result.success) {
|
|
107
143
|
* console.log(result.stdout.toString());
|
|
108
144
|
* } else {
|
|
109
145
|
* console.error(`Failed: ${result.stderr.toString()}`);
|
|
110
146
|
* }
|
|
147
|
+
*
|
|
148
|
+
* @throws {Error} When `command` is git — use `runGit()` instead
|
|
111
149
|
*/
|
|
112
150
|
export function safeExecResult(command, args = [], options = {}) {
|
|
151
|
+
// Deliberately OUTSIDE the try: this is a programming error to fix at the call
|
|
152
|
+
// site, not a command that failed. Folded into the result it would read as
|
|
153
|
+
// "git is unavailable" and callers that treat a failure as information — most
|
|
154
|
+
// of them — would carry on silently.
|
|
155
|
+
if (options.allowGit !== true)
|
|
156
|
+
refuseGit(command);
|
|
113
157
|
try {
|
|
114
158
|
const result = resolveAndSpawn(command, args, options);
|
|
115
159
|
const status = result.status ?? -1;
|
|
@@ -148,12 +192,61 @@ export function safeExecResult(command, args = [], options = {}) {
|
|
|
148
192
|
* }
|
|
149
193
|
*/
|
|
150
194
|
export function isToolAvailable(toolName) {
|
|
195
|
+
if (isGitCommand(toolName))
|
|
196
|
+
return probeVersion(toolName, '--version') !== null;
|
|
151
197
|
try {
|
|
152
198
|
safeExecSync(toolName, ['--version'], { stdio: 'ignore' });
|
|
153
199
|
return true;
|
|
154
200
|
}
|
|
155
|
-
catch {
|
|
156
|
-
|
|
201
|
+
catch (error) {
|
|
202
|
+
if (isToolUnusable(error))
|
|
203
|
+
return false;
|
|
204
|
+
throw error;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Whether a failed version probe means the tool is not usable — the two
|
|
209
|
+
* failures every caller reads as "not installed": the binary is not on PATH
|
|
210
|
+
* (`which` and `spawn` both say `ENOENT`), or it ran and exited non-zero (a
|
|
211
|
+
* binary that does not answer `--version`). The OS refusing to execute a file
|
|
212
|
+
* `which` had just found (`EACCES`), a spawn that could not start for any other
|
|
213
|
+
* reason, or a bug in this module are none of those; `vat doctor` reporting
|
|
214
|
+
* "not installed" for an `EACCES` sends the adopter to reinstall a tool that is
|
|
215
|
+
* there, so those stay loud.
|
|
216
|
+
*/
|
|
217
|
+
function isToolUnusable(error) {
|
|
218
|
+
return isPathAbsentError(error) || error instanceof CommandExecutionError;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Ask a binary its version, routing `git` around {@link refuseGit}.
|
|
222
|
+
*
|
|
223
|
+
* A version probe names the *executable*, never a repository, so the refusal
|
|
224
|
+
* would be a false negative here — and a silent one, because both callers below
|
|
225
|
+
* report "not installed" for a null. `vat doctor` did exactly that: correct
|
|
226
|
+
* `git`, reported missing. {@link runGit} is the sanctioned path regardless.
|
|
227
|
+
*
|
|
228
|
+
* @param toolName - Binary to ask
|
|
229
|
+
* @param versionArg - Argument that makes it print its version
|
|
230
|
+
* @returns Trimmed version string, or null when the tool is genuinely absent
|
|
231
|
+
*/
|
|
232
|
+
function probeVersion(toolName, versionArg) {
|
|
233
|
+
if (isGitCommand(toolName)) {
|
|
234
|
+
// The scrub is a no-op for a command that reads nothing; keeping the safe
|
|
235
|
+
// default means no call site here has to reason about it.
|
|
236
|
+
const result = runGit([versionArg]);
|
|
237
|
+
return result.ok ? result.stdout : null;
|
|
238
|
+
}
|
|
239
|
+
try {
|
|
240
|
+
const version = safeExecSync(toolName, [versionArg], {
|
|
241
|
+
encoding: 'utf8',
|
|
242
|
+
stdio: 'pipe',
|
|
243
|
+
});
|
|
244
|
+
return version.trim();
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
if (isToolUnusable(error))
|
|
248
|
+
return null;
|
|
249
|
+
throw error;
|
|
157
250
|
}
|
|
158
251
|
}
|
|
159
252
|
/**
|
|
@@ -172,16 +265,7 @@ export function isToolAvailable(toolName) {
|
|
|
172
265
|
* console.log(gitVersion); // "git version 2.39.2"
|
|
173
266
|
*/
|
|
174
267
|
export function getToolVersion(toolName, versionArg = '--version') {
|
|
175
|
-
|
|
176
|
-
const version = safeExecSync(toolName, [versionArg], {
|
|
177
|
-
encoding: 'utf8',
|
|
178
|
-
stdio: 'pipe',
|
|
179
|
-
});
|
|
180
|
-
return version.trim();
|
|
181
|
-
}
|
|
182
|
-
catch {
|
|
183
|
-
return null;
|
|
184
|
-
}
|
|
268
|
+
return probeVersion(toolName, versionArg);
|
|
185
269
|
}
|
|
186
270
|
/**
|
|
187
271
|
* Shell syntax character sets for hyper-efficient single-pass detection
|
|
@@ -301,9 +385,11 @@ export function hasShellSyntax(commandString) {
|
|
|
301
385
|
* @example
|
|
302
386
|
* ```typescript
|
|
303
387
|
* // ✅ Simple commands (these work)
|
|
304
|
-
* safeExecFromString('git status');
|
|
305
388
|
* safeExecFromString('pnpm test --watch');
|
|
306
389
|
* safeExecFromString('gh pr view 123');
|
|
390
|
+
*
|
|
391
|
+
* // ❌ git is refused here too — the string form is not a back door around
|
|
392
|
+
* // the chokepoint. Use runGit(['status'], { cwd }).
|
|
307
393
|
* ```
|
|
308
394
|
*
|
|
309
395
|
* @example
|
package/dist/safe-exec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-exec.js","sourceRoot":"","sources":["../src/safe-exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAyB,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,cAAc,GACf,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"safe-exec.js","sourceRoot":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IACvD,+EAA+E;IAC/E,MAAM,KAAK,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;IAC5C,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,uCAAuC,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,iBAAiB,CAAC,KAAK;YACpF,aAAa,aAAa,MAAM;YAChC,4DAA4D;YAC5D,iCAAiC,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,SAAS,CAAC,MAAM;YACzE,mEAAmE;YACnE,uEAAuE,CAC1E,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAEzB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE5B,OAAO,YAAY,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC"}
|
package/dist/skill-targets.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ interface SkillTargetPaths {
|
|
|
21
21
|
*
|
|
22
22
|
* @vendor-claim reviewed=2026-07-30 verify=Each of the seven platforms' own published docs for where it reads skills from (claude, codex, copilot, gemini, cursor, windsurf, agents)
|
|
23
23
|
*
|
|
24
|
-
*
|
|
24
|
+
* At the last review (the `reviewed=` date above): all fourteen paths
|
|
25
25
|
* re-read from the first-party sources listed below, all fourteen unchanged.
|
|
26
26
|
* Update this table when platforms change theirs — and re-read those sources when
|
|
27
27
|
* you do, because nothing here is verified at build or test time. A stale entry
|
|
@@ -40,7 +40,7 @@ interface SkillTargetPaths {
|
|
|
40
40
|
* a change-detector masquerading as verification, and friction against exactly the
|
|
41
41
|
* correction the clock above exists to produce.)
|
|
42
42
|
*
|
|
43
|
-
* Sources, one per target, re-read
|
|
43
|
+
* Sources, one per target, re-read at that review:
|
|
44
44
|
* - claude https://code.claude.com/docs/en/skills
|
|
45
45
|
* (docs.claude.com/en/docs/claude-code/skills now 301s here)
|
|
46
46
|
* - codex https://developers.openai.com/codex/skills/
|
package/dist/skill-targets.js
CHANGED
|
@@ -40,7 +40,7 @@ const AGENTS_SKILLS_PATH = '.agents/skills';
|
|
|
40
40
|
*
|
|
41
41
|
* @vendor-claim reviewed=2026-07-30 verify=Each of the seven platforms' own published docs for where it reads skills from (claude, codex, copilot, gemini, cursor, windsurf, agents)
|
|
42
42
|
*
|
|
43
|
-
*
|
|
43
|
+
* At the last review (the `reviewed=` date above): all fourteen paths
|
|
44
44
|
* re-read from the first-party sources listed below, all fourteen unchanged.
|
|
45
45
|
* Update this table when platforms change theirs — and re-read those sources when
|
|
46
46
|
* you do, because nothing here is verified at build or test time. A stale entry
|
|
@@ -59,7 +59,7 @@ const AGENTS_SKILLS_PATH = '.agents/skills';
|
|
|
59
59
|
* a change-detector masquerading as verification, and friction against exactly the
|
|
60
60
|
* correction the clock above exists to produce.)
|
|
61
61
|
*
|
|
62
|
-
* Sources, one per target, re-read
|
|
62
|
+
* Sources, one per target, re-read at that review:
|
|
63
63
|
* - claude https://code.claude.com/docs/en/skills
|
|
64
64
|
* (docs.claude.com/en/docs/claude-code/skills now 301s here)
|
|
65
65
|
* - codex https://developers.openai.com/codex/skills/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VatError } from '../errors/vat-error.js';
|
|
1
2
|
export type AuthMode = 'inherit' | 'subscription' | 'api-key' | 'auto';
|
|
2
3
|
export type AuthMechanism = 'subscription' | 'api-key';
|
|
3
4
|
export interface AuthStatusResult {
|
|
@@ -21,8 +22,8 @@ export interface ResolvedAuth {
|
|
|
21
22
|
apiKeySource?: string;
|
|
22
23
|
}
|
|
23
24
|
/** A preflight auth failure — maps to exit code 2. */
|
|
24
|
-
export declare class AuthPreflightError extends
|
|
25
|
-
readonly
|
|
25
|
+
export declare class AuthPreflightError extends VatError {
|
|
26
|
+
readonly reason: "preflight";
|
|
26
27
|
constructor(message: string);
|
|
27
28
|
}
|
|
28
29
|
/**
|
|
@@ -30,5 +31,12 @@ export declare class AuthPreflightError extends Error {
|
|
|
30
31
|
* given env: returns in ~150ms, exit 0, spends NO tokens. NOT a `-p` call.
|
|
31
32
|
*/
|
|
32
33
|
export declare function probeAuthStatus(env: NodeJS.ProcessEnv): AuthStatusResult | null;
|
|
34
|
+
/**
|
|
35
|
+
* Read what `claude auth status --json` printed. `null` means "not the JSON
|
|
36
|
+
* object the flag promises" — an older CLI answering in prose, or a bare
|
|
37
|
+
* literal — and only that: a failure inside this reader is a bug, not "not
|
|
38
|
+
* logged in", and `resolveAuth` would otherwise turn it into a preflight exit.
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseAuthStatus(stdout: string): AuthStatusResult | null;
|
|
33
41
|
export declare function resolveAuth(opts: ResolveAuthOptions): ResolvedAuth;
|
|
34
42
|
//# sourceMappingURL=auth-resolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-resolver.d.ts","sourceRoot":"","sources":["../../src/skill-test/auth-resolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth-resolver.d.ts","sourceRoot":"","sources":["../../src/skill-test/auth-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAKlD,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,CAAC;AACvE,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,SAAS,CAAC;AAEvD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,KAAK,gBAAgB,GAAG,IAAI,CAAC;AAElF,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC,UAAU,CAAC;IAC7B,uEAAuE;IACvE,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,MAAM,CAAC,UAAU,CAAC;IAChC,kBAAkB,EAAE,aAAa,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,sDAAsD;AACtD,qBAAa,kBAAmB,SAAQ,QAAQ;IAC9C,QAAQ,CAAC,MAAM,EAAG,WAAW,CAAU;gBAC3B,OAAO,EAAE,MAAM;CAG5B;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,gBAAgB,GAAG,IAAI,CAI/E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAevE;AAgBD,wBAAgB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,YAAY,CA+BlE"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { VatError } from '../errors/vat-error.js';
|
|
1
2
|
import { safeExecResult } from '../safe-exec.js';
|
|
2
3
|
import { buildForwardedEnv } from './env-scrub.js';
|
|
3
4
|
/** A preflight auth failure — maps to exit code 2. */
|
|
4
|
-
export class AuthPreflightError extends
|
|
5
|
-
|
|
5
|
+
export class AuthPreflightError extends VatError {
|
|
6
|
+
reason = 'preflight';
|
|
6
7
|
constructor(message) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.name = 'AuthPreflightError';
|
|
8
|
+
super('AUTH_PREFLIGHT', message);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
@@ -16,17 +16,32 @@ export function probeAuthStatus(env) {
|
|
|
16
16
|
const res = safeExecResult('claude', ['auth', 'status', '--json'], { env, encoding: 'utf8', stdio: 'pipe' });
|
|
17
17
|
if (!res.success)
|
|
18
18
|
return null;
|
|
19
|
+
return parseAuthStatus(res.stdout.toString());
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Read what `claude auth status --json` printed. `null` means "not the JSON
|
|
23
|
+
* object the flag promises" — an older CLI answering in prose, or a bare
|
|
24
|
+
* literal — and only that: a failure inside this reader is a bug, not "not
|
|
25
|
+
* logged in", and `resolveAuth` would otherwise turn it into a preflight exit.
|
|
26
|
+
*/
|
|
27
|
+
export function parseAuthStatus(stdout) {
|
|
28
|
+
let parsed;
|
|
19
29
|
try {
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
loggedIn: parsed['loggedIn'] === true,
|
|
23
|
-
...(typeof parsed['authMethod'] === 'string' ? { authMethod: parsed['authMethod'] } : {}),
|
|
24
|
-
...(typeof parsed['apiKeySource'] === 'string' ? { apiKeySource: parsed['apiKeySource'] } : {}),
|
|
25
|
-
};
|
|
30
|
+
parsed = JSON.parse(stdout);
|
|
26
31
|
}
|
|
27
|
-
catch {
|
|
32
|
+
catch (error) {
|
|
33
|
+
if (!(error instanceof SyntaxError))
|
|
34
|
+
throw error;
|
|
28
35
|
return null;
|
|
29
36
|
}
|
|
37
|
+
if (typeof parsed !== 'object' || parsed === null)
|
|
38
|
+
return null;
|
|
39
|
+
const record = parsed;
|
|
40
|
+
return {
|
|
41
|
+
loggedIn: record['loggedIn'] === true,
|
|
42
|
+
...(typeof record['authMethod'] === 'string' ? { authMethod: record['authMethod'] } : {}),
|
|
43
|
+
...(typeof record['apiKeySource'] === 'string' ? { apiKeySource: record['apiKeySource'] } : {}),
|
|
44
|
+
};
|
|
30
45
|
}
|
|
31
46
|
function hasInferenceKey(env) {
|
|
32
47
|
return Boolean(env['ANTHROPIC_API_KEY'] ?? env['ANTHROPIC_AUTH_TOKEN']);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-resolver.js","sourceRoot":"","sources":["../../src/skill-test/auth-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AA6BnD,sDAAsD;AACtD,MAAM,OAAO,kBAAmB,SAAQ,
|
|
1
|
+
{"version":3,"file":"auth-resolver.js","sourceRoot":"","sources":["../../src/skill-test/auth-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AA6BnD,sDAAsD;AACtD,MAAM,OAAO,kBAAmB,SAAQ,QAAQ;IACrC,MAAM,GAAG,WAAoB,CAAC;IACvC,YAAY,OAAe;QACzB,KAAK,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACnC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,GAAsB;IACpD,MAAM,GAAG,GAAG,cAAc,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7G,IAAI,CAAC,GAAG,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC9B,OAAO,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;AAChD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,IAAI,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H,CAAC;IACJ,CAAC;IAED,OAAO;QACL,YAAY;QACZ,kBAAkB;QAClB,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACvE,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { applyDeclaredEnv, buildForwardedEnv, formatForwardedEnvLine, protectedEnvNames, type DeclaredEnvInput, type DeclaredEnvResult, type ForwardEnvOptions, } from './env-scrub.js';
|
|
1
|
+
export { applyDeclaredEnv, buildForwardedEnv, formatForwardedEnvLine, isProtectedName, protectedEnvNames, type DeclaredEnvInput, type DeclaredEnvResult, type ForwardEnvOptions, } from './env-scrub.js';
|
|
2
2
|
export { AuthPreflightError, probeAuthStatus, resolveAuth, type AuthMechanism, type AuthMode, type AuthStatusProbe, type AuthStatusResult, type ResolveAuthOptions, type ResolvedAuth, } from './auth-resolver.js';
|
|
3
3
|
export { assembleClaudeArgs, killAllActiveClaudeChildren, spawnHeadlessClaude, type ClaudeSpawnArgs, type SpawnHeadlessOptions, type SpawnResult, } from './spawn-claude.js';
|
|
4
4
|
export { detectInvocationFromTranscript, parseStreamJsonTranscript, type ParsedTranscript, } from './transcript.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/skill-test/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,YAAY,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,WAAW,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EACzB,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/skill-test/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,YAAY,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,WAAW,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EACzB,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC"}
|
package/dist/skill-test/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { applyDeclaredEnv, buildForwardedEnv, formatForwardedEnvLine, protectedEnvNames, } from './env-scrub.js';
|
|
1
|
+
export { applyDeclaredEnv, buildForwardedEnv, formatForwardedEnvLine, isProtectedName, protectedEnvNames, } from './env-scrub.js';
|
|
2
2
|
export { AuthPreflightError, probeAuthStatus, resolveAuth, } from './auth-resolver.js';
|
|
3
3
|
export { assembleClaudeArgs, killAllActiveClaudeChildren, spawnHeadlessClaude, } from './spawn-claude.js';
|
|
4
4
|
export { detectInvocationFromTranscript, parseStreamJsonTranscript, } from './transcript.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/skill-test/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,GAIlB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,WAAW,GAOZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,GAIpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,GAE1B,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/skill-test/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,iBAAiB,GAIlB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,WAAW,GAOZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,GAIpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,GAE1B,MAAM,iBAAiB,CAAC"}
|