claude-dev-env 1.52.1 → 1.53.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.
@@ -0,0 +1,81 @@
1
+ import { test } from 'node:test';
2
+ import { strict as assert } from 'node:assert';
3
+ import { readFileSync } from 'node:fs';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { dirname, join } from 'node:path';
6
+
7
+ const workflowDirectory = dirname(fileURLToPath(import.meta.url));
8
+ const convergeSource = readFileSync(join(workflowDirectory, 'converge.mjs'), 'utf8');
9
+
10
+ function sourceSliceBetween(startNeedle, endNeedle) {
11
+ const sliceStart = convergeSource.indexOf(startNeedle);
12
+ assert.notEqual(sliceStart, -1, `expected ${startNeedle} to exist`);
13
+ const sliceEnd = convergeSource.indexOf(endNeedle, sliceStart + startNeedle.length);
14
+ assert.notEqual(sliceEnd, -1, `expected ${endNeedle} to exist after ${startNeedle}`);
15
+ return convergeSource.slice(sliceStart, sliceEnd);
16
+ }
17
+
18
+ const productionModule = new Function(
19
+ `${sourceSliceBetween('function normalizeRunInput(', '\nconst runInput =')}\n` +
20
+ 'return { normalizeRunInput, classifyRunInput };',
21
+ )();
22
+
23
+ const { normalizeRunInput, classifyRunInput } = productionModule;
24
+
25
+ const VALID_COORDINATES = { owner: 'jl-cmd', repo: 'claude-code-config', prNumber: 543 };
26
+
27
+ test('an object payload passes through unchanged', () => {
28
+ assert.deepEqual(normalizeRunInput(VALID_COORDINATES), VALID_COORDINATES);
29
+ });
30
+
31
+ test('a JSON-encoded string payload is parsed into coordinates', () => {
32
+ assert.deepEqual(normalizeRunInput(JSON.stringify(VALID_COORDINATES)), VALID_COORDINATES);
33
+ });
34
+
35
+ test('a non-JSON string returns null rather than throwing', () => {
36
+ assert.equal(normalizeRunInput('not json at all'), null);
37
+ });
38
+
39
+ test('an empty string returns null rather than throwing', () => {
40
+ assert.equal(normalizeRunInput(''), null);
41
+ });
42
+
43
+ test('classifyRunInput accepts coordinates carrying owner, repo, and prNumber', () => {
44
+ const classified = classifyRunInput(VALID_COORDINATES);
45
+ assert.deepEqual(classified.input, VALID_COORDINATES);
46
+ assert.equal(classified.blocker, null);
47
+ });
48
+
49
+ test('classifyRunInput blocks a failed parse with a structured blocker and no input', () => {
50
+ const classified = classifyRunInput('not json at all');
51
+ assert.equal(classified.input, null);
52
+ assert.match(classified.blocker, /coordinates/i);
53
+ });
54
+
55
+ test('classifyRunInput blocks a null payload with a structured blocker', () => {
56
+ const classified = classifyRunInput(null);
57
+ assert.equal(classified.input, null);
58
+ assert.match(classified.blocker, /coordinates/i);
59
+ });
60
+
61
+ test('classifyRunInput blocks a payload missing owner', () => {
62
+ const classified = classifyRunInput({ repo: 'claude-code-config', prNumber: 543 });
63
+ assert.equal(classified.input, null);
64
+ assert.match(classified.blocker, /coordinates/i);
65
+ });
66
+
67
+ test('classifyRunInput blocks a payload missing prNumber', () => {
68
+ const classified = classifyRunInput({ owner: 'jl-cmd', repo: 'claude-code-config' });
69
+ assert.equal(classified.input, null);
70
+ assert.match(classified.blocker, /coordinates/i);
71
+ });
72
+
73
+ test('the top-level run guards an unusable input into a structured blocker before reading input.owner', () => {
74
+ const guardBlock = convergeSource.slice(
75
+ convergeSource.indexOf('const runInput = classifyRunInput('),
76
+ convergeSource.indexOf('const prCoordinates ='),
77
+ );
78
+ assert.match(guardBlock, /runInput\.blocker/);
79
+ assert.match(guardBlock, /converged: false/);
80
+ assert.match(guardBlock, /return/);
81
+ });