@dependabit/manifest 0.1.14 → 0.1.15
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 +6 -0
- package/dist/config.d.ts +66 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +66 -6
- package/dist/config.js.map +1 -1
- package/dist/manifest.d.ts +131 -8
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +131 -8
- package/dist/manifest.js.map +1 -1
- package/dist/schema.d.ts +129 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +42 -0
- package/dist/schema.js.map +1 -1
- package/dist/size-check.js.map +1 -1
- package/dist/validator.d.ts +7 -1
- package/dist/validator.d.ts.map +1 -1
- package/dist/validator.js +7 -1
- package/dist/validator.js.map +1 -1
- package/package.json +24 -7
- package/src/config.test.ts +0 -266
- package/src/config.ts +0 -96
- package/src/index.ts +0 -16
- package/src/manifest.test.ts +0 -400
- package/src/manifest.ts +0 -278
- package/src/schema.test.ts +0 -293
- package/src/schema.ts +0 -266
- package/src/size-check.test.ts +0 -246
- package/src/size-check.ts +0 -124
- package/src/validator.test.ts +0 -161
- package/src/validator.ts +0 -131
- package/tsconfig.json +0 -10
- package/tsconfig.tsbuildinfo +0 -1
package/src/config.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import YAML from 'yaml';
|
|
3
|
-
import { type DependabitConfig } from './schema.js';
|
|
4
|
-
import { validateConfig } from './validator.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Parse and validate a YAML configuration file
|
|
8
|
-
*/
|
|
9
|
-
export async function readConfig(path: string): Promise<DependabitConfig> {
|
|
10
|
-
const content = await readFile(path, 'utf-8');
|
|
11
|
-
const data = YAML.parse(content);
|
|
12
|
-
return validateConfig(data);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Parse YAML string to config
|
|
17
|
-
*/
|
|
18
|
-
export function parseConfig(yaml: string): DependabitConfig {
|
|
19
|
-
const data = YAML.parse(yaml);
|
|
20
|
-
return validateConfig(data);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Convert config to YAML string
|
|
25
|
-
*/
|
|
26
|
-
export function stringifyConfig(config: DependabitConfig): string {
|
|
27
|
-
// Validate before stringifying
|
|
28
|
-
validateConfig(config);
|
|
29
|
-
return YAML.stringify(config);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Get effective monitoring rules for a dependency
|
|
34
|
-
* Merges global config with dependency-specific overrides
|
|
35
|
-
*/
|
|
36
|
-
export function getEffectiveMonitoringRules(
|
|
37
|
-
config: DependabitConfig,
|
|
38
|
-
dependencyUrl: string
|
|
39
|
-
): {
|
|
40
|
-
enabled: boolean;
|
|
41
|
-
checkFrequency: 'hourly' | 'daily' | 'weekly' | 'monthly';
|
|
42
|
-
ignoreChanges: boolean;
|
|
43
|
-
} {
|
|
44
|
-
// Start with global defaults
|
|
45
|
-
const globalEnabled = config.monitoring?.enabled ?? true;
|
|
46
|
-
const globalCheckFrequency = config.schedule?.interval ?? 'daily';
|
|
47
|
-
|
|
48
|
-
// Find dependency-specific override
|
|
49
|
-
const override = config.dependencies?.find((dep) => dep.url === dependencyUrl);
|
|
50
|
-
|
|
51
|
-
if (override?.monitoring) {
|
|
52
|
-
return {
|
|
53
|
-
enabled: override.monitoring.enabled ?? globalEnabled,
|
|
54
|
-
checkFrequency:
|
|
55
|
-
override.monitoring.checkFrequency ?? override.schedule?.interval ?? globalCheckFrequency,
|
|
56
|
-
ignoreChanges: override.monitoring.ignoreChanges ?? false
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return {
|
|
61
|
-
enabled: globalEnabled,
|
|
62
|
-
checkFrequency: globalCheckFrequency,
|
|
63
|
-
ignoreChanges: false
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Check if a URL should be ignored based on config
|
|
69
|
-
*/
|
|
70
|
-
export function shouldIgnoreUrl(config: DependabitConfig, url: string): boolean {
|
|
71
|
-
if (!config.ignore) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Check exact URL matches
|
|
76
|
-
if (config.ignore.urls?.includes(url)) {
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Check regex patterns with error handling
|
|
81
|
-
if (config.ignore.patterns) {
|
|
82
|
-
for (const pattern of config.ignore.patterns) {
|
|
83
|
-
try {
|
|
84
|
-
const regex = new RegExp(pattern);
|
|
85
|
-
if (regex.test(url)) {
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
} catch {
|
|
89
|
-
// Invalid regex pattern - log warning but continue
|
|
90
|
-
console.warn(`Invalid regex pattern in config.ignore.patterns: ${pattern}`);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return false;
|
|
96
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Entry point for @dependabit/manifest
|
|
2
|
-
|
|
3
|
-
// Export schemas and types
|
|
4
|
-
export * from './schema.js';
|
|
5
|
-
|
|
6
|
-
// Export validators
|
|
7
|
-
export * from './validator.js';
|
|
8
|
-
|
|
9
|
-
// Export manifest operations
|
|
10
|
-
export * from './manifest.js';
|
|
11
|
-
|
|
12
|
-
// Export config operations
|
|
13
|
-
export * from './config.js';
|
|
14
|
-
|
|
15
|
-
// Export size checking
|
|
16
|
-
export * from './size-check.js';
|
package/src/manifest.test.ts
DELETED
|
@@ -1,400 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
-
import { mkdir, rm } from 'node:fs/promises';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import {
|
|
5
|
-
readManifest,
|
|
6
|
-
writeManifest,
|
|
7
|
-
updateDependency,
|
|
8
|
-
addDependency,
|
|
9
|
-
removeDependency,
|
|
10
|
-
mergeManifests,
|
|
11
|
-
createEmptyManifest
|
|
12
|
-
} from '../src/manifest.js';
|
|
13
|
-
import type { DependencyEntry } from '../src/schema.js';
|
|
14
|
-
|
|
15
|
-
const TEST_DIR = '/tmp/dependabit-manifest-tests';
|
|
16
|
-
|
|
17
|
-
describe('Manifest Operations Tests', () => {
|
|
18
|
-
beforeEach(async () => {
|
|
19
|
-
await mkdir(TEST_DIR, { recursive: true });
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
afterEach(async () => {
|
|
23
|
-
await rm(TEST_DIR, { recursive: true, force: true });
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
describe('readManifest and writeManifest', () => {
|
|
27
|
-
it('should write and read a manifest', async () => {
|
|
28
|
-
const manifest = createEmptyManifest({
|
|
29
|
-
owner: 'test',
|
|
30
|
-
name: 'repo',
|
|
31
|
-
branch: 'main',
|
|
32
|
-
commit: 'abc123'
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const path = join(TEST_DIR, 'manifest.json');
|
|
36
|
-
await writeManifest(path, manifest);
|
|
37
|
-
|
|
38
|
-
const read = await readManifest(path);
|
|
39
|
-
expect(read.repository.owner).toBe('test');
|
|
40
|
-
expect(read.repository.name).toBe('repo');
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should create directory if not exists', async () => {
|
|
44
|
-
const manifest = createEmptyManifest({
|
|
45
|
-
owner: 'test',
|
|
46
|
-
name: 'repo',
|
|
47
|
-
branch: 'main',
|
|
48
|
-
commit: 'abc123'
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const path = join(TEST_DIR, 'nested', 'dir', 'manifest.json');
|
|
52
|
-
await writeManifest(path, manifest);
|
|
53
|
-
|
|
54
|
-
const read = await readManifest(path);
|
|
55
|
-
expect(read).toBeDefined();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('should validate manifest before writing', async () => {
|
|
59
|
-
const invalid = { version: '2.0.0' } as any;
|
|
60
|
-
const path = join(TEST_DIR, 'manifest.json');
|
|
61
|
-
|
|
62
|
-
await expect(writeManifest(path, invalid, { strict: true })).rejects.toThrow();
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
describe('addDependency', () => {
|
|
67
|
-
it('should add a dependency to manifest', async () => {
|
|
68
|
-
const manifest = createEmptyManifest({
|
|
69
|
-
owner: 'test',
|
|
70
|
-
name: 'repo',
|
|
71
|
-
branch: 'main',
|
|
72
|
-
commit: 'abc123'
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
const path = join(TEST_DIR, 'manifest.json');
|
|
76
|
-
await writeManifest(path, manifest);
|
|
77
|
-
|
|
78
|
-
const dependency: DependencyEntry = {
|
|
79
|
-
id: '550e8400-e29b-41d4-a716-446655440000',
|
|
80
|
-
url: 'https://github.com/microsoft/TypeScript',
|
|
81
|
-
type: 'reference-implementation',
|
|
82
|
-
accessMethod: 'github-api',
|
|
83
|
-
name: 'TypeScript',
|
|
84
|
-
currentStateHash: 'sha256:abc123',
|
|
85
|
-
detectionMethod: 'manual',
|
|
86
|
-
detectionConfidence: 1.0,
|
|
87
|
-
detectedAt: new Date().toISOString(),
|
|
88
|
-
lastChecked: new Date().toISOString(),
|
|
89
|
-
auth: undefined,
|
|
90
|
-
referencedIn: []
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const updated = await addDependency(path, dependency);
|
|
94
|
-
expect(updated.dependencies).toHaveLength(1);
|
|
95
|
-
expect(updated.dependencies[0].name).toBe('TypeScript');
|
|
96
|
-
expect(updated.statistics.totalDependencies).toBe(1);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('should reject duplicate IDs', async () => {
|
|
100
|
-
const manifest = createEmptyManifest({
|
|
101
|
-
owner: 'test',
|
|
102
|
-
name: 'repo',
|
|
103
|
-
branch: 'main',
|
|
104
|
-
commit: 'abc123'
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
const path = join(TEST_DIR, 'manifest.json');
|
|
108
|
-
await writeManifest(path, manifest);
|
|
109
|
-
|
|
110
|
-
const dependency: DependencyEntry = {
|
|
111
|
-
id: '550e8400-e29b-41d4-a716-446655440000',
|
|
112
|
-
url: 'https://github.com/microsoft/TypeScript',
|
|
113
|
-
type: 'reference-implementation',
|
|
114
|
-
accessMethod: 'github-api',
|
|
115
|
-
name: 'TypeScript',
|
|
116
|
-
currentStateHash: 'sha256:abc123',
|
|
117
|
-
detectionMethod: 'manual',
|
|
118
|
-
detectionConfidence: 1.0,
|
|
119
|
-
detectedAt: new Date().toISOString(),
|
|
120
|
-
lastChecked: new Date().toISOString(),
|
|
121
|
-
auth: undefined,
|
|
122
|
-
referencedIn: []
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
await addDependency(path, dependency);
|
|
126
|
-
await expect(addDependency(path, dependency)).rejects.toThrow(/already exists/);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('should reject duplicate URLs', async () => {
|
|
130
|
-
const manifest = createEmptyManifest({
|
|
131
|
-
owner: 'test',
|
|
132
|
-
name: 'repo',
|
|
133
|
-
branch: 'main',
|
|
134
|
-
commit: 'abc123'
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
const path = join(TEST_DIR, 'manifest.json');
|
|
138
|
-
await writeManifest(path, manifest);
|
|
139
|
-
|
|
140
|
-
const dependency1: DependencyEntry = {
|
|
141
|
-
id: '550e8400-e29b-41d4-a716-446655440000',
|
|
142
|
-
url: 'https://github.com/microsoft/TypeScript',
|
|
143
|
-
type: 'reference-implementation',
|
|
144
|
-
accessMethod: 'github-api',
|
|
145
|
-
name: 'TypeScript',
|
|
146
|
-
currentStateHash: 'sha256:abc123',
|
|
147
|
-
detectionMethod: 'manual',
|
|
148
|
-
detectionConfidence: 1.0,
|
|
149
|
-
detectedAt: new Date().toISOString(),
|
|
150
|
-
lastChecked: new Date().toISOString(),
|
|
151
|
-
auth: undefined,
|
|
152
|
-
referencedIn: []
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
const dependency2: DependencyEntry = {
|
|
156
|
-
...dependency1,
|
|
157
|
-
id: '660e8400-e29b-41d4-a716-446655440001'
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
await addDependency(path, dependency1);
|
|
161
|
-
await expect(addDependency(path, dependency2)).rejects.toThrow(/already exists/);
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
describe('updateDependency', () => {
|
|
166
|
-
it('should update a dependency', async () => {
|
|
167
|
-
const manifest = createEmptyManifest({
|
|
168
|
-
owner: 'test',
|
|
169
|
-
name: 'repo',
|
|
170
|
-
branch: 'main',
|
|
171
|
-
commit: 'abc123'
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
const path = join(TEST_DIR, 'manifest.json');
|
|
175
|
-
await writeManifest(path, manifest);
|
|
176
|
-
|
|
177
|
-
const dependency: DependencyEntry = {
|
|
178
|
-
id: '550e8400-e29b-41d4-a716-446655440000',
|
|
179
|
-
url: 'https://github.com/microsoft/TypeScript',
|
|
180
|
-
type: 'reference-implementation',
|
|
181
|
-
accessMethod: 'github-api',
|
|
182
|
-
name: 'TypeScript',
|
|
183
|
-
currentStateHash: 'sha256:abc123',
|
|
184
|
-
detectionMethod: 'manual',
|
|
185
|
-
detectionConfidence: 1.0,
|
|
186
|
-
detectedAt: new Date().toISOString(),
|
|
187
|
-
lastChecked: new Date().toISOString(),
|
|
188
|
-
auth: undefined,
|
|
189
|
-
referencedIn: []
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
await addDependency(path, dependency);
|
|
193
|
-
|
|
194
|
-
const updated = await updateDependency(path, dependency.id, {
|
|
195
|
-
currentVersion: '5.9.3',
|
|
196
|
-
currentStateHash: 'sha256:newHash'
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
expect(updated.dependencies[0].currentVersion).toBe('5.9.3');
|
|
200
|
-
expect(updated.dependencies[0].currentStateHash).toBe('sha256:newHash');
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
it('should throw error for non-existent dependency', async () => {
|
|
204
|
-
const manifest = createEmptyManifest({
|
|
205
|
-
owner: 'test',
|
|
206
|
-
name: 'repo',
|
|
207
|
-
branch: 'main',
|
|
208
|
-
commit: 'abc123'
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
const path = join(TEST_DIR, 'manifest.json');
|
|
212
|
-
await writeManifest(path, manifest);
|
|
213
|
-
|
|
214
|
-
await expect(
|
|
215
|
-
updateDependency(path, '550e8400-e29b-41d4-a716-446655440000', {
|
|
216
|
-
currentVersion: '5.9.3'
|
|
217
|
-
})
|
|
218
|
-
).rejects.toThrow(/not found/);
|
|
219
|
-
});
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
describe('removeDependency', () => {
|
|
223
|
-
it('should remove a dependency', async () => {
|
|
224
|
-
const manifest = createEmptyManifest({
|
|
225
|
-
owner: 'test',
|
|
226
|
-
name: 'repo',
|
|
227
|
-
branch: 'main',
|
|
228
|
-
commit: 'abc123'
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
const path = join(TEST_DIR, 'manifest.json');
|
|
232
|
-
await writeManifest(path, manifest);
|
|
233
|
-
|
|
234
|
-
const dependency: DependencyEntry = {
|
|
235
|
-
id: '550e8400-e29b-41d4-a716-446655440000',
|
|
236
|
-
url: 'https://github.com/microsoft/TypeScript',
|
|
237
|
-
type: 'reference-implementation',
|
|
238
|
-
accessMethod: 'github-api',
|
|
239
|
-
name: 'TypeScript',
|
|
240
|
-
currentStateHash: 'sha256:abc123',
|
|
241
|
-
detectionMethod: 'manual',
|
|
242
|
-
detectionConfidence: 1.0,
|
|
243
|
-
detectedAt: new Date().toISOString(),
|
|
244
|
-
lastChecked: new Date().toISOString(),
|
|
245
|
-
auth: undefined,
|
|
246
|
-
referencedIn: []
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
await addDependency(path, dependency);
|
|
250
|
-
const updated = await removeDependency(path, dependency.id);
|
|
251
|
-
|
|
252
|
-
expect(updated.dependencies).toHaveLength(0);
|
|
253
|
-
expect(updated.statistics.totalDependencies).toBe(0);
|
|
254
|
-
});
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
describe('mergeManifests', () => {
|
|
258
|
-
it('should merge two manifests preserving manual entries', () => {
|
|
259
|
-
const existing = createEmptyManifest({
|
|
260
|
-
owner: 'test',
|
|
261
|
-
name: 'repo',
|
|
262
|
-
branch: 'main',
|
|
263
|
-
commit: 'abc123'
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
const manualDep: DependencyEntry = {
|
|
267
|
-
id: '550e8400-e29b-41d4-a716-446655440000',
|
|
268
|
-
url: 'https://github.com/manual/dep',
|
|
269
|
-
type: 'documentation',
|
|
270
|
-
accessMethod: 'http',
|
|
271
|
-
name: 'Manual Dependency',
|
|
272
|
-
currentStateHash: 'sha256:manual',
|
|
273
|
-
detectionMethod: 'manual',
|
|
274
|
-
detectionConfidence: 1.0,
|
|
275
|
-
detectedAt: new Date().toISOString(),
|
|
276
|
-
lastChecked: new Date().toISOString(),
|
|
277
|
-
auth: undefined,
|
|
278
|
-
referencedIn: []
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
existing.dependencies.push(manualDep);
|
|
282
|
-
|
|
283
|
-
const updated = createEmptyManifest({
|
|
284
|
-
owner: 'test',
|
|
285
|
-
name: 'repo',
|
|
286
|
-
branch: 'main',
|
|
287
|
-
commit: 'def456'
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
const autoDep: DependencyEntry = {
|
|
291
|
-
id: '660e8400-e29b-41d4-a716-446655440001',
|
|
292
|
-
url: 'https://github.com/auto/dep',
|
|
293
|
-
type: 'documentation',
|
|
294
|
-
accessMethod: 'http',
|
|
295
|
-
name: 'Auto Dependency',
|
|
296
|
-
currentStateHash: 'sha256:auto',
|
|
297
|
-
detectionMethod: 'llm-analysis',
|
|
298
|
-
detectionConfidence: 0.9,
|
|
299
|
-
detectedAt: new Date().toISOString(),
|
|
300
|
-
lastChecked: new Date().toISOString(),
|
|
301
|
-
auth: undefined,
|
|
302
|
-
referencedIn: []
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
updated.dependencies.push(autoDep);
|
|
306
|
-
|
|
307
|
-
const merged = mergeManifests(existing, updated);
|
|
308
|
-
|
|
309
|
-
expect(merged.dependencies).toHaveLength(2);
|
|
310
|
-
expect(merged.dependencies.some((d) => d.name === 'Manual Dependency')).toBe(true);
|
|
311
|
-
expect(merged.dependencies.some((d) => d.name === 'Auto Dependency')).toBe(true);
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
it('should preserve change history', () => {
|
|
315
|
-
const existing = createEmptyManifest({
|
|
316
|
-
owner: 'test',
|
|
317
|
-
name: 'repo',
|
|
318
|
-
branch: 'main',
|
|
319
|
-
commit: 'abc123'
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
const depWithHistory: DependencyEntry = {
|
|
323
|
-
id: '550e8400-e29b-41d4-a716-446655440000',
|
|
324
|
-
url: 'https://github.com/test/dep',
|
|
325
|
-
type: 'documentation',
|
|
326
|
-
accessMethod: 'http',
|
|
327
|
-
name: 'Test Dependency',
|
|
328
|
-
currentStateHash: 'sha256:old',
|
|
329
|
-
detectionMethod: 'llm-analysis',
|
|
330
|
-
detectionConfidence: 1.0,
|
|
331
|
-
detectedAt: new Date().toISOString(),
|
|
332
|
-
lastChecked: new Date().toISOString(),
|
|
333
|
-
auth: undefined,
|
|
334
|
-
referencedIn: [],
|
|
335
|
-
changeHistory: [
|
|
336
|
-
{
|
|
337
|
-
detectedAt: new Date().toISOString(),
|
|
338
|
-
severity: 'minor',
|
|
339
|
-
falsePositive: false
|
|
340
|
-
}
|
|
341
|
-
]
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
existing.dependencies.push(depWithHistory);
|
|
345
|
-
|
|
346
|
-
const updated = createEmptyManifest({
|
|
347
|
-
owner: 'test',
|
|
348
|
-
name: 'repo',
|
|
349
|
-
branch: 'main',
|
|
350
|
-
commit: 'def456'
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
const updatedDep: DependencyEntry = {
|
|
354
|
-
...depWithHistory,
|
|
355
|
-
currentStateHash: 'sha256:new',
|
|
356
|
-
changeHistory: []
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
updated.dependencies.push(updatedDep);
|
|
360
|
-
|
|
361
|
-
const merged = mergeManifests(existing, updated);
|
|
362
|
-
|
|
363
|
-
expect(merged.dependencies[0].changeHistory).toHaveLength(1);
|
|
364
|
-
});
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
describe('createEmptyManifest', () => {
|
|
368
|
-
it('should create a valid empty manifest', () => {
|
|
369
|
-
const manifest = createEmptyManifest({
|
|
370
|
-
owner: 'test',
|
|
371
|
-
name: 'repo',
|
|
372
|
-
branch: 'main',
|
|
373
|
-
commit: 'abc123'
|
|
374
|
-
});
|
|
375
|
-
|
|
376
|
-
expect(manifest.version).toBe('1.0.0');
|
|
377
|
-
expect(manifest.dependencies).toHaveLength(0);
|
|
378
|
-
expect(manifest.statistics.totalDependencies).toBe(0);
|
|
379
|
-
expect(manifest.repository.owner).toBe('test');
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
it('should accept optional parameters', () => {
|
|
383
|
-
const manifest = createEmptyManifest({
|
|
384
|
-
owner: 'test',
|
|
385
|
-
name: 'repo',
|
|
386
|
-
branch: 'main',
|
|
387
|
-
commit: 'abc123',
|
|
388
|
-
action: 'custom-action',
|
|
389
|
-
version: '2.0.0',
|
|
390
|
-
llmProvider: 'claude',
|
|
391
|
-
llmModel: 'claude-3'
|
|
392
|
-
});
|
|
393
|
-
|
|
394
|
-
expect(manifest.generatedBy.action).toBe('custom-action');
|
|
395
|
-
expect(manifest.generatedBy.version).toBe('2.0.0');
|
|
396
|
-
expect(manifest.generatedBy.llmProvider).toBe('claude');
|
|
397
|
-
expect(manifest.generatedBy.llmModel).toBe('claude-3');
|
|
398
|
-
});
|
|
399
|
-
});
|
|
400
|
-
});
|