@kb-labs/core-config 1.2.0 → 1.4.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 (173) hide show
  1. package/dist/index.d.ts +1016 -25
  2. package/dist/index.js +1533 -29
  3. package/dist/index.js.map +1 -1
  4. package/package.json +2 -2
  5. package/dist/__tests__/cache.spec.d.ts +0 -6
  6. package/dist/__tests__/cache.spec.d.ts.map +0 -1
  7. package/dist/__tests__/cache.spec.js +0 -87
  8. package/dist/__tests__/cache.spec.js.map +0 -1
  9. package/dist/__tests__/fs-atomic.spec.d.ts +0 -6
  10. package/dist/__tests__/fs-atomic.spec.d.ts.map +0 -1
  11. package/dist/__tests__/fs-atomic.spec.js +0 -153
  12. package/dist/__tests__/fs-atomic.spec.js.map +0 -1
  13. package/dist/__tests__/get-product-config-edge-cases.spec.d.ts +0 -6
  14. package/dist/__tests__/get-product-config-edge-cases.spec.d.ts.map +0 -1
  15. package/dist/__tests__/get-product-config-edge-cases.spec.js +0 -334
  16. package/dist/__tests__/get-product-config-edge-cases.spec.js.map +0 -1
  17. package/dist/__tests__/init-workspace.spec.d.ts +0 -6
  18. package/dist/__tests__/init-workspace.spec.d.ts.map +0 -1
  19. package/dist/__tests__/init-workspace.spec.js +0 -101
  20. package/dist/__tests__/init-workspace.spec.js.map +0 -1
  21. package/dist/__tests__/kb-error.spec.d.ts +0 -6
  22. package/dist/__tests__/kb-error.spec.d.ts.map +0 -1
  23. package/dist/__tests__/kb-error.spec.js +0 -193
  24. package/dist/__tests__/kb-error.spec.js.map +0 -1
  25. package/dist/__tests__/preset-lockfile.spec.d.ts +0 -6
  26. package/dist/__tests__/preset-lockfile.spec.d.ts.map +0 -1
  27. package/dist/__tests__/preset-lockfile.spec.js +0 -142
  28. package/dist/__tests__/preset-lockfile.spec.js.map +0 -1
  29. package/dist/__tests__/product-config-profiles.spec.d.ts +0 -6
  30. package/dist/__tests__/product-config-profiles.spec.d.ts.map +0 -1
  31. package/dist/__tests__/product-config-profiles.spec.js +0 -82
  32. package/dist/__tests__/product-config-profiles.spec.js.map +0 -1
  33. package/dist/__tests__/product-config.spec.d.ts +0 -6
  34. package/dist/__tests__/product-config.spec.d.ts.map +0 -1
  35. package/dist/__tests__/product-config.spec.js +0 -304
  36. package/dist/__tests__/product-config.spec.js.map +0 -1
  37. package/dist/__tests__/profiles-demo.d.ts +0 -11
  38. package/dist/__tests__/profiles-demo.d.ts.map +0 -1
  39. package/dist/__tests__/profiles-demo.js +0 -173
  40. package/dist/__tests__/profiles-demo.js.map +0 -1
  41. package/dist/__tests__/profiles-resolver.spec.d.ts +0 -2
  42. package/dist/__tests__/profiles-resolver.spec.d.ts.map +0 -1
  43. package/dist/__tests__/profiles-resolver.spec.js +0 -114
  44. package/dist/__tests__/profiles-resolver.spec.js.map +0 -1
  45. package/dist/__tests__/profiles-section.spec.d.ts +0 -2
  46. package/dist/__tests__/profiles-section.spec.d.ts.map +0 -1
  47. package/dist/__tests__/profiles-section.spec.js +0 -50
  48. package/dist/__tests__/profiles-section.spec.js.map +0 -1
  49. package/dist/__tests__/runtime.spec.d.ts +0 -2
  50. package/dist/__tests__/runtime.spec.d.ts.map +0 -1
  51. package/dist/__tests__/runtime.spec.js +0 -170
  52. package/dist/__tests__/runtime.spec.js.map +0 -1
  53. package/dist/__tests__/upsert-lockfile.spec.d.ts +0 -1
  54. package/dist/__tests__/upsert-lockfile.spec.d.ts.map +0 -1
  55. package/dist/__tests__/upsert-lockfile.spec.js +0 -2
  56. package/dist/__tests__/upsert-lockfile.spec.js.map +0 -1
  57. package/dist/__tests__/validate-config.spec.d.ts +0 -2
  58. package/dist/__tests__/validate-config.spec.d.ts.map +0 -1
  59. package/dist/__tests__/validate-config.spec.js +0 -14
  60. package/dist/__tests__/validate-config.spec.js.map +0 -1
  61. package/dist/api/init-workspace.d.ts +0 -10
  62. package/dist/api/init-workspace.d.ts.map +0 -1
  63. package/dist/api/init-workspace.js +0 -186
  64. package/dist/api/init-workspace.js.map +0 -1
  65. package/dist/api/product-config.d.ts +0 -20
  66. package/dist/api/product-config.d.ts.map +0 -1
  67. package/dist/api/product-config.js +0 -236
  68. package/dist/api/product-config.js.map +0 -1
  69. package/dist/api/read-config.d.ts +0 -22
  70. package/dist/api/read-config.d.ts.map +0 -1
  71. package/dist/api/read-config.js +0 -112
  72. package/dist/api/read-config.js.map +0 -1
  73. package/dist/api/read-kb-config.d.ts +0 -12
  74. package/dist/api/read-kb-config.d.ts.map +0 -1
  75. package/dist/api/read-kb-config.js +0 -47
  76. package/dist/api/read-kb-config.js.map +0 -1
  77. package/dist/api/upsert-lockfile.d.ts +0 -10
  78. package/dist/api/upsert-lockfile.d.ts.map +0 -1
  79. package/dist/api/upsert-lockfile.js +0 -63
  80. package/dist/api/upsert-lockfile.js.map +0 -1
  81. package/dist/cache/fs-cache.d.ts +0 -38
  82. package/dist/cache/fs-cache.d.ts.map +0 -1
  83. package/dist/cache/fs-cache.js +0 -142
  84. package/dist/cache/fs-cache.js.map +0 -1
  85. package/dist/errors/kb-error.d.ts +0 -35
  86. package/dist/errors/kb-error.d.ts.map +0 -1
  87. package/dist/errors/kb-error.js +0 -57
  88. package/dist/errors/kb-error.js.map +0 -1
  89. package/dist/hash/config-hash.d.ts +0 -17
  90. package/dist/hash/config-hash.d.ts.map +0 -1
  91. package/dist/hash/config-hash.js +0 -55
  92. package/dist/hash/config-hash.js.map +0 -1
  93. package/dist/index.d.ts.map +0 -1
  94. package/dist/lockfile/lockfile.d.ts +0 -53
  95. package/dist/lockfile/lockfile.d.ts.map +0 -1
  96. package/dist/lockfile/lockfile.js +0 -142
  97. package/dist/lockfile/lockfile.js.map +0 -1
  98. package/dist/merge/layered-merge.d.ts +0 -16
  99. package/dist/merge/layered-merge.d.ts.map +0 -1
  100. package/dist/merge/layered-merge.js +0 -87
  101. package/dist/merge/layered-merge.js.map +0 -1
  102. package/dist/preset/resolve-preset.d.ts +0 -28
  103. package/dist/preset/resolve-preset.d.ts.map +0 -1
  104. package/dist/preset/resolve-preset.js +0 -104
  105. package/dist/preset/resolve-preset.js.map +0 -1
  106. package/dist/profiles/loader.d.ts +0 -12
  107. package/dist/profiles/loader.d.ts.map +0 -1
  108. package/dist/profiles/loader.js +0 -34
  109. package/dist/profiles/loader.js.map +0 -1
  110. package/dist/profiles/resolver.d.ts +0 -11
  111. package/dist/profiles/resolver.d.ts.map +0 -1
  112. package/dist/profiles/resolver.js +0 -252
  113. package/dist/profiles/resolver.js.map +0 -1
  114. package/dist/profiles/scope-selector.d.ts +0 -19
  115. package/dist/profiles/scope-selector.d.ts.map +0 -1
  116. package/dist/profiles/scope-selector.js +0 -64
  117. package/dist/profiles/scope-selector.js.map +0 -1
  118. package/dist/profiles/types.d.ts +0 -462
  119. package/dist/profiles/types.d.ts.map +0 -1
  120. package/dist/profiles/types.js +0 -68
  121. package/dist/profiles/types.js.map +0 -1
  122. package/dist/runtime/index.d.ts +0 -2
  123. package/dist/runtime/index.d.ts.map +0 -1
  124. package/dist/runtime/index.js +0 -2
  125. package/dist/runtime/index.js.map +0 -1
  126. package/dist/runtime/runtime.d.ts +0 -46
  127. package/dist/runtime/runtime.d.ts.map +0 -1
  128. package/dist/runtime/runtime.js +0 -126
  129. package/dist/runtime/runtime.js.map +0 -1
  130. package/dist/types/index.d.ts +0 -2
  131. package/dist/types/index.d.ts.map +0 -1
  132. package/dist/types/index.js +0 -2
  133. package/dist/types/index.js.map +0 -1
  134. package/dist/types/init.d.ts +0 -33
  135. package/dist/types/init.d.ts.map +0 -1
  136. package/dist/types/init.js +0 -6
  137. package/dist/types/init.js.map +0 -1
  138. package/dist/types/preset.d.ts +0 -27
  139. package/dist/types/preset.d.ts.map +0 -1
  140. package/dist/types/preset.js +0 -6
  141. package/dist/types/preset.js.map +0 -1
  142. package/dist/types/types.d.ts +0 -70
  143. package/dist/types/types.d.ts.map +0 -1
  144. package/dist/types/types.js +0 -2
  145. package/dist/types/types.js.map +0 -1
  146. package/dist/utils/__tests__/env.spec.d.ts +0 -2
  147. package/dist/utils/__tests__/env.spec.d.ts.map +0 -1
  148. package/dist/utils/__tests__/env.spec.js +0 -33
  149. package/dist/utils/__tests__/env.spec.js.map +0 -1
  150. package/dist/utils/env.d.ts +0 -7
  151. package/dist/utils/env.d.ts.map +0 -1
  152. package/dist/utils/env.js +0 -25
  153. package/dist/utils/env.js.map +0 -1
  154. package/dist/utils/fs-atomic.d.ts +0 -15
  155. package/dist/utils/fs-atomic.d.ts.map +0 -1
  156. package/dist/utils/fs-atomic.js +0 -46
  157. package/dist/utils/fs-atomic.js.map +0 -1
  158. package/dist/utils/index.d.ts +0 -3
  159. package/dist/utils/index.d.ts.map +0 -1
  160. package/dist/utils/index.js +0 -3
  161. package/dist/utils/index.js.map +0 -1
  162. package/dist/utils/paths.d.ts +0 -21
  163. package/dist/utils/paths.d.ts.map +0 -1
  164. package/dist/utils/paths.js +0 -32
  165. package/dist/utils/paths.js.map +0 -1
  166. package/dist/utils/product-normalize.d.ts +0 -25
  167. package/dist/utils/product-normalize.d.ts.map +0 -1
  168. package/dist/utils/product-normalize.js +0 -48
  169. package/dist/utils/product-normalize.js.map +0 -1
  170. package/dist/validation/validate-config.d.ts +0 -10
  171. package/dist/validation/validate-config.d.ts.map +0 -1
  172. package/dist/validation/validate-config.js +0 -21
  173. package/dist/validation/validate-config.js.map +0 -1
@@ -1,193 +0,0 @@
1
- /**
2
- * @module @kb-labs/core/config/__tests__/kb-error.spec.ts
3
- * Tests for KbError class and error utilities
4
- */
5
- import { describe, it, expect } from "vitest";
6
- import { KbError, getExitCode, ERROR_HINTS, } from "../errors/kb-error";
7
- describe("KbError", () => {
8
- describe("constructor", () => {
9
- it("should create error with all parameters", () => {
10
- const error = new KbError("ERR_TEST", "Test error message", "Test hint", {
11
- test: "meta",
12
- });
13
- expect(error.code).toBe("ERR_TEST");
14
- expect(error.message).toBe("Test error message");
15
- expect(error.hint).toBe("Test hint");
16
- expect(error.meta).toEqual({ test: "meta" });
17
- expect(error.name).toBe("KbError");
18
- expect(error).toBeInstanceOf(Error);
19
- });
20
- it("should create error with minimal parameters", () => {
21
- const error = new KbError("ERR_MINIMAL", "Minimal error");
22
- expect(error.code).toBe("ERR_MINIMAL");
23
- expect(error.message).toBe("Minimal error");
24
- expect(error.hint).toBeUndefined();
25
- expect(error.meta).toBeUndefined();
26
- expect(error.name).toBe("KbError");
27
- });
28
- it("should create error with code and message only", () => {
29
- const error = new KbError("ERR_CODE_ONLY", "Code only message");
30
- expect(error.code).toBe("ERR_CODE_ONLY");
31
- expect(error.message).toBe("Code only message");
32
- expect(error.hint).toBeUndefined();
33
- expect(error.meta).toBeUndefined();
34
- });
35
- it("should create error with hint but no meta", () => {
36
- const error = new KbError("ERR_HINT_ONLY", "Hint only message", "Hint without meta");
37
- expect(error.code).toBe("ERR_HINT_ONLY");
38
- expect(error.message).toBe("Hint only message");
39
- expect(error.hint).toBe("Hint without meta");
40
- expect(error.meta).toBeUndefined();
41
- });
42
- it("should create error with meta but no hint", () => {
43
- const error = new KbError("ERR_META_ONLY", "Meta only message", undefined, { meta: "data" });
44
- expect(error.code).toBe("ERR_META_ONLY");
45
- expect(error.message).toBe("Meta only message");
46
- expect(error.hint).toBeUndefined();
47
- expect(error.meta).toEqual({ meta: "data" });
48
- });
49
- it("should handle complex meta objects", () => {
50
- const complexMeta = {
51
- nested: { value: 42 },
52
- array: [1, 2, 3],
53
- nullValue: null,
54
- undefinedValue: undefined,
55
- };
56
- const error = new KbError("ERR_COMPLEX", "Complex meta error", "Complex hint", complexMeta);
57
- expect(error.meta).toEqual(complexMeta);
58
- });
59
- it("should handle empty string parameters", () => {
60
- const error = new KbError("", "", "", {});
61
- expect(error.code).toBe("");
62
- expect(error.message).toBe("");
63
- expect(error.hint).toBe("");
64
- expect(error.meta).toEqual({});
65
- });
66
- });
67
- describe("inheritance", () => {
68
- it("should be instanceof Error", () => {
69
- const error = new KbError("ERR_INHERITANCE", "Test");
70
- expect(error).toBeInstanceOf(Error);
71
- });
72
- it("should be instanceof KbError", () => {
73
- const error = new KbError("ERR_INHERITANCE", "Test");
74
- expect(error).toBeInstanceOf(KbError);
75
- });
76
- it("should have Error prototype methods", () => {
77
- const error = new KbError("ERR_METHODS", "Test message");
78
- expect(typeof error.toString).toBe("function");
79
- expect(typeof error.stack).toBe("string");
80
- });
81
- });
82
- describe("serialization", () => {
83
- it("should serialize to JSON correctly", () => {
84
- const error = new KbError("ERR_SERIALIZE", "Serialization test", "Test hint", { test: "data" });
85
- // Error objects don't serialize custom properties by default
86
- // We need to manually serialize them
87
- const errorData = {
88
- code: error.code,
89
- message: error.message,
90
- hint: error.hint,
91
- meta: error.meta,
92
- };
93
- const serialized = JSON.stringify(errorData);
94
- const parsed = JSON.parse(serialized);
95
- expect(parsed.code).toBe("ERR_SERIALIZE");
96
- expect(parsed.message).toBe("Serialization test");
97
- expect(parsed.hint).toBe("Test hint");
98
- expect(parsed.meta).toEqual({ test: "data" });
99
- });
100
- it("should handle undefined values in serialization", () => {
101
- const error = new KbError("ERR_UNDEFINED", "Test");
102
- const errorData = {
103
- code: error.code,
104
- message: error.message,
105
- hint: error.hint,
106
- meta: error.meta,
107
- };
108
- const serialized = JSON.stringify(errorData);
109
- const parsed = JSON.parse(serialized);
110
- expect(parsed.code).toBe("ERR_UNDEFINED");
111
- expect(parsed.message).toBe("Test");
112
- expect(parsed.hint).toBeUndefined();
113
- expect(parsed.meta).toBeUndefined();
114
- });
115
- });
116
- });
117
- describe("getExitCode", () => {
118
- it("should return 3 for ERR_FORBIDDEN", () => {
119
- const error = new KbError("ERR_FORBIDDEN", "Forbidden");
120
- expect(getExitCode(error)).toBe(3);
121
- });
122
- it("should return 2 for ERR_CONFIG_NOT_FOUND", () => {
123
- const error = new KbError("ERR_CONFIG_NOT_FOUND", "Config not found");
124
- expect(getExitCode(error)).toBe(2);
125
- });
126
- it("should return 2 for ERR_CONFIG_EXISTS_CONFLICT", () => {
127
- const error = new KbError("ERR_CONFIG_EXISTS_CONFLICT", "Config exists");
128
- expect(getExitCode(error)).toBe(2);
129
- });
130
- it("should return 2 for ERR_PATH_OUTSIDE_WORKSPACE", () => {
131
- const error = new KbError("ERR_PATH_OUTSIDE_WORKSPACE", "Path outside");
132
- expect(getExitCode(error)).toBe(2);
133
- });
134
- it("should return 1 for other ERR_ codes", () => {
135
- const error = new KbError("ERR_OTHER", "Other error");
136
- expect(getExitCode(error)).toBe(1);
137
- });
138
- it("should return 1 for non-ERR codes", () => {
139
- const error = new KbError("OTHER_CODE", "Other code");
140
- expect(getExitCode(error)).toBe(1);
141
- });
142
- it("should return 1 for empty code", () => {
143
- const error = new KbError("", "Empty code");
144
- expect(getExitCode(error)).toBe(1);
145
- });
146
- });
147
- describe("ERROR_HINTS", () => {
148
- it("should contain all expected error codes", () => {
149
- const expectedCodes = [
150
- "ERR_CONFIG_NOT_FOUND",
151
- "ERR_CONFIG_INVALID",
152
- "ERR_CONFIG_EXISTS_CONFLICT",
153
- "ERR_PATH_OUTSIDE_WORKSPACE",
154
- "ERR_PRESET_NOT_RESOLVED",
155
- "ERR_PROFILE_INCOMPATIBLE",
156
- "ERR_PROFILE_NOT_DEFINED",
157
- "ERR_PROFILE_RESOLVE_FAILED",
158
- "ERR_PROFILE_EXTENDS_FAILED",
159
- "ERR_PROFILE_SCOPE_NOT_FOUND",
160
- "ERR_PROFILE_SCOPE_CONFLICT",
161
- "ERR_PROFILE_INVALID_FORMAT",
162
- "ERR_ARTIFACT_LIMIT_EXCEEDED",
163
- "ERR_FORBIDDEN",
164
- ];
165
- expectedCodes.forEach((code) => {
166
- expect(ERROR_HINTS[code]).toBeDefined();
167
- expect(typeof ERROR_HINTS[code]).toBe("string");
168
- expect(ERROR_HINTS[code].length).toBeGreaterThan(0);
169
- });
170
- });
171
- it("should have helpful hints for each error", () => {
172
- expect(ERROR_HINTS.ERR_CONFIG_NOT_FOUND).toContain("kb init");
173
- expect(ERROR_HINTS.ERR_CONFIG_INVALID).toContain("syntax");
174
- expect(ERROR_HINTS.ERR_CONFIG_EXISTS_CONFLICT).toContain("--force");
175
- expect(ERROR_HINTS.ERR_PATH_OUTSIDE_WORKSPACE).toContain("workspace");
176
- expect(ERROR_HINTS.ERR_PRESET_NOT_RESOLVED).toContain("preset");
177
- expect(ERROR_HINTS.ERR_PROFILE_INCOMPATIBLE).toContain("incompatible");
178
- expect(ERROR_HINTS.ERR_PROFILE_NOT_DEFINED).toContain("profiles[]");
179
- expect(ERROR_HINTS.ERR_PROFILE_RESOLVE_FAILED).toContain("profiles[]");
180
- expect(ERROR_HINTS.ERR_PROFILE_EXTENDS_FAILED).toContain("extends");
181
- expect(ERROR_HINTS.ERR_PROFILE_INVALID_FORMAT).toContain("kb.config.json");
182
- expect(ERROR_HINTS.ERR_PROFILE_SCOPE_NOT_FOUND).toContain("--scope");
183
- expect(ERROR_HINTS.ERR_PROFILE_SCOPE_CONFLICT).toContain("--scope");
184
- expect(ERROR_HINTS.ERR_ARTIFACT_LIMIT_EXCEEDED).toContain("artifacts");
185
- expect(ERROR_HINTS.ERR_FORBIDDEN).toContain("policy");
186
- });
187
- it("should be readonly", () => {
188
- const originalValue = ERROR_HINTS.ERR_CONFIG_NOT_FOUND;
189
- ERROR_HINTS.ERR_CONFIG_NOT_FOUND = "Modified";
190
- expect(originalValue).toBe("Create .kb/kb-labs.config.yaml or run: kb init");
191
- });
192
- });
193
- //# sourceMappingURL=kb-error.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"kb-error.spec.js","sourceRoot":"","sources":["../../src/__tests__/kb-error.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,OAAO,EACP,WAAW,EACX,WAAW,GAEZ,MAAM,oBAAoB,CAAC;AAE5B,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC3B,EAAE,CAAC,y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,CAAC,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * @module @kb-labs/core/config/__tests__/preset-lockfile.spec.ts
3
- * Tests for preset resolution and lockfile functionality
4
- */
5
- export {};
6
- //# sourceMappingURL=preset-lockfile.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"preset-lockfile.spec.d.ts","sourceRoot":"","sources":["../../src/__tests__/preset-lockfile.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -1,142 +0,0 @@
1
- /**
2
- * @module @kb-labs/core/config/__tests__/preset-lockfile.spec.ts
3
- * Tests for preset resolution and lockfile functionality
4
- */
5
- import { describe, it, expect, beforeEach, afterEach } from "vitest";
6
- import { promises as fsp } from "node:fs";
7
- import path from "node:path";
8
- import { tmpdir } from "node:os";
9
- import { resolvePreset, getPresetConfigForProduct, readLockfile, writeLockfile, updateLockfile, isLockfileUpToDate, clearCaches, } from "../index";
10
- describe("Preset and Lockfile System", () => {
11
- let testDir;
12
- let presetDir;
13
- beforeEach(async () => {
14
- testDir = path.join(tmpdir(), `kb-labs-preset-test-${Date.now()}`);
15
- presetDir = path.join(testDir, "node_modules", "@kb-labs", "org-preset");
16
- await fsp.mkdir(presetDir, { recursive: true });
17
- clearCaches();
18
- });
19
- afterEach(async () => {
20
- await fsp.rm(testDir, { recursive: true, force: true });
21
- clearCaches();
22
- });
23
- describe("Preset Resolution", () => {
24
- it("should resolve preset from local node_modules", async () => {
25
- // Create preset package
26
- const packageJson = {
27
- name: "@kb-labs/org-preset",
28
- version: "1.3.2",
29
- description: "KB Labs org preset",
30
- };
31
- await fsp.writeFile(path.join(presetDir, "package.json"), JSON.stringify(packageJson, null, 2));
32
- const configDefaults = {
33
- products: {
34
- "ai-review": {
35
- enabled: true,
36
- rules: ["security", "performance"],
37
- },
38
- devlink: {
39
- watch: true,
40
- build: true,
41
- },
42
- },
43
- };
44
- await fsp.writeFile(path.join(presetDir, "config.defaults.json"), JSON.stringify(configDefaults, null, 2));
45
- const preset = await resolvePreset("@kb-labs/org-preset@1.3.2", testDir);
46
- expect(preset.name).toBe("@kb-labs/org-preset");
47
- expect(preset.version).toBe("1.3.2");
48
- expect(preset.path).toBe(presetDir);
49
- expect(preset.config).toEqual(configDefaults);
50
- });
51
- it("should get preset config for specific product", async () => {
52
- // Create preset package
53
- const packageJson = {
54
- name: "@kb-labs/org-preset",
55
- version: "1.3.2",
56
- };
57
- await fsp.writeFile(path.join(presetDir, "package.json"), JSON.stringify(packageJson, null, 2));
58
- const configDefaults = {
59
- products: {
60
- "ai-review": {
61
- enabled: true,
62
- rules: ["security", "performance"],
63
- },
64
- },
65
- };
66
- await fsp.writeFile(path.join(presetDir, "config.defaults.json"), JSON.stringify(configDefaults, null, 2));
67
- const preset = await resolvePreset("@kb-labs/org-preset@1.3.2", testDir);
68
- const aiReviewConfig = getPresetConfigForProduct(preset, "aiReview");
69
- expect(aiReviewConfig).toEqual({
70
- enabled: true,
71
- rules: ["security", "performance"],
72
- });
73
- });
74
- it("should throw error for invalid preset reference", async () => {
75
- await expect(resolvePreset("invalid-preset", testDir)).rejects.toThrow("Invalid preset reference");
76
- });
77
- it("should throw error for missing preset", async () => {
78
- await expect(resolvePreset("@kb-labs/missing-preset@1.0.0", testDir)).rejects.toThrow("Preset not found");
79
- });
80
- });
81
- describe("Lockfile Management", () => {
82
- it("should create and read lockfile", async () => {
83
- const lockfileData = {
84
- $schema: "https://schemas.kb-labs.dev/lockfile.schema.json",
85
- schemaVersion: "1.0",
86
- orgPreset: "@kb-labs/org-preset@1.3.2",
87
- profile: "node-ts-lib@1.2.0",
88
- hashes: {
89
- "ai-review": "sha256-abc123",
90
- devlink: "sha256-def456",
91
- },
92
- generatedAt: new Date().toISOString(),
93
- };
94
- await writeLockfile(testDir, lockfileData);
95
- const readData = await readLockfile(testDir);
96
- expect(readData).toEqual(lockfileData);
97
- });
98
- it("should update lockfile with new hashes", async () => {
99
- // Create initial lockfile
100
- const initialData = {
101
- schemaVersion: "1.0",
102
- hashes: {
103
- "ai-review": "sha256-old123",
104
- },
105
- generatedAt: new Date().toISOString(),
106
- };
107
- await writeLockfile(testDir, initialData);
108
- // Update with new config hashes
109
- const newConfigs = {
110
- aiReview: { enabled: true, rules: ["new-rule"] },
111
- devlink: { watch: true },
112
- };
113
- const updatedData = await updateLockfile(testDir, {
114
- configHashes: newConfigs,
115
- });
116
- expect(updatedData.hashes["ai-review"]).toBeDefined();
117
- expect(updatedData.hashes["devlink"]).toBeDefined();
118
- expect(updatedData.hashes["ai-review"]).not.toBe("sha256-old123");
119
- });
120
- it("should check if lockfile is up to date", async () => {
121
- const configs = {
122
- aiReview: { enabled: true, rules: ["test"] },
123
- };
124
- // No lockfile exists
125
- expect(await isLockfileUpToDate(testDir, configs)).toBe(false);
126
- // Create lockfile
127
- await updateLockfile(testDir, { configHashes: configs });
128
- // Should be up to date now
129
- expect(await isLockfileUpToDate(testDir, configs)).toBe(true);
130
- // Change config
131
- const newConfigs = {
132
- aiReview: { enabled: false, rules: ["different"] },
133
- };
134
- expect(await isLockfileUpToDate(testDir, newConfigs)).toBe(false);
135
- });
136
- it("should return null for missing lockfile", async () => {
137
- const lockfile = await readLockfile(testDir);
138
- expect(lockfile).toBeNull();
139
- });
140
- });
141
- });
142
- //# sourceMappingURL=preset-lockfile.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"preset-lockfile.spec.js","sourceRoot":"","sources":["../../src/__tests__/preset-lockfile.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,QAAQ,IAAI,GAAG,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,YAAY,EACZ,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C7C,CAAC;YAEF,qBAAqB;YACrB,MAAM,CAAC,MAAM,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAE/D,kBAAkB;YAClB,MAAM,cAAc,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,CAAC;YAEzD,2BAA2B;YAC3B,MAAM,CAAC,MAAM,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAE9D,gBAAgB;YAChB,MAAM,UAAU,GAAG;gBACjB,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE;aACnD,CAAC;YACF,MAAM,CAAC,MAAM,kBAAkB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;YACvD,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,CAAC;YAC7C,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * @module @kb-labs/core-config/__tests__/product-config-profiles
3
- * Tests for product config with profile integration
4
- */
5
- export {};
6
- //# sourceMappingURL=product-config-profiles.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"product-config-profiles.spec.d.ts","sourceRoot":"","sources":["../../src/__tests__/product-config-profiles.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -1,82 +0,0 @@
1
- /**
2
- * @module @kb-labs/core-config/__tests__/product-config-profiles
3
- * Tests for product config with profile integration
4
- */
5
- import { describe, it, expect, beforeEach } from "vitest";
6
- import { promises as fsp } from "node:fs";
7
- import path from "node:path";
8
- import { tmpdir } from "node:os";
9
- import { getProductConfig } from "../api/product-config";
10
- describe("Product Config with Profiles", () => {
11
- let testDir;
12
- beforeEach(async () => {
13
- testDir = path.join(tmpdir(), `kb-labs-config-profiles-${Date.now()}`);
14
- await fsp.mkdir(testDir, { recursive: true });
15
- });
16
- it("should merge profile overlays correctly", async () => {
17
- const profileLayer = {
18
- profileId: "test-profile",
19
- source: "profile:test-profile@1.0.0",
20
- products: { maxFiles: 50, debug: false },
21
- };
22
- const result = await getProductConfig({
23
- cwd: testDir,
24
- product: "aiReview",
25
- cli: {},
26
- profileLayer,
27
- }, null);
28
- expect(result.config.maxFiles).toBe(50);
29
- expect(result.config.debug).toBe(false);
30
- const traceLayer = result.trace.find((t) => t.layer === "profile");
31
- expect(traceLayer?.source).toBe("profile:test-profile@1.0.0");
32
- });
33
- it("should handle missing profile gracefully", async () => {
34
- // Test without profileInfo
35
- const config = await getProductConfig({
36
- cwd: testDir,
37
- product: "aiReview",
38
- cli: {},
39
- }, null);
40
- expect(config.config).toBeDefined();
41
- expect(config.trace).toBeDefined();
42
- });
43
- it("should include profile info in trace", async () => {
44
- const profileLayerInput = {
45
- profileId: "test-profile",
46
- source: "profile:test-profile@1.2.0",
47
- products: { enabled: true },
48
- };
49
- const config = await getProductConfig({
50
- cwd: testDir,
51
- product: "aiReview",
52
- cli: {},
53
- profileLayer: profileLayerInput,
54
- }, null);
55
- const profileLayer = config.trace.find((t) => t.layer === "profile");
56
- expect(profileLayer).toBeDefined();
57
- expect(profileLayer?.source).toBe("profile:test-profile@1.2.0");
58
- });
59
- it("should include scope layer when provided", async () => {
60
- const profileLayerInput = {
61
- profileId: "test-profile",
62
- source: "profile:test-profile@1.0.0",
63
- products: { engine: "openai" },
64
- scope: {
65
- id: "src",
66
- source: "profile-scope:src",
67
- products: { engine: "anthropic" },
68
- },
69
- };
70
- const config = await getProductConfig({
71
- cwd: testDir,
72
- product: "aiReview",
73
- cli: {},
74
- profileLayer: profileLayerInput,
75
- }, null);
76
- const scopeLayer = config.trace.find((t) => t.layer === "profile-scope");
77
- expect(scopeLayer).toBeDefined();
78
- expect(scopeLayer?.source).toBe("profile-scope:src");
79
- expect(config.config.engine).toBe("anthropic");
80
- });
81
- });
82
- //# sourceMappingURL=product-config-profiles.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"product-config-profiles.spec.js","sourceRoot":"","sources":["../../src/__tests__/product-config-profiles.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,QAAQ,IAAI,GAAG,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC5C,IAAI,OAAe,CAAC;IAEpB,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,2BAA2B,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACvE,MAAM,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;QACvD,MAAM,YAAY,GAAsB;YACtC,SAAS,EAAE,cAAc;YACzB,MAAM,EAAE,4BAA4B;YACpC,QAAQ,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;SACzC,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,gBAAgB,CACnC;YACE,GAAG,E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-labs/core/config/__tests__/product-config.spec.ts
3
- * Tests for product configuration system
4
- */
5
- export {};
6
- //# sourceMappingURL=product-config.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"product-config.spec.d.ts","sourceRoot":"","sources":["../../src/__tests__/product-config.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}