edsger 0.45.1 → 0.47.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 (140) hide show
  1. package/.claude/settings.local.json +3 -23
  2. package/dist/api/__tests__/app-store.test.d.ts +7 -0
  3. package/dist/api/__tests__/app-store.test.js +60 -0
  4. package/dist/api/__tests__/intelligence.test.d.ts +11 -0
  5. package/dist/api/__tests__/intelligence.test.js +315 -0
  6. package/dist/api/features/__tests__/feature-utils.test.d.ts +4 -0
  7. package/dist/api/features/__tests__/feature-utils.test.js +370 -0
  8. package/dist/api/features/__tests__/status-updater.test.d.ts +4 -0
  9. package/dist/api/features/__tests__/status-updater.test.js +88 -0
  10. package/dist/commands/build/__tests__/build.test.d.ts +5 -0
  11. package/dist/commands/build/__tests__/build.test.js +206 -0
  12. package/dist/commands/build/__tests__/detect-project.test.d.ts +6 -0
  13. package/dist/commands/build/__tests__/detect-project.test.js +160 -0
  14. package/dist/commands/build/__tests__/run-build.test.d.ts +6 -0
  15. package/dist/commands/build/__tests__/run-build.test.js +433 -0
  16. package/dist/commands/intelligence/__tests__/command.test.d.ts +4 -0
  17. package/dist/commands/intelligence/__tests__/command.test.js +48 -0
  18. package/dist/commands/run-sheet/index.js +6 -0
  19. package/dist/commands/workflow/core/__tests__/feature-filter.test.d.ts +5 -0
  20. package/dist/commands/workflow/core/__tests__/feature-filter.test.js +316 -0
  21. package/dist/commands/workflow/core/__tests__/pipeline-evaluator.test.d.ts +4 -0
  22. package/dist/commands/workflow/core/__tests__/pipeline-evaluator.test.js +397 -0
  23. package/dist/commands/workflow/core/__tests__/state-manager.test.d.ts +4 -0
  24. package/dist/commands/workflow/core/__tests__/state-manager.test.js +384 -0
  25. package/dist/commands/workflow/executors/phase-executor.js +3 -1
  26. package/dist/commands/workflow/phase-orchestrator.js +1 -2
  27. package/dist/config/__tests__/config.test.d.ts +4 -0
  28. package/dist/config/__tests__/config.test.js +286 -0
  29. package/dist/config/__tests__/feature-status.test.d.ts +4 -0
  30. package/dist/config/__tests__/feature-status.test.js +111 -0
  31. package/dist/errors/__tests__/index.test.d.ts +4 -0
  32. package/dist/errors/__tests__/index.test.js +349 -0
  33. package/dist/index.js +0 -0
  34. package/dist/phases/app-store-generation/__tests__/agent.test.d.ts +5 -0
  35. package/dist/phases/app-store-generation/__tests__/agent.test.js +142 -0
  36. package/dist/phases/app-store-generation/__tests__/context.test.d.ts +4 -0
  37. package/dist/phases/app-store-generation/__tests__/context.test.js +284 -0
  38. package/dist/phases/app-store-generation/__tests__/prompts.test.d.ts +4 -0
  39. package/dist/phases/app-store-generation/__tests__/prompts.test.js +122 -0
  40. package/dist/phases/app-store-generation/__tests__/screenshot-composer.test.d.ts +5 -0
  41. package/dist/phases/app-store-generation/__tests__/screenshot-composer.test.js +826 -0
  42. package/dist/phases/app-store-generation/index.js +1 -2
  43. package/dist/phases/branch-planning/index.js +1 -2
  44. package/dist/phases/bug-fixing/analyzer.js +1 -2
  45. package/dist/phases/code-implementation/index.js +1 -2
  46. package/dist/phases/code-refine/index.js +1 -2
  47. package/dist/phases/code-review/__tests__/diff-utils.test.d.ts +1 -0
  48. package/dist/phases/code-review/__tests__/diff-utils.test.js +101 -0
  49. package/dist/phases/code-review/index.js +1 -2
  50. package/dist/phases/code-testing/analyzer.js +1 -2
  51. package/dist/phases/feature-analysis/index.js +1 -2
  52. package/dist/phases/functional-testing/analyzer.js +1 -2
  53. package/dist/phases/growth-analysis/index.js +1 -2
  54. package/dist/phases/intelligence-analysis/__tests__/context.test.d.ts +4 -0
  55. package/dist/phases/intelligence-analysis/__tests__/context.test.js +192 -0
  56. package/dist/phases/intelligence-analysis/__tests__/matching.test.d.ts +13 -0
  57. package/dist/phases/intelligence-analysis/__tests__/matching.test.js +154 -0
  58. package/dist/phases/intelligence-analysis/__tests__/orchestration.test.d.ts +5 -0
  59. package/dist/phases/intelligence-analysis/__tests__/orchestration.test.js +378 -0
  60. package/dist/phases/intelligence-analysis/__tests__/prompts.test.d.ts +4 -0
  61. package/dist/phases/intelligence-analysis/__tests__/prompts.test.js +33 -0
  62. package/dist/phases/pr-execution/__tests__/file-assigner.test.d.ts +1 -0
  63. package/dist/phases/pr-execution/__tests__/file-assigner.test.js +303 -0
  64. package/dist/phases/pr-execution/index.js +1 -0
  65. package/dist/phases/pr-resolve/__tests__/checklist-learner.test.d.ts +1 -0
  66. package/dist/phases/pr-resolve/__tests__/checklist-learner.test.js +157 -0
  67. package/dist/phases/pr-resolve/__tests__/prompts.test.d.ts +1 -0
  68. package/dist/phases/pr-resolve/__tests__/prompts.test.js +116 -0
  69. package/dist/phases/pr-resolve/__tests__/resolve-mapping.test.d.ts +1 -0
  70. package/dist/phases/pr-resolve/__tests__/resolve-mapping.test.js +138 -0
  71. package/dist/phases/pr-resolve/__tests__/types.test.d.ts +1 -0
  72. package/dist/phases/pr-resolve/__tests__/types.test.js +43 -0
  73. package/dist/phases/pr-resolve/__tests__/workspace.test.d.ts +1 -0
  74. package/dist/phases/pr-resolve/__tests__/workspace.test.js +111 -0
  75. package/dist/phases/pr-review/__tests__/prompts.test.d.ts +1 -0
  76. package/dist/phases/pr-review/__tests__/prompts.test.js +49 -0
  77. package/dist/phases/pr-review/__tests__/review-comments.test.d.ts +1 -0
  78. package/dist/phases/pr-review/__tests__/review-comments.test.js +110 -0
  79. package/dist/phases/pr-shared/__tests__/agent-utils.test.d.ts +1 -0
  80. package/dist/phases/pr-shared/__tests__/agent-utils.test.js +91 -0
  81. package/dist/phases/pr-shared/__tests__/context.test.d.ts +1 -0
  82. package/dist/phases/pr-shared/__tests__/context.test.js +94 -0
  83. package/dist/phases/pr-splitting/__tests__/import-dep-validator.test.d.ts +1 -0
  84. package/dist/phases/pr-splitting/__tests__/import-dep-validator.test.js +331 -0
  85. package/dist/phases/pr-splitting/index.js +1 -2
  86. package/dist/phases/release-sync/github.d.ts +12 -0
  87. package/dist/phases/release-sync/github.js +39 -0
  88. package/dist/phases/release-sync/snapshot.js +0 -1
  89. package/dist/phases/run-sheet/index.d.ts +15 -0
  90. package/dist/phases/run-sheet/index.js +161 -29
  91. package/dist/phases/run-sheet/render.d.ts +23 -5
  92. package/dist/phases/run-sheet/render.js +195 -31
  93. package/dist/phases/smoke-test/__tests__/agent.test.d.ts +4 -0
  94. package/dist/phases/smoke-test/__tests__/agent.test.js +84 -0
  95. package/dist/phases/smoke-test/__tests__/github.test.d.ts +9 -0
  96. package/dist/phases/smoke-test/__tests__/github.test.js +120 -0
  97. package/dist/phases/smoke-test/__tests__/snapshot.test.d.ts +8 -0
  98. package/dist/phases/smoke-test/__tests__/snapshot.test.js +93 -0
  99. package/dist/phases/smoke-test/agent.js +2 -4
  100. package/dist/phases/smoke-test/github.d.ts +54 -0
  101. package/dist/phases/smoke-test/github.js +101 -0
  102. package/dist/phases/smoke-test/index.js +11 -6
  103. package/dist/phases/smoke-test/snapshot.d.ts +27 -0
  104. package/dist/phases/smoke-test/snapshot.js +157 -0
  105. package/dist/phases/technical-design/index.js +1 -2
  106. package/dist/phases/test-cases-analysis/index.js +1 -2
  107. package/dist/phases/user-stories-analysis/index.js +1 -2
  108. package/dist/services/coaching/__tests__/coaching-agent.test.d.ts +1 -0
  109. package/dist/services/coaching/__tests__/coaching-agent.test.js +74 -0
  110. package/dist/services/coaching/__tests__/coaching-loop.test.d.ts +1 -0
  111. package/dist/services/coaching/__tests__/coaching-loop.test.js +59 -0
  112. package/dist/services/coaching/__tests__/self-rating.test.d.ts +1 -0
  113. package/dist/services/coaching/__tests__/self-rating.test.js +188 -0
  114. package/dist/services/lifecycle-agent/__tests__/phase-criteria.test.d.ts +4 -0
  115. package/dist/services/lifecycle-agent/__tests__/phase-criteria.test.js +133 -0
  116. package/dist/services/lifecycle-agent/__tests__/transition-rules.test.d.ts +4 -0
  117. package/dist/services/lifecycle-agent/__tests__/transition-rules.test.js +336 -0
  118. package/dist/services/lifecycle-agent/index.d.ts +24 -0
  119. package/dist/services/lifecycle-agent/index.js +25 -0
  120. package/dist/services/lifecycle-agent/phase-criteria.d.ts +57 -0
  121. package/dist/services/lifecycle-agent/phase-criteria.js +335 -0
  122. package/dist/services/lifecycle-agent/transition-rules.d.ts +60 -0
  123. package/dist/services/lifecycle-agent/transition-rules.js +184 -0
  124. package/dist/services/lifecycle-agent/types.d.ts +190 -0
  125. package/dist/services/lifecycle-agent/types.js +12 -0
  126. package/dist/services/phase-hooks/__tests__/bindings-fetcher.test.d.ts +1 -0
  127. package/dist/services/phase-hooks/__tests__/bindings-fetcher.test.js +122 -0
  128. package/dist/services/phase-hooks/__tests__/hook-executor.test.d.ts +1 -0
  129. package/dist/services/phase-hooks/__tests__/hook-executor.test.js +321 -0
  130. package/dist/services/phase-hooks/__tests__/hook-runner.test.d.ts +1 -0
  131. package/dist/services/phase-hooks/__tests__/hook-runner.test.js +261 -0
  132. package/dist/services/phase-hooks/__tests__/plugin-loader.test.d.ts +1 -0
  133. package/dist/services/phase-hooks/__tests__/plugin-loader.test.js +158 -0
  134. package/dist/services/video/__tests__/video-pipeline.test.d.ts +6 -0
  135. package/dist/services/video/__tests__/video-pipeline.test.js +249 -0
  136. package/dist/workspace/__tests__/workspace-manager.test.d.ts +7 -0
  137. package/dist/workspace/__tests__/workspace-manager.test.js +52 -0
  138. package/dist/workspace/workspace-manager.js +17 -4
  139. package/package.json +1 -1
  140. package/.env.local +0 -12
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Unit tests for smoke-test agent response parsing.
3
+ */
4
+ import assert from 'node:assert';
5
+ import { describe, it } from 'node:test';
6
+ import { extractJson, findBalancedJsonObject } from '../agent.js';
7
+ void describe('extractJson', () => {
8
+ void it('parses a plain JSON object', () => {
9
+ const raw = `{
10
+ "summary": "one thing changed",
11
+ "test_cases": [
12
+ { "name": "login still works", "description": "step 1", "is_critical": true }
13
+ ]
14
+ }`;
15
+ const parsed = extractJson(raw);
16
+ assert.strictEqual(parsed.summary, 'one thing changed');
17
+ assert.strictEqual(parsed.test_cases.length, 1);
18
+ assert.strictEqual(parsed.test_cases[0].is_critical, true);
19
+ });
20
+ void it('strips ```json fences', () => {
21
+ const raw = '```json\n{"summary":"x","test_cases":[{"name":"a","description":"b"}]}\n```';
22
+ const parsed = extractJson(raw);
23
+ assert.strictEqual(parsed.summary, 'x');
24
+ assert.strictEqual(parsed.test_cases[0].name, 'a');
25
+ });
26
+ void it('strips unlabeled fences', () => {
27
+ const raw = '```\n{"summary":"x","test_cases":[]}\n```';
28
+ const parsed = extractJson(raw);
29
+ assert.deepStrictEqual(parsed.test_cases, []);
30
+ });
31
+ void it('tolerates leading and trailing prose', () => {
32
+ const raw = `Here you go:
33
+ {"summary":"x","test_cases":[{"name":"a","description":"b"}]}
34
+
35
+ Hope that helps.`;
36
+ const parsed = extractJson(raw);
37
+ assert.strictEqual(parsed.summary, 'x');
38
+ });
39
+ void it('throws when test_cases is missing', () => {
40
+ assert.throws(() => extractJson('{"summary":"x"}'), /test_cases/);
41
+ });
42
+ void it('throws on invalid JSON', () => {
43
+ assert.throws(() => extractJson('not json'));
44
+ });
45
+ void it('picks the first balanced object when prose contains decoy braces', () => {
46
+ const raw = 'Note: { pseudo-json example } but the real answer is:\n' +
47
+ '{"summary":"x","test_cases":[{"name":"a","description":"b"}]}\n' +
48
+ 'Let me know if you want changes.';
49
+ const parsed = extractJson(raw);
50
+ assert.strictEqual(parsed.summary, 'x');
51
+ assert.strictEqual(parsed.test_cases[0].name, 'a');
52
+ });
53
+ void it('preserves braces inside JSON string values', () => {
54
+ const raw = '{"summary":"changes to {pricing} and {checkout}","test_cases":[{"name":"n","description":"d"}]}';
55
+ const parsed = extractJson(raw);
56
+ assert.strictEqual(parsed.summary, 'changes to {pricing} and {checkout}');
57
+ });
58
+ void it('throws when test_cases is not an array', () => {
59
+ assert.throws(() => extractJson('{"summary":"x","test_cases":"nope"}'), /test_cases/);
60
+ });
61
+ });
62
+ void describe('findBalancedJsonObject', () => {
63
+ void it('returns null when there is no opening brace', () => {
64
+ assert.strictEqual(findBalancedJsonObject('no braces here'), null);
65
+ });
66
+ void it('returns the first balanced top-level object', () => {
67
+ assert.strictEqual(findBalancedJsonObject('prefix {"a": 1} and {"b": 2} suffix'), '{"a": 1}');
68
+ });
69
+ void it('handles nested braces', () => {
70
+ const text = 'xxx {"a": {"b": {"c": 1}}} yyy';
71
+ assert.strictEqual(findBalancedJsonObject(text), '{"a": {"b": {"c": 1}}}');
72
+ });
73
+ void it('ignores braces inside strings', () => {
74
+ const text = '{"msg": "this has { and } inside", "ok": true}';
75
+ assert.strictEqual(findBalancedJsonObject(text), text);
76
+ });
77
+ void it('handles escaped quotes inside strings', () => {
78
+ const text = '{"msg": "she said \\"hi\\" {not object}"}';
79
+ assert.strictEqual(findBalancedJsonObject(text), text);
80
+ });
81
+ void it('returns null on unbalanced input', () => {
82
+ assert.strictEqual(findBalancedJsonObject('{"a": 1'), null);
83
+ });
84
+ });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Unit tests for smoke-test github helpers.
3
+ *
4
+ * Covers the pure functions that shape GitHub compare data into a
5
+ * prompt-ready digest. Network-facing functions (fetchLatestTwoReleases,
6
+ * fetchCompare) are exercised only indirectly — their output shape is
7
+ * fed through buildDiffDigest / summariseStats here.
8
+ */
9
+ export {};
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Unit tests for smoke-test github helpers.
3
+ *
4
+ * Covers the pure functions that shape GitHub compare data into a
5
+ * prompt-ready digest. Network-facing functions (fetchLatestTwoReleases,
6
+ * fetchCompare) are exercised only indirectly — their output shape is
7
+ * fed through buildDiffDigest / summariseStats here.
8
+ */
9
+ import assert from 'node:assert';
10
+ import { describe, it } from 'node:test';
11
+ import { buildDiffDigest, summariseStats, } from '../github.js';
12
+ function makeCompare(over = {}) {
13
+ return {
14
+ total_commits: 2,
15
+ commits: [
16
+ {
17
+ sha: '1111111aaaaaaaa',
18
+ commit: { message: 'feat: add checkout flow\n\nmore body', author: null },
19
+ },
20
+ {
21
+ sha: '2222222bbbbbbbb',
22
+ commit: { message: 'fix: null deref', author: { name: 'Ada' } },
23
+ },
24
+ ],
25
+ files: [
26
+ {
27
+ filename: 'src/checkout.ts',
28
+ status: 'modified',
29
+ additions: 10,
30
+ deletions: 2,
31
+ changes: 12,
32
+ patch: '@@ -1 +1 @@\n-old\n+new',
33
+ },
34
+ {
35
+ filename: 'src/util.ts',
36
+ status: 'added',
37
+ additions: 5,
38
+ deletions: 0,
39
+ changes: 5,
40
+ },
41
+ ],
42
+ ...over,
43
+ };
44
+ }
45
+ void describe('summariseStats', () => {
46
+ void it('sums additions, deletions, and file count', () => {
47
+ const stats = summariseStats(makeCompare());
48
+ assert.deepStrictEqual(stats, {
49
+ files_changed: 2,
50
+ additions: 15,
51
+ deletions: 2,
52
+ total_commits: 2,
53
+ });
54
+ });
55
+ void it('handles an empty diff', () => {
56
+ const stats = summariseStats({
57
+ total_commits: 0,
58
+ commits: [],
59
+ files: [],
60
+ });
61
+ assert.deepStrictEqual(stats, {
62
+ files_changed: 0,
63
+ additions: 0,
64
+ deletions: 0,
65
+ total_commits: 0,
66
+ });
67
+ });
68
+ });
69
+ void describe('buildDiffDigest', () => {
70
+ void it('includes commit subjects, file list, and patches', () => {
71
+ const digest = buildDiffDigest(makeCompare());
72
+ assert.match(digest, /Total commits: 2/);
73
+ assert.match(digest, /1111111 feat: add checkout flow/);
74
+ assert.match(digest, /2222222 fix: null deref/);
75
+ assert.match(digest, /modified src\/checkout\.ts \(\+10\/-2\)/);
76
+ assert.match(digest, /added src\/util\.ts \(\+5\/-0\)/);
77
+ assert.match(digest, /--- src\/checkout\.ts ---/);
78
+ assert.match(digest, /\+new/);
79
+ });
80
+ void it('truncates only the subject line of multi-line commit messages', () => {
81
+ const digest = buildDiffDigest(makeCompare());
82
+ // "more body" from the first commit's message body must not leak in.
83
+ assert.ok(!digest.includes('more body'));
84
+ });
85
+ void it('caps the patch budget and appends a truncation marker', () => {
86
+ const huge = 'x'.repeat(200_000);
87
+ const compare = makeCompare({
88
+ files: [
89
+ {
90
+ filename: 'src/big.ts',
91
+ status: 'modified',
92
+ additions: 1,
93
+ deletions: 0,
94
+ changes: 1,
95
+ patch: huge,
96
+ },
97
+ ],
98
+ });
99
+ const digest = buildDiffDigest(compare);
100
+ assert.match(digest, /\[truncated\]/);
101
+ // Even with a 200k patch, digest stays bounded by the internal budget.
102
+ assert.ok(digest.length < 200_000);
103
+ });
104
+ void it('skips files without patches in the patches section', () => {
105
+ const compare = makeCompare({
106
+ files: [
107
+ {
108
+ filename: 'vendored.min.js',
109
+ status: 'added',
110
+ additions: 1,
111
+ deletions: 0,
112
+ changes: 1,
113
+ },
114
+ ],
115
+ });
116
+ const digest = buildDiffDigest(compare);
117
+ assert.ok(digest.includes('== Patches (truncated) =='));
118
+ assert.ok(!digest.includes('--- vendored.min.js ---'));
119
+ });
120
+ });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Unit tests for snapshot-detection pure helpers.
3
+ *
4
+ * The network / SDK path (`detectSnapshotVersion`) is not covered here
5
+ * — it's exercised end-to-end when the CLI runs — but the parser and
6
+ * the plausibility check are critical and easy to cover.
7
+ */
8
+ export {};
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Unit tests for snapshot-detection pure helpers.
3
+ *
4
+ * The network / SDK path (`detectSnapshotVersion`) is not covered here
5
+ * — it's exercised end-to-end when the CLI runs — but the parser and
6
+ * the plausibility check are critical and easy to cover.
7
+ */
8
+ import assert from 'node:assert';
9
+ import { describe, it } from 'node:test';
10
+ import { buildSnapshotDetectionPrompt, isPlausibleSnapshotTag, parseSnapshotDetection, } from '../snapshot.js';
11
+ void describe('parseSnapshotDetection', () => {
12
+ void it('parses a clean JSON object', () => {
13
+ const raw = '{"snapshot_tag":"v2.0.0","source":"package.json","reasoning":"next ver"}';
14
+ const parsed = parseSnapshotDetection(raw);
15
+ assert.strictEqual(parsed.snapshot_tag, 'v2.0.0');
16
+ assert.strictEqual(parsed.source, 'package.json');
17
+ assert.match(parsed.reasoning, /next ver/);
18
+ });
19
+ void it('strips ```json fences', () => {
20
+ const raw = '```json\n{"snapshot_tag":"v1.0.1","source":"VERSION","reasoning":"x"}\n```';
21
+ const parsed = parseSnapshotDetection(raw);
22
+ assert.strictEqual(parsed.snapshot_tag, 'v1.0.1');
23
+ });
24
+ void it('tolerates leading and trailing prose', () => {
25
+ const raw = `I checked package.json:
26
+ {"snapshot_tag":"v3.0.0","source":"package.json","reasoning":"bumped"}
27
+ Done.`;
28
+ const parsed = parseSnapshotDetection(raw);
29
+ assert.strictEqual(parsed.snapshot_tag, 'v3.0.0');
30
+ });
31
+ void it('returns null snapshot_tag when model reports no snapshot', () => {
32
+ const raw = '{"snapshot_tag": null, "source": null, "reasoning": "version matches latest release"}';
33
+ const parsed = parseSnapshotDetection(raw);
34
+ assert.strictEqual(parsed.snapshot_tag, null);
35
+ assert.strictEqual(parsed.source, null);
36
+ });
37
+ void it('treats empty string snapshot_tag as null', () => {
38
+ const raw = '{"snapshot_tag":"","source":null,"reasoning":"nothing found"}';
39
+ const parsed = parseSnapshotDetection(raw);
40
+ assert.strictEqual(parsed.snapshot_tag, null);
41
+ });
42
+ void it('falls back to balanced-brace extraction for surrounding prose', () => {
43
+ const raw = 'Analysis: { could be v1 } — but the real answer is ' +
44
+ '{"snapshot_tag":"v1.2.0","source":"CHANGELOG","reasoning":"unreleased section present"}';
45
+ const parsed = parseSnapshotDetection(raw);
46
+ assert.strictEqual(parsed.snapshot_tag, 'v1.2.0');
47
+ assert.strictEqual(parsed.source, 'CHANGELOG');
48
+ });
49
+ void it('throws when no JSON object is present', () => {
50
+ assert.throws(() => parseSnapshotDetection('no json at all'), /JSON/);
51
+ });
52
+ void it('supplies default reasoning when missing', () => {
53
+ const raw = '{"snapshot_tag":"v1","source":"package.json"}';
54
+ const parsed = parseSnapshotDetection(raw);
55
+ assert.strictEqual(parsed.snapshot_tag, 'v1');
56
+ assert.strictEqual(parsed.reasoning, '(no reasoning given)');
57
+ });
58
+ });
59
+ void describe('isPlausibleSnapshotTag', () => {
60
+ void it('accepts normal version tags', () => {
61
+ assert.strictEqual(isPlausibleSnapshotTag('v2.0.0', 'v1.9.0'), true);
62
+ assert.strictEqual(isPlausibleSnapshotTag('2.0.0-rc.1', '1.9.0'), true);
63
+ assert.strictEqual(isPlausibleSnapshotTag('v1.2.3-SNAPSHOT', 'v1.2.2'), true);
64
+ assert.strictEqual(isPlausibleSnapshotTag('release/2.0', 'release/1.9'), true);
65
+ });
66
+ void it('rejects tags identical to the latest release', () => {
67
+ assert.strictEqual(isPlausibleSnapshotTag('v1.0.0', 'v1.0.0'), false);
68
+ });
69
+ void it('rejects empty or overlong tags', () => {
70
+ assert.strictEqual(isPlausibleSnapshotTag('', 'v1'), false);
71
+ assert.strictEqual(isPlausibleSnapshotTag('x'.repeat(101), 'v1'), false);
72
+ });
73
+ void it('rejects whitespace and shell metacharacters', () => {
74
+ assert.strictEqual(isPlausibleSnapshotTag('v 2', 'v1'), false);
75
+ assert.strictEqual(isPlausibleSnapshotTag('v2;rm -rf', 'v1'), false);
76
+ assert.strictEqual(isPlausibleSnapshotTag('v2$PATH', 'v1'), false);
77
+ });
78
+ void it('rejects leading dot or dash, double dot, @{ reflog', () => {
79
+ assert.strictEqual(isPlausibleSnapshotTag('.v2', 'v1'), false);
80
+ assert.strictEqual(isPlausibleSnapshotTag('-v2', 'v1'), false);
81
+ assert.strictEqual(isPlausibleSnapshotTag('v2..rc', 'v1'), false);
82
+ assert.strictEqual(isPlausibleSnapshotTag('v2@{1}', 'v1'), false);
83
+ });
84
+ });
85
+ void describe('buildSnapshotDetectionPrompt', () => {
86
+ void it('injects the latest release tag into the prompt', () => {
87
+ const prompt = buildSnapshotDetectionPrompt('v1.4.2');
88
+ assert.match(prompt, /v1\.4\.2/);
89
+ // Must ask for JSON output
90
+ assert.match(prompt, /JSON/);
91
+ assert.match(prompt, /snapshot_tag/);
92
+ });
93
+ });
@@ -66,11 +66,9 @@ export async function executeSmokeTestQuery(systemPrompt, userPrompt, config, ve
66
66
  lastAssistant += `${content.text}\n`;
67
67
  logDebug(content.text, verbose);
68
68
  }
69
- else if (content.type === 'tool_use') {
69
+ else if (content.type === 'tool_use' && verbose) {
70
70
  const desc = content.input?.description || content.input?.command || 'Running...';
71
- if (verbose) {
72
- logInfo(`[Turn ${turnCount}] ${content.name}: ${typeof desc === 'string' ? desc.slice(0, 120) : 'Running...'}`);
73
- }
71
+ logInfo(`[Turn ${turnCount}] ${content.name}: ${typeof desc === 'string' ? desc.slice(0, 120) : 'Running...'}`);
74
72
  }
75
73
  }
76
74
  }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * GitHub release helpers for smoke-test generation, implemented on top of
3
+ * @octokit/rest so we share retry / rate-limit / User-Agent behavior with the
4
+ * rest of the packages/edsger codebase.
5
+ */
6
+ export interface GithubRelease {
7
+ id: number;
8
+ tag_name: string;
9
+ name: string | null;
10
+ body: string | null;
11
+ html_url: string;
12
+ published_at: string | null;
13
+ draft: boolean;
14
+ prerelease: boolean;
15
+ }
16
+ export interface CompareFile {
17
+ filename: string;
18
+ status: string;
19
+ additions: number;
20
+ deletions: number;
21
+ changes: number;
22
+ patch?: string;
23
+ }
24
+ export interface CompareCommit {
25
+ sha: string;
26
+ commit: {
27
+ message: string;
28
+ author?: {
29
+ name?: string;
30
+ } | null;
31
+ };
32
+ }
33
+ export interface CompareResponse {
34
+ total_commits: number;
35
+ files: CompareFile[];
36
+ commits: CompareCommit[];
37
+ }
38
+ export interface ReleasePair {
39
+ latest: GithubRelease;
40
+ previous: GithubRelease | null;
41
+ }
42
+ export declare function fetchLatestTwoReleases(owner: string, repo: string, token: string): Promise<ReleasePair>;
43
+ export declare function getDefaultBranchHead(owner: string, repo: string, token: string): Promise<{
44
+ branch: string;
45
+ sha: string;
46
+ }>;
47
+ export declare function fetchCompare(owner: string, repo: string, base: string, head: string, token: string): Promise<CompareResponse>;
48
+ export declare function buildDiffDigest(compare: CompareResponse): string;
49
+ export declare function summariseStats(compare: CompareResponse): {
50
+ files_changed: number;
51
+ additions: number;
52
+ deletions: number;
53
+ total_commits: number;
54
+ };
@@ -0,0 +1,101 @@
1
+ /**
2
+ * GitHub release helpers for smoke-test generation, implemented on top of
3
+ * @octokit/rest so we share retry / rate-limit / User-Agent behavior with the
4
+ * rest of the packages/edsger codebase.
5
+ */
6
+ import { Octokit } from '@octokit/rest';
7
+ const MAX_PATCH_CHARS = 60_000;
8
+ const MAX_COMMITS_INCLUDED = 40;
9
+ function octokit(token) {
10
+ return new Octokit({ auth: token, userAgent: 'edsger-cli' });
11
+ }
12
+ export async function fetchLatestTwoReleases(owner, repo, token) {
13
+ const gh = octokit(token);
14
+ const { data } = await gh.repos.listReleases({ owner, repo, per_page: 10 });
15
+ const real = data.filter((r) => !r.draft);
16
+ if (real.length === 0) {
17
+ throw new Error(`Repository ${owner}/${repo} has no releases yet. Publish one first.`);
18
+ }
19
+ return { latest: real[0], previous: real[1] ?? null };
20
+ }
21
+ export async function getDefaultBranchHead(owner, repo, token) {
22
+ const gh = octokit(token);
23
+ const { data: repoInfo } = await gh.repos.get({ owner, repo });
24
+ const branch = repoInfo.default_branch;
25
+ const { data: branchInfo } = await gh.repos.getBranch({
26
+ owner,
27
+ repo,
28
+ branch,
29
+ });
30
+ return { branch, sha: branchInfo.commit.sha };
31
+ }
32
+ export async function fetchCompare(owner, repo, base, head, token) {
33
+ const gh = octokit(token);
34
+ const { data } = await gh.repos.compareCommits({
35
+ owner,
36
+ repo,
37
+ base,
38
+ head,
39
+ });
40
+ // Octokit returns a richer shape; narrow to the subset we consume.
41
+ return {
42
+ total_commits: data.total_commits ?? 0,
43
+ files: (data.files ?? []).map((f) => ({
44
+ filename: f.filename,
45
+ status: f.status,
46
+ additions: f.additions ?? 0,
47
+ deletions: f.deletions ?? 0,
48
+ changes: f.changes ?? 0,
49
+ patch: f.patch,
50
+ })),
51
+ commits: (data.commits ?? []).map((c) => ({
52
+ sha: c.sha,
53
+ commit: {
54
+ message: c.commit?.message ?? '',
55
+ author: c.commit?.author
56
+ ? { name: c.commit.author.name ?? undefined }
57
+ : null,
58
+ },
59
+ })),
60
+ };
61
+ }
62
+ export function buildDiffDigest(compare) {
63
+ const lines = [];
64
+ lines.push(`Total commits: ${compare.total_commits}`);
65
+ lines.push('\n== Commits ==');
66
+ for (const c of compare.commits.slice(0, MAX_COMMITS_INCLUDED)) {
67
+ const subject = (c.commit.message || '').split('\n')[0].slice(0, 200);
68
+ lines.push(`- ${c.sha.slice(0, 7)} ${subject}`);
69
+ }
70
+ lines.push('\n== Files ==');
71
+ for (const f of compare.files) {
72
+ lines.push(`- ${f.status} ${f.filename} (+${f.additions}/-${f.deletions})`);
73
+ }
74
+ lines.push('\n== Patches (truncated) ==');
75
+ let budget = MAX_PATCH_CHARS;
76
+ for (const f of compare.files) {
77
+ if (budget <= 0 || !f.patch) {
78
+ continue;
79
+ }
80
+ const header = `\n--- ${f.filename} ---\n`;
81
+ const piece = header + f.patch;
82
+ if (piece.length > budget) {
83
+ lines.push(piece.slice(0, budget));
84
+ lines.push('\n...[truncated]');
85
+ budget = 0;
86
+ }
87
+ else {
88
+ lines.push(piece);
89
+ budget -= piece.length;
90
+ }
91
+ }
92
+ return lines.join('\n');
93
+ }
94
+ export function summariseStats(compare) {
95
+ return {
96
+ files_changed: compare.files.length,
97
+ additions: compare.files.reduce((s, f) => s + f.additions, 0),
98
+ deletions: compare.files.reduce((s, f) => s + f.deletions, 0),
99
+ total_commits: compare.total_commits,
100
+ };
101
+ }
@@ -17,7 +17,15 @@ import { buildSmokeTestUserPrompt, createSmokeTestSystemPrompt, } from './prompt
17
17
  function isSnapshotRelease(release) {
18
18
  return !release.published_at && !release.url;
19
19
  }
20
- // eslint-disable-next-line complexity -- orchestration spans GitHub + DB + AI
20
+ function describeReleaseContext(release, isSnapshot) {
21
+ if (isSnapshot) {
22
+ return ` (snapshot ahead of ${release.previous_tag ?? 'first release'})`;
23
+ }
24
+ if (release.previous_tag) {
25
+ return ` (vs ${release.previous_tag})`;
26
+ }
27
+ return ' (first release)';
28
+ }
21
29
  export async function runSmokeTest(options, config) {
22
30
  const { releaseId, verbose } = options;
23
31
  if (verbose) {
@@ -216,11 +224,8 @@ async function runSmokeTestInner(ctx) {
216
224
  diff_stats: diffStats,
217
225
  generation_error: null,
218
226
  }, verbose);
219
- logSuccess(`Generated ${casesCount} smoke-test cases for ${release.tag}${isSnapshot
220
- ? ` (snapshot ahead of ${release.previous_tag ?? 'first release'})`
221
- : release.previous_tag
222
- ? ` (vs ${release.previous_tag})`
223
- : ' (first release)'}`);
227
+ const suffix = describeReleaseContext(release, isSnapshot);
228
+ logSuccess(`Generated ${casesCount} smoke-test cases for ${release.tag}${suffix}`);
224
229
  return {
225
230
  status: 'success',
226
231
  releaseId: release.id,
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Snapshot detection: after the latest GitHub release already has a
3
+ * smoke-test plan, inspect the cloned repo for a yet-to-be-released
4
+ * "snapshot" version (next package.json version, an [Unreleased] entry
5
+ * in CHANGELOG, an unreleased git tag, etc.) so we can prepare the
6
+ * next smoke test before anyone cuts the tag on GitHub.
7
+ */
8
+ import { type EdsgerConfig } from '../../types/index.js';
9
+ export interface SnapshotDetection {
10
+ snapshot_tag: string | null;
11
+ source: string | null;
12
+ reasoning: string;
13
+ }
14
+ export declare function buildSnapshotDetectionPrompt(latestReleaseTag: string): string;
15
+ export declare function parseSnapshotDetection(raw: string): SnapshotDetection;
16
+ /**
17
+ * Very loose sanity check on a proposed snapshot tag. We reject tags
18
+ * that are obviously the same as the latest release or that contain
19
+ * characters that would break downstream git / GitHub API calls.
20
+ */
21
+ export declare function isPlausibleSnapshotTag(candidate: string, latestReleaseTag: string): boolean;
22
+ export declare function detectSnapshotVersion(options: {
23
+ cwd: string;
24
+ latestReleaseTag: string;
25
+ config: EdsgerConfig;
26
+ verbose?: boolean;
27
+ }): Promise<SnapshotDetection>;