agent-config-detect 0.0.0

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.
Files changed (164) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/dist/cjs/errors.js +105 -0
  4. package/dist/cjs/errors.js.map +1 -0
  5. package/dist/cjs/index.js +89 -0
  6. package/dist/cjs/index.js.map +1 -0
  7. package/dist/cjs/platform/Platform.js +13 -0
  8. package/dist/cjs/platform/Platform.js.map +1 -0
  9. package/dist/cjs/platform/TestPlatform.js +65 -0
  10. package/dist/cjs/platform/TestPlatform.js.map +1 -0
  11. package/dist/cjs/platform/index.js +118 -0
  12. package/dist/cjs/platform/index.js.map +1 -0
  13. package/dist/cjs/platform/internal/common.js +40 -0
  14. package/dist/cjs/platform/internal/common.js.map +1 -0
  15. package/dist/cjs/platform/internal/darwin.js +40 -0
  16. package/dist/cjs/platform/internal/darwin.js.map +1 -0
  17. package/dist/cjs/platform/internal/linux.js +69 -0
  18. package/dist/cjs/platform/internal/linux.js.map +1 -0
  19. package/dist/cjs/platform/internal/testUtils.js +79 -0
  20. package/dist/cjs/platform/internal/testUtils.js.map +1 -0
  21. package/dist/cjs/platform/internal/windows.js +61 -0
  22. package/dist/cjs/platform/internal/windows.js.map +1 -0
  23. package/dist/cjs/types/ConfigResource.js +44 -0
  24. package/dist/cjs/types/ConfigResource.js.map +1 -0
  25. package/dist/cjs/types/DirectoryResource.js +42 -0
  26. package/dist/cjs/types/DirectoryResource.js.map +1 -0
  27. package/dist/cjs/types/DirectoryStructure.js +56 -0
  28. package/dist/cjs/types/DirectoryStructure.js.map +1 -0
  29. package/dist/cjs/types/EnvValue.js +199 -0
  30. package/dist/cjs/types/EnvValue.js.map +1 -0
  31. package/dist/cjs/types/FileFormat.js +25 -0
  32. package/dist/cjs/types/FileFormat.js.map +1 -0
  33. package/dist/cjs/types/HarnessKind.js +130 -0
  34. package/dist/cjs/types/HarnessKind.js.map +1 -0
  35. package/dist/cjs/types/InstallationStatus.js +119 -0
  36. package/dist/cjs/types/InstallationStatus.js.map +1 -0
  37. package/dist/cjs/types/PathType.js +25 -0
  38. package/dist/cjs/types/PathType.js.map +1 -0
  39. package/dist/cjs/types/ResourceKind.js +26 -0
  40. package/dist/cjs/types/ResourceKind.js.map +1 -0
  41. package/dist/cjs/types/Scope.js +59 -0
  42. package/dist/cjs/types/Scope.js.map +1 -0
  43. package/dist/cjs/types/index.js +116 -0
  44. package/dist/cjs/types/index.js.map +1 -0
  45. package/dist/dts/errors.d.ts +125 -0
  46. package/dist/dts/errors.d.ts.map +1 -0
  47. package/dist/dts/index.d.ts +11 -0
  48. package/dist/dts/index.d.ts.map +1 -0
  49. package/dist/dts/platform/Platform.d.ts +61 -0
  50. package/dist/dts/platform/Platform.d.ts.map +1 -0
  51. package/dist/dts/platform/TestPlatform.d.ts +52 -0
  52. package/dist/dts/platform/TestPlatform.d.ts.map +1 -0
  53. package/dist/dts/platform/index.d.ts +20 -0
  54. package/dist/dts/platform/index.d.ts.map +1 -0
  55. package/dist/dts/platform/internal/common.d.ts +20 -0
  56. package/dist/dts/platform/internal/common.d.ts.map +1 -0
  57. package/dist/dts/platform/internal/darwin.d.ts +33 -0
  58. package/dist/dts/platform/internal/darwin.d.ts.map +1 -0
  59. package/dist/dts/platform/internal/linux.d.ts +29 -0
  60. package/dist/dts/platform/internal/linux.d.ts.map +1 -0
  61. package/dist/dts/platform/internal/testUtils.d.ts +32 -0
  62. package/dist/dts/platform/internal/testUtils.d.ts.map +1 -0
  63. package/dist/dts/platform/internal/windows.d.ts +38 -0
  64. package/dist/dts/platform/internal/windows.d.ts.map +1 -0
  65. package/dist/dts/types/ConfigResource.d.ts +34 -0
  66. package/dist/dts/types/ConfigResource.d.ts.map +1 -0
  67. package/dist/dts/types/DirectoryResource.d.ts +33 -0
  68. package/dist/dts/types/DirectoryResource.d.ts.map +1 -0
  69. package/dist/dts/types/DirectoryStructure.d.ts +61 -0
  70. package/dist/dts/types/DirectoryStructure.d.ts.map +1 -0
  71. package/dist/dts/types/EnvValue.d.ts +102 -0
  72. package/dist/dts/types/EnvValue.d.ts.map +1 -0
  73. package/dist/dts/types/FileFormat.d.ts +22 -0
  74. package/dist/dts/types/FileFormat.d.ts.map +1 -0
  75. package/dist/dts/types/HarnessKind.d.ts +45 -0
  76. package/dist/dts/types/HarnessKind.d.ts.map +1 -0
  77. package/dist/dts/types/InstallationStatus.d.ts +89 -0
  78. package/dist/dts/types/InstallationStatus.d.ts.map +1 -0
  79. package/dist/dts/types/PathType.d.ts +22 -0
  80. package/dist/dts/types/PathType.d.ts.map +1 -0
  81. package/dist/dts/types/ResourceKind.d.ts +23 -0
  82. package/dist/dts/types/ResourceKind.d.ts.map +1 -0
  83. package/dist/dts/types/Scope.d.ts +59 -0
  84. package/dist/dts/types/Scope.d.ts.map +1 -0
  85. package/dist/dts/types/index.d.ts +16 -0
  86. package/dist/dts/types/index.d.ts.map +1 -0
  87. package/dist/esm/errors.js +87 -0
  88. package/dist/esm/errors.js.map +1 -0
  89. package/dist/esm/index.js +14 -0
  90. package/dist/esm/index.js.map +1 -0
  91. package/dist/esm/package.json +4 -0
  92. package/dist/esm/platform/Platform.js +6 -0
  93. package/dist/esm/platform/Platform.js.map +1 -0
  94. package/dist/esm/platform/TestPlatform.js +54 -0
  95. package/dist/esm/platform/TestPlatform.js.map +1 -0
  96. package/dist/esm/platform/index.js +68 -0
  97. package/dist/esm/platform/index.js.map +1 -0
  98. package/dist/esm/platform/internal/common.js +30 -0
  99. package/dist/esm/platform/internal/common.js.map +1 -0
  100. package/dist/esm/platform/internal/darwin.js +33 -0
  101. package/dist/esm/platform/internal/darwin.js.map +1 -0
  102. package/dist/esm/platform/internal/linux.js +62 -0
  103. package/dist/esm/platform/internal/linux.js.map +1 -0
  104. package/dist/esm/platform/internal/testUtils.js +70 -0
  105. package/dist/esm/platform/internal/testUtils.js.map +1 -0
  106. package/dist/esm/platform/internal/windows.js +54 -0
  107. package/dist/esm/platform/internal/windows.js.map +1 -0
  108. package/dist/esm/types/ConfigResource.js +36 -0
  109. package/dist/esm/types/ConfigResource.js.map +1 -0
  110. package/dist/esm/types/DirectoryResource.js +34 -0
  111. package/dist/esm/types/DirectoryResource.js.map +1 -0
  112. package/dist/esm/types/DirectoryStructure.js +45 -0
  113. package/dist/esm/types/DirectoryStructure.js.map +1 -0
  114. package/dist/esm/types/EnvValue.js +182 -0
  115. package/dist/esm/types/EnvValue.js.map +1 -0
  116. package/dist/esm/types/FileFormat.js +18 -0
  117. package/dist/esm/types/FileFormat.js.map +1 -0
  118. package/dist/esm/types/HarnessKind.js +120 -0
  119. package/dist/esm/types/HarnessKind.js.map +1 -0
  120. package/dist/esm/types/InstallationStatus.js +101 -0
  121. package/dist/esm/types/InstallationStatus.js.map +1 -0
  122. package/dist/esm/types/PathType.js +18 -0
  123. package/dist/esm/types/PathType.js.map +1 -0
  124. package/dist/esm/types/ResourceKind.js +19 -0
  125. package/dist/esm/types/ResourceKind.js.map +1 -0
  126. package/dist/esm/types/Scope.js +46 -0
  127. package/dist/esm/types/Scope.js.map +1 -0
  128. package/dist/esm/types/index.js +17 -0
  129. package/dist/esm/types/index.js.map +1 -0
  130. package/errors/package.json +6 -0
  131. package/package.json +135 -0
  132. package/platform/Platform/package.json +6 -0
  133. package/platform/TestPlatform/package.json +6 -0
  134. package/src/errors.ts +135 -0
  135. package/src/index.ts +27 -0
  136. package/src/platform/Platform.ts +64 -0
  137. package/src/platform/TestPlatform.ts +93 -0
  138. package/src/platform/index.ts +72 -0
  139. package/src/platform/internal/common.ts +30 -0
  140. package/src/platform/internal/darwin.ts +43 -0
  141. package/src/platform/internal/linux.ts +66 -0
  142. package/src/platform/internal/testUtils.ts +82 -0
  143. package/src/platform/internal/windows.ts +58 -0
  144. package/src/types/ConfigResource.ts +48 -0
  145. package/src/types/DirectoryResource.ts +45 -0
  146. package/src/types/DirectoryStructure.ts +64 -0
  147. package/src/types/EnvValue.ts +189 -0
  148. package/src/types/FileFormat.ts +36 -0
  149. package/src/types/HarnessKind.ts +150 -0
  150. package/src/types/InstallationStatus.ts +119 -0
  151. package/src/types/PathType.ts +24 -0
  152. package/src/types/ResourceKind.ts +27 -0
  153. package/src/types/Scope.ts +57 -0
  154. package/src/types/index.ts +17 -0
  155. package/types/ConfigResource/package.json +6 -0
  156. package/types/DirectoryResource/package.json +6 -0
  157. package/types/DirectoryStructure/package.json +6 -0
  158. package/types/EnvValue/package.json +6 -0
  159. package/types/FileFormat/package.json +6 -0
  160. package/types/HarnessKind/package.json +6 -0
  161. package/types/InstallationStatus/package.json +6 -0
  162. package/types/PathType/package.json +6 -0
  163. package/types/ResourceKind/package.json +6 -0
  164. package/types/Scope/package.json +6 -0
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Categories of resources that harnesses manage in named directories.
3
+ *
4
+ * Used with `HarnessKind.directoryNames` to query expected
5
+ * directory naming conventions.
6
+ *
7
+ * @module
8
+ */
9
+ import { Schema } from "effect";
10
+ /**
11
+ * Resource kind schema - represents the different types of resources
12
+ * that harnesses can manage.
13
+ */
14
+ export declare const ResourceKind: Schema.Literal<["Skills", "Commands", "Agents", "Plugins"]>;
15
+ /**
16
+ * Resource kind type.
17
+ */
18
+ export type ResourceKind = typeof ResourceKind.Type;
19
+ /**
20
+ * All supported resource kinds.
21
+ */
22
+ export declare const ResourceKindAll: readonly ["Skills", "Commands", "Agents", "Plugins"];
23
+ //# sourceMappingURL=ResourceKind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResourceKind.d.ts","sourceRoot":"","sources":["../../../src/types/ResourceKind.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B;;;GAGG;AACH,eAAO,MAAM,YAAY,6DAA4D,CAAA;AAErF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAA;AAEnD;;GAEG;AACH,eAAO,MAAM,eAAe,sDAE3B,CAAA"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Scope for path resolution.
3
+ *
4
+ * Determines whether to look up global (user-level) or
5
+ * project-local configuration paths.
6
+ *
7
+ * @module
8
+ */
9
+ import { Schema } from "effect";
10
+ declare const Global_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Readonly<A> & {
11
+ readonly _tag: "Global";
12
+ };
13
+ /**
14
+ * User-level global configuration (e.g., `~/.config/...`).
15
+ */
16
+ export declare class Global extends Global_base<{}> {
17
+ }
18
+ declare const Project_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Readonly<A> & {
19
+ readonly _tag: "Project";
20
+ };
21
+ /**
22
+ * Project-local configuration (e.g., `.claude/` in project root).
23
+ */
24
+ export declare class Project extends Project_base<{
25
+ readonly path: string;
26
+ }> {
27
+ }
28
+ declare const Custom_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Readonly<A> & {
29
+ readonly _tag: "Custom";
30
+ };
31
+ /**
32
+ * Custom path for profile-scoped resources (inherits harness directory structure).
33
+ */
34
+ export declare class Custom extends Custom_base<{
35
+ readonly path: string;
36
+ }> {
37
+ }
38
+ /**
39
+ * Scope type - union of all scope variants.
40
+ */
41
+ export type Scope = Global | Project | Custom;
42
+ /**
43
+ * Scope schema for serialization.
44
+ */
45
+ export declare const Scope: Schema.Schema<Scope>;
46
+ /**
47
+ * Creates a global scope.
48
+ */
49
+ export declare const global: () => Scope;
50
+ /**
51
+ * Creates a project scope with the given path.
52
+ */
53
+ export declare const project: (path: string) => Scope;
54
+ /**
55
+ * Creates a custom scope with the given path.
56
+ */
57
+ export declare const custom: (path: string) => Scope;
58
+ export {};
59
+ //# sourceMappingURL=Scope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Scope.d.ts","sourceRoot":"","sources":["../../../src/types/Scope.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAQ,MAAM,EAAE,MAAM,QAAQ,CAAA;;;;AAErC;;GAEG;AACH,qBAAa,MAAO,SAAQ,YAA2B,EAAE,CAAC;CAAG;;;;AAE7D;;GAEG;AACH,qBAAa,OAAQ,SAAQ,aAA4B;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB,CAAC;CAAG;;;;AAEL;;GAEG;AACH,qBAAa,MAAO,SAAQ,YAA2B;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB,CAAC;CAAG;AAEL;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;AAE7C;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAId,CAAA;AAEzB;;GAEG;AACH,eAAO,MAAM,MAAM,QAAO,KAAqB,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,KAAG,KAA8B,CAAA;AAErE;;GAEG;AACH,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,KAAG,KAA6B,CAAA"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Core type definitions for harness path resolution.
3
+ *
4
+ * @module
5
+ */
6
+ export * from "./ConfigResource.js";
7
+ export * from "./DirectoryResource.js";
8
+ export * from "./DirectoryStructure.js";
9
+ export * from "./EnvValue.js";
10
+ export * from "./FileFormat.js";
11
+ export * from "./HarnessKind.js";
12
+ export * from "./InstallationStatus.js";
13
+ export * from "./PathType.js";
14
+ export * from "./ResourceKind.js";
15
+ export * from "./Scope.js";
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,yBAAyB,CAAA;AACvC,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Error types for harness operations.
3
+ *
4
+ * @module
5
+ */
6
+ import { Data } from "effect";
7
+ /**
8
+ * The requested harness was not found on this system.
9
+ */
10
+ export class NotFoundError extends /*#__PURE__*/Data.TaggedError("NotFoundError") {}
11
+ /**
12
+ * The path is invalid or inaccessible.
13
+ */
14
+ export class InvalidPathError extends /*#__PURE__*/Data.TaggedError("InvalidPathError") {
15
+ get message() {
16
+ return `invalid path: ${this.path}`;
17
+ }
18
+ }
19
+ /**
20
+ * An environment variable could not be read.
21
+ */
22
+ export class EnvVarError extends /*#__PURE__*/Data.TaggedError("EnvVarError") {
23
+ get message() {
24
+ return `environment variable error: ${this.cause.message}`;
25
+ }
26
+ }
27
+ /**
28
+ * The current platform is not supported.
29
+ */
30
+ export class UnsupportedPlatformError extends /*#__PURE__*/Data.TaggedError("UnsupportedPlatformError") {
31
+ get message() {
32
+ return "unsupported platform";
33
+ }
34
+ }
35
+ /**
36
+ * An I/O error occurred.
37
+ */
38
+ export class IoError extends /*#__PURE__*/Data.TaggedError("IoError") {
39
+ get message() {
40
+ return `IO error: ${this.cause.message}`;
41
+ }
42
+ }
43
+ /**
44
+ * MCP server uses unsupported features for target harness.
45
+ */
46
+ export class UnsupportedMcpConfigError extends /*#__PURE__*/Data.TaggedError("UnsupportedMcpConfigError") {
47
+ get message() {
48
+ return `unsupported MCP config for ${this.harness}: ${this.reason}`;
49
+ }
50
+ }
51
+ /**
52
+ * Binary detection failed due to system error.
53
+ */
54
+ export class BinaryDetectionError extends /*#__PURE__*/Data.TaggedError("BinaryDetectionError") {}
55
+ /**
56
+ * The requested scope is not supported by this harness.
57
+ */
58
+ export class UnsupportedScopeError extends /*#__PURE__*/Data.TaggedError("UnsupportedScopeError") {
59
+ get message() {
60
+ return `${this.harness} does not support ${this.scope} scope`;
61
+ }
62
+ }
63
+ /**
64
+ * YAML parsing failed.
65
+ */
66
+ export class YamlParseError extends /*#__PURE__*/Data.TaggedError("YamlParseError") {
67
+ get message() {
68
+ return `YAML parse error: ${this.cause.message}`;
69
+ }
70
+ }
71
+ /**
72
+ * A required field is missing from the input.
73
+ */
74
+ export class MissingFieldError extends /*#__PURE__*/Data.TaggedError("MissingFieldError") {
75
+ get message() {
76
+ return `missing required field: ${this.field}`;
77
+ }
78
+ }
79
+ /**
80
+ * An environment variable referenced by EnvValue is not set.
81
+ */
82
+ export class MissingEnvVarError extends /*#__PURE__*/Data.TaggedError("MissingEnvVarError") {
83
+ get message() {
84
+ return `missing environment variable: ${this.name}`;
85
+ }
86
+ }
87
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","names":["Data","NotFoundError","TaggedError","InvalidPathError","message","path","EnvVarError","cause","UnsupportedPlatformError","IoError","UnsupportedMcpConfigError","harness","reason","BinaryDetectionError","UnsupportedScopeError","scope","YamlParseError","MissingFieldError","field","MissingEnvVarError","name"],"sources":["../../src/errors.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;AAKA,SAASA,IAAI,QAAQ,QAAQ;AAE7B;;;AAGA,OAAM,MAAOC,aAAc,sBAAQD,IAAI,CAACE,WAAW,CAAC,eAAe,CAEjE;AAEF;;;AAGA,OAAM,MAAOC,gBAAiB,sBAAQH,IAAI,CAACE,WAAW,CAAC,kBAAkB,CAEvE;EACA,IAAIE,OAAOA,CAAA;IACT,OAAO,iBAAiB,IAAI,CAACC,IAAI,EAAE;EACrC;;AAGF;;;AAGA,OAAM,MAAOC,WAAY,sBAAQN,IAAI,CAACE,WAAW,CAAC,aAAa,CAE7D;EACA,IAAIE,OAAOA,CAAA;IACT,OAAO,+BAA+B,IAAI,CAACG,KAAK,CAACH,OAAO,EAAE;EAC5D;;AAGF;;;AAGA,OAAM,MAAOI,wBAAyB,sBAAQR,IAAI,CAACE,WAAW,CAAC,0BAA0B,CAAK;EAC5F,IAAIE,OAAOA,CAAA;IACT,OAAO,sBAAsB;EAC/B;;AAGF;;;AAGA,OAAM,MAAOK,OAAQ,sBAAQT,IAAI,CAACE,WAAW,CAAC,SAAS,CAErD;EACA,IAAIE,OAAOA,CAAA;IACT,OAAO,aAAa,IAAI,CAACG,KAAK,CAACH,OAAO,EAAE;EAC1C;;AAGF;;;AAGA,OAAM,MAAOM,yBAA0B,sBAAQV,IAAI,CAACE,WAAW,CAAC,2BAA2B,CAGzF;EACA,IAAIE,OAAOA,CAAA;IACT,OAAO,8BAA8B,IAAI,CAACO,OAAO,KAAK,IAAI,CAACC,MAAM,EAAE;EACrE;;AAGF;;;AAGA,OAAM,MAAOC,oBAAqB,sBAAQb,IAAI,CAACE,WAAW,CAAC,sBAAsB,CAE/E;AAEF;;;AAGA,OAAM,MAAOY,qBAAsB,sBAAQd,IAAI,CAACE,WAAW,CAAC,uBAAuB,CAGjF;EACA,IAAIE,OAAOA,CAAA;IACT,OAAO,GAAG,IAAI,CAACO,OAAO,qBAAqB,IAAI,CAACI,KAAK,QAAQ;EAC/D;;AAGF;;;AAGA,OAAM,MAAOC,cAAe,sBAAQhB,IAAI,CAACE,WAAW,CAAC,gBAAgB,CAEnE;EACA,IAAIE,OAAOA,CAAA;IACT,OAAO,qBAAqB,IAAI,CAACG,KAAK,CAACH,OAAO,EAAE;EAClD;;AAGF;;;AAGA,OAAM,MAAOa,iBAAkB,sBAAQjB,IAAI,CAACE,WAAW,CAAC,mBAAmB,CAEzE;EACA,IAAIE,OAAOA,CAAA;IACT,OAAO,2BAA2B,IAAI,CAACc,KAAK,EAAE;EAChD;;AAGF;;;AAGA,OAAM,MAAOC,kBAAmB,sBAAQnB,IAAI,CAACE,WAAW,CAAC,oBAAoB,CAE3E;EACA,IAAIE,OAAOA,CAAA;IACT,OAAO,iCAAiC,IAAI,CAACgB,IAAI,EAAE;EACrD","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Agent config detection library.
3
+ *
4
+ * Port of harness-locate Rust crate to TypeScript + Effect.
5
+ *
6
+ * @module
7
+ */
8
+ // Types
9
+ export * from "./types/index.js";
10
+ // Errors
11
+ export * from "./errors.js";
12
+ // Platform
13
+ export { Platform, PlatformLive, TestPlatform, TestPlatformDarwin, TestPlatformLinux, TestPlatformWindows, withEnv, withoutEnv } from "./platform/index.js";
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["Platform","PlatformLive","TestPlatform","TestPlatformDarwin","TestPlatformLinux","TestPlatformWindows","withEnv","withoutEnv"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;AAQA;AACA,cAAc,kBAAkB;AAEhC;AACA,cAAc,aAAa;AAE3B;AACA,SAEEA,QAAQ,EACRC,YAAY,EAEZC,YAAY,EACZC,kBAAkB,EAClBC,iBAAiB,EACjBC,mBAAmB,EACnBC,OAAO,EACPC,UAAU,QACL,qBAAqB","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ {
2
+ "type": "module",
3
+ "sideEffects": []
4
+ }
@@ -0,0 +1,6 @@
1
+ import { Context } from "effect";
2
+ /**
3
+ * Platform service tag.
4
+ */
5
+ export class Platform extends /*#__PURE__*/Context.Tag("Platform")() {}
6
+ //# sourceMappingURL=Platform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Platform.js","names":["Context","Platform","Tag"],"sources":["../../../src/platform/Platform.ts"],"sourcesContent":[null],"mappings":"AAMA,SAASA,OAAO,QAAQ,QAAQ;AAsDhC;;;AAGA,OAAM,MAAOC,QAAS,sBAAQD,OAAO,CAACE,GAAG,CAAC,UAAU,CAAC,EAA6B","ignoreList":[]}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Test platform layer for mocking in tests.
3
+ *
4
+ * @module
5
+ */
6
+ import { Effect, Layer } from "effect";
7
+ import { Platform } from "./Platform.js";
8
+ /**
9
+ * Creates a test platform layer with the given configuration.
10
+ *
11
+ * Useful for testing platform-dependent code without relying on
12
+ * the actual filesystem or environment.
13
+ */
14
+ export const TestPlatform = (config = {}) => {
15
+ const service = {
16
+ os: config.os ?? "darwin",
17
+ homeDir: Effect.succeed(config.home ?? "/home/testuser"),
18
+ configDir: Effect.succeed(config.config ?? "/home/testuser/.config"),
19
+ dataDir: Effect.succeed(config.data ?? "/home/testuser/.local/share"),
20
+ cacheDir: Effect.succeed(config.cache ?? "/home/testuser/.cache")
21
+ };
22
+ return Layer.succeed(Platform, service);
23
+ };
24
+ /**
25
+ * Creates a macOS test platform.
26
+ */
27
+ export const TestPlatformDarwin = (home = "/Users/testuser") => TestPlatform({
28
+ os: "darwin",
29
+ home,
30
+ config: `${home}/.config`,
31
+ data: `${home}/Library/Application Support`,
32
+ cache: `${home}/Library/Application Support`
33
+ });
34
+ /**
35
+ * Creates a Linux test platform.
36
+ */
37
+ export const TestPlatformLinux = (home = "/home/testuser") => TestPlatform({
38
+ os: "linux",
39
+ home,
40
+ config: `${home}/.config`,
41
+ data: `${home}/.local/share`,
42
+ cache: `${home}/.cache`
43
+ });
44
+ /**
45
+ * Creates a Windows test platform.
46
+ */
47
+ export const TestPlatformWindows = (home = "C:\\Users\\testuser") => TestPlatform({
48
+ os: "win32",
49
+ home,
50
+ config: `${home}\\AppData\\Roaming`,
51
+ data: `${home}\\AppData\\Local`,
52
+ cache: `${home}\\AppData\\Local`
53
+ });
54
+ //# sourceMappingURL=TestPlatform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestPlatform.js","names":["Effect","Layer","Platform","TestPlatform","config","service","os","homeDir","succeed","home","configDir","dataDir","data","cacheDir","cache","TestPlatformDarwin","TestPlatformLinux","TestPlatformWindows"],"sources":["../../../src/platform/TestPlatform.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;AAKA,SAASA,MAAM,EAAEC,KAAK,QAAQ,QAAQ;AACtC,SAAkBC,QAAQ,QAA8B,eAAe;AAgCvE;;;;;;AAMA,OAAO,MAAMC,YAAY,GAAGA,CAACC,MAAA,GAA6B,EAAE,KAA2B;EACrF,MAAMC,OAAO,GAAoB;IAC/BC,EAAE,EAAEF,MAAM,CAACE,EAAE,IAAI,QAAQ;IACzBC,OAAO,EAAEP,MAAM,CAACQ,OAAO,CAACJ,MAAM,CAACK,IAAI,IAAI,gBAAgB,CAAC;IACxDC,SAAS,EAAEV,MAAM,CAACQ,OAAO,CAACJ,MAAM,CAACA,MAAM,IAAI,wBAAwB,CAAC;IACpEO,OAAO,EAAEX,MAAM,CAACQ,OAAO,CAACJ,MAAM,CAACQ,IAAI,IAAI,6BAA6B,CAAC;IACrEC,QAAQ,EAAEb,MAAM,CAACQ,OAAO,CAACJ,MAAM,CAACU,KAAK,IAAI,uBAAuB;GACjE;EAED,OAAOb,KAAK,CAACO,OAAO,CAACN,QAAQ,EAAEG,OAAO,CAAC;AACzC,CAAC;AAED;;;AAGA,OAAO,MAAMU,kBAAkB,GAAGA,CAACN,IAAI,GAAG,iBAAiB,KACzDN,YAAY,CAAC;EACXG,EAAE,EAAE,QAAQ;EACZG,IAAI;EACJL,MAAM,EAAE,GAAGK,IAAI,UAAU;EACzBG,IAAI,EAAE,GAAGH,IAAI,8BAA8B;EAC3CK,KAAK,EAAE,GAAGL,IAAI;CACf,CAAC;AAEJ;;;AAGA,OAAO,MAAMO,iBAAiB,GAAGA,CAACP,IAAI,GAAG,gBAAgB,KACvDN,YAAY,CAAC;EACXG,EAAE,EAAE,OAAO;EACXG,IAAI;EACJL,MAAM,EAAE,GAAGK,IAAI,UAAU;EACzBG,IAAI,EAAE,GAAGH,IAAI,eAAe;EAC5BK,KAAK,EAAE,GAAGL,IAAI;CACf,CAAC;AAEJ;;;AAGA,OAAO,MAAMQ,mBAAmB,GAAGA,CACjCR,IAAI,GAAG,qBAAqB,KAE5BN,YAAY,CAAC;EACXG,EAAE,EAAE,OAAO;EACXG,IAAI;EACJL,MAAM,EAAE,GAAGK,IAAI,oBAAoB;EACnCG,IAAI,EAAE,GAAGH,IAAI,kBAAkB;EAC/BK,KAAK,EAAE,GAAGL,IAAI;CACf,CAAC","ignoreList":[]}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Platform-specific path resolution.
3
+ *
4
+ * This module provides the Platform service for resolving base configuration
5
+ * directories on each supported platform (macOS, Linux, Windows).
6
+ *
7
+ * @module
8
+ */
9
+ import { Layer } from "effect";
10
+ import { UnsupportedPlatformError } from "../errors.js";
11
+ import { homeDir } from "./internal/common.js";
12
+ import * as darwin from "./internal/darwin.js";
13
+ import * as linux from "./internal/linux.js";
14
+ import * as windows from "./internal/windows.js";
15
+ import { Platform } from "./Platform.js";
16
+ // Re-export types and service
17
+ export { withEnv, withoutEnv } from "./internal/testUtils.js";
18
+ export { Platform } from "./Platform.js";
19
+ export { TestPlatform, TestPlatformDarwin, TestPlatformLinux, TestPlatformWindows } from "./TestPlatform.js";
20
+ /**
21
+ * Detects the current operating system.
22
+ */
23
+ const detectOS = () => {
24
+ const platform = process.platform;
25
+ if (platform === "darwin" || platform === "linux" || platform === "win32") {
26
+ return platform;
27
+ }
28
+ throw new UnsupportedPlatformError();
29
+ };
30
+ /**
31
+ * Creates a platform service for the current OS.
32
+ */
33
+ const createPlatformService = () => {
34
+ const os = detectOS();
35
+ switch (os) {
36
+ case "darwin":
37
+ return {
38
+ os,
39
+ homeDir,
40
+ configDir: darwin.configDir,
41
+ dataDir: darwin.dataDir,
42
+ cacheDir: darwin.cacheDir
43
+ };
44
+ case "linux":
45
+ return {
46
+ os,
47
+ homeDir,
48
+ configDir: linux.configDir,
49
+ dataDir: linux.dataDir,
50
+ cacheDir: linux.cacheDir
51
+ };
52
+ case "win32":
53
+ return {
54
+ os,
55
+ homeDir,
56
+ configDir: windows.configDir,
57
+ dataDir: windows.dataDir,
58
+ cacheDir: windows.cacheDir
59
+ };
60
+ }
61
+ };
62
+ /**
63
+ * Live platform layer that uses the actual system paths.
64
+ *
65
+ * Uses runtime platform detection to select the appropriate implementation.
66
+ */
67
+ export const PlatformLive = /*#__PURE__*/Layer.sync(Platform, createPlatformService);
68
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["Layer","UnsupportedPlatformError","homeDir","darwin","linux","windows","Platform","withEnv","withoutEnv","TestPlatform","TestPlatformDarwin","TestPlatformLinux","TestPlatformWindows","detectOS","platform","process","createPlatformService","os","configDir","dataDir","cacheDir","PlatformLive","sync"],"sources":["../../../src/platform/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;AAQA,SAASA,KAAK,QAAQ,QAAQ;AAC9B,SAASC,wBAAwB,QAAQ,cAAc;AACvD,SAASC,OAAO,QAAQ,sBAAsB;AAC9C,OAAO,KAAKC,MAAM,MAAM,sBAAsB;AAC9C,OAAO,KAAKC,KAAK,MAAM,qBAAqB;AAC5C,OAAO,KAAKC,OAAO,MAAM,uBAAuB;AAChD,SAAkBC,QAAQ,QAA8B,eAAe;AAEvE;AACA,SAASC,OAAO,EAAEC,UAAU,QAAQ,yBAAyB;AAC7D,SAAkBF,QAAQ,QAA8B,eAAe;AACvE,SAASG,YAAY,EAAEC,kBAAkB,EAAEC,iBAAiB,EAAEC,mBAAmB,QAAQ,mBAAmB;AAE5G;;;AAGA,MAAMC,QAAQ,GAAGA,CAAA,KAAS;EACxB,MAAMC,QAAQ,GAAGC,OAAO,CAACD,QAAQ;EACjC,IAAIA,QAAQ,KAAK,QAAQ,IAAIA,QAAQ,KAAK,OAAO,IAAIA,QAAQ,KAAK,OAAO,EAAE;IACzE,OAAOA,QAAQ;EACjB;EACA,MAAM,IAAIb,wBAAwB,EAAE;AACtC,CAAC;AAED;;;AAGA,MAAMe,qBAAqB,GAAGA,CAAA,KAAsB;EAClD,MAAMC,EAAE,GAAGJ,QAAQ,EAAE;EAErB,QAAQI,EAAE;IACR,KAAK,QAAQ;MACX,OAAO;QACLA,EAAE;QACFf,OAAO;QACPgB,SAAS,EAAEf,MAAM,CAACe,SAAS;QAC3BC,OAAO,EAAEhB,MAAM,CAACgB,OAAO;QACvBC,QAAQ,EAAEjB,MAAM,CAACiB;OAClB;IACH,KAAK,OAAO;MACV,OAAO;QACLH,EAAE;QACFf,OAAO;QACPgB,SAAS,EAAEd,KAAK,CAACc,SAAS;QAC1BC,OAAO,EAAEf,KAAK,CAACe,OAAO;QACtBC,QAAQ,EAAEhB,KAAK,CAACgB;OACjB;IACH,KAAK,OAAO;MACV,OAAO;QACLH,EAAE;QACFf,OAAO;QACPgB,SAAS,EAAEb,OAAO,CAACa,SAAS;QAC5BC,OAAO,EAAEd,OAAO,CAACc,OAAO;QACxBC,QAAQ,EAAEf,OAAO,CAACe;OACnB;EACL;AACF,CAAC;AAED;;;;;AAKA,OAAO,MAAMC,YAAY,gBAA0BrB,KAAK,CAACsB,IAAI,CAAChB,QAAQ,EAAEU,qBAAqB,CAAC","ignoreList":[]}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Common platform utilities.
3
+ *
4
+ * @module
5
+ */
6
+ import { Effect } from "effect";
7
+ import * as os from "node:os";
8
+ import * as path from "node:path";
9
+ import { NotFoundError } from "../../errors.js";
10
+ /**
11
+ * Returns the user's home directory.
12
+ */
13
+ export const homeDir = /*#__PURE__*/Effect.sync(() => {
14
+ const home = os.homedir();
15
+ if (!home) {
16
+ return Effect.fail(new NotFoundError({
17
+ message: "home directory"
18
+ }));
19
+ }
20
+ return Effect.succeed(home);
21
+ }).pipe(Effect.flatten);
22
+ /**
23
+ * Joins path segments.
24
+ */
25
+ export const joinPath = (...segments) => path.join(...segments);
26
+ /**
27
+ * Checks if a path is absolute.
28
+ */
29
+ export const isAbsolute = p => path.isAbsolute(p);
30
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","names":["Effect","os","path","NotFoundError","homeDir","sync","home","homedir","fail","message","succeed","pipe","flatten","joinPath","segments","join","isAbsolute","p"],"sources":["../../../../src/platform/internal/common.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;AAKA,SAASA,MAAM,QAAQ,QAAQ;AAC/B,OAAO,KAAKC,EAAE,MAAM,SAAS;AAC7B,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,SAASC,aAAa,QAAQ,iBAAiB;AAE/C;;;AAGA,OAAO,MAAMC,OAAO,gBAAGJ,MAAM,CAACK,IAAI,CAAC,MAAK;EACtC,MAAMC,IAAI,GAAGL,EAAE,CAACM,OAAO,EAAE;EACzB,IAAI,CAACD,IAAI,EAAE;IACT,OAAON,MAAM,CAACQ,IAAI,CAAC,IAAIL,aAAa,CAAC;MAAEM,OAAO,EAAE;IAAgB,CAAE,CAAC,CAAC;EACtE;EACA,OAAOT,MAAM,CAACU,OAAO,CAACJ,IAAI,CAAC;AAC7B,CAAC,CAAC,CAACK,IAAI,CAACX,MAAM,CAACY,OAAO,CAAC;AAEvB;;;AAGA,OAAO,MAAMC,QAAQ,GAAGA,CAAC,GAAGC,QAAuB,KAAaZ,IAAI,CAACa,IAAI,CAAC,GAAGD,QAAQ,CAAC;AAEtF;;;AAGA,OAAO,MAAME,UAAU,GAAIC,CAAS,IAAcf,IAAI,CAACc,UAAU,CAACC,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * macOS-specific path resolution.
3
+ *
4
+ * @module
5
+ */
6
+ import { Effect } from "effect";
7
+ import { homeDir, joinPath } from "./common.js";
8
+ /**
9
+ * Returns the user's config directory on macOS.
10
+ *
11
+ * Most CLI tools use `~/.config/` following XDG conventions,
12
+ * though native macOS apps prefer `~/Library/Application Support/`.
13
+ */
14
+ export const configDir = /*#__PURE__*/Effect.map(homeDir, home => joinPath(home, ".config"));
15
+ /**
16
+ * Returns the user's data directory on macOS.
17
+ *
18
+ * Returns `~/Library/Application Support/` for native macOS conventions.
19
+ */
20
+ export const dataDir = /*#__PURE__*/Effect.map(homeDir, home => joinPath(home, "Library", "Application Support"));
21
+ /**
22
+ * Returns the Application Support directory on macOS.
23
+ *
24
+ * This is `~/Library/Application Support/`, used by native macOS applications.
25
+ */
26
+ export const applicationSupportDir = dataDir;
27
+ /**
28
+ * Returns the cache directory on macOS.
29
+ *
30
+ * On macOS, we use the data directory as there's no standard XDG cache.
31
+ */
32
+ export const cacheDir = dataDir;
33
+ //# sourceMappingURL=darwin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"darwin.js","names":["Effect","homeDir","joinPath","configDir","map","home","dataDir","applicationSupportDir","cacheDir"],"sources":["../../../../src/platform/internal/darwin.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;AAKA,SAASA,MAAM,QAAQ,QAAQ;AAE/B,SAASC,OAAO,EAAEC,QAAQ,QAAQ,aAAa;AAE/C;;;;;;AAMA,OAAO,MAAMC,SAAS,gBAAyCH,MAAM,CAACI,GAAG,CACvEH,OAAO,EACNI,IAAI,IAAKH,QAAQ,CAACG,IAAI,EAAE,SAAS,CAAC,CACpC;AAED;;;;;AAKA,OAAO,MAAMC,OAAO,gBAAyCN,MAAM,CAACI,GAAG,CACrEH,OAAO,EACNI,IAAI,IAAKH,QAAQ,CAACG,IAAI,EAAE,SAAS,EAAE,qBAAqB,CAAC,CAC3D;AAED;;;;;AAKA,OAAO,MAAME,qBAAqB,GAAyCD,OAAO;AAElF;;;;;AAKA,OAAO,MAAME,QAAQ,GAAyCF,OAAO","ignoreList":[]}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Linux-specific path resolution with XDG Base Directory support.
3
+ *
4
+ * @module
5
+ */
6
+ import { Effect, Option } from "effect";
7
+ import { homeDir, isAbsolute, joinPath } from "./common.js";
8
+ /**
9
+ * Gets an XDG path if the environment variable is set and valid.
10
+ *
11
+ * Returns None if:
12
+ * - The environment variable is not set
13
+ * - The value is empty
14
+ * - The path is not absolute
15
+ */
16
+ const xdgPathIfValid = varName => {
17
+ const value = process.env[varName];
18
+ if (value && value.length > 0 && isAbsolute(value)) {
19
+ return Option.some(value);
20
+ }
21
+ return Option.none();
22
+ };
23
+ /**
24
+ * Returns the user's config directory on Linux.
25
+ *
26
+ * Respects `XDG_CONFIG_HOME` if set to an absolute path,
27
+ * otherwise defaults to `~/.config/`.
28
+ */
29
+ export const configDir = /*#__PURE__*/Effect.suspend(() => {
30
+ const xdgPath = xdgPathIfValid("XDG_CONFIG_HOME");
31
+ if (Option.isSome(xdgPath)) {
32
+ return Effect.succeed(xdgPath.value);
33
+ }
34
+ return Effect.map(homeDir, home => joinPath(home, ".config"));
35
+ });
36
+ /**
37
+ * Returns the user's data directory on Linux.
38
+ *
39
+ * Respects `XDG_DATA_HOME` if set to an absolute path,
40
+ * otherwise defaults to `~/.local/share/`.
41
+ */
42
+ export const dataDir = /*#__PURE__*/Effect.suspend(() => {
43
+ const xdgPath = xdgPathIfValid("XDG_DATA_HOME");
44
+ if (Option.isSome(xdgPath)) {
45
+ return Effect.succeed(xdgPath.value);
46
+ }
47
+ return Effect.map(homeDir, home => joinPath(home, ".local", "share"));
48
+ });
49
+ /**
50
+ * Returns the user's cache directory on Linux.
51
+ *
52
+ * Respects `XDG_CACHE_HOME` if set to an absolute path,
53
+ * otherwise defaults to `~/.cache/`.
54
+ */
55
+ export const cacheDir = /*#__PURE__*/Effect.suspend(() => {
56
+ const xdgPath = xdgPathIfValid("XDG_CACHE_HOME");
57
+ if (Option.isSome(xdgPath)) {
58
+ return Effect.succeed(xdgPath.value);
59
+ }
60
+ return Effect.map(homeDir, home => joinPath(home, ".cache"));
61
+ });
62
+ //# sourceMappingURL=linux.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linux.js","names":["Effect","Option","homeDir","isAbsolute","joinPath","xdgPathIfValid","varName","value","process","env","length","some","none","configDir","suspend","xdgPath","isSome","succeed","map","home","dataDir","cacheDir"],"sources":["../../../../src/platform/internal/linux.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;AAKA,SAASA,MAAM,EAAEC,MAAM,QAAQ,QAAQ;AAEvC,SAASC,OAAO,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,aAAa;AAE3D;;;;;;;;AAQA,MAAMC,cAAc,GAAIC,OAAe,IAA2B;EAChE,MAAMC,KAAK,GAAGC,OAAO,CAACC,GAAG,CAACH,OAAO,CAAC;EAClC,IAAIC,KAAK,IAAIA,KAAK,CAACG,MAAM,GAAG,CAAC,IAAIP,UAAU,CAACI,KAAK,CAAC,EAAE;IAClD,OAAON,MAAM,CAACU,IAAI,CAACJ,KAAK,CAAC;EAC3B;EACA,OAAON,MAAM,CAACW,IAAI,EAAE;AACtB,CAAC;AAED;;;;;;AAMA,OAAO,MAAMC,SAAS,gBAAyCb,MAAM,CAACc,OAAO,CAAC,MAAK;EACjF,MAAMC,OAAO,GAAGV,cAAc,CAAC,iBAAiB,CAAC;EACjD,IAAIJ,MAAM,CAACe,MAAM,CAACD,OAAO,CAAC,EAAE;IAC1B,OAAOf,MAAM,CAACiB,OAAO,CAACF,OAAO,CAACR,KAAK,CAAC;EACtC;EACA,OAAOP,MAAM,CAACkB,GAAG,CAAChB,OAAO,EAAGiB,IAAI,IAAKf,QAAQ,CAACe,IAAI,EAAE,SAAS,CAAC,CAAC;AACjE,CAAC,CAAC;AAEF;;;;;;AAMA,OAAO,MAAMC,OAAO,gBAAyCpB,MAAM,CAACc,OAAO,CAAC,MAAK;EAC/E,MAAMC,OAAO,GAAGV,cAAc,CAAC,eAAe,CAAC;EAC/C,IAAIJ,MAAM,CAACe,MAAM,CAACD,OAAO,CAAC,EAAE;IAC1B,OAAOf,MAAM,CAACiB,OAAO,CAACF,OAAO,CAACR,KAAK,CAAC;EACtC;EACA,OAAOP,MAAM,CAACkB,GAAG,CAAChB,OAAO,EAAGiB,IAAI,IAAKf,QAAQ,CAACe,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AACzE,CAAC,CAAC;AAEF;;;;;;AAMA,OAAO,MAAME,QAAQ,gBAAyCrB,MAAM,CAACc,OAAO,CAAC,MAAK;EAChF,MAAMC,OAAO,GAAGV,cAAc,CAAC,gBAAgB,CAAC;EAChD,IAAIJ,MAAM,CAACe,MAAM,CAACD,OAAO,CAAC,EAAE;IAC1B,OAAOf,MAAM,CAACiB,OAAO,CAACF,OAAO,CAACR,KAAK,CAAC;EACtC;EACA,OAAOP,MAAM,CAACkB,GAAG,CAAChB,OAAO,EAAGiB,IAAI,IAAKf,QAAQ,CAACe,IAAI,EAAE,QAAQ,CAAC,CAAC;AAChE,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Test utilities for platform testing.
3
+ *
4
+ * @module
5
+ */
6
+ import { Effect } from "effect";
7
+ /**
8
+ * Runs an effect with mocked environment variables.
9
+ *
10
+ * The original environment is restored after the effect completes,
11
+ * regardless of success or failure.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const result = await Effect.runPromise(
16
+ * withEnv({ XDG_CONFIG_HOME: "/custom/config" }, myEffect)
17
+ * )
18
+ * ```
19
+ */
20
+ export const withEnv = (vars, effect) => {
21
+ const states = [];
22
+ return Effect.acquireUseRelease(
23
+ // Acquire: save original values and set new ones
24
+ Effect.sync(() => {
25
+ for (const [key, value] of Object.entries(vars)) {
26
+ states.push({
27
+ key,
28
+ originalValue: process.env[key]
29
+ });
30
+ if (value === undefined) {
31
+ delete process.env[key];
32
+ } else {
33
+ process.env[key] = value;
34
+ }
35
+ }
36
+ }),
37
+ // Use: run the effect
38
+ () => effect,
39
+ // Release: restore original values
40
+ () => Effect.sync(() => {
41
+ for (const {
42
+ key,
43
+ originalValue
44
+ } of states) {
45
+ if (originalValue === undefined) {
46
+ delete process.env[key];
47
+ } else {
48
+ process.env[key] = originalValue;
49
+ }
50
+ }
51
+ }));
52
+ };
53
+ /**
54
+ * Removes environment variables for the duration of an effect.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const result = await Effect.runPromise(
59
+ * withoutEnv(["XDG_CONFIG_HOME", "XDG_DATA_HOME"], myEffect)
60
+ * )
61
+ * ```
62
+ */
63
+ export const withoutEnv = (keys, effect) => {
64
+ const vars = {};
65
+ for (const key of keys) {
66
+ vars[key] = undefined;
67
+ }
68
+ return withEnv(vars, effect);
69
+ };
70
+ //# sourceMappingURL=testUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testUtils.js","names":["Effect","withEnv","vars","effect","states","acquireUseRelease","sync","key","value","Object","entries","push","originalValue","process","env","undefined","withoutEnv","keys"],"sources":["../../../../src/platform/internal/testUtils.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;AAKA,SAASA,MAAM,QAAQ,QAAQ;AAU/B;;;;;;;;;;;;;AAaA,OAAO,MAAMC,OAAO,GAAGA,CACrBC,IAAwC,EACxCC,MAA8B,KACJ;EAC1B,MAAMC,MAAM,GAAoB,EAAE;EAElC,OAAOJ,MAAM,CAACK,iBAAiB;EAC7B;EACAL,MAAM,CAACM,IAAI,CAAC,MAAK;IACf,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACR,IAAI,CAAC,EAAE;MAC/CE,MAAM,CAACO,IAAI,CAAC;QAAEJ,GAAG;QAAEK,aAAa,EAAEC,OAAO,CAACC,GAAG,CAACP,GAAG;MAAC,CAAE,CAAC;MACrD,IAAIC,KAAK,KAAKO,SAAS,EAAE;QACvB,OAAOF,OAAO,CAACC,GAAG,CAACP,GAAG,CAAC;MACzB,CAAC,MAAM;QACLM,OAAO,CAACC,GAAG,CAACP,GAAG,CAAC,GAAGC,KAAK;MAC1B;IACF;EACF,CAAC,CAAC;EACF;EACA,MAAML,MAAM;EACZ;EACA,MACEH,MAAM,CAACM,IAAI,CAAC,MAAK;IACf,KAAK,MAAM;MAAEC,GAAG;MAAEK;IAAa,CAAE,IAAIR,MAAM,EAAE;MAC3C,IAAIQ,aAAa,KAAKG,SAAS,EAAE;QAC/B,OAAOF,OAAO,CAACC,GAAG,CAACP,GAAG,CAAC;MACzB,CAAC,MAAM;QACLM,OAAO,CAACC,GAAG,CAACP,GAAG,CAAC,GAAGK,aAAa;MAClC;IACF;EACF,CAAC,CAAC,CACL;AACH,CAAC;AAED;;;;;;;;;;AAUA,OAAO,MAAMI,UAAU,GAAGA,CACxBC,IAA2B,EAC3Bd,MAA8B,KACJ;EAC1B,MAAMD,IAAI,GAA8B,EAAE;EAC1C,KAAK,MAAMK,GAAG,IAAIU,IAAI,EAAE;IACtBf,IAAI,CAACK,GAAG,CAAC,GAAGQ,SAAS;EACvB;EACA,OAAOd,OAAO,CAACC,IAAI,EAAEC,MAAM,CAAC;AAC9B,CAAC","ignoreList":[]}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Windows-specific path resolution.
3
+ *
4
+ * @module
5
+ */
6
+ import { Effect } from "effect";
7
+ import { EnvVarError } from "../../errors.js";
8
+ /**
9
+ * Returns the user's config directory on Windows.
10
+ *
11
+ * Returns `%APPDATA%` which is typically `C:\Users\<user>\AppData\Roaming`.
12
+ */
13
+ export const configDir = /*#__PURE__*/Effect.suspend(() => {
14
+ const appdata = process.env.APPDATA;
15
+ if (!appdata) {
16
+ return Effect.fail(new EnvVarError({
17
+ cause: new Error("APPDATA environment variable not set")
18
+ }));
19
+ }
20
+ return Effect.succeed(appdata);
21
+ });
22
+ /**
23
+ * Returns the user's data directory on Windows.
24
+ *
25
+ * Returns `%LOCALAPPDATA%` which is typically `C:\Users\<user>\AppData\Local`.
26
+ */
27
+ export const dataDir = /*#__PURE__*/Effect.suspend(() => {
28
+ const localAppData = process.env.LOCALAPPDATA;
29
+ if (!localAppData) {
30
+ return Effect.fail(new EnvVarError({
31
+ cause: new Error("LOCALAPPDATA environment variable not set")
32
+ }));
33
+ }
34
+ return Effect.succeed(localAppData);
35
+ });
36
+ /**
37
+ * Returns the roaming app data directory on Windows.
38
+ *
39
+ * This is `%APPDATA%`, used for settings that should roam with the user.
40
+ */
41
+ export const roamingAppDataDir = configDir;
42
+ /**
43
+ * Returns the local app data directory on Windows.
44
+ *
45
+ * This is `%LOCALAPPDATA%`, used for data that should stay on the local machine.
46
+ */
47
+ export const localAppDataDir = dataDir;
48
+ /**
49
+ * Returns the cache directory on Windows.
50
+ *
51
+ * On Windows, we use the local app data directory.
52
+ */
53
+ export const cacheDir = dataDir;
54
+ //# sourceMappingURL=windows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"windows.js","names":["Effect","EnvVarError","configDir","suspend","appdata","process","env","APPDATA","fail","cause","Error","succeed","dataDir","localAppData","LOCALAPPDATA","roamingAppDataDir","localAppDataDir","cacheDir"],"sources":["../../../../src/platform/internal/windows.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;AAKA,SAASA,MAAM,QAAQ,QAAQ;AAC/B,SAASC,WAAW,QAA4B,iBAAiB;AAEjE;;;;;AAKA,OAAO,MAAMC,SAAS,gBAAyCF,MAAM,CAACG,OAAO,CAAC,MAAK;EACjF,MAAMC,OAAO,GAAGC,OAAO,CAACC,GAAG,CAACC,OAAO;EACnC,IAAI,CAACH,OAAO,EAAE;IACZ,OAAOJ,MAAM,CAACQ,IAAI,CAChB,IAAIP,WAAW,CAAC;MAAEQ,KAAK,EAAE,IAAIC,KAAK,CAAC,sCAAsC;IAAC,CAAE,CAAC,CAC9E;EACH;EACA,OAAOV,MAAM,CAACW,OAAO,CAACP,OAAO,CAAC;AAChC,CAAC,CAAC;AAEF;;;;;AAKA,OAAO,MAAMQ,OAAO,gBAAyCZ,MAAM,CAACG,OAAO,CAAC,MAAK;EAC/E,MAAMU,YAAY,GAAGR,OAAO,CAACC,GAAG,CAACQ,YAAY;EAC7C,IAAI,CAACD,YAAY,EAAE;IACjB,OAAOb,MAAM,CAACQ,IAAI,CAChB,IAAIP,WAAW,CAAC;MAAEQ,KAAK,EAAE,IAAIC,KAAK,CAAC,2CAA2C;IAAC,CAAE,CAAC,CACnF;EACH;EACA,OAAOV,MAAM,CAACW,OAAO,CAACE,YAAY,CAAC;AACrC,CAAC,CAAC;AAEF;;;;;AAKA,OAAO,MAAME,iBAAiB,GAAyCb,SAAS;AAEhF;;;;;AAKA,OAAO,MAAMc,eAAe,GAAyCJ,OAAO;AAE5E;;;;;AAKA,OAAO,MAAMK,QAAQ,GAAyCL,OAAO","ignoreList":[]}