@quiltdata/benchling-webhook 0.7.4-20251107T053446Z → 0.7.4

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 (45) hide show
  1. package/README.md +6 -4
  2. package/dist/bin/cli.js +0 -15
  3. package/dist/bin/cli.js.map +1 -1
  4. package/dist/bin/commands/get-env.d.ts +16 -0
  5. package/dist/bin/commands/get-env.d.ts.map +1 -0
  6. package/dist/bin/commands/get-env.js +210 -0
  7. package/dist/bin/commands/get-env.js.map +1 -0
  8. package/dist/bin/commands/infer-quilt-config.d.ts +3 -2
  9. package/dist/bin/commands/infer-quilt-config.d.ts.map +1 -1
  10. package/dist/bin/commands/infer-quilt-config.js +39 -65
  11. package/dist/bin/commands/infer-quilt-config.js.map +1 -1
  12. package/dist/bin/commands/setup-wizard.d.ts.map +1 -1
  13. package/dist/bin/commands/setup-wizard.js +105 -110
  14. package/dist/bin/commands/setup-wizard.js.map +1 -1
  15. package/dist/bin/commands/sync-secrets.d.ts +6 -3
  16. package/dist/bin/commands/sync-secrets.d.ts.map +1 -1
  17. package/dist/bin/commands/sync-secrets.js +14 -6
  18. package/dist/bin/commands/sync-secrets.js.map +1 -1
  19. package/dist/lib/interfaces/config-storage.d.ts +80 -0
  20. package/dist/lib/interfaces/config-storage.d.ts.map +1 -0
  21. package/dist/lib/interfaces/config-storage.js +9 -0
  22. package/dist/lib/interfaces/config-storage.js.map +1 -0
  23. package/dist/lib/utils/stack-inference.d.ts +28 -0
  24. package/dist/lib/utils/stack-inference.d.ts.map +1 -1
  25. package/dist/lib/utils/stack-inference.js +61 -0
  26. package/dist/lib/utils/stack-inference.js.map +1 -1
  27. package/dist/lib/xdg-base.d.ts +306 -0
  28. package/dist/lib/xdg-base.d.ts.map +1 -0
  29. package/dist/lib/xdg-base.js +440 -0
  30. package/dist/lib/xdg-base.js.map +1 -0
  31. package/dist/lib/xdg-config.d.ts +54 -187
  32. package/dist/lib/xdg-config.d.ts.map +1 -1
  33. package/dist/lib/xdg-config.js +83 -342
  34. package/dist/lib/xdg-config.js.map +1 -1
  35. package/dist/package.json +4 -3
  36. package/dist/scripts/list-quilt-stacks.d.ts +14 -0
  37. package/dist/scripts/list-quilt-stacks.d.ts.map +1 -0
  38. package/dist/scripts/list-quilt-stacks.js +96 -0
  39. package/dist/scripts/list-quilt-stacks.js.map +1 -0
  40. package/env.template +79 -0
  41. package/package.json +4 -3
  42. package/dist/bin/commands/config-show.d.ts +0 -14
  43. package/dist/bin/commands/config-show.d.ts.map +0 -1
  44. package/dist/bin/commands/config-show.js +0 -24
  45. package/dist/bin/commands/config-show.js.map +0 -1
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * XDG Configuration Management (v0.7.0 - BREAKING CHANGE)
3
3
  *
4
- * Complete rewrite with NO backward compatibility with v0.6.x.
4
+ * Filesystem implementation of XDGBase for XDG-compliant configuration management.
5
5
  *
6
- * This module provides XDG-compliant configuration management for the Benchling Webhook system
7
- * with a simplified, profile-first architecture:
6
+ * This module provides filesystem-specific storage primitives for the Benchling Webhook system:
7
+ * - Filesystem-based profile storage in ~/.config/benchling-webhook/
8
+ * - Per-profile deployment tracking
9
+ * - Legacy configuration detection
10
+ * - Atomic writes with automatic backups
8
11
  *
9
- * - Single unified configuration file per profile (`config.json`)
10
- * - Per-profile deployment tracking (`deployments.json`)
11
- * - Profile inheritance support with deep merging
12
- * - Comprehensive validation and helpful error messages
12
+ * All business logic (validation, inheritance, deployment tracking) is handled by XDGBase.
13
13
  *
14
14
  * Directory Structure:
15
15
  * ```
@@ -25,10 +25,12 @@
25
25
  * @module xdg-config
26
26
  * @version 0.7.0
27
27
  */
28
- import { ProfileConfig, DeploymentHistory, DeploymentRecord, ValidationResult } from "./types/config";
28
+ import { ProfileConfig, DeploymentHistory } from "./types/config";
29
+ import { XDGBase } from "./xdg-base";
29
30
  /**
30
31
  * XDG Configuration Manager (v0.7.0)
31
32
  *
33
+ * Filesystem-based implementation extending XDGBase.
32
34
  * Manages profile-based configuration with deployment tracking.
33
35
  * NO backward compatibility with v0.6.x configuration files.
34
36
  *
@@ -53,7 +55,7 @@ import { ProfileConfig, DeploymentHistory, DeploymentRecord, ValidationResult }
53
55
  * });
54
56
  * ```
55
57
  */
56
- export declare class XDGConfig {
58
+ export declare class XDGConfig extends XDGBase {
57
59
  private readonly baseDir;
58
60
  /**
59
61
  * Creates a new XDG Configuration Manager
@@ -62,222 +64,81 @@ export declare class XDGConfig {
62
64
  */
63
65
  constructor(baseDir?: string);
64
66
  /**
65
- * Gets the default XDG base directory
66
- *
67
- * Respects XDG_CONFIG_HOME environment variable per XDG Base Directory spec.
67
+ * Reads raw profile configuration from filesystem without validation
68
68
  *
69
- * @returns The default base directory path (~/.config/benchling-webhook or $XDG_CONFIG_HOME/benchling-webhook)
70
- */
71
- private getDefaultBaseDir;
72
- /**
73
- * Ensures the base configuration directory exists
74
- *
75
- * @throws {Error} If directory creation fails
76
- */
77
- private ensureBaseDirectoryExists;
78
- /**
79
- * Reads configuration for a profile
80
- *
81
- * @param profile - Profile name (e.g., "default", "dev", "prod")
82
- * @returns Parsed configuration object
83
- * @throws {Error} If profile not found or configuration is invalid
84
- *
85
- * @example
86
- * ```typescript
87
- * const config = xdg.readProfile("default");
88
- * console.log(config.benchling.tenant);
89
- * ```
69
+ * @param profile - Profile name
70
+ * @returns Raw profile configuration
71
+ * @throws {Error} If profile cannot be read
90
72
  */
91
- readProfile(profile: string): ProfileConfig;
73
+ protected readProfileRaw(profile: string): ProfileConfig;
92
74
  /**
93
- * Writes configuration for a profile
75
+ * Writes raw profile configuration to filesystem without validation
94
76
  *
95
77
  * Creates the profile directory if it doesn't exist.
96
78
  * Performs atomic write with automatic backup.
97
79
  *
98
80
  * @param profile - Profile name
99
- * @param config - Configuration object to write
100
- * @throws {Error} If validation fails or write operation fails
101
- *
102
- * @example
103
- * ```typescript
104
- * xdg.writeProfile("default", {
105
- * quilt: { ... },
106
- * benchling: { ... },
107
- * packages: { ... },
108
- * deployment: { ... },
109
- * _metadata: {
110
- * version: "0.7.0",
111
- * createdAt: new Date().toISOString(),
112
- * updatedAt: new Date().toISOString(),
113
- * source: "wizard"
114
- * }
115
- * });
116
- * ```
81
+ * @param config - Configuration to write
82
+ * @throws {Error} If write fails
117
83
  */
118
- writeProfile(profile: string, config: ProfileConfig): void;
84
+ protected writeProfileRaw(profile: string, config: ProfileConfig): void;
119
85
  /**
120
- * Deletes a profile and all its files
121
- *
122
- * WARNING: This is a destructive operation!
123
- * Cannot delete the "default" profile.
124
- *
125
- * @param profile - Profile name to delete
126
- * @throws {Error} If attempting to delete default profile or if deletion fails
86
+ * Deletes profile and all associated data from filesystem
127
87
  *
128
- * @example
129
- * ```typescript
130
- * xdg.deleteProfile("dev");
131
- * ```
88
+ * @param profile - Profile name
89
+ * @throws {Error} If deletion fails
132
90
  */
133
- deleteProfile(profile: string): void;
91
+ protected deleteProfileRaw(profile: string): void;
134
92
  /**
135
- * Lists all available profiles
93
+ * Lists all profile names from filesystem
136
94
  *
137
95
  * @returns Array of profile names
138
- *
139
- * @example
140
- * ```typescript
141
- * const profiles = xdg.listProfiles();
142
- * console.log(profiles); // ["default", "dev", "prod"]
143
- * ```
144
- */
145
- listProfiles(): string[];
146
- /**
147
- * Checks if a profile exists
148
- *
149
- * @param profile - Profile name to check
150
- * @returns True if profile exists and has valid config.json, false otherwise
151
- *
152
- * @example
153
- * ```typescript
154
- * if (xdg.profileExists("dev")) {
155
- * const config = xdg.readProfile("dev");
156
- * }
157
- * ```
158
96
  */
159
- profileExists(profile: string): boolean;
97
+ protected listProfilesRaw(): string[];
160
98
  /**
161
- * Gets deployment history for a profile
162
- *
163
- * Returns empty history if deployments.json doesn't exist.
99
+ * Checks if profile exists on filesystem
164
100
  *
165
101
  * @param profile - Profile name
166
- * @returns Deployment history with active deployments and full history
167
- *
168
- * @example
169
- * ```typescript
170
- * const deployments = xdg.getDeployments("default");
171
- * console.log(deployments.active["prod"]); // Active prod deployment
172
- * console.log(deployments.history[0]); // Most recent deployment
173
- * ```
102
+ * @returns True if profile exists
174
103
  */
175
- getDeployments(profile: string): DeploymentHistory;
104
+ protected profileExistsRaw(profile: string): boolean;
176
105
  /**
177
- * Records a new deployment for a profile
178
- *
179
- * Adds deployment to history and updates active deployment for the stage.
180
- * Creates deployments.json if it doesn't exist.
106
+ * Reads raw deployment history from filesystem without validation
181
107
  *
182
108
  * @param profile - Profile name
183
- * @param deployment - Deployment record to add
184
- *
185
- * @example
186
- * ```typescript
187
- * xdg.recordDeployment("default", {
188
- * stage: "prod",
189
- * timestamp: new Date().toISOString(),
190
- * imageTag: "0.7.0",
191
- * endpoint: "https://abc123.execute-api.us-east-1.amazonaws.com/prod",
192
- * stackName: "BenchlingWebhookStack",
193
- * region: "us-east-1",
194
- * deployedBy: "ernest@example.com",
195
- * commit: "abc123f"
196
- * });
197
- * ```
109
+ * @returns Deployment history or null if none exists
110
+ * @throws {Error} If read fails
198
111
  */
199
- recordDeployment(profile: string, deployment: DeploymentRecord): void;
112
+ protected readDeploymentsRaw(profile: string): DeploymentHistory | null;
200
113
  /**
201
- * Gets the active deployment for a specific stage
114
+ * Writes raw deployment history to filesystem without validation
202
115
  *
203
116
  * @param profile - Profile name
204
- * @param stage - Stage name (e.g., "dev", "prod")
205
- * @returns Active deployment record for the stage, or null if none exists
206
- *
207
- * @example
208
- * ```typescript
209
- * const prodDeployment = xdg.getActiveDeployment("default", "prod");
210
- * if (prodDeployment) {
211
- * console.log("Prod endpoint:", prodDeployment.endpoint);
212
- * }
213
- * ```
117
+ * @param history - Deployment history to write
118
+ * @throws {Error} If write fails
214
119
  */
215
- getActiveDeployment(profile: string, stage: string): DeploymentRecord | null;
120
+ protected writeDeploymentsRaw(profile: string, history: DeploymentHistory): void;
216
121
  /**
217
- * Reads profile configuration with inheritance support
218
- *
219
- * If the profile has an `_inherits` field, loads the base profile first
220
- * and deep merges the current profile on top.
221
- *
222
- * Detects and prevents circular inheritance chains.
223
- *
224
- * @param profile - Profile name to read
225
- * @param baseProfile - Optional explicit base profile (overrides `_inherits`)
226
- * @returns Merged configuration with inheritance applied
227
- * @throws {Error} If circular inheritance is detected
228
- *
229
- * @example
230
- * ```typescript
231
- * // dev/config.json has "_inherits": "default"
232
- * const devConfig = xdg.readProfileWithInheritance("dev");
233
- * // Returns default config deep-merged with dev overrides
234
- * ```
235
- */
236
- readProfileWithInheritance(profile: string, baseProfile?: string): ProfileConfig;
237
- /**
238
- * Internal recursive implementation of profile inheritance
239
- *
240
- * @param profile - Current profile name
241
- * @param explicitBase - Explicitly specified base profile
242
- * @param visited - Set of visited profiles (for circular detection)
243
- * @returns Merged configuration
244
- * @throws {Error} If circular inheritance is detected
245
- */
246
- private readProfileWithInheritanceInternal;
247
- /**
248
- * Deep merges two profile configurations
122
+ * Gets the default XDG base directory
249
123
  *
250
- * Nested objects are merged recursively.
251
- * Arrays are replaced (not concatenated).
252
- * Current config takes precedence over base config.
124
+ * Respects XDG_CONFIG_HOME environment variable per XDG Base Directory spec.
253
125
  *
254
- * @param base - Base configuration
255
- * @param current - Current configuration (takes precedence)
256
- * @returns Merged configuration
126
+ * @returns The default base directory path (~/.config/benchling-webhook or $XDG_CONFIG_HOME/benchling-webhook)
257
127
  */
258
- private deepMergeConfigs;
128
+ private getDefaultBaseDir;
259
129
  /**
260
- * Validates a profile configuration against the schema
261
- *
262
- * @param config - Configuration object to validate
263
- * @returns Validation result with errors and warnings
130
+ * Ensures the base configuration directory exists
264
131
  *
265
- * @example
266
- * ```typescript
267
- * const validation = xdg.validateProfile(config);
268
- * if (!validation.isValid) {
269
- * console.error("Validation errors:", validation.errors);
270
- * }
271
- * ```
132
+ * @throws {Error} If directory creation fails
272
133
  */
273
- validateProfile(config: ProfileConfig): ValidationResult;
134
+ private ensureBaseDirectoryExists;
274
135
  /**
275
136
  * Gets the directory path for a profile
276
137
  *
277
138
  * @param profile - Profile name
278
139
  * @returns Absolute path to profile directory
279
140
  */
280
- private getProfileDir;
141
+ private getProfilePath;
281
142
  /**
282
143
  * Gets the config.json path for a profile
283
144
  *
@@ -291,15 +152,21 @@ export declare class XDGConfig {
291
152
  * @param profile - Profile name
292
153
  * @returns Absolute path to deployments.json
293
154
  */
294
- private getProfileDeploymentsPath;
155
+ private getDeploymentsPath;
156
+ /**
157
+ * Detects legacy v0.6.x configuration files
158
+ *
159
+ * @returns True if legacy files are detected
160
+ */
161
+ detectLegacyConfiguration(): boolean;
295
162
  /**
296
163
  * Builds a helpful error message when a profile is not found
297
164
  *
298
- * Detects legacy v0.6.x configuration files and provides upgrade guidance.
165
+ * Overrides base class to add legacy configuration detection.
299
166
  *
300
167
  * @param profile - Profile name that was not found
301
168
  * @returns Formatted error message
302
169
  */
303
- private buildProfileNotFoundError;
170
+ protected buildProfileNotFoundError(profile: string): string;
304
171
  }
305
172
  //# sourceMappingURL=xdg-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"xdg-config.d.ts","sourceRoot":"","sources":["../../lib/xdg-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAQH,OAAO,EACH,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAGnB,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,SAAS;IAClB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC;;;;OAIG;gBACS,OAAO,CAAC,EAAE,MAAM;IAK5B;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IASzB;;;;OAIG;IACH,OAAO,CAAC,yBAAyB;IAUjC;;;;;;;;;;;;OAYG;IACI,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa;IA8BlD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACI,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI;IAqDjE;;;;;;;;;;;;;OAaG;IACI,aAAa,CAAC,OAAO,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