@socketsecurity/lib 6.0.7 → 6.0.9
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/CHANGELOG.md +42 -0
- package/README.md +1 -1
- package/dist/ai/agent-context.d.mts +103 -0
- package/dist/ai/agent-context.js +157 -0
- package/dist/ai/backends.d.mts +83 -0
- package/dist/ai/backends.js +173 -0
- package/dist/ai/credentials.d.mts +49 -0
- package/dist/ai/credentials.js +82 -0
- package/dist/ai/discover.d.mts +4 -0
- package/dist/ai/discover.js +1 -1
- package/dist/ai/exec.d.mts +52 -0
- package/dist/ai/exec.js +92 -0
- package/dist/ai/http.d.mts +132 -0
- package/dist/ai/http.js +130 -0
- package/dist/ai/profiles.d.mts +41 -6
- package/dist/ai/profiles.js +52 -10
- package/dist/ai/route.d.mts +82 -0
- package/dist/ai/route.js +171 -0
- package/dist/ai/spawn.d.mts +42 -2
- package/dist/ai/spawn.js +146 -33
- package/dist/ai/subagent-status.d.mts +48 -0
- package/dist/ai/subagent-status.js +57 -0
- package/dist/ai/tier.d.mts +60 -0
- package/dist/ai/tier.js +53 -0
- package/dist/ai/types.d.mts +25 -2
- package/dist/ai/worktree.js +4 -0
- package/dist/archives/tar.js +1 -1
- package/dist/archives/zip.js +2 -2
- package/dist/argv/parse.d.ts +19 -2
- package/dist/argv/parse.js +1 -1
- package/dist/arrays/join.js +4 -0
- package/dist/bin/find.js +4 -4
- package/dist/bin/prim.cjs +23322 -18018
- package/dist/bin/resolve.js +2 -2
- package/dist/cache/ttl/store.js +2 -2
- package/dist/cli/check-primordials.d.ts +8 -3
- package/dist/cli/check-primordials.js +4 -4
- package/dist/compression/_internal.js +1 -1
- package/dist/compression/brotli.d.ts +1 -2
- package/dist/compression/brotli.js +5 -1
- package/dist/compression/gzip.js +5 -1
- package/dist/config/layers.d.ts +53 -0
- package/dist/config/layers.js +83 -0
- package/dist/constants/packages.d.ts +3 -0
- package/dist/constants/packages.js +2 -1
- package/dist/constants/socket.d.ts +2 -6
- package/dist/constants/socket.js +12 -14
- package/dist/cover/code.js +2 -2
- package/dist/crypto/hash.d.ts +4 -1
- package/dist/crypto/hash.js +4 -1
- package/dist/dlx/arborist.js +13 -3
- package/dist/dlx/binary-cache.js +1 -1
- package/dist/dlx/binary-resolution.js +1 -1
- package/dist/dlx/detect.d.ts +8 -0
- package/dist/dlx/firewall.d.ts +8 -0
- package/dist/dlx/lockfile.js +5 -2
- package/dist/dlx/manifest.js +1 -1
- package/dist/dlx/package.js +4 -0
- package/dist/eco/cargo/parse-lockfile.d.ts +1 -2
- package/dist/eco/cargo/parse-lockfile.js +3 -3
- package/dist/eco/manifest/detect-format.js +1 -1
- package/dist/eco/npm/npm/parse-lockfile.d.ts +3 -4
- package/dist/eco/npm/npm/parse-lockfile.js +2 -2
- package/dist/eco/npm/parse-package-json.d.ts +11 -0
- package/dist/eco/npm/parse-package-json.js +1 -1
- package/dist/eco/npm/pnpm/parse-lockfile.d.ts +5 -3
- package/dist/eco/npm/pnpm/parse-lockfile.js +3 -3
- package/dist/eco/npm/yarnpkg/yarn/exec.js +1 -1
- package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.d.ts +1 -2
- package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.js +2 -2
- package/dist/env/proxy.js +1 -1
- package/dist/env/rewire.d.ts +6 -3
- package/dist/env/rewire.js +7 -8
- package/dist/env/socket.d.ts +7 -0
- package/dist/env/socket.js +10 -0
- package/dist/env/xdg.d.ts +17 -0
- package/dist/env/xdg.js +21 -1
- package/dist/errors/predicates.js +1 -1
- package/dist/errors/stack.js +1 -2
- package/dist/external/@npmcli/package-json.js +3455 -4881
- package/dist/external/@npmcli/promise-spawn.js +3 -1
- package/dist/external/@yarnpkg/extensions.js +1 -1
- package/dist/external/external-pack.js +1 -1
- package/dist/external/npm-pack.js +29164 -31799
- package/dist/external/pico-pack.js +4 -2
- package/dist/external/tar-fs.js +63 -16
- package/dist/external/which.js +3 -1
- package/dist/external-tools/bazel/asset-names.d.ts +1 -1
- package/dist/external-tools/bazel/asset-names.js +5 -2
- package/dist/external-tools/bazel/from-download.d.ts +1 -1
- package/dist/external-tools/bazel/from-download.js +5 -2
- package/dist/external-tools/bazel/resolve-bazel-version.js +4 -0
- package/dist/external-tools/bazel/resolve.d.ts +3 -3
- package/dist/external-tools/bazel/resolve.js +16 -8
- package/dist/external-tools/cdxgen/asset-names.d.ts +1 -1
- package/dist/external-tools/cdxgen/asset-names.js +5 -2
- package/dist/external-tools/cdxgen/from-download.d.ts +1 -1
- package/dist/external-tools/cdxgen/from-download.js +7 -4
- package/dist/external-tools/cdxgen/resolve.d.ts +3 -3
- package/dist/external-tools/cdxgen/resolve.js +16 -8
- package/dist/external-tools/from-download.d.ts +2 -2
- package/dist/external-tools/from-download.js +11 -5
- package/dist/external-tools/from-pip-venv.d.ts +1 -1
- package/dist/external-tools/from-pip-venv.js +12 -5
- package/dist/external-tools/janus/asset-names.d.ts +1 -1
- package/dist/external-tools/janus/asset-names.js +5 -2
- package/dist/external-tools/janus/from-download.d.ts +1 -1
- package/dist/external-tools/janus/from-download.js +5 -2
- package/dist/external-tools/janus/resolve.d.ts +3 -3
- package/dist/external-tools/janus/resolve.js +16 -8
- package/dist/external-tools/jre/asset-names.d.ts +1 -1
- package/dist/external-tools/jre/asset-names.js +5 -2
- package/dist/external-tools/jre/detect-platform-arch.js +1 -1
- package/dist/external-tools/jre/from-download.d.ts +1 -1
- package/dist/external-tools/jre/from-download.js +7 -4
- package/dist/external-tools/jre/from-java-home.js +2 -2
- package/dist/external-tools/jre/from-vfs.js +2 -2
- package/dist/external-tools/jre/resolve.d.ts +3 -3
- package/dist/external-tools/jre/resolve.js +16 -8
- package/dist/external-tools/manifest.d.ts +18 -0
- package/dist/external-tools/manifest.js +2 -2
- package/dist/external-tools/opengrep/asset-names.d.ts +1 -1
- package/dist/external-tools/opengrep/asset-names.js +5 -2
- package/dist/external-tools/opengrep/from-download.d.ts +1 -1
- package/dist/external-tools/opengrep/from-download.js +5 -2
- package/dist/external-tools/opengrep/resolve.d.ts +3 -3
- package/dist/external-tools/opengrep/resolve.js +16 -8
- package/dist/external-tools/python/asset-names.d.ts +1 -1
- package/dist/external-tools/python/asset-names.js +11 -4
- package/dist/external-tools/python/dlx.d.ts +3 -3
- package/dist/external-tools/python/dlx.js +20 -9
- package/dist/external-tools/python/from-download.d.ts +1 -1
- package/dist/external-tools/python/from-download.js +12 -5
- package/dist/external-tools/python/pin.js +6 -3
- package/dist/external-tools/python/pip-install.js +6 -3
- package/dist/external-tools/python/resolve.d.ts +3 -3
- package/dist/external-tools/python/resolve.js +19 -11
- package/dist/external-tools/python/uv-install.d.ts +89 -0
- package/dist/external-tools/python/uv-install.js +165 -0
- package/dist/external-tools/sbt/asset-names.d.ts +1 -1
- package/dist/external-tools/sbt/asset-names.js +5 -2
- package/dist/external-tools/sbt/from-download.d.ts +1 -1
- package/dist/external-tools/sbt/from-download.js +5 -2
- package/dist/external-tools/sbt/resolve.d.ts +3 -3
- package/dist/external-tools/sbt/resolve.js +16 -8
- package/dist/external-tools/skillspector/from-dlx.d.ts +1 -1
- package/dist/external-tools/skillspector/from-dlx.js +10 -3
- package/dist/external-tools/skillspector/from-uv.d.ts +30 -0
- package/dist/external-tools/skillspector/from-uv.js +56 -0
- package/dist/external-tools/skillspector/resolve.d.ts +20 -5
- package/dist/external-tools/skillspector/resolve.js +27 -6
- package/dist/external-tools/skillspector/types.d.ts +3 -1
- package/dist/external-tools/synp/asset-names.d.ts +1 -1
- package/dist/external-tools/synp/asset-names.js +6 -2
- package/dist/external-tools/synp/from-download.d.ts +1 -1
- package/dist/external-tools/synp/from-download.js +5 -2
- package/dist/external-tools/synp/resolve.d.ts +3 -3
- package/dist/external-tools/synp/resolve.js +16 -8
- package/dist/external-tools/trivy/asset-names.d.ts +1 -1
- package/dist/external-tools/trivy/asset-names.js +5 -2
- package/dist/external-tools/trivy/from-download.d.ts +1 -1
- package/dist/external-tools/trivy/from-download.js +7 -4
- package/dist/external-tools/trivy/resolve.d.ts +3 -3
- package/dist/external-tools/trivy/resolve.js +16 -8
- package/dist/external-tools/trufflehog/asset-names.d.ts +1 -1
- package/dist/external-tools/trufflehog/asset-names.js +5 -2
- package/dist/external-tools/trufflehog/from-download.d.ts +1 -1
- package/dist/external-tools/trufflehog/from-download.js +7 -4
- package/dist/external-tools/trufflehog/resolve.d.ts +3 -3
- package/dist/external-tools/trufflehog/resolve.js +16 -8
- package/dist/external-tools/uv/asset-names.d.ts +36 -0
- package/dist/external-tools/uv/asset-names.js +73 -0
- package/dist/external-tools/uv/from-download.d.ts +17 -0
- package/dist/external-tools/uv/from-download.js +50 -0
- package/dist/external-tools/uv/from-path.d.ts +5 -0
- package/dist/external-tools/uv/from-path.js +22 -0
- package/dist/external-tools/uv/from-vfs.d.ts +7 -0
- package/dist/external-tools/uv/from-vfs.js +26 -0
- package/dist/external-tools/uv/resolve.d.ts +25 -0
- package/dist/external-tools/uv/resolve.js +61 -0
- package/dist/external-tools/uv/types.d.ts +24 -0
- package/dist/external-tools/uv/types.js +2 -0
- package/dist/fleet/repo-config.d.ts +53 -0
- package/dist/fleet/repo-config.js +79 -0
- package/dist/fs/allowed-dirs-cache.d.ts +27 -1
- package/dist/fs/allowed-dirs-cache.js +39 -6
- package/dist/fs/copy.d.ts +88 -0
- package/dist/fs/copy.js +89 -0
- package/dist/fs/find.js +1 -1
- package/dist/fs/read-json-cache.d.ts +7 -0
- package/dist/fs/resolve-module.js +6 -2
- package/dist/fs/safe.js +1 -1
- package/dist/git/_internal.js +3 -3
- package/dist/git/repo.js +2 -4
- package/dist/git/staged.js +8 -0
- package/dist/git/tracked.d.ts +84 -0
- package/dist/git/tracked.js +163 -0
- package/dist/git/unstaged.js +8 -0
- package/dist/github/refs-graphql.js +4 -0
- package/dist/github/refs-rest.js +4 -0
- package/dist/globs/_internal.js +1 -1
- package/dist/globs/match.js +9 -1
- package/dist/globs/matcher.js +5 -1
- package/dist/http-request/browser.js +7 -3
- package/dist/http-request/checksum-file.js +1 -1
- package/dist/http-request/{browser-fetch.d.ts → fetch/browser.d.ts} +2 -2
- package/dist/http-request/{browser-fetch.js → fetch/browser.js} +4 -4
- package/dist/http-request/headers.js +1 -1
- package/dist/http-request/request-attempt.js +2 -2
- package/dist/http-request/user-agent.js +1 -1
- package/dist/integrity.d.ts +124 -71
- package/dist/integrity.js +168 -78
- package/dist/json/edit.js +38 -30
- package/dist/json/format.js +1 -1
- package/dist/logger/colors.d.ts +1 -2
- package/dist/logger/colors.js +2 -2
- package/dist/logger/symbols-builder.js +7 -8
- package/dist/logger/symbols.js +8 -8
- package/dist/native-messaging/install.d.ts +1 -1
- package/dist/native-messaging/install.js +7 -4
- package/dist/native-messaging/rate-limit.d.ts +7 -0
- package/dist/native-messaging/rate-limit.js +4 -0
- package/dist/node/async-hooks.js +1 -1
- package/dist/node/child-process.js +1 -1
- package/dist/node/crypto.js +1 -1
- package/dist/node/events.js +1 -1
- package/dist/node/fs-promises.js +1 -1
- package/dist/node/fs.d.ts +22 -6
- package/dist/node/fs.js +16 -3
- package/dist/node/http.js +1 -1
- package/dist/node/https.js +1 -1
- package/dist/node/module.d.ts +73 -2
- package/dist/node/module.js +97 -12
- package/dist/node/os.d.ts +10 -2
- package/dist/node/os.js +11 -4
- package/dist/node/path.d.ts +11 -2
- package/dist/node/path.js +17 -4
- package/dist/node/timers-promises.js +1 -1
- package/dist/node/url.js +1 -1
- package/dist/node/util.js +1 -1
- package/dist/objects/getters.js +1 -1
- package/dist/objects/mutate.js +2 -2
- package/dist/packages/edit-class.d.ts +2 -3
- package/dist/packages/edit-class.js +41 -35
- package/dist/packages/exports.js +4 -4
- package/dist/packages/fetch.js +1 -1
- package/dist/packages/isolation.js +2 -2
- package/dist/packages/licenses.js +2 -2
- package/dist/packages/manifest.d.ts +29 -0
- package/dist/packages/manifest.js +40 -4
- package/dist/packages/normalize.js +2 -2
- package/dist/packages/provenance.js +3 -3
- package/dist/packages/specs.js +1 -1
- package/dist/packages/tarball.js +4 -2
- package/dist/packages/types.d.ts +1 -2
- package/dist/paths/_internal.d.ts +1 -7
- package/dist/paths/_internal.js +9 -15
- package/dist/paths/conversion.js +1 -1
- package/dist/paths/dirnames.d.ts +1 -0
- package/dist/paths/dirnames.js +2 -0
- package/dist/paths/normalize.js +1 -1
- package/dist/paths/predicates.js +2 -1
- package/dist/paths/resolve.js +14 -19
- package/dist/paths/rewire.d.ts +5 -0
- package/dist/paths/socket.d.ts +137 -123
- package/dist/paths/socket.js +172 -131
- package/dist/perf/metrics.js +1 -1
- package/dist/perf/report.js +1 -1
- package/dist/primordials/process.d.ts +88 -0
- package/dist/primordials/process.js +132 -0
- package/dist/primordials/uncurry.d.ts +1 -2
- package/dist/process/spawn/child.js +8 -2
- package/dist/process/spawn/errors.js +1 -1
- package/dist/releases/github-archives.js +1 -1
- package/dist/releases/github-listing.d.ts +1 -2
- package/dist/schema/types.d.ts +3 -4
- package/dist/schema/validate.js +1 -1
- package/dist/secrets/broker.d.ts +35 -0
- package/dist/secrets/broker.js +72 -0
- package/dist/secrets/find.d.ts +8 -6
- package/dist/secrets/find.js +25 -5
- package/dist/secrets/keychain.d.ts +1 -1
- package/dist/secrets/linux.js +32 -44
- package/dist/secrets/macos.d.ts +1 -2
- package/dist/secrets/macos.js +20 -29
- package/dist/secrets/rc.d.ts +2 -2
- package/dist/secrets/rc.js +21 -13
- package/dist/secrets/socket-api-token.js +8 -0
- package/dist/secrets/windows.js +27 -33
- package/dist/shell/parse.d.ts +32 -0
- package/dist/shell/parse.js +60 -0
- package/dist/smol/detect.js +1 -1
- package/dist/smol/http.js +1 -1
- package/dist/smol/https.js +1 -1
- package/dist/smol/manifest.js +1 -1
- package/dist/smol/path.js +1 -1
- package/dist/smol/primordial.js +1 -1
- package/dist/smol/purl.js +1 -1
- package/dist/smol/versions.js +1 -1
- package/dist/smol/vfs.js +1 -1
- package/dist/sorts/_internal.d.ts +1 -2
- package/dist/sorts/_internal.js +2 -6
- package/dist/sorts/semver.js +2 -2
- package/dist/spinner/create-spinner-class.js +2 -2
- package/dist/spinner/spinner-internals.d.ts +1 -1
- package/dist/spinner/spinner-internals.js +9 -5
- package/dist/spinner/spinner.d.ts +4 -0
- package/dist/spinner/spinner.js +1 -1
- package/dist/stdio/progress.js +6 -2
- package/dist/stdio/prompts.d.ts +2 -10
- package/dist/stdio/prompts.js +11 -24
- package/dist/strings/format.js +1 -1
- package/dist/strings/search.js +1 -1
- package/dist/temporal/instant.js +2 -2
- package/dist/themes/context.d.ts +5 -3
- package/dist/themes/context.js +5 -6
- package/dist/url/assert-safe.d.ts +29 -0
- package/dist/url/assert-safe.js +54 -0
- package/dist/url/predicates.d.ts +31 -1
- package/dist/url/predicates.js +42 -1
- package/dist/url/types.d.ts +4 -0
- package/llms.txt +750 -0
- package/package.json +253 -125
package/dist/paths/conversion.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_constants_platform = require('../constants/platform.js');
|
|
5
4
|
const require_primordials_string = require('../primordials/string.js');
|
|
5
|
+
const require_constants_platform = require('../constants/platform.js');
|
|
6
6
|
const require_paths__internal = require('./_internal.js');
|
|
7
7
|
const require_paths_normalize = require('./normalize.js');
|
|
8
8
|
|
package/dist/paths/dirnames.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ export declare const DOT_GITHUB = ".github";
|
|
|
7
7
|
export declare const DOT_SOCKET_DIR = ".socket";
|
|
8
8
|
export declare const CACHE_DIR = "cache";
|
|
9
9
|
export declare const CACHE_TTL_DIR = "ttl";
|
|
10
|
+
export declare const RUN_DIR = "run";
|
|
10
11
|
export declare const NODE_MODULES_GLOB_RECURSIVE = "**/node_modules";
|
|
11
12
|
export declare const SLASH_NODE_MODULES_SLASH = "/node_modules/";
|
package/dist/paths/dirnames.js
CHANGED
|
@@ -12,6 +12,7 @@ const DOT_GITHUB = ".github";
|
|
|
12
12
|
const DOT_SOCKET_DIR = ".socket";
|
|
13
13
|
const CACHE_DIR = "cache";
|
|
14
14
|
const CACHE_TTL_DIR = "ttl";
|
|
15
|
+
const RUN_DIR = "run";
|
|
15
16
|
const NODE_MODULES_GLOB_RECURSIVE = "**/node_modules";
|
|
16
17
|
const SLASH_NODE_MODULES_SLASH = "/node_modules/";
|
|
17
18
|
|
|
@@ -23,4 +24,5 @@ exports.DOT_GIT_DIR = DOT_GIT_DIR;
|
|
|
23
24
|
exports.DOT_SOCKET_DIR = DOT_SOCKET_DIR;
|
|
24
25
|
exports.NODE_MODULES = NODE_MODULES;
|
|
25
26
|
exports.NODE_MODULES_GLOB_RECURSIVE = NODE_MODULES_GLOB_RECURSIVE;
|
|
27
|
+
exports.RUN_DIR = RUN_DIR;
|
|
26
28
|
exports.SLASH_NODE_MODULES_SLASH = SLASH_NODE_MODULES_SLASH;
|
package/dist/paths/normalize.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_constants_platform = require('../constants/platform.js');
|
|
5
4
|
const require_primordials_string = require('../primordials/string.js');
|
|
5
|
+
const require_constants_platform = require('../constants/platform.js');
|
|
6
6
|
const require_strings_search = require('../strings/search.js');
|
|
7
7
|
const require_paths__internal = require('./_internal.js');
|
|
8
8
|
const require_paths_conversion = require('./conversion.js');
|
package/dist/paths/predicates.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_constants_platform = require('../constants/platform.js');
|
|
5
4
|
const require_primordials_string = require('../primordials/string.js');
|
|
5
|
+
const require_constants_platform = require('../constants/platform.js');
|
|
6
|
+
const require_constants_encoding = require('../constants/encoding.js');
|
|
6
7
|
const require_paths__internal = require('./_internal.js');
|
|
7
8
|
const require_primordials_regexp = require('../primordials/regexp.js');
|
|
8
9
|
|
package/dist/paths/resolve.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_constants_platform = require('../constants/platform.js');
|
|
5
|
-
const require_primordials_string = require('../primordials/string.js');
|
|
6
|
-
const require_paths__internal = require('./_internal.js');
|
|
7
|
-
const require_paths_predicates = require('./predicates.js');
|
|
8
|
-
const require_paths_normalize = require('./normalize.js');
|
|
9
4
|
|
|
10
5
|
//#region src/paths/resolve.ts
|
|
11
6
|
/**
|
|
@@ -44,7 +39,7 @@ function relative(from, to) {
|
|
|
44
39
|
const actualTo = resolve(to);
|
|
45
40
|
if (actualFrom === actualTo) return "";
|
|
46
41
|
/* c8 ignore start - Windows-only case-insensitive comparison. */
|
|
47
|
-
if (
|
|
42
|
+
if (WIN32) {
|
|
48
43
|
if (actualFrom.toLowerCase() === actualTo.toLowerCase()) return "";
|
|
49
44
|
}
|
|
50
45
|
/* c8 ignore stop */
|
|
@@ -57,32 +52,32 @@ function relative(from, to) {
|
|
|
57
52
|
let lastCommonSep = -1;
|
|
58
53
|
let i = 0;
|
|
59
54
|
for (; i < length; i += 1) {
|
|
60
|
-
let fromCode =
|
|
61
|
-
let toCode =
|
|
55
|
+
let fromCode = StringPrototypeCharCodeAt(actualFrom, fromStart + i);
|
|
56
|
+
let toCode = StringPrototypeCharCodeAt(actualTo, toStart + i);
|
|
62
57
|
/* c8 ignore start - Windows-only case folding. */
|
|
63
|
-
if (
|
|
64
|
-
if (fromCode >=
|
|
65
|
-
if (toCode >=
|
|
58
|
+
if (WIN32) {
|
|
59
|
+
if (fromCode >= CHAR_UPPERCASE_A && fromCode <= CHAR_UPPERCASE_Z) fromCode += 32;
|
|
60
|
+
if (toCode >= CHAR_UPPERCASE_A && toCode <= CHAR_UPPERCASE_Z) toCode += 32;
|
|
66
61
|
}
|
|
67
62
|
/* c8 ignore stop */
|
|
68
63
|
if (fromCode !== toCode) break;
|
|
69
|
-
if (
|
|
64
|
+
if (isPathSeparator(StringPrototypeCharCodeAt(actualFrom, fromStart + i))) lastCommonSep = i;
|
|
70
65
|
}
|
|
71
66
|
/* c8 ignore start */
|
|
72
67
|
if (i === length) {
|
|
73
68
|
if (toLen > length) {
|
|
74
|
-
if (
|
|
69
|
+
if (isPathSeparator(StringPrototypeCharCodeAt(actualTo, toStart + i))) return actualTo.slice(toStart + i + 1);
|
|
75
70
|
if (i === 0) return actualTo.slice(toStart + i);
|
|
76
71
|
} else if (fromLen > length) {
|
|
77
|
-
if (
|
|
72
|
+
if (isPathSeparator(StringPrototypeCharCodeAt(actualFrom, fromStart + i))) lastCommonSep = i;
|
|
78
73
|
else if (i === 0) lastCommonSep = 0;
|
|
79
74
|
}
|
|
80
75
|
}
|
|
81
76
|
/* c8 ignore stop */
|
|
82
77
|
let out = "";
|
|
83
78
|
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; i += 1) {
|
|
84
|
-
const code =
|
|
85
|
-
if (i === fromEnd ||
|
|
79
|
+
const code = StringPrototypeCharCodeAt(actualFrom, i);
|
|
80
|
+
if (i === fromEnd || isPathSeparator(code)) out += out.length === 0 ? ".." : "/..";
|
|
86
81
|
}
|
|
87
82
|
return out + actualTo.slice(toStart + lastCommonSep);
|
|
88
83
|
}
|
|
@@ -108,7 +103,7 @@ function relative(from, to) {
|
|
|
108
103
|
function relativeResolve(from, to) {
|
|
109
104
|
const rel = relative(from, to);
|
|
110
105
|
if (rel === "") return "";
|
|
111
|
-
return
|
|
106
|
+
return normalizePath(rel);
|
|
112
107
|
}
|
|
113
108
|
/**
|
|
114
109
|
* Resolve an absolute path from path segments.
|
|
@@ -137,11 +132,11 @@ function resolve(...segments) {
|
|
|
137
132
|
/* c8 ignore start */
|
|
138
133
|
if (typeof segment !== "string" || segment.length === 0) continue;
|
|
139
134
|
resolvedPath = segment + (resolvedPath.length === 0 ? "" : `/${resolvedPath}`);
|
|
140
|
-
resolvedAbsolute =
|
|
135
|
+
resolvedAbsolute = isAbsolute(segment);
|
|
141
136
|
}
|
|
142
137
|
if (!resolvedAbsolute) resolvedPath = /* @__PURE__ */ require("node:process").cwd() + (resolvedPath.length === 0 ? "" : `/${resolvedPath}`);
|
|
143
138
|
/* c8 ignore stop */
|
|
144
|
-
return
|
|
139
|
+
return normalizePath(resolvedPath);
|
|
145
140
|
}
|
|
146
141
|
|
|
147
142
|
//#endregion
|
package/dist/paths/rewire.d.ts
CHANGED
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
* - Automatic cache invalidation for path-dependent modules
|
|
8
8
|
* - Thread-safe for concurrent test execution
|
|
9
9
|
*/
|
|
10
|
+
export interface PathRewireState {
|
|
11
|
+
testOverrides: Map<string, string | undefined>;
|
|
12
|
+
valueCache: Map<string, string>;
|
|
13
|
+
cacheInvalidationCallbacks: Array<() => void>;
|
|
14
|
+
}
|
|
10
15
|
/**
|
|
11
16
|
* Clear a specific path override.
|
|
12
17
|
*/
|
package/dist/paths/socket.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file Path utilities for Socket ecosystem directories.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
2
|
+
* @file Path utilities for Socket ecosystem directories. Platform-aware
|
|
3
|
+
* resolution for the shared ~/.socket/ layout. The `_`-prefixed entries are
|
|
4
|
+
* Socket-managed DIRS (not apps): `_cacache` content-addressable cache;
|
|
5
|
+
* `_dlx/<hash>/` name+version binary store (node, jre, python, sfw, …);
|
|
6
|
+
* `_state/<app>/` version-LESS persistent app state (daemon socket + lock +
|
|
7
|
+
* OAuth refresh; mirrors pnpm `state-dir` / XDG_STATE_HOME), with
|
|
8
|
+
* `_state/<app>/run/` for a daemon's socket/lock/pid; `_wheelhouse`
|
|
9
|
+
* cross-fleet shared bin. Generic per-app dirs (`getSocketAppDir('<name>')`)
|
|
10
|
+
* nest under the same `_`-prefix.
|
|
10
11
|
*/
|
|
11
12
|
/**
|
|
12
13
|
* Get the OS home directory. Can be overridden in tests using
|
|
@@ -22,6 +23,26 @@ export declare function getOsHomeDir(): string;
|
|
|
22
23
|
* setPath('tmpdir', ...) from paths/rewire.
|
|
23
24
|
*/
|
|
24
25
|
export declare function getOsTmpDir(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve the runtime socket path for a local daemon named `name`. Distinct
|
|
28
|
+
* from getSocketAppRuntimeDir (the persistent ~/.socket/_state/<app>/run/
|
|
29
|
+
* home): the SOCKET endpoint itself belongs in the ephemeral, owner-only XDG
|
|
30
|
+
* runtime dir — correctly permissioned and auto-cleaned on logout — while the
|
|
31
|
+
* downloaded daemon binary + durable token cache live under ~/.socket. The
|
|
32
|
+
* daemon and every client MUST compute the identical path (1 path, 1
|
|
33
|
+
* reference), so this is the single resolver both sides call.
|
|
34
|
+
*
|
|
35
|
+
* Resolution:
|
|
36
|
+
*
|
|
37
|
+
* - Windows: `\\.\pipe\<name>-sock` (named pipe; Unix sockets are unavailable
|
|
38
|
+
* pre-Win10 1803, same framing/semantics). Returned raw — a pipe path is not
|
|
39
|
+
* a filesystem path and must not be slash-normalized.
|
|
40
|
+
* - `$XDG_RUNTIME_DIR/<name>.sock` when XDG_RUNTIME_DIR is set (systemd
|
|
41
|
+
* `/run/user/<uid>/`).
|
|
42
|
+
* - Else `$TMPDIR/<name>-<uid>.sock` (the `<uid>` suffix avoids collisions when
|
|
43
|
+
* TMPDIR is shared across users on a multi-tenant box).
|
|
44
|
+
*/
|
|
45
|
+
export declare function getRuntimeSocketPath(name: string): string;
|
|
25
46
|
/**
|
|
26
47
|
* Get a Socket app cache directory (~/.socket/_<appName>/cache).
|
|
27
48
|
*/
|
|
@@ -37,67 +58,56 @@ export declare function getSocketAppCacheDir(appName: string): string;
|
|
|
37
58
|
*/
|
|
38
59
|
export declare function getSocketAppCacheTtlDir(appName: string): string;
|
|
39
60
|
/**
|
|
40
|
-
* Get a Socket app directory (~/.socket/_<appName>).
|
|
61
|
+
* Get a Socket app directory (~/.socket/_<appName>). The `_` prefix is applied
|
|
62
|
+
* here; pass the bare app name (e.g. 'socket', 'registry').
|
|
41
63
|
*/
|
|
42
64
|
/**
|
|
43
|
-
* Get a Socket app directory (~/.socket/_<appName>).
|
|
65
|
+
* Get a Socket app directory (~/.socket/_<appName>). The `_` prefix is applied
|
|
66
|
+
* here; pass the bare app name (e.g. 'socket', 'registry').
|
|
44
67
|
*/
|
|
45
68
|
export declare function getSocketAppDir(appName: string): string;
|
|
46
69
|
/**
|
|
47
|
-
* Get the Socket cacache directory (~/.socket/_cacache).
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* Priority order:
|
|
52
|
-
*
|
|
53
|
-
* 1. Test override via setPath('socket-cacache-dir', ...)
|
|
54
|
-
* 2. SOCKET_CACACHE_DIR - Full override of cacache directory
|
|
55
|
-
* 3. Default: $SOCKET_HOME/_cacache or $HOME/.socket/_cacache
|
|
70
|
+
* Get the Socket cacache directory (~/.socket/_cacache). Override precedence:
|
|
71
|
+
* setPath('socket-cacache-dir', …) → SOCKET_CACACHE_DIR env →
|
|
72
|
+
* $SOCKET_HOME/_cacache → $HOME/.socket/_cacache.
|
|
56
73
|
*/
|
|
57
74
|
/**
|
|
58
|
-
* Get
|
|
59
|
-
*
|
|
60
|
-
* is
|
|
61
|
-
*
|
|
62
|
-
* Priority order:
|
|
63
|
-
*
|
|
64
|
-
* 1. Test override via setPath('socket-cacache-dir', ...)
|
|
65
|
-
* 2. SOCKET_CACACHE_DIR - Full override of cacache directory
|
|
66
|
-
* 3. Default: $SOCKET_HOME/_cacache or $HOME/.socket/_cacache
|
|
75
|
+
* Get an app's runtime directory (~/.socket/_state/<app>/run/) — the home for a
|
|
76
|
+
* daemon's Unix socket + `concurrency.lock` + `<socket>.pid`. Version-less so
|
|
77
|
+
* the socket path is stable across binary upgrades.
|
|
67
78
|
*/
|
|
68
|
-
export declare function
|
|
79
|
+
export declare function getSocketAppRuntimeDir(appName: string): string;
|
|
69
80
|
/**
|
|
70
|
-
* Get the Socket
|
|
81
|
+
* Get the Socket user directory (~/.socket). Override precedence:
|
|
82
|
+
* setPath('socket-user-dir', …) → SOCKET_HOME env → $HOME/.socket →
|
|
83
|
+
* /tmp/.socket (Unix) or %TEMP%.socket (Windows).
|
|
71
84
|
*/
|
|
72
85
|
/**
|
|
73
|
-
* Get
|
|
86
|
+
* Get an app's persistent state directory (~/.socket/_state/<app>/). The
|
|
87
|
+
* `<app>` is a real app (proteus, acorn) nesting its version-less state inside
|
|
88
|
+
* the `_state` infra dir.
|
|
74
89
|
*/
|
|
75
|
-
export declare function
|
|
90
|
+
export declare function getSocketAppStateDir(appName: string): string;
|
|
76
91
|
/**
|
|
77
|
-
* Get
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* Priority order:
|
|
82
|
-
*
|
|
83
|
-
* 1. Test override via setPath('socket-dlx-dir', ...)
|
|
84
|
-
* 2. SOCKET_DLX_DIR - Full override of DLX cache directory
|
|
85
|
-
* 3. SOCKET_HOME/_dlx - Base directory override (inherits from getSocketUserDir)
|
|
86
|
-
* 4. Default: $HOME/.socket/_dlx
|
|
87
|
-
* 5. Fallback: /tmp/.socket/_dlx (Unix) or %TEMP%.socket_dlx (Windows)
|
|
92
|
+
* Get an app's runtime directory (~/.socket/_state/<app>/run/) — the home for a
|
|
93
|
+
* daemon's Unix socket + `concurrency.lock` + `<socket>.pid`. Version-less so
|
|
94
|
+
* the socket path is stable across binary upgrades.
|
|
88
95
|
*/
|
|
89
96
|
/**
|
|
90
|
-
* Get the Socket
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
* Get the Socket cacache directory (~/.socket/_cacache). Override precedence:
|
|
98
|
+
* setPath('socket-cacache-dir', …) → SOCKET_CACACHE_DIR env →
|
|
99
|
+
* $SOCKET_HOME/_cacache → $HOME/.socket/_cacache.
|
|
100
|
+
*/
|
|
101
|
+
export declare function getSocketCacacheDir(): string;
|
|
102
|
+
/**
|
|
103
|
+
* Get the Socket DLX directory (~/.socket/_dlx) — the name+version binary store
|
|
104
|
+
* (node, jre, python, sfw, …). Override precedence: setPath('socket-dlx-dir',
|
|
105
|
+
* …) → SOCKET_DLX_DIR env → $SOCKET_HOME/_dlx → $HOME/.socket/_dlx.
|
|
106
|
+
*/
|
|
107
|
+
/**
|
|
108
|
+
* Get the Socket DLX directory (~/.socket/_dlx) — the name+version binary store
|
|
109
|
+
* (node, jre, python, sfw, …). Override precedence: setPath('socket-dlx-dir',
|
|
110
|
+
* …) → SOCKET_DLX_DIR env → $SOCKET_HOME/_dlx → $HOME/.socket/_dlx.
|
|
101
111
|
*/
|
|
102
112
|
export declare function getSocketDlxDir(): string;
|
|
103
113
|
/**
|
|
@@ -110,91 +120,95 @@ export declare function getSocketDlxDir(): string;
|
|
|
110
120
|
*/
|
|
111
121
|
export declare function getSocketHomePath(): string;
|
|
112
122
|
/**
|
|
113
|
-
* Get the
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
*
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
|
|
153
|
-
|
|
123
|
+
* Get the Wheelhouse rack directory (~/.socket/_wheelhouse/rack) — the tool
|
|
124
|
+
* STORE. Every `_wheelhouse`-managed CLI tool keeps its real binaries here,
|
|
125
|
+
* racked by name + version as `<rack>/<tool>/<version>/…` (the wheelhouse
|
|
126
|
+
* analog of Homebrew's `Cellar/`). The handles on PATH live in
|
|
127
|
+
* `<wheelhouse>/bin` (getSocketWheelhouseBinDir) and point into the rack.
|
|
128
|
+
* Inherits the `_wheelhouse` override chain (SOCKET_HOME /
|
|
129
|
+
* setPath('socket-wheelhouse-dir')).
|
|
130
|
+
*/
|
|
131
|
+
export declare function getSocketRackDir(): string;
|
|
132
|
+
/**
|
|
133
|
+
* Get a racked tool's version directory (~/.socket/_wheelhouse/rack/<tool>/
|
|
134
|
+
* <version>) — the per-tool, per-version home under the rack. The
|
|
135
|
+
* 1-path-1-reference owner of a tool install destination: installers resolve
|
|
136
|
+
* their extract/copy target through this, and the `<wheelhouse>/bin/<tool>`
|
|
137
|
+
* shim points at a binary inside it.
|
|
138
|
+
*/
|
|
139
|
+
export declare function getSocketRackToolDir(options: {
|
|
140
|
+
tool: string;
|
|
141
|
+
version: string;
|
|
142
|
+
}): string;
|
|
143
|
+
/**
|
|
144
|
+
* Get the Wheelhouse repo-clones directory (~/.socket/_wheelhouse/repo-clones).
|
|
145
|
+
* Sits beside the per-tool dirs (sfw, codedb, janus, bin) under `_wheelhouse`.
|
|
146
|
+
* The home for reference clones of EXTERNAL repos an agent reviews, each as
|
|
147
|
+
* `<org>-<repo>` lowercased + dash-cased (e.g. `justrach-codedb`).
|
|
148
|
+
*
|
|
149
|
+
* Smallest-practical clone form (smallest disk + fastest initial fetch without
|
|
150
|
+
* the treeless tax): git clone --depth=1 --single-branch --filter=blob:none
|
|
151
|
+
* <url> <dest> `--depth=1` truncates history, `--single-branch` skips other
|
|
152
|
+
* refs, and `--filter=blob:none` (a BLOBLESS partial clone) fetches file blobs
|
|
153
|
+
* lazily on first access — so the initial download is tree-metadata only.
|
|
154
|
+
* (Treeless `--filter=tree:0` is smaller still but refetches trees on every
|
|
155
|
+
* walk, which is slow + breaks offline, so it is NOT the default.)
|
|
156
|
+
*
|
|
157
|
+
* Deliberately OUTSIDE `~/projects/` so the fleet's sibling-walk tooling (e.g.
|
|
158
|
+
* cascade `--all`) never mistakes a reference clone for a fleet member
|
|
159
|
+
* checkout. Disposable: a reference cache, not a working tree. Inherits the
|
|
160
|
+
* `_wheelhouse` override chain (SOCKET_HOME /
|
|
161
|
+
* setPath('socket-wheelhouse-dir')).
|
|
162
|
+
*/
|
|
163
|
+
export declare function getSocketRepoClonesDir(): string;
|
|
164
|
+
/**
|
|
165
|
+
* Get the Socket state directory (~/.socket/_state) — version-LESS persistent
|
|
166
|
+
* app state (the home for daemon sockets, locks, OAuth refresh, durable caches
|
|
167
|
+
* that survive version bumps; mirrors pnpm `state-dir` / XDG_STATE_HOME).
|
|
168
|
+
* Override precedence: setPath('socket-state-dir', …) → SOCKET_STATE_DIR env →
|
|
169
|
+
* $SOCKET_HOME/_state → $HOME/.socket/_state.
|
|
170
|
+
*/
|
|
171
|
+
export declare function getSocketStateDir(): string;
|
|
172
|
+
/**
|
|
173
|
+
* Get the Socket user directory (~/.socket). Override precedence:
|
|
174
|
+
* setPath('socket-user-dir', …) → SOCKET_HOME env → $HOME/.socket →
|
|
175
|
+
* /tmp/.socket (Unix) or %TEMP%.socket (Windows).
|
|
154
176
|
*/
|
|
155
177
|
export declare function getSocketUserDir(): string;
|
|
156
178
|
/**
|
|
157
|
-
* Get the
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
179
|
+
* Get the Wheelhouse bin directory (~/.socket/_wheelhouse/bin) — the single
|
|
180
|
+
* directory placed on PATH. Holds only flat handles (thin exec shims or
|
|
181
|
+
* symlinks), one per tool, each pointing at a real binary racked under
|
|
182
|
+
* `<wheelhouse>/rack/<tool>/<version>/…` (getSocketRackToolDir). The shim IS
|
|
183
|
+
* the bin, the npm `prefix/bin` / Homebrew `bin/` model: PATH lookup does not
|
|
184
|
+
* recurse, so this dir stays flat (never a `bin/<tool>/` subdir). Inherits the
|
|
185
|
+
* `_wheelhouse` override chain (SOCKET_HOME /
|
|
186
|
+
* setPath('socket-wheelhouse-dir')).
|
|
163
187
|
*/
|
|
188
|
+
export declare function getSocketWheelhouseBinDir(): string;
|
|
164
189
|
/**
|
|
165
190
|
* Get the Socket Wheelhouse directory (~/.socket/_wheelhouse). Shared
|
|
166
191
|
* cross-fleet location for binaries that every fleet member can reach without
|
|
167
192
|
* each one re-downloading and re-extracting per-repo. Tool installers (janus,
|
|
168
|
-
* sfw, etc.)
|
|
169
|
-
* `<wheelhouse
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* 1. Test override via setPath('socket-wheelhouse-dir', ...)
|
|
175
|
-
* 2. SOCKET_HOME/_wheelhouse - Base directory override (inherits from
|
|
176
|
-
* getSocketUserDir)
|
|
177
|
-
* 3. Default: $HOME/.socket/_wheelhouse
|
|
193
|
+
* sfw, etc.) rack their resolved executables under
|
|
194
|
+
* `<wheelhouse>/rack/<tool>/<version>/…` (getSocketRackToolDir) and expose a
|
|
195
|
+
* handle in `<wheelhouse>/bin` (getSocketWheelhouseBinDir); consumers add that
|
|
196
|
+
* one `bin/` to PATH. Override precedence: setPath('socket-wheelhouse-dir', …)
|
|
197
|
+
* → $SOCKET_HOME/_wheelhouse → $HOME/.socket/_wheelhouse.
|
|
178
198
|
*/
|
|
179
199
|
export declare function getSocketWheelhouseDir(): string;
|
|
180
200
|
/**
|
|
181
|
-
* Get the
|
|
182
|
-
*
|
|
183
|
-
* getPathValue for performance.
|
|
184
|
-
*
|
|
185
|
-
* Priority order:
|
|
201
|
+
* Get the user's home directory. Uses environment variables directly to support
|
|
202
|
+
* test mocking. Falls back to temporary directory if home is not available.
|
|
186
203
|
*
|
|
187
|
-
* 1.
|
|
188
|
-
*
|
|
189
|
-
* 3. Default: $HOME/.socket
|
|
190
|
-
* 4. Fallback: /tmp/.socket (Unix) or %TEMP%.socket (Windows)
|
|
204
|
+
* Priority order: 1. HOME (Unix) 2. USERPROFILE (Windows) 3.
|
|
205
|
+
* getNodeOs().homedir() 4. Fallback: getNodeOs().tmpdir() (restricted envs).
|
|
191
206
|
*/
|
|
192
207
|
/**
|
|
193
208
|
* Get the user's home directory. Uses environment variables directly to support
|
|
194
209
|
* test mocking. Falls back to temporary directory if home is not available.
|
|
195
210
|
*
|
|
196
|
-
* Priority order: 1. HOME
|
|
197
|
-
*
|
|
198
|
-
* getNodeOs().tmpdir() (rarely used, for restricted environments)
|
|
211
|
+
* Priority order: 1. HOME (Unix) 2. USERPROFILE (Windows) 3.
|
|
212
|
+
* getNodeOs().homedir() 4. Fallback: getNodeOs().tmpdir() (restricted envs).
|
|
199
213
|
*/
|
|
200
214
|
export declare function getUserHomeDir(): string;
|