@vibe-agent-toolkit/utils 0.1.39 → 0.1.40-rc.2
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/dist/fs.d.ts +11 -0
- package/dist/fs.d.ts.map +1 -0
- package/dist/fs.js +11 -0
- package/dist/fs.js.map +1 -0
- package/dist/link-auth/expand-macro.d.ts.map +1 -1
- package/dist/link-auth/expand-macro.js +4 -2
- package/dist/link-auth/expand-macro.js.map +1 -1
- package/dist/link-auth/resolve-token.d.ts +29 -1
- package/dist/link-auth/resolve-token.d.ts.map +1 -1
- package/dist/link-auth/resolve-token.js +26 -2
- package/dist/link-auth/resolve-token.js.map +1 -1
- package/dist/process.d.ts +10 -0
- package/dist/process.d.ts.map +1 -0
- package/dist/process.js +10 -0
- package/dist/process.js.map +1 -0
- package/package.json +11 -2
package/dist/fs.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vibe-agent-toolkit/utils/fs
|
|
3
|
+
*
|
|
4
|
+
* Narrow subpath export for filesystem and path primitives. Import this entry
|
|
5
|
+
* point when you need cross-platform path/fs helpers without pulling in the
|
|
6
|
+
* linkAuth, git, skill-testing, or macro-expansion machinery from the full
|
|
7
|
+
* `"."` barrel.
|
|
8
|
+
*/
|
|
9
|
+
export { normalizePath, normalizedTmpdir, mkdirSyncReal, isAbsolutePath, isAbsoluteAnyPlatform, hasParentTraversalSegment, toAbsolutePath, getRelativePath, toForwardSlash, safePath, resolveFromImportMeta, dynamicImportPath, } from './path-utils.js';
|
|
10
|
+
export { copyDirectory, verifyCaseSensitiveFilename } from './fs-utils.js';
|
|
11
|
+
//# sourceMappingURL=fs.d.ts.map
|
package/dist/fs.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,cAAc,EACd,eAAe,EACf,cAAc,EACd,QAAQ,EACR,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/fs.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vibe-agent-toolkit/utils/fs
|
|
3
|
+
*
|
|
4
|
+
* Narrow subpath export for filesystem and path primitives. Import this entry
|
|
5
|
+
* point when you need cross-platform path/fs helpers without pulling in the
|
|
6
|
+
* linkAuth, git, skill-testing, or macro-expansion machinery from the full
|
|
7
|
+
* `"."` barrel.
|
|
8
|
+
*/
|
|
9
|
+
export { normalizePath, normalizedTmpdir, mkdirSyncReal, isAbsolutePath, isAbsoluteAnyPlatform, hasParentTraversalSegment, toAbsolutePath, getRelativePath, toForwardSlash, safePath, resolveFromImportMeta, dynamicImportPath, } from './path-utils.js';
|
|
10
|
+
export { copyDirectory, verifyCaseSensitiveFilename } from './fs-utils.js';
|
|
11
|
+
//# sourceMappingURL=fs.js.map
|
package/dist/fs.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,cAAc,EACd,eAAe,EACf,cAAc,EACd,QAAQ,EACR,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expand-macro.d.ts","sourceRoot":"","sources":["../../src/link-auth/expand-macro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"expand-macro.d.ts","sourceRoot":"","sources":["../../src/link-auth/expand-macro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAyCH;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,MAAM,EAAE;CAIvD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAYzB"}
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
import { readFileSync } from 'node:fs';
|
|
17
17
|
import { fileURLToPath } from 'node:url';
|
|
18
18
|
import { parse as parseYaml } from 'yaml';
|
|
19
|
-
const macrosPath = fileURLToPath(new URL('./macros.yaml', import.meta.url));
|
|
20
19
|
let macrosCache;
|
|
21
20
|
/**
|
|
22
21
|
* Load macros lazily on first use rather than at module init.
|
|
@@ -28,13 +27,16 @@ let macrosCache;
|
|
|
28
27
|
* unconditionally, before the mock-setup intent reaches our file.
|
|
29
28
|
*
|
|
30
29
|
* Lazy load makes module import side-effect-free; only callers of
|
|
31
|
-
* `expandMacro` pay the fs cost.
|
|
30
|
+
* `expandMacro` pay the fs cost. `macrosPath` is also computed here (not at
|
|
31
|
+
* module top level) so that merely importing this module leaves no `new URL()`
|
|
32
|
+
* reference for bundler static analysis to trip over.
|
|
32
33
|
*/
|
|
33
34
|
function getMacros() {
|
|
34
35
|
if (macrosCache !== undefined)
|
|
35
36
|
return macrosCache;
|
|
36
37
|
// Path is derived from `import.meta.url`, not user input — points at the
|
|
37
38
|
// shipped macros.yaml asset next to this module in both src and dist trees.
|
|
39
|
+
const macrosPath = fileURLToPath(new URL('./macros.yaml', import.meta.url));
|
|
38
40
|
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
39
41
|
const macrosFileContent = readFileSync(macrosPath, 'utf8');
|
|
40
42
|
const parsed = parseYaml(macrosFileContent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expand-macro.js","sourceRoot":"","sources":["../../src/link-auth/expand-macro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1C,
|
|
1
|
+
{"version":3,"file":"expand-macro.js","sourceRoot":"","sources":["../../src/link-auth/expand-macro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1C,IAAI,WAAgE,CAAC;AAErE;;;;;;;;;;;;;GAaG;AACH,SAAS,SAAS;IAChB,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,WAAW,CAAC;IAElD,yEAAyE;IACzE,4EAA4E;IAC5E,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5E,mEAAmE;IACnE,MAAM,iBAAiB,GAAG,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,SAAS,CAAC,iBAAiB,CAAY,CAAC;IAEvD,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;IAClG,CAAC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YAAY,CAAC,MAA+B;IACnD,MAAM,MAAM,GAA4C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5E,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACnD,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,qBAAqB,CAAC,CAAC;QACpE,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,aAAa,CAAC,CAAU;IAC/B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
* argv. **Not** passed through a shell — operators (`|`, `&&`, `$(...)`)
|
|
10
10
|
* become literal argv elements, per the design's §6.1 sharp-edge note.
|
|
11
11
|
*
|
|
12
|
+
* Command sources can be disabled at runtime with `VAT_LINKAUTH_ALLOW_COMMAND=0`
|
|
13
|
+
* (or by passing `allowCommand: false` in deps). Useful in security-sensitive
|
|
14
|
+
* environments where arbitrary command execution is undesirable.
|
|
15
|
+
*
|
|
12
16
|
* Returns `undefined` if every source fails or yields an empty/whitespace
|
|
13
17
|
* value — the caller's `resolveAuthenticatedUrl` translates that to the
|
|
14
18
|
* `unverified` outcome (surfaced as `LINK_AUTH_UNVERIFIED` by the validator).
|
|
@@ -37,11 +41,35 @@ export interface TokenResolutionDeps {
|
|
|
37
41
|
success: boolean;
|
|
38
42
|
stdout: string;
|
|
39
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* Whether `{ command: ... }` sources are allowed. Defaults to reading
|
|
46
|
+
* `VAT_LINKAUTH_ALLOW_COMMAND` from the resolved `env` map (not ambient
|
|
47
|
+
* `process.env`), so a caller supplying a curated `deps.env` can control the
|
|
48
|
+
* flag without touching real process state. Set to `false` (or set
|
|
49
|
+
* `VAT_LINKAUTH_ALLOW_COMMAND=0` in the env) to skip all command sources and
|
|
50
|
+
* rely solely on env-var sources — useful in locked-down CI or security reviews.
|
|
51
|
+
*/
|
|
52
|
+
readonly allowCommand: boolean;
|
|
40
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Return a copy of the given env with all `GIT_*` keys removed. Case-insensitive
|
|
56
|
+
* on the key so Windows env vars (which are case-insensitive at the OS level,
|
|
57
|
+
* though `process.env` preserves original case) can't sneak through as e.g.
|
|
58
|
+
* `Git_Dir`.
|
|
59
|
+
*
|
|
60
|
+
* Exported for unit testing and for callers assembling their own `runCommand`
|
|
61
|
+
* who want the exact same scrub `defaultRunCommand` applies.
|
|
62
|
+
*
|
|
63
|
+
* Rationale: `vat resources validate` is often invoked from git pre-commit
|
|
64
|
+
* hooks, which pre-set `GIT_DIR` / `GIT_WORK_TREE` / `GIT_INDEX_FILE`. These
|
|
65
|
+
* poison any nested tool that shells out to git, notably `gh auth token`.
|
|
66
|
+
*/
|
|
67
|
+
export declare function scrubGitEnv(source: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
41
68
|
/**
|
|
42
69
|
* Default `runCommand` implementation — exported so callers that want to
|
|
43
70
|
* memoize per-validate-run can wrap it without duplicating the spawn logic.
|
|
44
|
-
* Forwards to `safeExecResult` (no shell, argv-based)
|
|
71
|
+
* Forwards to `safeExecResult` (no shell, argv-based), with `GIT_*` vars
|
|
72
|
+
* stripped from the child env — see {@link scrubGitEnv}.
|
|
45
73
|
*/
|
|
46
74
|
export declare const defaultRunCommand: TokenResolutionDeps['runCommand'];
|
|
47
75
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-token.d.ts","sourceRoot":"","sources":["../../src/link-auth/resolve-token.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"resolve-token.d.ts","sourceRoot":"","sources":["../../src/link-auth/resolve-token.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAEtG,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAEjD;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,KAAK;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAEvF;;;;;;;OAOG;IACH,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;CAChC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAIxE;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,mBAAmB,CAAC,YAAY,CAO/D,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,SAAS,WAAW,EAAE,EAC/B,IAAI,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAClC,MAAM,GAAG,SAAS,CAWpB"}
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
* argv. **Not** passed through a shell — operators (`|`, `&&`, `$(...)`)
|
|
10
10
|
* become literal argv elements, per the design's §6.1 sharp-edge note.
|
|
11
11
|
*
|
|
12
|
+
* Command sources can be disabled at runtime with `VAT_LINKAUTH_ALLOW_COMMAND=0`
|
|
13
|
+
* (or by passing `allowCommand: false` in deps). Useful in security-sensitive
|
|
14
|
+
* environments where arbitrary command execution is undesirable.
|
|
15
|
+
*
|
|
12
16
|
* Returns `undefined` if every source fails or yields an empty/whitespace
|
|
13
17
|
* value — the caller's `resolveAuthenticatedUrl` translates that to the
|
|
14
18
|
* `unverified` outcome (surfaced as `LINK_AUTH_UNVERIFIED` by the validator).
|
|
@@ -17,10 +21,27 @@
|
|
|
17
21
|
* `safeExecSync`-backed, `shell: false`).
|
|
18
22
|
*/
|
|
19
23
|
import { safeExecResult } from '../safe-exec.js';
|
|
24
|
+
/**
|
|
25
|
+
* Return a copy of the given env with all `GIT_*` keys removed. Case-insensitive
|
|
26
|
+
* on the key so Windows env vars (which are case-insensitive at the OS level,
|
|
27
|
+
* though `process.env` preserves original case) can't sneak through as e.g.
|
|
28
|
+
* `Git_Dir`.
|
|
29
|
+
*
|
|
30
|
+
* Exported for unit testing and for callers assembling their own `runCommand`
|
|
31
|
+
* who want the exact same scrub `defaultRunCommand` applies.
|
|
32
|
+
*
|
|
33
|
+
* Rationale: `vat resources validate` is often invoked from git pre-commit
|
|
34
|
+
* hooks, which pre-set `GIT_DIR` / `GIT_WORK_TREE` / `GIT_INDEX_FILE`. These
|
|
35
|
+
* poison any nested tool that shells out to git, notably `gh auth token`.
|
|
36
|
+
*/
|
|
37
|
+
export function scrubGitEnv(source) {
|
|
38
|
+
return Object.fromEntries(Object.entries(source).filter(([k]) => !k.toUpperCase().startsWith('GIT_')));
|
|
39
|
+
}
|
|
20
40
|
/**
|
|
21
41
|
* Default `runCommand` implementation — exported so callers that want to
|
|
22
42
|
* memoize per-validate-run can wrap it without duplicating the spawn logic.
|
|
23
|
-
* Forwards to `safeExecResult` (no shell, argv-based)
|
|
43
|
+
* Forwards to `safeExecResult` (no shell, argv-based), with `GIT_*` vars
|
|
44
|
+
* stripped from the child env — see {@link scrubGitEnv}.
|
|
24
45
|
*/
|
|
25
46
|
export const defaultRunCommand = (argv) => {
|
|
26
47
|
if (argv.length === 0)
|
|
@@ -28,7 +49,7 @@ export const defaultRunCommand = (argv) => {
|
|
|
28
49
|
const [bin, ...args] = argv;
|
|
29
50
|
if (bin === undefined)
|
|
30
51
|
return { success: false, stdout: '' };
|
|
31
|
-
const result = safeExecResult(bin, [...args], { encoding: 'utf8' });
|
|
52
|
+
const result = safeExecResult(bin, [...args], { encoding: 'utf8', env: scrubGitEnv(process.env) });
|
|
32
53
|
const stdout = typeof result.stdout === 'string' ? result.stdout : result.stdout.toString('utf8');
|
|
33
54
|
return { success: result.success, stdout };
|
|
34
55
|
};
|
|
@@ -42,7 +63,10 @@ export const defaultRunCommand = (argv) => {
|
|
|
42
63
|
export function resolveToken(sources, deps) {
|
|
43
64
|
const env = deps?.env ?? process.env;
|
|
44
65
|
const runCommand = deps?.runCommand ?? defaultRunCommand;
|
|
66
|
+
const allowCommand = deps?.allowCommand ?? (env['VAT_LINKAUTH_ALLOW_COMMAND'] !== '0');
|
|
45
67
|
for (const source of sources) {
|
|
68
|
+
if (!allowCommand && 'command' in source)
|
|
69
|
+
continue;
|
|
46
70
|
const value = tryResolveSource(source, env, runCommand);
|
|
47
71
|
if (value !== undefined && value.length > 0)
|
|
48
72
|
return value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-token.js","sourceRoot":"","sources":["../../src/link-auth/resolve-token.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"resolve-token.js","sourceRoot":"","sources":["../../src/link-auth/resolve-token.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AA8BjD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CAAC,MAAyB;IACnD,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAA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MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vibe-agent-toolkit/utils/process
|
|
3
|
+
*
|
|
4
|
+
* Narrow subpath export for process/command-execution primitives. Import this
|
|
5
|
+
* entry point when you need cross-platform spawn helpers without pulling in
|
|
6
|
+
* the linkAuth, git, skill-testing, or macro-expansion machinery from the
|
|
7
|
+
* full `"."` barrel.
|
|
8
|
+
*/
|
|
9
|
+
export { type SafeExecOptions, type SafeExecResult, CommandExecutionError, safeExecSync, safeExecResult, isToolAvailable, getToolVersion, hasShellSyntax, safeExecFromString, } from './safe-exec.js';
|
|
10
|
+
//# sourceMappingURL=process.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../src/process.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,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"}
|
package/dist/process.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vibe-agent-toolkit/utils/process
|
|
3
|
+
*
|
|
4
|
+
* Narrow subpath export for process/command-execution primitives. Import this
|
|
5
|
+
* entry point when you need cross-platform spawn helpers without pulling in
|
|
6
|
+
* the linkAuth, git, skill-testing, or macro-expansion machinery from the
|
|
7
|
+
* full `"."` barrel.
|
|
8
|
+
*/
|
|
9
|
+
export { CommandExecutionError, safeExecSync, safeExecResult, isToolAvailable, getToolVersion, hasShellSyntax, safeExecFromString, } from './safe-exec.js';
|
|
10
|
+
//# sourceMappingURL=process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.js","sourceRoot":"","sources":["../src/process.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAGL,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,MAAM,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibe-agent-toolkit/utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.40-rc.2",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Core utility functions
|
|
5
|
+
"description": "Core utility functions shared across the vibe-agent-toolkit packages",
|
|
6
|
+
"sideEffects": false,
|
|
6
7
|
"keywords": [
|
|
7
8
|
"typescript",
|
|
8
9
|
"utilities",
|
|
@@ -16,6 +17,14 @@
|
|
|
16
17
|
".": {
|
|
17
18
|
"types": "./dist/index.d.ts",
|
|
18
19
|
"import": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./process": {
|
|
22
|
+
"types": "./dist/process.d.ts",
|
|
23
|
+
"import": "./dist/process.js"
|
|
24
|
+
},
|
|
25
|
+
"./fs": {
|
|
26
|
+
"types": "./dist/fs.d.ts",
|
|
27
|
+
"import": "./dist/fs.js"
|
|
19
28
|
}
|
|
20
29
|
},
|
|
21
30
|
"files": [
|