@defai.digital/config-domain 13.0.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.
- package/LICENSE +214 -0
- package/dist/aggregate.d.ts +110 -0
- package/dist/aggregate.d.ts.map +1 -0
- package/dist/aggregate.js +297 -0
- package/dist/aggregate.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/migrator.d.ts +93 -0
- package/dist/migrator.d.ts.map +1 -0
- package/dist/migrator.js +263 -0
- package/dist/migrator.js.map +1 -0
- package/dist/operations.d.ts +47 -0
- package/dist/operations.d.ts.map +1 -0
- package/dist/operations.js +260 -0
- package/dist/operations.js.map +1 -0
- package/dist/ports/detection.d.ts +61 -0
- package/dist/ports/detection.d.ts.map +1 -0
- package/dist/ports/detection.js +60 -0
- package/dist/ports/detection.js.map +1 -0
- package/dist/repository.d.ts +100 -0
- package/dist/repository.d.ts.map +1 -0
- package/dist/repository.js +135 -0
- package/dist/repository.js.map +1 -0
- package/dist/resolver.d.ts +92 -0
- package/dist/resolver.d.ts.map +1 -0
- package/dist/resolver.js +94 -0
- package/dist/resolver.js.map +1 -0
- package/dist/store.d.ts +85 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +247 -0
- package/dist/store.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multi-Level Config Resolver
|
|
3
|
+
*
|
|
4
|
+
* Resolves configuration from multiple levels:
|
|
5
|
+
* 1. Built-in defaults
|
|
6
|
+
* 2. User config (~/.automatosx/config.json)
|
|
7
|
+
* 3. Project config (.automatosx/config.json) - highest priority
|
|
8
|
+
*
|
|
9
|
+
* Merge semantics:
|
|
10
|
+
* - Objects: deep merge
|
|
11
|
+
* - Arrays: replace (not concatenate)
|
|
12
|
+
* - Primitives: override
|
|
13
|
+
*
|
|
14
|
+
* Invariants:
|
|
15
|
+
* - INV-CFG-RES-001: Project config overrides user config
|
|
16
|
+
* - INV-CFG-RES-002: User config overrides defaults
|
|
17
|
+
* - INV-CFG-RES-003: Undefined values do not override
|
|
18
|
+
*/
|
|
19
|
+
import type { AutomatosXConfig } from '@defai.digital/contracts';
|
|
20
|
+
import { CONFIG_PATHS, DATA_PATHS } from './store.js';
|
|
21
|
+
/**
|
|
22
|
+
* Config resolution result
|
|
23
|
+
*/
|
|
24
|
+
export interface ConfigResolutionResult {
|
|
25
|
+
config: AutomatosXConfig;
|
|
26
|
+
sources: {
|
|
27
|
+
defaults: boolean;
|
|
28
|
+
user: boolean;
|
|
29
|
+
project: boolean;
|
|
30
|
+
};
|
|
31
|
+
paths: {
|
|
32
|
+
user: string;
|
|
33
|
+
project: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Config resolver interface
|
|
38
|
+
*/
|
|
39
|
+
export interface IConfigResolver {
|
|
40
|
+
/**
|
|
41
|
+
* Resolve configuration from all levels
|
|
42
|
+
*/
|
|
43
|
+
resolve(): Promise<ConfigResolutionResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Get just the resolved config
|
|
46
|
+
*/
|
|
47
|
+
getConfig(): Promise<AutomatosXConfig>;
|
|
48
|
+
/**
|
|
49
|
+
* Check if user config exists
|
|
50
|
+
*/
|
|
51
|
+
hasUserConfig(): Promise<boolean>;
|
|
52
|
+
/**
|
|
53
|
+
* Check if project config exists
|
|
54
|
+
*/
|
|
55
|
+
hasProjectConfig(): Promise<boolean>;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Multi-level config resolver
|
|
59
|
+
*/
|
|
60
|
+
export declare class ConfigResolver implements IConfigResolver {
|
|
61
|
+
private store;
|
|
62
|
+
/**
|
|
63
|
+
* Resolve configuration from all levels
|
|
64
|
+
*/
|
|
65
|
+
resolve(): Promise<ConfigResolutionResult>;
|
|
66
|
+
/**
|
|
67
|
+
* Get just the resolved config
|
|
68
|
+
*/
|
|
69
|
+
getConfig(): Promise<AutomatosXConfig>;
|
|
70
|
+
/**
|
|
71
|
+
* Check if user config exists
|
|
72
|
+
*/
|
|
73
|
+
hasUserConfig(): Promise<boolean>;
|
|
74
|
+
/**
|
|
75
|
+
* Check if project config exists
|
|
76
|
+
*/
|
|
77
|
+
hasProjectConfig(): Promise<boolean>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Creates a config resolver
|
|
81
|
+
*/
|
|
82
|
+
export declare function createConfigResolver(): IConfigResolver;
|
|
83
|
+
/**
|
|
84
|
+
* Quick resolve - returns just the config
|
|
85
|
+
*/
|
|
86
|
+
export declare function resolveConfig(): Promise<AutomatosXConfig>;
|
|
87
|
+
/**
|
|
88
|
+
* Full resolve - returns config with metadata
|
|
89
|
+
*/
|
|
90
|
+
export declare function resolveConfigFull(): Promise<ConfigResolutionResult>;
|
|
91
|
+
export { CONFIG_PATHS, DATA_PATHS };
|
|
92
|
+
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAqB,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAMzE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE;QACP,QAAQ,EAAE,OAAO,CAAC;QAClB,IAAI,EAAE,OAAO,CAAC;QACd,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAE3C;;OAEG;IACH,SAAS,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEvC;;OAEG;IACH,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAElC;;OAEG;IACH,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CACtC;AAMD;;GAEG;AACH,qBAAa,cAAe,YAAW,eAAe;IACpD,OAAO,CAAC,KAAK,CAAuB;IAEpC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,sBAAsB,CAAC;IAmBhD;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAI5C;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;IAIvC;;OAEG;IACG,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;CAG3C;AAMD;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,eAAe,CAEtD;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAG/D;AAED;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAGzE;AAMD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/resolver.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multi-Level Config Resolver
|
|
3
|
+
*
|
|
4
|
+
* Resolves configuration from multiple levels:
|
|
5
|
+
* 1. Built-in defaults
|
|
6
|
+
* 2. User config (~/.automatosx/config.json)
|
|
7
|
+
* 3. Project config (.automatosx/config.json) - highest priority
|
|
8
|
+
*
|
|
9
|
+
* Merge semantics:
|
|
10
|
+
* - Objects: deep merge
|
|
11
|
+
* - Arrays: replace (not concatenate)
|
|
12
|
+
* - Primitives: override
|
|
13
|
+
*
|
|
14
|
+
* Invariants:
|
|
15
|
+
* - INV-CFG-RES-001: Project config overrides user config
|
|
16
|
+
* - INV-CFG-RES-002: User config overrides defaults
|
|
17
|
+
* - INV-CFG-RES-003: Undefined values do not override
|
|
18
|
+
*/
|
|
19
|
+
import { createConfigStore, CONFIG_PATHS, DATA_PATHS } from './store.js';
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// Config Resolver Implementation
|
|
22
|
+
// ============================================================================
|
|
23
|
+
/**
|
|
24
|
+
* Multi-level config resolver
|
|
25
|
+
*/
|
|
26
|
+
export class ConfigResolver {
|
|
27
|
+
store = createConfigStore();
|
|
28
|
+
/**
|
|
29
|
+
* Resolve configuration from all levels
|
|
30
|
+
*/
|
|
31
|
+
async resolve() {
|
|
32
|
+
const hasUser = await this.store.exists('global');
|
|
33
|
+
const hasProject = await this.store.exists('local');
|
|
34
|
+
const config = await this.store.readMerged();
|
|
35
|
+
return {
|
|
36
|
+
config,
|
|
37
|
+
sources: {
|
|
38
|
+
defaults: true, // Always includes defaults
|
|
39
|
+
user: hasUser,
|
|
40
|
+
project: hasProject,
|
|
41
|
+
},
|
|
42
|
+
paths: {
|
|
43
|
+
user: CONFIG_PATHS.global,
|
|
44
|
+
project: CONFIG_PATHS.local,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get just the resolved config
|
|
50
|
+
*/
|
|
51
|
+
async getConfig() {
|
|
52
|
+
return this.store.readMerged();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Check if user config exists
|
|
56
|
+
*/
|
|
57
|
+
async hasUserConfig() {
|
|
58
|
+
return this.store.exists('global');
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Check if project config exists
|
|
62
|
+
*/
|
|
63
|
+
async hasProjectConfig() {
|
|
64
|
+
return this.store.exists('local');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// ============================================================================
|
|
68
|
+
// Factory Functions
|
|
69
|
+
// ============================================================================
|
|
70
|
+
/**
|
|
71
|
+
* Creates a config resolver
|
|
72
|
+
*/
|
|
73
|
+
export function createConfigResolver() {
|
|
74
|
+
return new ConfigResolver();
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Quick resolve - returns just the config
|
|
78
|
+
*/
|
|
79
|
+
export async function resolveConfig() {
|
|
80
|
+
const resolver = new ConfigResolver();
|
|
81
|
+
return resolver.getConfig();
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Full resolve - returns config with metadata
|
|
85
|
+
*/
|
|
86
|
+
export async function resolveConfigFull() {
|
|
87
|
+
const resolver = new ConfigResolver();
|
|
88
|
+
return resolver.resolve();
|
|
89
|
+
}
|
|
90
|
+
// ============================================================================
|
|
91
|
+
// Path Constants (re-export for convenience)
|
|
92
|
+
// ============================================================================
|
|
93
|
+
export { CONFIG_PATHS, DATA_PATHS };
|
|
94
|
+
//# sourceMappingURL=resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA+CzE,+EAA+E;AAC/E,iCAAiC;AACjC,+EAA+E;AAE/E;;GAEG;AACH,MAAM,OAAO,cAAc;IACjB,KAAK,GAAG,iBAAiB,EAAE,CAAC;IAEpC;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAClD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACpD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QAE7C,OAAO;YACL,MAAM;YACN,OAAO,EAAE;gBACP,QAAQ,EAAE,IAAI,EAAE,2BAA2B;gBAC3C,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE,UAAU;aACpB;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,YAAY,CAAC,MAAM;gBACzB,OAAO,EAAE,YAAY,CAAC,KAAK;aAC5B;SACF,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;CACF;AAED,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,IAAI,cAAc,EAAE,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;IACtC,OAAO,QAAQ,CAAC,SAAS,EAAE,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,MAAM,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;IACtC,OAAO,QAAQ,CAAC,OAAO,EAAE,CAAC;AAC5B,CAAC;AAED,+EAA+E;AAC/E,6CAA6C;AAC7C,+EAA+E;AAE/E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/store.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration Store
|
|
3
|
+
*
|
|
4
|
+
* Handles file-based configuration storage with atomic writes.
|
|
5
|
+
*
|
|
6
|
+
* Invariants:
|
|
7
|
+
* - INV-CFG-ADP-001: Atomic writes (temp + rename)
|
|
8
|
+
* - INV-CFG-DOM-001: Schema validation before write
|
|
9
|
+
*/
|
|
10
|
+
import { type AutomatosXConfig } from '@defai.digital/contracts';
|
|
11
|
+
/**
|
|
12
|
+
* Configuration file paths
|
|
13
|
+
*/
|
|
14
|
+
export declare const CONFIG_PATHS: {
|
|
15
|
+
readonly global: string;
|
|
16
|
+
readonly local: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Data directory paths
|
|
20
|
+
*/
|
|
21
|
+
export declare const DATA_PATHS: {
|
|
22
|
+
readonly global: string;
|
|
23
|
+
readonly local: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Config store interface
|
|
27
|
+
*/
|
|
28
|
+
export interface ConfigStore {
|
|
29
|
+
/**
|
|
30
|
+
* Checks if configuration exists
|
|
31
|
+
*/
|
|
32
|
+
exists(scope?: 'global' | 'local'): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Reads configuration from file
|
|
35
|
+
*/
|
|
36
|
+
read(scope?: 'global' | 'local'): Promise<AutomatosXConfig | undefined>;
|
|
37
|
+
/**
|
|
38
|
+
* Writes configuration to file
|
|
39
|
+
* INV-CFG-ADP-001: Uses atomic write
|
|
40
|
+
*/
|
|
41
|
+
write(config: AutomatosXConfig, scope?: 'global' | 'local'): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Deletes configuration file
|
|
44
|
+
*/
|
|
45
|
+
delete(scope?: 'global' | 'local'): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Gets the resolved config path
|
|
48
|
+
*/
|
|
49
|
+
getPath(scope?: 'global' | 'local'): string;
|
|
50
|
+
/**
|
|
51
|
+
* Merges local config over global config
|
|
52
|
+
*/
|
|
53
|
+
readMerged(): Promise<AutomatosXConfig>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Expands ~ to home directory
|
|
57
|
+
*/
|
|
58
|
+
export declare function expandPath(filePath: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* Gets config path for scope
|
|
61
|
+
*/
|
|
62
|
+
export declare function getConfigPath(scope?: 'global' | 'local'): string;
|
|
63
|
+
/**
|
|
64
|
+
* Creates a config store
|
|
65
|
+
*/
|
|
66
|
+
export declare function createConfigStore(): ConfigStore;
|
|
67
|
+
/**
|
|
68
|
+
* Subdirectories to create during setup
|
|
69
|
+
* Per PRD Section 9: File Structure
|
|
70
|
+
*/
|
|
71
|
+
export declare const CONFIG_SUBDIRS: readonly ["providers", "cache", "data"];
|
|
72
|
+
/**
|
|
73
|
+
* Initializes config directory structure
|
|
74
|
+
* Creates:
|
|
75
|
+
* - ~/.automatosx/
|
|
76
|
+
* - ~/.automatosx/providers/
|
|
77
|
+
* - ~/.automatosx/cache/
|
|
78
|
+
* - ~/.automatosx/data/
|
|
79
|
+
*/
|
|
80
|
+
export declare function initConfigDirectory(scope?: 'global' | 'local'): Promise<string>;
|
|
81
|
+
/**
|
|
82
|
+
* Checks if setup has been completed
|
|
83
|
+
*/
|
|
84
|
+
export declare function isSetupComplete(): Promise<boolean>;
|
|
85
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,EACL,KAAK,gBAAgB,EAQtB,MAAM,0BAA0B,CAAC;AAMlC;;GAEG;AACH,eAAO,MAAM,YAAY;;;CAGf,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,UAAU;;;CAGb,CAAC;AAMX;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAErD;;OAEG;IACH,IAAI,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC;IAExE;;;OAGG;IACH,KAAK,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3E;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAErD;;OAEG;IACH,OAAO,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;IAE5C;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACzC;AAMD;;GAEG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKnD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,GAAE,QAAQ,GAAG,OAAkB,GAAG,MAAM,CAE1E;AAqID;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,WAAW,CA4E/C;AAMD;;;GAGG;AACH,eAAO,MAAM,cAAc,yCAA0C,CAAC;AAEtE;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,GAAE,QAAQ,GAAG,OAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAY/F;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAGxD"}
|
package/dist/store.js
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration Store
|
|
3
|
+
*
|
|
4
|
+
* Handles file-based configuration storage with atomic writes.
|
|
5
|
+
*
|
|
6
|
+
* Invariants:
|
|
7
|
+
* - INV-CFG-ADP-001: Atomic writes (temp + rename)
|
|
8
|
+
* - INV-CFG-DOM-001: Schema validation before write
|
|
9
|
+
*/
|
|
10
|
+
import * as fs from 'node:fs';
|
|
11
|
+
import * as path from 'node:path';
|
|
12
|
+
import * as os from 'node:os';
|
|
13
|
+
import { validateConfig, safeValidateConfig, DEFAULT_CONFIG, ConfigErrorCode, ConfigError, DATA_DIR_NAME, CONFIG_FILENAME, } from '@defai.digital/contracts';
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// Constants
|
|
16
|
+
// ============================================================================
|
|
17
|
+
/**
|
|
18
|
+
* Configuration file paths
|
|
19
|
+
*/
|
|
20
|
+
export const CONFIG_PATHS = {
|
|
21
|
+
global: path.join(os.homedir(), DATA_DIR_NAME, CONFIG_FILENAME),
|
|
22
|
+
local: path.join(process.cwd(), DATA_DIR_NAME, CONFIG_FILENAME),
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Data directory paths
|
|
26
|
+
*/
|
|
27
|
+
export const DATA_PATHS = {
|
|
28
|
+
global: path.join(os.homedir(), DATA_DIR_NAME),
|
|
29
|
+
local: path.join(process.cwd(), DATA_DIR_NAME),
|
|
30
|
+
};
|
|
31
|
+
// ============================================================================
|
|
32
|
+
// File Operations (Pure Functions)
|
|
33
|
+
// ============================================================================
|
|
34
|
+
/**
|
|
35
|
+
* Expands ~ to home directory
|
|
36
|
+
*/
|
|
37
|
+
export function expandPath(filePath) {
|
|
38
|
+
if (filePath.startsWith('~')) {
|
|
39
|
+
return path.join(os.homedir(), filePath.slice(1));
|
|
40
|
+
}
|
|
41
|
+
return filePath;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Gets config path for scope
|
|
45
|
+
*/
|
|
46
|
+
export function getConfigPath(scope = 'global') {
|
|
47
|
+
return CONFIG_PATHS[scope];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Ensures directory exists
|
|
51
|
+
*/
|
|
52
|
+
async function ensureDir(dirPath) {
|
|
53
|
+
await fs.promises.mkdir(dirPath, { recursive: true });
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Checks if file exists
|
|
57
|
+
*/
|
|
58
|
+
async function fileExists(filePath) {
|
|
59
|
+
try {
|
|
60
|
+
await fs.promises.access(filePath, fs.constants.F_OK);
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Reads JSON file
|
|
69
|
+
*/
|
|
70
|
+
async function readJsonFile(filePath) {
|
|
71
|
+
try {
|
|
72
|
+
const content = await fs.promises.readFile(filePath, 'utf-8');
|
|
73
|
+
return JSON.parse(content);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
if (error.code === 'ENOENT') {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
throw new ConfigError(ConfigErrorCode.CONFIG_READ_ERROR, `Failed to read config file: ${filePath}`, { path: filePath, error: String(error) });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Writes JSON file atomically
|
|
84
|
+
* INV-CFG-ADP-001: Write to temp file, then rename
|
|
85
|
+
*/
|
|
86
|
+
async function writeJsonFileAtomic(filePath, data) {
|
|
87
|
+
const dir = path.dirname(filePath);
|
|
88
|
+
await ensureDir(dir);
|
|
89
|
+
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
90
|
+
try {
|
|
91
|
+
const content = JSON.stringify(data, null, 2);
|
|
92
|
+
await fs.promises.writeFile(tempPath, content, 'utf-8');
|
|
93
|
+
await fs.promises.rename(tempPath, filePath);
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
// Clean up temp file on failure
|
|
97
|
+
try {
|
|
98
|
+
await fs.promises.unlink(tempPath);
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
// Ignore cleanup errors
|
|
102
|
+
}
|
|
103
|
+
throw new ConfigError(ConfigErrorCode.CONFIG_WRITE_ERROR, `Failed to write config file: ${filePath}`, { path: filePath, error: String(error) });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Deletes file if exists
|
|
108
|
+
*/
|
|
109
|
+
async function deleteFile(filePath) {
|
|
110
|
+
try {
|
|
111
|
+
await fs.promises.unlink(filePath);
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
if (error.code === 'ENOENT') {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
throw new ConfigError(ConfigErrorCode.CONFIG_WRITE_ERROR, `Failed to delete config file: ${filePath}`, { path: filePath, error: String(error) });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// ============================================================================
|
|
122
|
+
// Config Merging
|
|
123
|
+
// ============================================================================
|
|
124
|
+
/**
|
|
125
|
+
* Deep merges two objects
|
|
126
|
+
*/
|
|
127
|
+
function deepMerge(base, override) {
|
|
128
|
+
const result = { ...base };
|
|
129
|
+
for (const key of Object.keys(override)) {
|
|
130
|
+
const overrideValue = override[key];
|
|
131
|
+
const baseValue = base[key];
|
|
132
|
+
if (overrideValue === undefined) {
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (typeof overrideValue === 'object' &&
|
|
136
|
+
overrideValue !== null &&
|
|
137
|
+
!Array.isArray(overrideValue) &&
|
|
138
|
+
typeof baseValue === 'object' &&
|
|
139
|
+
baseValue !== null &&
|
|
140
|
+
!Array.isArray(baseValue)) {
|
|
141
|
+
result[key] = deepMerge(baseValue, overrideValue);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
result[key] = overrideValue;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
// ============================================================================
|
|
150
|
+
// Config Store Implementation
|
|
151
|
+
// ============================================================================
|
|
152
|
+
/**
|
|
153
|
+
* Creates a config store
|
|
154
|
+
*/
|
|
155
|
+
export function createConfigStore() {
|
|
156
|
+
return {
|
|
157
|
+
async exists(scope = 'global') {
|
|
158
|
+
const configPath = getConfigPath(scope);
|
|
159
|
+
return fileExists(configPath);
|
|
160
|
+
},
|
|
161
|
+
async read(scope = 'global') {
|
|
162
|
+
const configPath = getConfigPath(scope);
|
|
163
|
+
const data = await readJsonFile(configPath);
|
|
164
|
+
if (data === undefined) {
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
// Validate with schema
|
|
168
|
+
const result = safeValidateConfig(data);
|
|
169
|
+
if (!result.success) {
|
|
170
|
+
throw new ConfigError(ConfigErrorCode.CONFIG_VALIDATION_ERROR, `Config validation failed for ${scope} config`, {
|
|
171
|
+
path: configPath,
|
|
172
|
+
errors: result.error.errors.map((e) => `${e.path.join('.')}: ${e.message}`),
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return result.data;
|
|
176
|
+
},
|
|
177
|
+
async write(config, scope = 'global') {
|
|
178
|
+
// INV-CFG-DOM-001: Validate before write
|
|
179
|
+
const validated = validateConfig(config);
|
|
180
|
+
// Add/update timestamps
|
|
181
|
+
const now = new Date().toISOString();
|
|
182
|
+
const configWithTimestamps = {
|
|
183
|
+
...validated,
|
|
184
|
+
updatedAt: now,
|
|
185
|
+
createdAt: validated.createdAt ?? now,
|
|
186
|
+
};
|
|
187
|
+
const configPath = getConfigPath(scope);
|
|
188
|
+
await writeJsonFileAtomic(configPath, configWithTimestamps);
|
|
189
|
+
},
|
|
190
|
+
async delete(scope = 'global') {
|
|
191
|
+
const configPath = getConfigPath(scope);
|
|
192
|
+
return deleteFile(configPath);
|
|
193
|
+
},
|
|
194
|
+
getPath(scope = 'global') {
|
|
195
|
+
return getConfigPath(scope);
|
|
196
|
+
},
|
|
197
|
+
async readMerged() {
|
|
198
|
+
const globalConfig = await this.read('global');
|
|
199
|
+
const localConfig = await this.read('local');
|
|
200
|
+
// Start with defaults
|
|
201
|
+
let merged = { ...DEFAULT_CONFIG };
|
|
202
|
+
// Merge global config
|
|
203
|
+
if (globalConfig !== undefined) {
|
|
204
|
+
merged = deepMerge(merged, globalConfig);
|
|
205
|
+
}
|
|
206
|
+
// Merge local config (highest priority)
|
|
207
|
+
if (localConfig !== undefined) {
|
|
208
|
+
merged = deepMerge(merged, localConfig);
|
|
209
|
+
}
|
|
210
|
+
return merged;
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
// ============================================================================
|
|
215
|
+
// Utility Functions
|
|
216
|
+
// ============================================================================
|
|
217
|
+
/**
|
|
218
|
+
* Subdirectories to create during setup
|
|
219
|
+
* Per PRD Section 9: File Structure
|
|
220
|
+
*/
|
|
221
|
+
export const CONFIG_SUBDIRS = ['providers', 'cache', 'data'];
|
|
222
|
+
/**
|
|
223
|
+
* Initializes config directory structure
|
|
224
|
+
* Creates:
|
|
225
|
+
* - ~/.automatosx/
|
|
226
|
+
* - ~/.automatosx/providers/
|
|
227
|
+
* - ~/.automatosx/cache/
|
|
228
|
+
* - ~/.automatosx/data/
|
|
229
|
+
*/
|
|
230
|
+
export async function initConfigDirectory(scope = 'global') {
|
|
231
|
+
const dataPath = DATA_PATHS[scope];
|
|
232
|
+
// Create main directory
|
|
233
|
+
await ensureDir(dataPath);
|
|
234
|
+
// Create subdirectories
|
|
235
|
+
for (const subdir of CONFIG_SUBDIRS) {
|
|
236
|
+
await ensureDir(path.join(dataPath, subdir));
|
|
237
|
+
}
|
|
238
|
+
return dataPath;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Checks if setup has been completed
|
|
242
|
+
*/
|
|
243
|
+
export async function isSetupComplete() {
|
|
244
|
+
const store = createConfigStore();
|
|
245
|
+
return store.exists('global');
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B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|
5
|
+
"description": "Configuration domain - config management following contract invariants",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"author": "DEFAI Private Limited",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/defai-digital/automatosx.git",
|
|
11
|
+
"directory": "packages/core/config-domain"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/defai-digital/automatosx#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/defai-digital/automatosx/issues"
|
|
16
|
+
},
|
|
17
|
+
"main": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=20.0.0"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@defai.digital/contracts": "13.0.3"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsc --build",
|
|
39
|
+
"clean": "rm -rf dist *.tsbuildinfo"
|
|
40
|
+
}
|
|
41
|
+
}
|