claude-yes 1.26.0 → 1.27.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,101 @@
1
+ import { describe, expect, it } from 'bun:test';
2
+ import {
3
+ extractSessionId,
4
+ extractSessionIdFromSessionMeta,
5
+ } from './codexSessionManager';
6
+
7
+ describe('Session Extraction Test', () => {
8
+ it('should extract session IDs from various codex output formats', async () => {
9
+ console.log('\n=== Session ID Extraction Test ===');
10
+
11
+ // Test different formats where session IDs might appear
12
+ const testCases = [
13
+ {
14
+ name: 'Direct UUID in output',
15
+ output: 'Session started with ID: 0199e659-0e5f-7843-8876-5a65c64e77c0',
16
+ expected: '0199e659-0e5f-7843-8876-5a65c64e77c0',
17
+ },
18
+ {
19
+ name: 'UUID in brackets',
20
+ output:
21
+ 'Using session [0199e659-0e5f-7843-8876-5a65c64e77c0] for this conversation',
22
+ expected: '0199e659-0e5f-7843-8876-5a65c64e77c0',
23
+ },
24
+ {
25
+ name: 'Mixed case UUID',
26
+ output: 'SESSION_ID: 0199E659-0E5F-7843-8876-5A65C64E77C0',
27
+ expected: '0199E659-0E5F-7843-8876-5A65C64E77C0',
28
+ },
29
+ {
30
+ name: 'No UUID present',
31
+ output: 'Welcome to codex! Type your message and press enter.',
32
+ expected: null,
33
+ },
34
+ {
35
+ name: 'Multiple UUIDs (should get first)',
36
+ output:
37
+ 'Old: 1111e659-0e5f-7843-8876-5a65c64e77c0 New: 2222e659-0e5f-7843-8876-5a65c64e77c0',
38
+ expected: '1111e659-0e5f-7843-8876-5a65c64e77c0',
39
+ },
40
+ ];
41
+
42
+ for (const testCase of testCases) {
43
+ console.log(`Testing: ${testCase.name}`);
44
+ const result = extractSessionId(testCase.output);
45
+ console.log(` Input: ${testCase.output}`);
46
+ console.log(` Expected: ${testCase.expected}`);
47
+ console.log(` Got: ${result}`);
48
+ expect(result).toBe(testCase.expected);
49
+ }
50
+
51
+ console.log('✅ All session extraction tests passed!\n');
52
+ });
53
+
54
+ it('should extract session ID from session metadata JSON', async () => {
55
+ console.log('\n=== Session Metadata Extraction Test ===');
56
+
57
+ const sessionMetaJson = `{"timestamp":"2025-10-15T05:30:20.265Z","type":"session_meta","payload":{"id":"0199e659-0e5f-7843-8876-5a65c64e77c0","timestamp":"2025-10-15T05:30:20.127Z","cwd":"/v1/code/project","originator":"codex_cli_rs"}}
58
+ {"timestamp":"2025-10-15T05:30:20.415Z","type":"response_item","payload":{"type":"message","role":"user"}}`;
59
+
60
+ const sessionId = extractSessionIdFromSessionMeta(sessionMetaJson);
61
+ console.log(`Extracted session ID: ${sessionId}`);
62
+ expect(sessionId).toBe('0199e659-0e5f-7843-8876-5a65c64e77c0');
63
+
64
+ console.log('✅ Session metadata extraction test passed!\n');
65
+ });
66
+
67
+ it('should demonstrate session tracking workflow', async () => {
68
+ console.log('\n=== Session Tracking Workflow Demo ===');
69
+
70
+ // Simulate codex output that would contain session information
71
+ const mockCodexOutputs = [
72
+ {
73
+ directory: 'logs/cwd1',
74
+ output:
75
+ 'Starting new conversation... Session ID: aaaa1111-2222-3333-4444-bbbbccccdddd',
76
+ },
77
+ {
78
+ directory: 'logs/cwd2',
79
+ output:
80
+ 'Resuming session... Using ID: bbbb2222-3333-4444-5555-ccccddddeeee',
81
+ },
82
+ ];
83
+
84
+ console.log('Simulating session capture from codex output:');
85
+
86
+ for (const mock of mockCodexOutputs) {
87
+ const sessionId = extractSessionId(mock.output);
88
+ console.log(`Directory: ${mock.directory}`);
89
+ console.log(`Output: ${mock.output}`);
90
+ console.log(`Captured Session ID: ${sessionId}`);
91
+ console.log('---');
92
+
93
+ expect(sessionId).toBeTruthy();
94
+ expect(sessionId).toMatch(
95
+ /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i,
96
+ );
97
+ }
98
+
99
+ console.log('✅ Workflow demonstration completed!\n');
100
+ });
101
+ });