@iservu-inc/adf-cli 0.1.5 → 0.2.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.
- package/.project/chats/current/2025-10-03_ADF-CLI-QUALITY-BASED-PROGRESS-AND-RESUME.md +399 -0
- package/.project/docs/architecture/SYSTEM-DESIGN.md +369 -0
- package/.project/docs/frameworks/FRAMEWORK-METHODOLOGIES.md +449 -0
- package/.project/docs/goals/PROJECT-VISION.md +112 -0
- package/.project/docs/tool-integrations/IDE-CUSTOMIZATIONS.md +578 -0
- package/CHANGELOG.md +253 -0
- package/README.md +50 -11
- package/jest.config.js +20 -0
- package/lib/commands/init.js +41 -111
- package/lib/frameworks/answer-quality-analyzer.js +216 -0
- package/lib/frameworks/interviewer.js +447 -0
- package/lib/frameworks/output-generators.js +345 -0
- package/lib/frameworks/progress-tracker.js +239 -0
- package/lib/frameworks/questions.js +664 -0
- package/lib/frameworks/session-manager.js +100 -0
- package/package.json +10 -5
- package/test-scenarios.sh +134 -0
- package/tests/answer-quality-analyzer.test.js +173 -0
- package/tests/progress-tracker.test.js +205 -0
- package/tests/session-manager.test.js +162 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const SessionManager = require('../lib/frameworks/session-manager');
|
|
4
|
+
const ProgressTracker = require('../lib/frameworks/progress-tracker');
|
|
5
|
+
|
|
6
|
+
const TEST_PROJECT_PATH = path.join(__dirname, 'test-project');
|
|
7
|
+
const TEST_SESSIONS_DIR = path.join(TEST_PROJECT_PATH, '.adf', 'sessions');
|
|
8
|
+
|
|
9
|
+
describe('SessionManager', () => {
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
// Clean up test project directory
|
|
12
|
+
await fs.remove(TEST_PROJECT_PATH);
|
|
13
|
+
await fs.ensureDir(TEST_PROJECT_PATH);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
afterEach(async () => {
|
|
17
|
+
// Clean up after tests
|
|
18
|
+
await fs.remove(TEST_PROJECT_PATH);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe('listSessions', () => {
|
|
22
|
+
it('should return empty array when no sessions exist', async () => {
|
|
23
|
+
const manager = new SessionManager(TEST_PROJECT_PATH);
|
|
24
|
+
const sessions = await manager.listSessions();
|
|
25
|
+
|
|
26
|
+
expect(sessions).toEqual([]);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('should list all sessions with progress files', async () => {
|
|
30
|
+
const manager = new SessionManager(TEST_PROJECT_PATH);
|
|
31
|
+
|
|
32
|
+
// Create test sessions
|
|
33
|
+
const session1Path = path.join(TEST_SESSIONS_DIR, 'session-1');
|
|
34
|
+
const session2Path = path.join(TEST_SESSIONS_DIR, 'session-2');
|
|
35
|
+
|
|
36
|
+
await fs.ensureDir(session1Path);
|
|
37
|
+
await fs.ensureDir(session2Path);
|
|
38
|
+
|
|
39
|
+
// Create progress trackers
|
|
40
|
+
const tracker1 = new ProgressTracker(session1Path, 5, 'rapid');
|
|
41
|
+
await tracker1.initialize();
|
|
42
|
+
|
|
43
|
+
const tracker2 = new ProgressTracker(session2Path, 10, 'balanced');
|
|
44
|
+
await tracker2.initialize();
|
|
45
|
+
|
|
46
|
+
const sessions = await manager.listSessions();
|
|
47
|
+
|
|
48
|
+
expect(sessions.length).toBe(2);
|
|
49
|
+
expect(sessions[0].sessionId).toBe('session-1');
|
|
50
|
+
expect(sessions[1].sessionId).toBe('session-2');
|
|
51
|
+
expect(sessions[0].progress.framework).toBe('rapid');
|
|
52
|
+
expect(sessions[1].progress.framework).toBe('balanced');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('should skip directories without progress files', async () => {
|
|
56
|
+
const manager = new SessionManager(TEST_PROJECT_PATH);
|
|
57
|
+
|
|
58
|
+
// Create session with progress
|
|
59
|
+
const session1Path = path.join(TEST_SESSIONS_DIR, 'session-1');
|
|
60
|
+
await fs.ensureDir(session1Path);
|
|
61
|
+
const tracker1 = new ProgressTracker(session1Path, 5, 'rapid');
|
|
62
|
+
await tracker1.initialize();
|
|
63
|
+
|
|
64
|
+
// Create directory without progress file
|
|
65
|
+
const session2Path = path.join(TEST_SESSIONS_DIR, 'session-2');
|
|
66
|
+
await fs.ensureDir(session2Path);
|
|
67
|
+
|
|
68
|
+
const sessions = await manager.listSessions();
|
|
69
|
+
|
|
70
|
+
expect(sessions.length).toBe(1);
|
|
71
|
+
expect(sessions[0].sessionId).toBe('session-1');
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
describe('getResumableSessions', () => {
|
|
76
|
+
it('should return only in-progress resumable sessions', async () => {
|
|
77
|
+
const manager = new SessionManager(TEST_PROJECT_PATH);
|
|
78
|
+
|
|
79
|
+
// Create in-progress session
|
|
80
|
+
const session1Path = path.join(TEST_SESSIONS_DIR, 'session-1');
|
|
81
|
+
await fs.ensureDir(session1Path);
|
|
82
|
+
const tracker1 = new ProgressTracker(session1Path, 5, 'rapid');
|
|
83
|
+
await tracker1.initialize();
|
|
84
|
+
await tracker1.startBlock(1, 'Block 1');
|
|
85
|
+
|
|
86
|
+
// Create completed session
|
|
87
|
+
const session2Path = path.join(TEST_SESSIONS_DIR, 'session-2');
|
|
88
|
+
await fs.ensureDir(session2Path);
|
|
89
|
+
const tracker2 = new ProgressTracker(session2Path, 5, 'rapid');
|
|
90
|
+
await tracker2.initialize();
|
|
91
|
+
await tracker2.complete();
|
|
92
|
+
|
|
93
|
+
const resumable = await manager.getResumableSessions();
|
|
94
|
+
|
|
95
|
+
expect(resumable.length).toBe(1);
|
|
96
|
+
expect(resumable[0].sessionId).toBe('session-1');
|
|
97
|
+
expect(resumable[0].progress.status).toBe('in-progress');
|
|
98
|
+
expect(resumable[0].progress.canResume).toBe(true);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('should return empty array when no resumable sessions', async () => {
|
|
102
|
+
const manager = new SessionManager(TEST_PROJECT_PATH);
|
|
103
|
+
|
|
104
|
+
// Create completed session
|
|
105
|
+
const sessionPath = path.join(TEST_SESSIONS_DIR, 'session-1');
|
|
106
|
+
await fs.ensureDir(sessionPath);
|
|
107
|
+
const tracker = new ProgressTracker(sessionPath, 5, 'rapid');
|
|
108
|
+
await tracker.initialize();
|
|
109
|
+
await tracker.complete();
|
|
110
|
+
|
|
111
|
+
const resumable = await manager.getResumableSessions();
|
|
112
|
+
|
|
113
|
+
expect(resumable).toEqual([]);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
describe('deleteSession', () => {
|
|
118
|
+
it('should delete session directory', async () => {
|
|
119
|
+
const manager = new SessionManager(TEST_PROJECT_PATH);
|
|
120
|
+
|
|
121
|
+
// Create session
|
|
122
|
+
const sessionPath = path.join(TEST_SESSIONS_DIR, 'session-1');
|
|
123
|
+
await fs.ensureDir(sessionPath);
|
|
124
|
+
const tracker = new ProgressTracker(sessionPath, 5, 'rapid');
|
|
125
|
+
await tracker.initialize();
|
|
126
|
+
|
|
127
|
+
expect(await fs.pathExists(sessionPath)).toBe(true);
|
|
128
|
+
|
|
129
|
+
await manager.deleteSession('session-1');
|
|
130
|
+
|
|
131
|
+
expect(await fs.pathExists(sessionPath)).toBe(false);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
describe('deleteAllSessions', () => {
|
|
136
|
+
it('should delete all sessions and recreate directory', async () => {
|
|
137
|
+
const manager = new SessionManager(TEST_PROJECT_PATH);
|
|
138
|
+
|
|
139
|
+
// Create multiple sessions
|
|
140
|
+
const session1Path = path.join(TEST_SESSIONS_DIR, 'session-1');
|
|
141
|
+
const session2Path = path.join(TEST_SESSIONS_DIR, 'session-2');
|
|
142
|
+
|
|
143
|
+
await fs.ensureDir(session1Path);
|
|
144
|
+
await fs.ensureDir(session2Path);
|
|
145
|
+
|
|
146
|
+
const tracker1 = new ProgressTracker(session1Path, 5, 'rapid');
|
|
147
|
+
await tracker1.initialize();
|
|
148
|
+
|
|
149
|
+
const tracker2 = new ProgressTracker(session2Path, 5, 'rapid');
|
|
150
|
+
await tracker2.initialize();
|
|
151
|
+
|
|
152
|
+
expect(await fs.pathExists(session1Path)).toBe(true);
|
|
153
|
+
expect(await fs.pathExists(session2Path)).toBe(true);
|
|
154
|
+
|
|
155
|
+
await manager.deleteAllSessions();
|
|
156
|
+
|
|
157
|
+
expect(await fs.pathExists(session1Path)).toBe(false);
|
|
158
|
+
expect(await fs.pathExists(session2Path)).toBe(false);
|
|
159
|
+
expect(await fs.pathExists(TEST_SESSIONS_DIR)).toBe(true); // Directory should still exist
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
});
|