anvil-dev-framework 0.1.7 → 0.1.9
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/README.md +71 -22
- package/VERSION +1 -1
- package/docs/ANV-263-hook-logging-investigation.md +116 -0
- package/docs/command-reference.md +398 -17
- package/docs/session-workflow.md +62 -9
- package/docs/system-architecture.md +584 -0
- package/global/api/__pycache__/ralph_api.cpython-314.pyc +0 -0
- package/global/api/openapi.yaml +357 -0
- package/global/api/ralph_api.py +528 -0
- package/global/commands/anvil-settings.md +47 -19
- package/global/commands/audit.md +163 -0
- package/global/commands/checklist.md +180 -0
- package/global/commands/coderabbit-fix.md +282 -0
- package/global/commands/efficiency.md +356 -0
- package/global/commands/evidence.md +117 -33
- package/global/commands/hud.md +24 -0
- package/global/commands/insights.md +101 -3
- package/global/commands/orient.md +22 -21
- package/global/commands/patterns.md +115 -0
- package/global/commands/ralph.md +47 -1
- package/global/commands/token-budget.md +214 -0
- package/global/commands/weekly-review.md +21 -1
- package/global/config/notifications.yaml.template +50 -0
- package/global/hooks/ralph_stop.sh +33 -1
- package/global/hooks/statusline.sh +67 -2
- package/global/lib/__pycache__/coderabbit_metrics.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/command_tracker.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/context_optimizer.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/git_utils.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/issue_models.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/linear_provider.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/optimization_applier.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/ralph_state.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/ralph_webhooks.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/state_manager.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/token_analyzer.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/token_metrics.cpython-314.pyc +0 -0
- package/global/lib/coderabbit_metrics.py +647 -0
- package/global/lib/command_tracker.py +147 -0
- package/global/lib/context_optimizer.py +323 -0
- package/global/lib/linear_provider.py +210 -16
- package/global/lib/log_rotation.py +287 -0
- package/global/lib/optimization_applier.py +582 -0
- package/global/lib/ralph_events.py +398 -0
- package/global/lib/ralph_notifier.py +366 -0
- package/global/lib/ralph_state.py +264 -24
- package/global/lib/ralph_webhooks.py +470 -0
- package/global/lib/state_manager.py +121 -0
- package/global/lib/token_analyzer.py +1383 -0
- package/global/lib/token_metrics.py +919 -0
- package/global/tests/__pycache__/test_command_tracker.cpython-314-pytest-9.0.2.pyc +0 -0
- package/global/tests/__pycache__/test_context_optimizer.cpython-314-pytest-9.0.2.pyc +0 -0
- package/global/tests/__pycache__/test_doc_coverage.cpython-314-pytest-9.0.2.pyc +0 -0
- package/global/tests/__pycache__/test_git_utils.cpython-314-pytest-9.0.2.pyc +0 -0
- package/global/tests/__pycache__/test_issue_models.cpython-314-pytest-9.0.2.pyc +0 -0
- package/global/tests/__pycache__/test_linear_filtering.cpython-314-pytest-9.0.2.pyc +0 -0
- package/global/tests/__pycache__/test_linear_provider.cpython-314-pytest-9.0.2.pyc +0 -0
- package/global/tests/__pycache__/test_local_provider.cpython-314-pytest-9.0.2.pyc +0 -0
- package/global/tests/__pycache__/test_optimization_applier.cpython-314-pytest-9.0.2.pyc +0 -0
- package/global/tests/__pycache__/test_token_analyzer.cpython-314-pytest-9.0.2.pyc +0 -0
- package/global/tests/__pycache__/test_token_analyzer_phase6.cpython-314-pytest-9.0.2.pyc +0 -0
- package/global/tests/__pycache__/test_token_metrics.cpython-314-pytest-9.0.2.pyc +0 -0
- package/global/tests/test_command_tracker.py +172 -0
- package/global/tests/test_context_optimizer.py +321 -0
- package/global/tests/test_linear_filtering.py +319 -0
- package/global/tests/test_linear_provider.py +40 -1
- package/global/tests/test_optimization_applier.py +508 -0
- package/global/tests/test_token_analyzer.py +735 -0
- package/global/tests/test_token_analyzer_phase6.py +537 -0
- package/global/tests/test_token_metrics.py +829 -0
- package/global/tools/README.md +153 -0
- package/global/tools/__pycache__/anvil-hud.cpython-314.pyc +0 -0
- package/global/tools/__pycache__/orient_linear.cpython-314.pyc +0 -0
- package/global/tools/__pycache__/ralph-watchcpython-314.pyc +0 -0
- package/global/tools/anvil-hud.py +86 -1
- package/global/tools/anvil-memory/src/__tests__/ccs/context-monitor.test.ts +472 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/fixtures.ts +405 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/index.ts +36 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/prompt-generator.test.ts +653 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/ralph-stop.test.ts +727 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/test-utils.ts +340 -0
- package/global/tools/anvil-memory/src/__tests__/commands.test.ts +218 -0
- package/global/tools/anvil-memory/src/commands/context.ts +322 -0
- package/global/tools/anvil-memory/src/db.ts +108 -0
- package/global/tools/anvil-memory/src/index.ts +2 -8
- package/global/tools/orient_linear.py +159 -0
- package/global/tools/ralph-watch +423 -0
- package/package.json +2 -1
- package/project/.anvil-project.yaml.template +93 -0
- package/project/CLAUDE.md.template +343 -0
- package/project/agents/README.md +119 -0
- package/project/agents/cross-layer-debugger.md +217 -0
- package/project/agents/security-code-reviewer.md +162 -0
- package/project/constitution.md.template +235 -0
- package/project/coordination.md +103 -0
- package/project/docs/background-tasks.md +258 -0
- package/project/docs/skills-frontmatter.md +243 -0
- package/project/examples/README.md +106 -0
- package/project/examples/api-route-template.ts +171 -0
- package/project/examples/component-template.tsx +110 -0
- package/project/examples/hook-template.ts +152 -0
- package/project/examples/service-template.ts +207 -0
- package/project/examples/test-template.test.tsx +249 -0
- package/project/hooks/README.md +491 -0
- package/project/hooks/__pycache__/notification.cpython-314.pyc +0 -0
- package/project/hooks/__pycache__/post_tool_use.cpython-314.pyc +0 -0
- package/project/hooks/__pycache__/pre_tool_use.cpython-314.pyc +0 -0
- package/project/hooks/__pycache__/session_start.cpython-314.pyc +0 -0
- package/project/hooks/__pycache__/stop.cpython-314.pyc +0 -0
- package/project/hooks/notification.py +183 -0
- package/project/hooks/permission_request.py +438 -0
- package/project/hooks/post_tool_use.py +397 -0
- package/project/hooks/pre_compact.py +126 -0
- package/project/hooks/pre_tool_use.py +454 -0
- package/project/hooks/session_start.py +656 -0
- package/project/hooks/stop.py +356 -0
- package/project/hooks/subagent_start.py +223 -0
- package/project/hooks/subagent_stop.py +215 -0
- package/project/hooks/user_prompt_submit.py +110 -0
- package/project/hooks/utils/llm/anth.py +114 -0
- package/project/hooks/utils/llm/oai.py +114 -0
- package/project/hooks/utils/tts/elevenlabs_tts.py +63 -0
- package/project/hooks/utils/tts/mlx_audio_tts.py +86 -0
- package/project/hooks/utils/tts/openai_tts.py +92 -0
- package/project/hooks/utils/tts/pyttsx3_tts.py +75 -0
- package/project/linear.yaml.template +23 -0
- package/project/product.md.template +238 -0
- package/project/retros/README.md +126 -0
- package/project/rules/README.md +90 -0
- package/project/rules/debugging.md +139 -0
- package/project/rules/security-review.md +115 -0
- package/project/settings.yaml.template +185 -0
- package/project/specs/SPEC-ANV-72-hud-kanban.md +525 -0
- package/project/templates/api-python/CLAUDE.md +547 -0
- package/project/templates/generic/CLAUDE.md +260 -0
- package/project/templates/saas/CLAUDE.md +478 -0
- package/project/tests/README.md +140 -0
- package/project/tests/__pycache__/test_transcript_parser.cpython-314-pytest-9.0.2.pyc +0 -0
- package/project/tests/fixtures/sample-transcript.jsonl +21 -0
- package/project/tests/test-hooks.sh +259 -0
- package/project/tests/test-lib.sh +248 -0
- package/project/tests/test-statusline.sh +165 -0
- package/project/tests/test_transcript_parser.py +323 -0
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CCS Test Fixtures
|
|
3
|
+
*
|
|
4
|
+
* Mock data and fixtures for Context Checkpoint System testing.
|
|
5
|
+
* Provides sample data for various scenarios and states.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { RalphState, ContextWindowData } from './test-utils';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Fixed base time for deterministic test fixtures.
|
|
12
|
+
* Using a fixed timestamp prevents flaky tests from time-dependent comparisons.
|
|
13
|
+
*/
|
|
14
|
+
const BASE_TIME = new Date('2026-01-17T15:00:00.000Z');
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Generate ISO timestamp with optional offset from BASE_TIME
|
|
18
|
+
* @param offsetMs - Milliseconds to offset from BASE_TIME (negative for past)
|
|
19
|
+
*/
|
|
20
|
+
const iso = (offsetMs = 0): string =>
|
|
21
|
+
new Date(BASE_TIME.getTime() + offsetMs).toISOString();
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Sample Ralph states for different scenarios
|
|
25
|
+
*/
|
|
26
|
+
export const RALPH_STATES: Record<string, Partial<RalphState>> = {
|
|
27
|
+
/**
|
|
28
|
+
* Fresh Ralph session just started
|
|
29
|
+
*/
|
|
30
|
+
fresh: {
|
|
31
|
+
mode: 'ralph',
|
|
32
|
+
session_id: 'ralph-fresh-001',
|
|
33
|
+
iteration: 1,
|
|
34
|
+
started_at: iso(),
|
|
35
|
+
status: 'running',
|
|
36
|
+
task_list: ['Task 1', 'Task 2', 'Task 3'],
|
|
37
|
+
completed_tasks: [],
|
|
38
|
+
checkpoint_active: false,
|
|
39
|
+
context_history: [],
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Ralph session mid-progress
|
|
44
|
+
*/
|
|
45
|
+
inProgress: {
|
|
46
|
+
mode: 'ralph',
|
|
47
|
+
session_id: 'ralph-progress-002',
|
|
48
|
+
iteration: 3,
|
|
49
|
+
started_at: iso(-3600000), // 1 hour ago
|
|
50
|
+
status: 'running',
|
|
51
|
+
task_list: ['Task 1', 'Task 2', 'Task 3', 'Task 4'],
|
|
52
|
+
completed_tasks: ['Task 1', 'Task 2'],
|
|
53
|
+
checkpoint_active: false,
|
|
54
|
+
context_history: [
|
|
55
|
+
{ iteration: 1, peak_percent: 45, checkpoint: false, level: 'L0' },
|
|
56
|
+
{ iteration: 2, peak_percent: 58, checkpoint: false, level: 'L0' },
|
|
57
|
+
],
|
|
58
|
+
linear_issue: 'ANV-42',
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Ralph session with active checkpoint
|
|
63
|
+
*/
|
|
64
|
+
checkpointActive: {
|
|
65
|
+
mode: 'ralph',
|
|
66
|
+
session_id: 'ralph-checkpoint-003',
|
|
67
|
+
iteration: 5,
|
|
68
|
+
started_at: iso(-7200000), // 2 hours ago
|
|
69
|
+
status: 'checkpointed',
|
|
70
|
+
task_list: ['Task 1', 'Task 2', 'Task 3', 'Task 4', 'Task 5'],
|
|
71
|
+
completed_tasks: ['Task 1', 'Task 2', 'Task 3'],
|
|
72
|
+
checkpoint_active: true,
|
|
73
|
+
context_history: [
|
|
74
|
+
{ iteration: 3, peak_percent: 65, checkpoint: false, level: 'L0' },
|
|
75
|
+
{ iteration: 4, peak_percent: 78, checkpoint: false, level: 'L1' },
|
|
76
|
+
{ iteration: 5, peak_percent: 87, checkpoint: true, level: 'L2' },
|
|
77
|
+
],
|
|
78
|
+
handoff_file: '.claude/handoffs/2026-01-17-1500.md',
|
|
79
|
+
linear_issue: 'ANV-100',
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Ralph session at high context (approaching L3)
|
|
84
|
+
*/
|
|
85
|
+
highContext: {
|
|
86
|
+
mode: 'ralph',
|
|
87
|
+
session_id: 'ralph-high-004',
|
|
88
|
+
iteration: 7,
|
|
89
|
+
started_at: iso(-10800000), // 3 hours ago
|
|
90
|
+
status: 'running',
|
|
91
|
+
task_list: ['Task 1', 'Task 2', 'Task 3'],
|
|
92
|
+
completed_tasks: ['Task 1', 'Task 2'],
|
|
93
|
+
checkpoint_active: false,
|
|
94
|
+
context_history: [
|
|
95
|
+
{ iteration: 6, peak_percent: 82, checkpoint: false, level: 'L1' },
|
|
96
|
+
{ iteration: 7, peak_percent: 91, checkpoint: false, level: 'L2' },
|
|
97
|
+
],
|
|
98
|
+
linear_issue: 'ANV-200',
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Manual mode (not Ralph)
|
|
103
|
+
*/
|
|
104
|
+
manual: {
|
|
105
|
+
mode: 'manual',
|
|
106
|
+
session_id: 'manual-001',
|
|
107
|
+
iteration: 1,
|
|
108
|
+
started_at: iso(),
|
|
109
|
+
status: 'running',
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Context window data for different percentage levels
|
|
115
|
+
*/
|
|
116
|
+
export const CONTEXT_DATA: Record<string, ContextWindowData> = {
|
|
117
|
+
/**
|
|
118
|
+
* Low context usage (50%)
|
|
119
|
+
*/
|
|
120
|
+
low: {
|
|
121
|
+
context_window: {
|
|
122
|
+
current_usage: {
|
|
123
|
+
input_tokens: 100000,
|
|
124
|
+
output_tokens: 5000,
|
|
125
|
+
cache_read_input_tokens: 20000,
|
|
126
|
+
cache_creation_input_tokens: 0,
|
|
127
|
+
},
|
|
128
|
+
context_window_size: 200000,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* L1 threshold (75%)
|
|
134
|
+
*/
|
|
135
|
+
l1: {
|
|
136
|
+
context_window: {
|
|
137
|
+
current_usage: {
|
|
138
|
+
input_tokens: 150000,
|
|
139
|
+
output_tokens: 10000,
|
|
140
|
+
cache_read_input_tokens: 30000,
|
|
141
|
+
cache_creation_input_tokens: 0,
|
|
142
|
+
},
|
|
143
|
+
context_window_size: 200000,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* L2 threshold (88%)
|
|
149
|
+
*/
|
|
150
|
+
l2: {
|
|
151
|
+
context_window: {
|
|
152
|
+
current_usage: {
|
|
153
|
+
input_tokens: 176000,
|
|
154
|
+
output_tokens: 15000,
|
|
155
|
+
cache_read_input_tokens: 40000,
|
|
156
|
+
cache_creation_input_tokens: 0,
|
|
157
|
+
},
|
|
158
|
+
context_window_size: 200000,
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* L3 threshold (96%)
|
|
164
|
+
*/
|
|
165
|
+
l3: {
|
|
166
|
+
context_window: {
|
|
167
|
+
current_usage: {
|
|
168
|
+
input_tokens: 192000,
|
|
169
|
+
output_tokens: 18000,
|
|
170
|
+
cache_read_input_tokens: 45000,
|
|
171
|
+
cache_creation_input_tokens: 0,
|
|
172
|
+
},
|
|
173
|
+
context_window_size: 200000,
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Empty context
|
|
179
|
+
*/
|
|
180
|
+
empty: {
|
|
181
|
+
context_window: {
|
|
182
|
+
current_usage: {
|
|
183
|
+
input_tokens: 0,
|
|
184
|
+
output_tokens: 0,
|
|
185
|
+
cache_read_input_tokens: 0,
|
|
186
|
+
cache_creation_input_tokens: 0,
|
|
187
|
+
},
|
|
188
|
+
context_window_size: 200000,
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Zero-size context window (edge case)
|
|
194
|
+
*/
|
|
195
|
+
zeroSize: {
|
|
196
|
+
context_window: {
|
|
197
|
+
current_usage: {
|
|
198
|
+
input_tokens: 1000,
|
|
199
|
+
output_tokens: 100,
|
|
200
|
+
cache_read_input_tokens: 0,
|
|
201
|
+
cache_creation_input_tokens: 0,
|
|
202
|
+
},
|
|
203
|
+
context_window_size: 0,
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Sample handoff document content
|
|
210
|
+
*/
|
|
211
|
+
export const HANDOFF_TEMPLATES: Record<string, string> = {
|
|
212
|
+
/**
|
|
213
|
+
* Standard checkpoint handoff
|
|
214
|
+
*/
|
|
215
|
+
checkpoint: `# Session Handoff: Checkpoint (L2)
|
|
216
|
+
|
|
217
|
+
## Session Context
|
|
218
|
+
- **Session ID**: ralph-progress-002
|
|
219
|
+
- **Iteration**: 3
|
|
220
|
+
- **Context**: 87% (L2 checkpoint triggered)
|
|
221
|
+
- **Time**: ${iso()}
|
|
222
|
+
|
|
223
|
+
## Current Task
|
|
224
|
+
Implementing feature X with database migrations
|
|
225
|
+
|
|
226
|
+
## Completed Items
|
|
227
|
+
- [x] Created database schema
|
|
228
|
+
- [x] Added migration scripts
|
|
229
|
+
- [x] Updated types
|
|
230
|
+
|
|
231
|
+
## Remaining Items
|
|
232
|
+
- [ ] Write API endpoints
|
|
233
|
+
- [ ] Add validation
|
|
234
|
+
- [ ] Create tests
|
|
235
|
+
|
|
236
|
+
## Key Decisions
|
|
237
|
+
- Using SQLite for local storage
|
|
238
|
+
- FTS5 for search functionality
|
|
239
|
+
|
|
240
|
+
## Files Modified
|
|
241
|
+
- src/db.ts (schema changes)
|
|
242
|
+
- src/types.ts (type updates)
|
|
243
|
+
- migrations/001_initial.sql (new)
|
|
244
|
+
|
|
245
|
+
## Next Steps
|
|
246
|
+
1. Resume with API endpoint implementation
|
|
247
|
+
2. Focus on GET endpoint first
|
|
248
|
+
3. Then implement POST with validation
|
|
249
|
+
|
|
250
|
+
## Notes
|
|
251
|
+
Context checkpoint triggered at 87%. Safe to resume.
|
|
252
|
+
`,
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Emergency L3 handoff
|
|
256
|
+
*/
|
|
257
|
+
emergency: `# Session Handoff: EMERGENCY STOP (L3)
|
|
258
|
+
|
|
259
|
+
## Critical Information
|
|
260
|
+
- **Context**: 96% - EMERGENCY STOP
|
|
261
|
+
- **Iteration**: 7
|
|
262
|
+
- **Immediate Action Required**: Resume in new session
|
|
263
|
+
|
|
264
|
+
## State at Stop
|
|
265
|
+
- In the middle of file write operation
|
|
266
|
+
- Changes may be partial
|
|
267
|
+
|
|
268
|
+
## Uncommitted Changes
|
|
269
|
+
- global/lib/feature.ts (partial)
|
|
270
|
+
- global/lib/types.ts (complete)
|
|
271
|
+
|
|
272
|
+
## Recovery Steps
|
|
273
|
+
1. Check git status for uncommitted changes
|
|
274
|
+
2. Review partial file changes
|
|
275
|
+
3. Continue from last completed task
|
|
276
|
+
|
|
277
|
+
## Last Completed Task
|
|
278
|
+
Task 5: Database migration
|
|
279
|
+
|
|
280
|
+
## Next Task to Resume
|
|
281
|
+
Task 6: API endpoint implementation (PARTIAL)
|
|
282
|
+
`,
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Minimal handoff
|
|
286
|
+
*/
|
|
287
|
+
minimal: `# Handoff
|
|
288
|
+
|
|
289
|
+
## Summary
|
|
290
|
+
- Context: 85%
|
|
291
|
+
- Status: Checkpointed
|
|
292
|
+
|
|
293
|
+
## Resume
|
|
294
|
+
Continue with remaining tasks.
|
|
295
|
+
`,
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Sample PROMPT.md template content
|
|
300
|
+
*/
|
|
301
|
+
export const PROMPT_TEMPLATES: Record<string, string> = {
|
|
302
|
+
/**
|
|
303
|
+
* Standard resume prompt
|
|
304
|
+
*/
|
|
305
|
+
resume: `# Resume Session: ralph-progress-002
|
|
306
|
+
|
|
307
|
+
## Previous Context
|
|
308
|
+
You were working on ANV-42 before a context checkpoint.
|
|
309
|
+
|
|
310
|
+
## Completed Work
|
|
311
|
+
- Task 1: Schema design
|
|
312
|
+
- Task 2: Migration scripts
|
|
313
|
+
|
|
314
|
+
## Current State
|
|
315
|
+
- Iteration: 4 (resumed from 3)
|
|
316
|
+
- Context checkpoint completed successfully
|
|
317
|
+
- Files are in consistent state
|
|
318
|
+
|
|
319
|
+
## Remaining Tasks
|
|
320
|
+
- Task 3: API endpoints
|
|
321
|
+
- Task 4: Tests
|
|
322
|
+
|
|
323
|
+
## Instructions
|
|
324
|
+
1. Review the handoff document at .claude/handoffs/2026-01-17-1500.md
|
|
325
|
+
2. Check git status for any uncommitted changes
|
|
326
|
+
3. Continue with Task 3: API endpoints
|
|
327
|
+
|
|
328
|
+
Do NOT re-do completed work. Start fresh from the remaining items.
|
|
329
|
+
`,
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Emergency resume prompt
|
|
333
|
+
*/
|
|
334
|
+
emergencyResume: `# EMERGENCY RESUME: ralph-high-004
|
|
335
|
+
|
|
336
|
+
## Critical Context
|
|
337
|
+
Previous session hit L3 (96% context). Immediate stop was triggered.
|
|
338
|
+
|
|
339
|
+
## IMPORTANT
|
|
340
|
+
- Some work may be incomplete
|
|
341
|
+
- Check git status FIRST
|
|
342
|
+
- Verify file integrity before continuing
|
|
343
|
+
|
|
344
|
+
## Last Known State
|
|
345
|
+
- Working on: Task 2
|
|
346
|
+
- Status: PARTIAL (interrupted)
|
|
347
|
+
|
|
348
|
+
## Recovery Steps
|
|
349
|
+
1. Run: git status
|
|
350
|
+
2. Review any uncommitted changes
|
|
351
|
+
3. Decide: commit partial work OR revert
|
|
352
|
+
4. Then continue with remaining tasks
|
|
353
|
+
|
|
354
|
+
## Remaining Tasks
|
|
355
|
+
- Task 2: API endpoints (MAY BE PARTIAL)
|
|
356
|
+
- Task 3: Tests
|
|
357
|
+
|
|
358
|
+
Proceed carefully.
|
|
359
|
+
`,
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Malformed/edge case inputs for error handling tests
|
|
364
|
+
*/
|
|
365
|
+
export const MALFORMED_INPUTS: Record<string, unknown> = {
|
|
366
|
+
/**
|
|
367
|
+
* Empty object
|
|
368
|
+
*/
|
|
369
|
+
empty: {},
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Null
|
|
373
|
+
*/
|
|
374
|
+
null: null,
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Missing context_window
|
|
378
|
+
*/
|
|
379
|
+
missingContextWindow: {
|
|
380
|
+
tool_name: 'Write',
|
|
381
|
+
tool_result: 'Success',
|
|
382
|
+
},
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Invalid JSON string (for stdin tests)
|
|
386
|
+
*/
|
|
387
|
+
invalidJson: 'not valid json {{{',
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Nested null values
|
|
391
|
+
*/
|
|
392
|
+
nestedNull: {
|
|
393
|
+
context_window: null,
|
|
394
|
+
},
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Wrong types
|
|
398
|
+
*/
|
|
399
|
+
wrongTypes: {
|
|
400
|
+
context_window: {
|
|
401
|
+
current_usage: 'not an object',
|
|
402
|
+
context_window_size: 'not a number',
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CCS Test Module Exports
|
|
3
|
+
*
|
|
4
|
+
* Central export for all CCS testing utilities and fixtures.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Test utilities
|
|
8
|
+
export {
|
|
9
|
+
PROJECT_ROOT,
|
|
10
|
+
HOOKS_DIR,
|
|
11
|
+
LIB_DIR,
|
|
12
|
+
CCS_THRESHOLDS,
|
|
13
|
+
createTestDir,
|
|
14
|
+
createRalphStateFile,
|
|
15
|
+
readRalphStateFile,
|
|
16
|
+
createContextData,
|
|
17
|
+
runPythonHook,
|
|
18
|
+
runBashHook,
|
|
19
|
+
parseCCSSignal,
|
|
20
|
+
isJqAvailable,
|
|
21
|
+
createHandoffFile,
|
|
22
|
+
type HookResult,
|
|
23
|
+
type RalphState,
|
|
24
|
+
type ContextWindowData,
|
|
25
|
+
type ContextHistoryEntry,
|
|
26
|
+
type ContextCheckpoint,
|
|
27
|
+
} from './test-utils';
|
|
28
|
+
|
|
29
|
+
// Fixtures
|
|
30
|
+
export {
|
|
31
|
+
RALPH_STATES,
|
|
32
|
+
CONTEXT_DATA,
|
|
33
|
+
HANDOFF_TEMPLATES,
|
|
34
|
+
PROMPT_TEMPLATES,
|
|
35
|
+
MALFORMED_INPUTS,
|
|
36
|
+
} from './fixtures';
|