@dependabit/action 0.1.1
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/CHANGELOG.md +12 -0
- package/LICENSE +21 -0
- package/README.md +225 -0
- package/action.yml +85 -0
- package/dist/actions/check.d.ts +33 -0
- package/dist/actions/check.d.ts.map +1 -0
- package/dist/actions/check.js +162 -0
- package/dist/actions/check.js.map +1 -0
- package/dist/actions/generate.d.ts +9 -0
- package/dist/actions/generate.d.ts.map +1 -0
- package/dist/actions/generate.js +152 -0
- package/dist/actions/generate.js.map +1 -0
- package/dist/actions/update.d.ts +9 -0
- package/dist/actions/update.d.ts.map +1 -0
- package/dist/actions/update.js +246 -0
- package/dist/actions/update.js.map +1 -0
- package/dist/actions/validate.d.ts +33 -0
- package/dist/actions/validate.d.ts.map +1 -0
- package/dist/actions/validate.js +226 -0
- package/dist/actions/validate.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +114 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +154 -0
- package/dist/logger.js.map +1 -0
- package/dist/utils/agent-config.d.ts +31 -0
- package/dist/utils/agent-config.d.ts.map +1 -0
- package/dist/utils/agent-config.js +42 -0
- package/dist/utils/agent-config.js.map +1 -0
- package/dist/utils/agent-router.d.ts +33 -0
- package/dist/utils/agent-router.d.ts.map +1 -0
- package/dist/utils/agent-router.js +57 -0
- package/dist/utils/agent-router.js.map +1 -0
- package/dist/utils/errors.d.ts +51 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +219 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/inputs.d.ts +35 -0
- package/dist/utils/inputs.d.ts.map +1 -0
- package/dist/utils/inputs.js +47 -0
- package/dist/utils/inputs.js.map +1 -0
- package/dist/utils/metrics.d.ts +66 -0
- package/dist/utils/metrics.d.ts.map +1 -0
- package/dist/utils/metrics.js +116 -0
- package/dist/utils/metrics.js.map +1 -0
- package/dist/utils/outputs.d.ts +43 -0
- package/dist/utils/outputs.d.ts.map +1 -0
- package/dist/utils/outputs.js +146 -0
- package/dist/utils/outputs.js.map +1 -0
- package/dist/utils/performance.d.ts +100 -0
- package/dist/utils/performance.d.ts.map +1 -0
- package/dist/utils/performance.js +185 -0
- package/dist/utils/performance.js.map +1 -0
- package/dist/utils/reporter.d.ts +43 -0
- package/dist/utils/reporter.d.ts.map +1 -0
- package/dist/utils/reporter.js +122 -0
- package/dist/utils/reporter.js.map +1 -0
- package/dist/utils/secrets.d.ts +45 -0
- package/dist/utils/secrets.d.ts.map +1 -0
- package/dist/utils/secrets.js +94 -0
- package/dist/utils/secrets.js.map +1 -0
- package/package.json +45 -0
- package/src/actions/check.ts +223 -0
- package/src/actions/generate.ts +181 -0
- package/src/actions/update.ts +284 -0
- package/src/actions/validate.ts +292 -0
- package/src/index.ts +43 -0
- package/src/logger.test.ts +200 -0
- package/src/logger.ts +210 -0
- package/src/utils/agent-config.ts +61 -0
- package/src/utils/agent-router.ts +67 -0
- package/src/utils/errors.ts +251 -0
- package/src/utils/inputs.ts +75 -0
- package/src/utils/metrics.ts +169 -0
- package/src/utils/outputs.ts +202 -0
- package/src/utils/performance.ts +248 -0
- package/src/utils/reporter.ts +169 -0
- package/src/utils/secrets.ts +124 -0
- package/test/actions/check.test.ts +216 -0
- package/test/actions/generate.test.ts +82 -0
- package/test/actions/update.test.ts +70 -0
- package/test/actions/validate.test.ts +257 -0
- package/test/utils/agent-config.test.ts +112 -0
- package/test/utils/agent-router.test.ts +129 -0
- package/test/utils/metrics.test.ts +221 -0
- package/test/utils/reporter.test.ts +196 -0
- package/test/utils/secrets.test.ts +217 -0
- package/tsconfig.json +15 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { readManifest, validateManifest, readConfig } from '@dependabit/manifest';
|
|
2
|
+
import * as core from '@actions/core';
|
|
3
|
+
/**
|
|
4
|
+
* Main entry point for the validate action wrapped for error handling
|
|
5
|
+
*/
|
|
6
|
+
export async function run() {
|
|
7
|
+
try {
|
|
8
|
+
const manifestPath = core.getInput('manifest_path') || '.dependabit/manifest.json';
|
|
9
|
+
const configPath = core.getInput('config_path') || '';
|
|
10
|
+
console.log('Starting validation...');
|
|
11
|
+
const result = await validateAction(manifestPath, configPath || undefined);
|
|
12
|
+
// Output the formatted result
|
|
13
|
+
const formatted = formatValidationErrors(result);
|
|
14
|
+
console.log('\n' + formatted);
|
|
15
|
+
if (!result.valid) {
|
|
16
|
+
core.setFailed(`Validation failed with ${result.errors.length} errors`);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
core.setOutput('valid', 'true');
|
|
20
|
+
core.setOutput('errors', JSON.stringify(result.errors));
|
|
21
|
+
core.setOutput('warnings', JSON.stringify(result.warnings));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
core.setFailed(error instanceof Error ? error.message : String(error));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Validate manifest file with comprehensive checks
|
|
30
|
+
*
|
|
31
|
+
* Performs:
|
|
32
|
+
* - Schema validation (Zod)
|
|
33
|
+
* - Business rule validation (duplicate IDs, valid URLs, timestamp order)
|
|
34
|
+
* - Optional config validation
|
|
35
|
+
*
|
|
36
|
+
* @param manifestPath Path to manifest.json
|
|
37
|
+
* @param configPath Optional path to config.yml
|
|
38
|
+
* @returns Validation result with errors and warnings
|
|
39
|
+
*/
|
|
40
|
+
export async function validateAction(manifestPath, configPath) {
|
|
41
|
+
const errors = [];
|
|
42
|
+
const warnings = [];
|
|
43
|
+
let manifest;
|
|
44
|
+
let config;
|
|
45
|
+
console.log(`Validating manifest: ${manifestPath}`);
|
|
46
|
+
// Step 1: Read and validate manifest schema
|
|
47
|
+
try {
|
|
48
|
+
const rawManifest = await readManifest(manifestPath);
|
|
49
|
+
manifest = validateManifest(rawManifest);
|
|
50
|
+
console.log(`✓ Schema validation passed`);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
54
|
+
errors.push(`Schema validation failed: ${message}`);
|
|
55
|
+
console.error(`✗ Schema validation failed: ${message}`);
|
|
56
|
+
return { valid: false, errors, warnings, config: undefined };
|
|
57
|
+
}
|
|
58
|
+
// Step 2: Validate business rules
|
|
59
|
+
validateBusinessRules(manifest, errors, warnings);
|
|
60
|
+
// Step 3: Read and validate config if provided
|
|
61
|
+
if (configPath) {
|
|
62
|
+
try {
|
|
63
|
+
config = await readConfig(configPath);
|
|
64
|
+
console.log(`✓ Config validation passed: ${configPath}`);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
68
|
+
errors.push(`Config validation failed: ${message}`);
|
|
69
|
+
console.error(`✗ Config validation failed: ${message}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Step 4: Cross-validate manifest and config
|
|
73
|
+
if (manifest && config) {
|
|
74
|
+
validateManifestConfigCompatibility(manifest, config, errors, warnings);
|
|
75
|
+
}
|
|
76
|
+
const valid = errors.length === 0;
|
|
77
|
+
if (valid) {
|
|
78
|
+
console.log(`✓ Validation passed with ${warnings.length} warnings`);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
console.error(`✗ Validation failed with ${errors.length} errors`);
|
|
82
|
+
}
|
|
83
|
+
return { valid, errors, warnings, manifest, config: config || undefined };
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Validate business rules
|
|
87
|
+
*/
|
|
88
|
+
function validateBusinessRules(manifest, errors, warnings) {
|
|
89
|
+
// Check for duplicate dependency IDs
|
|
90
|
+
const ids = new Set();
|
|
91
|
+
const duplicateIds = [];
|
|
92
|
+
for (const dep of manifest.dependencies) {
|
|
93
|
+
if (ids.has(dep.id)) {
|
|
94
|
+
duplicateIds.push(dep.id);
|
|
95
|
+
}
|
|
96
|
+
ids.add(dep.id);
|
|
97
|
+
}
|
|
98
|
+
if (duplicateIds.length > 0) {
|
|
99
|
+
errors.push(`Duplicate dependency IDs found: ${duplicateIds.join(', ')}`);
|
|
100
|
+
}
|
|
101
|
+
// Check for duplicate URLs
|
|
102
|
+
const urls = new Set();
|
|
103
|
+
const duplicateUrls = [];
|
|
104
|
+
for (const dep of manifest.dependencies) {
|
|
105
|
+
if (urls.has(dep.url)) {
|
|
106
|
+
duplicateUrls.push(dep.url);
|
|
107
|
+
}
|
|
108
|
+
urls.add(dep.url);
|
|
109
|
+
}
|
|
110
|
+
if (duplicateUrls.length > 0) {
|
|
111
|
+
warnings.push(`Duplicate URLs found: ${duplicateUrls.join(', ')}`);
|
|
112
|
+
}
|
|
113
|
+
// Validate URL formats explicitly
|
|
114
|
+
for (const dep of manifest.dependencies) {
|
|
115
|
+
try {
|
|
116
|
+
new URL(dep.url);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
errors.push(`Dependency ${dep.name}: invalid URL format: ${dep.url}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// Validate timestamps order
|
|
123
|
+
for (const dep of manifest.dependencies) {
|
|
124
|
+
const detectedAt = new Date(dep.detectedAt);
|
|
125
|
+
const lastChecked = new Date(dep.lastChecked);
|
|
126
|
+
if (lastChecked < detectedAt) {
|
|
127
|
+
errors.push(`Dependency ${dep.name}: lastChecked (${dep.lastChecked}) is before detectedAt (${dep.detectedAt})`);
|
|
128
|
+
}
|
|
129
|
+
if (dep.lastChanged) {
|
|
130
|
+
const lastChanged = new Date(dep.lastChanged);
|
|
131
|
+
if (lastChanged < detectedAt) {
|
|
132
|
+
errors.push(`Dependency ${dep.name}: lastChanged (${dep.lastChanged}) is before detectedAt (${dep.detectedAt})`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// Validate statistics consistency
|
|
137
|
+
if (manifest.statistics.totalDependencies !== manifest.dependencies.length) {
|
|
138
|
+
errors.push(`Statistics mismatch: totalDependencies (${manifest.statistics.totalDependencies}) != actual count (${manifest.dependencies.length})`);
|
|
139
|
+
}
|
|
140
|
+
// Validate referenced files exist (warning only)
|
|
141
|
+
const missingReferences = [];
|
|
142
|
+
for (const dep of manifest.dependencies) {
|
|
143
|
+
for (const ref of dep.referencedIn) {
|
|
144
|
+
// This is a warning because files might have been deleted
|
|
145
|
+
// We don't fail validation for this
|
|
146
|
+
if (!ref.file) {
|
|
147
|
+
missingReferences.push(`Dependency ${dep.name} has empty file reference`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (missingReferences.length > 0) {
|
|
152
|
+
warnings.push(...missingReferences);
|
|
153
|
+
}
|
|
154
|
+
// Check for low confidence detections
|
|
155
|
+
const lowConfidence = manifest.dependencies.filter((dep) => dep.detectionConfidence < 0.5);
|
|
156
|
+
if (lowConfidence.length > 0) {
|
|
157
|
+
warnings.push(`${lowConfidence.length} dependencies have low detection confidence (<0.5)`);
|
|
158
|
+
}
|
|
159
|
+
// Check manifest size
|
|
160
|
+
const manifestSize = JSON.stringify(manifest).length;
|
|
161
|
+
const sizeInMB = manifestSize / (1024 * 1024);
|
|
162
|
+
if (sizeInMB > 10) {
|
|
163
|
+
errors.push(`Manifest size (${sizeInMB.toFixed(2)}MB) exceeds maximum (10MB)`);
|
|
164
|
+
}
|
|
165
|
+
else if (sizeInMB > 5) {
|
|
166
|
+
warnings.push(`Manifest size (${sizeInMB.toFixed(2)}MB) is large (target: <1MB, warn: >5MB)`);
|
|
167
|
+
}
|
|
168
|
+
console.log(`✓ Business rule validation completed`);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Validate manifest and config compatibility
|
|
172
|
+
*/
|
|
173
|
+
function validateManifestConfigCompatibility(manifest, config, errors, warnings) {
|
|
174
|
+
// Check that dependency overrides reference valid dependencies
|
|
175
|
+
if (config.dependencies) {
|
|
176
|
+
for (const override of config.dependencies) {
|
|
177
|
+
const found = manifest.dependencies.some((dep) => dep.url === override.url);
|
|
178
|
+
if (!found) {
|
|
179
|
+
warnings.push(`Config override for ${override.url} does not match any dependency in manifest`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// Check that ignored URLs are not in manifest (warning)
|
|
184
|
+
if (config.ignore?.urls) {
|
|
185
|
+
for (const ignoredUrl of config.ignore.urls) {
|
|
186
|
+
const found = manifest.dependencies.some((dep) => dep.url === ignoredUrl);
|
|
187
|
+
if (found) {
|
|
188
|
+
warnings.push(`Dependency ${ignoredUrl} is in manifest but marked as ignored in config`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
console.log(`✓ Cross-validation completed`);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Format validation errors for CLI output
|
|
196
|
+
*/
|
|
197
|
+
export function formatValidationErrors(result) {
|
|
198
|
+
const lines = [];
|
|
199
|
+
if (result.valid) {
|
|
200
|
+
lines.push('✓ Validation passed');
|
|
201
|
+
if (result.warnings.length > 0) {
|
|
202
|
+
lines.push('');
|
|
203
|
+
lines.push(`Warnings (${result.warnings.length}):`);
|
|
204
|
+
for (const warning of result.warnings) {
|
|
205
|
+
lines.push(` ⚠ ${warning}`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
lines.push('✗ Validation failed');
|
|
211
|
+
lines.push('');
|
|
212
|
+
lines.push(`Errors (${result.errors.length}):`);
|
|
213
|
+
for (const error of result.errors) {
|
|
214
|
+
lines.push(` ✗ ${error}`);
|
|
215
|
+
}
|
|
216
|
+
if (result.warnings.length > 0) {
|
|
217
|
+
lines.push('');
|
|
218
|
+
lines.push(`Warnings (${result.warnings.length}):`);
|
|
219
|
+
for (const warning of result.warnings) {
|
|
220
|
+
lines.push(` ⚠ ${warning}`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return lines.join('\n');
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/actions/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,UAAU,EAGX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AAatC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,GAAkB;IACzC,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,2BAA2B,CAAC;QACnF,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;QAEtD,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;QACtC,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,YAAY,EAAE,UAAU,IAAI,SAAS,CAAC,CAAC;QAE3E,8BAA8B;QAC9B,MAAM,SAAS,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;QAE9B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAClB,IAAI,CAAC,SAAS,CAAC,0BAA0B,MAAM,CAAC,MAAM,CAAC,MAAM,SAAS,CAAC,CAAC;QAC1E,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAChC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;YACxD,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC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E,CAAC;gBACtC,KAAK,CAAC,IAAI,CAAC,SAAO,OAAO,EAAE,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,IAAI,CAAC,uBAAqB,CAAC,CAAC;QAClC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,WAAW,MAAM,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;QAChD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,SAAO,KAAK,EAAE,CAAC,CAAC;QAC7B,CAAC;QAED,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,aAAa,MAAM,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,CAAC;YACpD,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACtC,KAAK,CAAC,IAAI,CAAC,SAAO,OAAO,EAAE,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAAA,CACzB"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAuBnC;AAQD,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,cAAc,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry point for @dependabit/action
|
|
3
|
+
* Routes to the appropriate action based on input
|
|
4
|
+
*/
|
|
5
|
+
import * as core from '@actions/core';
|
|
6
|
+
import { run as runGenerate } from './actions/generate.js';
|
|
7
|
+
import { run as runUpdate } from './actions/update.js';
|
|
8
|
+
import { run as runValidate } from './actions/validate.js';
|
|
9
|
+
async function main() {
|
|
10
|
+
const action = core.getInput('action') || 'generate';
|
|
11
|
+
switch (action) {
|
|
12
|
+
case 'generate':
|
|
13
|
+
await runGenerate();
|
|
14
|
+
break;
|
|
15
|
+
case 'update':
|
|
16
|
+
await runUpdate();
|
|
17
|
+
break;
|
|
18
|
+
case 'check':
|
|
19
|
+
core.setFailed('Check action not yet implemented');
|
|
20
|
+
break;
|
|
21
|
+
case 'validate':
|
|
22
|
+
await runValidate();
|
|
23
|
+
break;
|
|
24
|
+
default:
|
|
25
|
+
core.setFailed(`Unknown action: ${action}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// Run the action
|
|
29
|
+
main().catch((error) => {
|
|
30
|
+
core.setFailed(error instanceof Error ? error.message : String(error));
|
|
31
|
+
});
|
|
32
|
+
// Export for testing
|
|
33
|
+
export { main };
|
|
34
|
+
export * from './logger.js';
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,GAAG,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE3D,KAAK,UAAU,IAAI,GAAkB;IACnC,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,UAAU,CAAC;IAErD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,UAAU;YACb,MAAM,WAAW,EAAE,CAAC;YACpB,MAAM;QAER,KAAK,QAAQ;YACX,MAAM,SAAS,EAAE,CAAC;YAClB,MAAM;QAER,KAAK,OAAO;YACV,IAAI,CAAC,SAAS,CAAC,kCAAkC,CAAC,CAAC;YACnD,MAAM;QAER,KAAK,UAAU;YACb,MAAM,WAAW,EAAE,CAAC;YACpB,MAAM;QAER;YACE,IAAI,CAAC,SAAS,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAC;IAChD,CAAC;AAAA,CACF;AAED,iBAAiB;AACjB,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;IACtB,IAAI,CAAC,SAAS,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAAA,CACxE,CAAC,CAAC;AAEH,qBAAqB;AACrB,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,cAAc,aAAa,CAAC"}
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Log level enumeration
|
|
3
|
+
*/
|
|
4
|
+
export declare enum LogLevel {
|
|
5
|
+
DEBUG = "debug",
|
|
6
|
+
INFO = "info",
|
|
7
|
+
WARNING = "warning",
|
|
8
|
+
ERROR = "error"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Structured log entry
|
|
12
|
+
*/
|
|
13
|
+
export interface LogEntry {
|
|
14
|
+
timestamp: string;
|
|
15
|
+
level: LogLevel;
|
|
16
|
+
message: string;
|
|
17
|
+
correlationId?: string;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Logger configuration
|
|
22
|
+
*/
|
|
23
|
+
export interface LoggerConfig {
|
|
24
|
+
correlationId?: string;
|
|
25
|
+
enableDebug?: boolean;
|
|
26
|
+
context?: Record<string, unknown>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Structured JSON logger for GitHub Actions
|
|
30
|
+
*/
|
|
31
|
+
export declare class Logger {
|
|
32
|
+
private correlationId;
|
|
33
|
+
private enableDebug;
|
|
34
|
+
private context;
|
|
35
|
+
constructor(config?: LoggerConfig);
|
|
36
|
+
/**
|
|
37
|
+
* Generate a unique correlation ID for operation tracing
|
|
38
|
+
*/
|
|
39
|
+
private generateCorrelationId;
|
|
40
|
+
/**
|
|
41
|
+
* Format log entry as JSON
|
|
42
|
+
*/
|
|
43
|
+
private formatEntry;
|
|
44
|
+
/**
|
|
45
|
+
* Log debug message
|
|
46
|
+
*/
|
|
47
|
+
debug(message: string, data?: Record<string, unknown>): void;
|
|
48
|
+
/**
|
|
49
|
+
* Log info message
|
|
50
|
+
*/
|
|
51
|
+
info(message: string, data?: Record<string, unknown>): void;
|
|
52
|
+
/**
|
|
53
|
+
* Log warning message
|
|
54
|
+
*/
|
|
55
|
+
warning(message: string, data?: Record<string, unknown>): void;
|
|
56
|
+
/**
|
|
57
|
+
* Log error message
|
|
58
|
+
*/
|
|
59
|
+
error(message: string, data?: Record<string, unknown>): void;
|
|
60
|
+
/**
|
|
61
|
+
* Start a log group
|
|
62
|
+
*/
|
|
63
|
+
startGroup(name: string): void;
|
|
64
|
+
/**
|
|
65
|
+
* End a log group
|
|
66
|
+
*/
|
|
67
|
+
endGroup(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Get correlation ID
|
|
70
|
+
*/
|
|
71
|
+
getCorrelationId(): string;
|
|
72
|
+
/**
|
|
73
|
+
* Create a child logger with the same correlation ID
|
|
74
|
+
*/
|
|
75
|
+
child(context?: Record<string, unknown>): Logger;
|
|
76
|
+
/**
|
|
77
|
+
* Log LLM interaction
|
|
78
|
+
*/
|
|
79
|
+
logLLMInteraction(data: {
|
|
80
|
+
provider: string;
|
|
81
|
+
model?: string;
|
|
82
|
+
prompt: string;
|
|
83
|
+
response: string;
|
|
84
|
+
tokens?: number;
|
|
85
|
+
latencyMs?: number;
|
|
86
|
+
}): void;
|
|
87
|
+
/**
|
|
88
|
+
* Log API call
|
|
89
|
+
*/
|
|
90
|
+
logAPICall(data: {
|
|
91
|
+
endpoint: string;
|
|
92
|
+
method: string;
|
|
93
|
+
statusCode?: number;
|
|
94
|
+
latencyMs?: number;
|
|
95
|
+
rateLimit?: {
|
|
96
|
+
remaining: number;
|
|
97
|
+
limit: number;
|
|
98
|
+
reset: number;
|
|
99
|
+
};
|
|
100
|
+
}): void;
|
|
101
|
+
/**
|
|
102
|
+
* Log operation duration
|
|
103
|
+
*/
|
|
104
|
+
logDuration(operation: string, durationMs: number, data?: Record<string, unknown>): void;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Create a new logger instance
|
|
108
|
+
*/
|
|
109
|
+
export declare function createLogger(config?: LoggerConfig): Logger;
|
|
110
|
+
/**
|
|
111
|
+
* Measure and log operation duration
|
|
112
|
+
*/
|
|
113
|
+
export declare function withTiming<T>(logger: Logger, operation: string, fn: () => Promise<T>): Promise<T>;
|
|
114
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,QAAQ;IAClB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAA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EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,IAAI,CAKP;IAED;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE;YACV,SAAS,EAAE,MAAM,CAAC;YAClB,KAAK,EAAE,MAAM,CAAC;YACd,KAAK,EAAE,MAAM,CAAC;SACf,CAAC;KACH,GAAG,IAAI,CAKP;IAED;;OAEG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAOvF;CACF;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAE1D;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAChC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAcZ"}
|
package/dist/logger.js
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import * as core from '@actions/core';
|
|
2
|
+
export { LogLevel };
|
|
3
|
+
/**
|
|
4
|
+
* Log level enumeration
|
|
5
|
+
*/
|
|
6
|
+
var LogLevel;
|
|
7
|
+
(function (LogLevel) {
|
|
8
|
+
LogLevel["DEBUG"] = "debug";
|
|
9
|
+
LogLevel["INFO"] = "info";
|
|
10
|
+
LogLevel["WARNING"] = "warning";
|
|
11
|
+
LogLevel["ERROR"] = "error";
|
|
12
|
+
})(LogLevel || (LogLevel = {}));
|
|
13
|
+
/**
|
|
14
|
+
* Structured JSON logger for GitHub Actions
|
|
15
|
+
*/
|
|
16
|
+
export class Logger {
|
|
17
|
+
correlationId;
|
|
18
|
+
enableDebug;
|
|
19
|
+
context;
|
|
20
|
+
constructor(config = {}) {
|
|
21
|
+
this.correlationId = config.correlationId || this.generateCorrelationId();
|
|
22
|
+
this.enableDebug = config.enableDebug ?? false;
|
|
23
|
+
this.context = config.context || {};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Generate a unique correlation ID for operation tracing
|
|
27
|
+
*/
|
|
28
|
+
generateCorrelationId() {
|
|
29
|
+
return `${Date.now()}-${Math.random().toString(36).substring(7)}`;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Format log entry as JSON
|
|
33
|
+
*/
|
|
34
|
+
formatEntry(level, message, data) {
|
|
35
|
+
const entry = {
|
|
36
|
+
timestamp: new Date().toISOString(),
|
|
37
|
+
level,
|
|
38
|
+
message,
|
|
39
|
+
correlationId: this.correlationId,
|
|
40
|
+
...this.context,
|
|
41
|
+
...data
|
|
42
|
+
};
|
|
43
|
+
return JSON.stringify(entry);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Log debug message
|
|
47
|
+
*/
|
|
48
|
+
debug(message, data) {
|
|
49
|
+
if (this.enableDebug) {
|
|
50
|
+
core.debug(this.formatEntry(LogLevel.DEBUG, message, data));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Log info message
|
|
55
|
+
*/
|
|
56
|
+
info(message, data) {
|
|
57
|
+
core.info(this.formatEntry(LogLevel.INFO, message, data));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Log warning message
|
|
61
|
+
*/
|
|
62
|
+
warning(message, data) {
|
|
63
|
+
core.warning(this.formatEntry(LogLevel.WARNING, message, data));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Log error message
|
|
67
|
+
*/
|
|
68
|
+
error(message, data) {
|
|
69
|
+
core.error(this.formatEntry(LogLevel.ERROR, message, data));
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Start a log group
|
|
73
|
+
*/
|
|
74
|
+
startGroup(name) {
|
|
75
|
+
core.startGroup(name);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* End a log group
|
|
79
|
+
*/
|
|
80
|
+
endGroup() {
|
|
81
|
+
core.endGroup();
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Get correlation ID
|
|
85
|
+
*/
|
|
86
|
+
getCorrelationId() {
|
|
87
|
+
return this.correlationId;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Create a child logger with the same correlation ID
|
|
91
|
+
*/
|
|
92
|
+
child(context) {
|
|
93
|
+
return new Logger({
|
|
94
|
+
correlationId: this.correlationId,
|
|
95
|
+
enableDebug: this.enableDebug,
|
|
96
|
+
context: { ...this.context, ...context }
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Log LLM interaction
|
|
101
|
+
*/
|
|
102
|
+
logLLMInteraction(data) {
|
|
103
|
+
this.info('LLM interaction', {
|
|
104
|
+
type: 'llm_interaction',
|
|
105
|
+
...data
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Log API call
|
|
110
|
+
*/
|
|
111
|
+
logAPICall(data) {
|
|
112
|
+
this.info('API call', {
|
|
113
|
+
type: 'api_call',
|
|
114
|
+
...data
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Log operation duration
|
|
119
|
+
*/
|
|
120
|
+
logDuration(operation, durationMs, data) {
|
|
121
|
+
this.info(`Operation completed: ${operation}`, {
|
|
122
|
+
type: 'operation_duration',
|
|
123
|
+
operation,
|
|
124
|
+
durationMs,
|
|
125
|
+
...data
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Create a new logger instance
|
|
131
|
+
*/
|
|
132
|
+
export function createLogger(config) {
|
|
133
|
+
return new Logger(config);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Measure and log operation duration
|
|
137
|
+
*/
|
|
138
|
+
export async function withTiming(logger, operation, fn) {
|
|
139
|
+
const start = Date.now();
|
|
140
|
+
try {
|
|
141
|
+
const result = await fn();
|
|
142
|
+
const duration = Date.now() - start;
|
|
143
|
+
logger.logDuration(operation, duration);
|
|
144
|
+
return result;
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
const duration = Date.now() - start;
|
|
148
|
+
logger.logDuration(operation, duration, {
|
|
149
|
+
error: error instanceof Error ? error.message : String(error)
|
|
150
|
+
});
|
|
151
|
+
throw error;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;SAK1B,QAAQ;AAHpB;;GAEG;AACH,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,2BAAe,CAAA;AAAA,CACjB,EALY,QAAQ,KAAR,QAAQ,QAKnB;AAsBD;;GAEG;AACH,MAAM,OAAO,MAAM;IACT,aAAa,CAAS;IACtB,WAAW,CAAU;IACrB,OAAO,CAA0B;IAEzC,YAAY,MAAM,GAAiB,EAAE,EAAE;QACrC,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC1E,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,KAAK,CAAC;QAC/C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IAAA,CACrC;IAED;;OAEG;IACK,qB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;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,MAAc,EACd,SAAiB,EACjB,EAAoB,EACR;IACZ,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACzB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;QACpC,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACxC,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;QACpC,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE;YACtC,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9D,CAAC,CAAC;QACH,MAAM,KAAK,CAAC;IACd,CAAC;AAAA,CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { DependabitConfig } from '@dependabit/manifest';
|
|
2
|
+
/**
|
|
3
|
+
* Agent assignment configuration
|
|
4
|
+
*/
|
|
5
|
+
export interface AgentAssignmentConfig {
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
severityMapping: {
|
|
8
|
+
breaking?: string;
|
|
9
|
+
major?: string;
|
|
10
|
+
minor?: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Parse AI agent assignment configuration from config
|
|
15
|
+
*
|
|
16
|
+
* Extracts severity-to-agent mapping from config.yml:
|
|
17
|
+
*
|
|
18
|
+
* ```yaml
|
|
19
|
+
* issues:
|
|
20
|
+
* aiAgentAssignment:
|
|
21
|
+
* enabled: true
|
|
22
|
+
* breaking: copilot
|
|
23
|
+
* major: claude
|
|
24
|
+
* minor: copilot
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @param config Dependabit configuration
|
|
28
|
+
* @returns Agent assignment configuration
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseAgentConfig(config: DependabitConfig): AgentAssignmentConfig;
|
|
31
|
+
//# sourceMappingURL=agent-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-config.d.ts","sourceRoot":"","sources":["../../src/utils/agent-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAY,MAAM,sBAAsB,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,qBAAqB,CA6BhF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse AI agent assignment configuration from config
|
|
3
|
+
*
|
|
4
|
+
* Extracts severity-to-agent mapping from config.yml:
|
|
5
|
+
*
|
|
6
|
+
* ```yaml
|
|
7
|
+
* issues:
|
|
8
|
+
* aiAgentAssignment:
|
|
9
|
+
* enabled: true
|
|
10
|
+
* breaking: copilot
|
|
11
|
+
* major: claude
|
|
12
|
+
* minor: copilot
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param config Dependabit configuration
|
|
16
|
+
* @returns Agent assignment configuration
|
|
17
|
+
*/
|
|
18
|
+
export function parseAgentConfig(config) {
|
|
19
|
+
const aiAgentAssignment = config.issues?.aiAgentAssignment;
|
|
20
|
+
if (!aiAgentAssignment || !aiAgentAssignment.enabled) {
|
|
21
|
+
return {
|
|
22
|
+
enabled: false,
|
|
23
|
+
severityMapping: {}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
// Normalize agent names to lowercase
|
|
27
|
+
const severityMapping = {};
|
|
28
|
+
if (aiAgentAssignment.breaking) {
|
|
29
|
+
severityMapping['breaking'] = aiAgentAssignment.breaking.toLowerCase();
|
|
30
|
+
}
|
|
31
|
+
if (aiAgentAssignment.major) {
|
|
32
|
+
severityMapping['major'] = aiAgentAssignment.major.toLowerCase();
|
|
33
|
+
}
|
|
34
|
+
if (aiAgentAssignment.minor) {
|
|
35
|
+
severityMapping['minor'] = aiAgentAssignment.minor.toLowerCase();
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
enabled: true,
|
|
39
|
+
severityMapping
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=agent-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-config.js","sourceRoot":"","sources":["../../src/utils/agent-config.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAwB,EAAyB;IAChF,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC;IAE3D,IAAI,CAAC,iBAAiB,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;QACrD,OAAO;YACL,OAAO,EAAE,KAAK;YACd,eAAe,EAAE,EAAE;SACpB,CAAC;IACJ,CAAC;IAED,qCAAqC;IACrC,MAAM,eAAe,GAA2B,EAAE,CAAC;IAEnD,IAAI,iBAAiB,CAAC,QAAQ,EAAE,CAAC;QAC/B,eAAe,CAAC,UAAU,CAAC,GAAG,iBAAiB,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;IACzE,CAAC;IAED,IAAI,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAC5B,eAAe,CAAC,OAAO,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;IACnE,CAAC;IAED,IAAI,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAC5B,eAAe,CAAC,OAAO,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;IACnE,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI;QACb,eAAe;KAChB,CAAC;AAAA,CACH"}
|