@sayknow-cli/utils 0.4.2 → 0.4.3

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.
@@ -0,0 +1,14 @@
1
+ export declare class TempDir {
2
+ #private;
3
+ private constructor();
4
+ static createSync(prefix?: string): TempDir;
5
+ static create(prefix?: string): Promise<TempDir>;
6
+ path(): string;
7
+ absolute(): string;
8
+ remove(): Promise<void>;
9
+ removeSync(): void;
10
+ toString(): string;
11
+ join(...paths: string[]): string;
12
+ [Symbol.asyncDispose](): Promise<void>;
13
+ [Symbol.dispose](): void;
14
+ }
@@ -0,0 +1,3 @@
1
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
2
+ export declare function asRecord(value: unknown): Record<string, unknown> | null;
3
+ export declare function toError(value: unknown): Error;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Cache policy for which lookups.
3
+ */
4
+ export declare const enum WhichCachePolicy {
5
+ /**
6
+ * Use cached result if available.
7
+ */
8
+ Cached = 0,
9
+ /**
10
+ * Bypass cache and perform a new lookup.
11
+ */
12
+ Bypass = 1,
13
+ /**
14
+ * Always update cache.
15
+ */
16
+ Fresh = 2,
17
+ /**
18
+ * Read-only, serves from cache if present, but doesn't write.
19
+ */
20
+ ReadOnly = 3
21
+ }
22
+ export interface WhichOptions extends Bun.WhichOptions {
23
+ /**
24
+ * Cache policy for the lookup.
25
+ * Defaults to `WhichCachePolicy.Fresh`.
26
+ */
27
+ cache?: WhichCachePolicy;
28
+ }
29
+ declare function darwinWhich(command: string, _options?: Bun.WhichOptions): string | null;
30
+ export declare const whichFresh: typeof darwinWhich;
31
+ /**
32
+ * Locate binary on PATH (with flexible caching).
33
+ *
34
+ * @param command - Binary name to resolve
35
+ * @param options - Bun.WhichOptions plus `cache` control
36
+ * @returns Filesystem path if found, else null
37
+ */
38
+ export declare function $which(command: string, options?: WhichOptions): string | null;
39
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@sayknow-cli/utils",
4
- "version": "0.4.2",
4
+ "version": "0.4.3",
5
5
  "description": "Shared utilities for pi packages",
6
6
  "homepage": "https://sayknow-cli.com",
7
7
  "author": "jaybeyond",
@@ -21,7 +21,7 @@
21
21
  "streams"
22
22
  ],
23
23
  "main": "./src/index.ts",
24
- "types": "./src/index.ts",
24
+ "types": "./dist/types/index.d.ts",
25
25
  "scripts": {
26
26
  "check": "biome check . && bun run check:types",
27
27
  "check:types": "tsc -p tsconfig.json --noEmit",
@@ -31,7 +31,7 @@
31
31
  "fmt": "biome format --write ."
32
32
  },
33
33
  "dependencies": {
34
- "@sayknow-cli/natives": "0.4.2",
34
+ "@sayknow-cli/natives": "0.4.3",
35
35
  "beautiful-mermaid": "^1.1.3",
36
36
  "handlebars": "^4.7.9",
37
37
  "winston": "^3.19.0",
@@ -44,15 +44,16 @@
44
44
  "bun": ">=1.3.14"
45
45
  },
46
46
  "files": [
47
- "src"
47
+ "src",
48
+ "dist/types"
48
49
  ],
49
50
  "exports": {
50
51
  ".": {
51
- "types": "./src/index.ts",
52
+ "types": "./dist/types/index.d.ts",
52
53
  "import": "./src/index.ts"
53
54
  },
54
55
  "./*": {
55
- "types": "./src/*.ts",
56
+ "types": "./dist/types/*.d.ts",
56
57
  "import": "./src/*.ts"
57
58
  },
58
59
  "./*.js": "./src/*.ts"