claude-comms 1.0.46 → 2.0.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/CHANGELOG.md +20 -1
- package/README.md +12 -13
- package/package.json +6 -10
- package/.agents/AGENTS.md +0 -61
- package/.agents/repo.md +0 -18
- package/.agents/tools/README.md +0 -45
- package/.agents/tools/agent-job/README.md +0 -208
- package/.agents/tools/agent-job/__pycache__/agent_monitor.cpython-312.pyc +0 -0
- package/.agents/tools/agent-job/agent_job.py +0 -936
- package/.agents/tools/agent-job/agent_monitor.py +0 -575
- package/.agents/tools/agent-job/consultant_template.txt +0 -73
- package/.agents/tools/chrome-devtools/README.md +0 -101
- package/.agents/tools/chrome-devtools/browsertools.py +0 -839
- package/.agents/tools/chrome-devtools/config.json +0 -24
- package/.agents/tools/workflow/CONSUMER_SETUP.md +0 -114
- package/.agents/tools/workflow/ONBOARD.md +0 -167
- package/.agents/tools/workflow/README.md +0 -169
- package/.agents/tools/workflow/cli.ts +0 -726
- package/.agents/tools/workflow/config.example.json +0 -16
- package/.agents/tools/workflow/init.ts +0 -76
- package/.agents/tools/workflow/lib/file-tracker.test.ts +0 -81
- package/.agents/tools/workflow/lib/file-tracker.ts +0 -387
- package/.agents/tools/workflow/lib/harness-executor.ts +0 -649
- package/.agents/tools/workflow/lib/prompts.scenario.test.ts +0 -262
- package/.agents/tools/workflow/lib/prompts.ts +0 -548
- package/.agents/tools/workflow/lib/streams.test.ts +0 -140
- package/.agents/tools/workflow/lib/streams.ts +0 -254
- package/.agents/tools/workflow/runner.ts +0 -994
- package/.agents/tools/workflow/templates/document.md +0 -42
- package/.agents/tools/workflow/templates/implement.md +0 -117
- package/.agents/tools/workflow/templates/plan.md +0 -54
- package/.agents/tools/workflow/templates/pm.md +0 -84
- package/.agents/tools/workflow/templates/product-owner.md +0 -211
- package/.agents/tools/workflow/templates/review.md +0 -56
- package/.agents/tools/workflow/templates/uat.md +0 -71
- package/.claude/agents/core/engineer.md +0 -146
- package/.claude/commands/action-feedback-item.md +0 -27
- package/.claude/commands/install-feedback-widget.md +0 -599
- package/.claude/commands/learn.md +0 -32
- package/.claude/hooks/comms/__pycache__/register_subagent.cpython-312.pyc +0 -0
- package/.claude/hooks/comms/__pycache__/update_subagent_completion.cpython-312.pyc +0 -0
- package/.claude/hooks/comms/get_unread_messages.py +0 -71
- package/.claude/hooks/comms/register_subagent.py +0 -74
- package/.claude/hooks/comms/send_message.py +0 -87
- package/.claude/hooks/comms/update_subagent_completion.py +0 -126
- package/.claude/hooks/context/session_id.py +0 -35
- package/.claude/hooks/observability/send_event.py +0 -110
- package/.claude/hooks/session-data/get_session_data.py +0 -261
- package/.claude/hooks/session-data/intercept_session_id.py +0 -69
- package/.claude/hooks/utils/__pycache__/server_config.cpython-312.pyc +0 -0
- package/.claude/hooks/utils/server_config.py +0 -17
- package/.claude/settings.json +0 -108
- package/.claude/settings.local.json +0 -46
- package/CLAUDE.md +0 -240
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Scenario tests for prompts module
|
|
3
|
-
*
|
|
4
|
-
* Tests end-to-end prompt building with realistic data.
|
|
5
|
-
* Run with: npx tsx --test lib/prompts.scenario.test.ts
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { describe, it, before, after } from 'node:test';
|
|
9
|
-
import assert from 'node:assert';
|
|
10
|
-
import { writeFileSync, mkdirSync, rmSync, existsSync } from 'node:fs';
|
|
11
|
-
import { join, dirname } from 'node:path';
|
|
12
|
-
import { fileURLToPath } from 'node:url';
|
|
13
|
-
import {
|
|
14
|
-
loadTemplate,
|
|
15
|
-
buildPrompt,
|
|
16
|
-
buildChatPrompt,
|
|
17
|
-
Assignment,
|
|
18
|
-
Job,
|
|
19
|
-
JobGroup,
|
|
20
|
-
ChatJobContext,
|
|
21
|
-
} from './prompts.js';
|
|
22
|
-
|
|
23
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
24
|
-
const TEMPLATES_DIR = join(__dirname, '..', 'templates');
|
|
25
|
-
const TEST_TEMPLATE_PATH = join(TEMPLATES_DIR, '_test-scenario.md');
|
|
26
|
-
|
|
27
|
-
// Test fixtures
|
|
28
|
-
function mockAssignment(overrides: Partial<Assignment> = {}): Assignment {
|
|
29
|
-
return {
|
|
30
|
-
_id: 'asgn_abc123',
|
|
31
|
-
_creationTime: Date.now(),
|
|
32
|
-
namespaceId: 'ns_xyz',
|
|
33
|
-
northStar: 'Build a user authentication system with login, logout, and session management.',
|
|
34
|
-
status: 'active',
|
|
35
|
-
independent: false,
|
|
36
|
-
priority: 5,
|
|
37
|
-
artifacts: 'src/auth/login.ts: Login component\nsrc/auth/session.ts: Session manager',
|
|
38
|
-
decisions: 'D1: Using JWT for tokens. D2: 24hr session expiry.',
|
|
39
|
-
createdAt: Date.now() - 3600000,
|
|
40
|
-
updatedAt: Date.now(),
|
|
41
|
-
...overrides,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function mockJob(overrides: Partial<Job> = {}): Job {
|
|
46
|
-
return {
|
|
47
|
-
_id: 'job_def456',
|
|
48
|
-
_creationTime: Date.now(),
|
|
49
|
-
assignmentId: 'asgn_abc123',
|
|
50
|
-
jobType: 'implement',
|
|
51
|
-
harness: 'claude',
|
|
52
|
-
context: 'Implement the login form with email/password fields and validation.',
|
|
53
|
-
status: 'running',
|
|
54
|
-
createdAt: Date.now() - 1800000,
|
|
55
|
-
...overrides,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function mockGroup(overrides: Partial<JobGroup> = {}): JobGroup {
|
|
60
|
-
return {
|
|
61
|
-
_id: 'group_789',
|
|
62
|
-
_creationTime: Date.now(),
|
|
63
|
-
assignmentId: 'asgn_abc123',
|
|
64
|
-
status: 'complete',
|
|
65
|
-
createdAt: Date.now() - 2000000,
|
|
66
|
-
...overrides,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function mockChatContext(overrides: Partial<ChatJobContext> = {}): ChatJobContext {
|
|
71
|
-
return {
|
|
72
|
-
threadId: 'thread_123',
|
|
73
|
-
namespaceId: 'ns_xyz',
|
|
74
|
-
mode: 'jam',
|
|
75
|
-
messages: [
|
|
76
|
-
{ _id: 'msg1', threadId: 'thread_123', role: 'user', content: 'Hello', createdAt: Date.now() - 1000 },
|
|
77
|
-
],
|
|
78
|
-
latestUserMessage: 'Can you help me with the authentication flow?',
|
|
79
|
-
...overrides,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// ============================================================================
|
|
84
|
-
// loadTemplate scenarios
|
|
85
|
-
// ============================================================================
|
|
86
|
-
|
|
87
|
-
describe('loadTemplate scenarios', () => {
|
|
88
|
-
it('loads existing template files', () => {
|
|
89
|
-
// These templates should exist in the project
|
|
90
|
-
const existingTypes = ['pm', 'implement', 'plan', 'uat'];
|
|
91
|
-
|
|
92
|
-
existingTypes.forEach(type => {
|
|
93
|
-
const template = loadTemplate(type);
|
|
94
|
-
assert.ok(template.length > 50, `${type} template should have content`);
|
|
95
|
-
assert.ok(!template.includes('Execute the task as described'), `${type} should not be fallback`);
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('returns fallback for missing template', () => {
|
|
100
|
-
const template = loadTemplate('nonexistent-job-type-xyz');
|
|
101
|
-
|
|
102
|
-
assert.ok(template.includes('Execute the task as described'));
|
|
103
|
-
assert.ok(template.includes('{{CONTEXT}}'));
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
// ============================================================================
|
|
108
|
-
// buildPrompt scenarios
|
|
109
|
-
// ============================================================================
|
|
110
|
-
|
|
111
|
-
describe('buildPrompt scenarios', () => {
|
|
112
|
-
const testTemplate = `# Test Job
|
|
113
|
-
|
|
114
|
-
## North Star
|
|
115
|
-
{{NORTH_STAR}}
|
|
116
|
-
|
|
117
|
-
## Context
|
|
118
|
-
{{CONTEXT}}
|
|
119
|
-
|
|
120
|
-
## Artifacts
|
|
121
|
-
{{ARTIFACTS}}
|
|
122
|
-
|
|
123
|
-
## Decisions
|
|
124
|
-
{{DECISIONS}}
|
|
125
|
-
|
|
126
|
-
## Previous Result
|
|
127
|
-
{{PREVIOUS_RESULT}}
|
|
128
|
-
|
|
129
|
-
## IDs
|
|
130
|
-
Assignment: {{ASSIGNMENT_ID}}
|
|
131
|
-
Job: {{CURRENT_JOB_ID}}
|
|
132
|
-
`;
|
|
133
|
-
|
|
134
|
-
before(() => {
|
|
135
|
-
// Create test template
|
|
136
|
-
writeFileSync(TEST_TEMPLATE_PATH, testTemplate);
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
after(() => {
|
|
140
|
-
// Cleanup test template
|
|
141
|
-
if (existsSync(TEST_TEMPLATE_PATH)) {
|
|
142
|
-
rmSync(TEST_TEMPLATE_PATH);
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
it('scenario: fresh assignment, first job', () => {
|
|
147
|
-
const assignment = mockAssignment({ artifacts: '', decisions: '' });
|
|
148
|
-
const job = mockJob({
|
|
149
|
-
jobType: '_test-scenario',
|
|
150
|
-
context: 'Start planning the authentication feature.',
|
|
151
|
-
});
|
|
152
|
-
const group = mockGroup();
|
|
153
|
-
|
|
154
|
-
const prompt = buildPrompt(group, assignment, job, []);
|
|
155
|
-
|
|
156
|
-
// North star injected
|
|
157
|
-
assert.ok(prompt.includes('Build a user authentication system'));
|
|
158
|
-
|
|
159
|
-
// Context injected
|
|
160
|
-
assert.ok(prompt.includes('Start planning the authentication feature'));
|
|
161
|
-
|
|
162
|
-
// Empty artifacts/decisions show defaults
|
|
163
|
-
assert.ok(prompt.includes('(none)'));
|
|
164
|
-
|
|
165
|
-
// No previous result
|
|
166
|
-
assert.ok(prompt.includes('(no previous results)'));
|
|
167
|
-
|
|
168
|
-
// IDs injected
|
|
169
|
-
assert.ok(prompt.includes('asgn_abc123'));
|
|
170
|
-
assert.ok(prompt.includes('job_def456'));
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
it('scenario: mid-assignment with artifacts and decisions', () => {
|
|
174
|
-
const assignment = mockAssignment();
|
|
175
|
-
const job = mockJob();
|
|
176
|
-
const group = mockGroup();
|
|
177
|
-
const previousResult = 'Successfully implemented login form with validation. Tests passing.';
|
|
178
|
-
|
|
179
|
-
const prompt = buildPrompt(group, assignment, job, [
|
|
180
|
-
{ jobType: 'implement', harness: 'claude', result: previousResult },
|
|
181
|
-
]);
|
|
182
|
-
|
|
183
|
-
// Artifacts present
|
|
184
|
-
assert.ok(prompt.includes('src/auth/login.ts'));
|
|
185
|
-
assert.ok(prompt.includes('Login component'));
|
|
186
|
-
|
|
187
|
-
// Decisions present
|
|
188
|
-
assert.ok(prompt.includes('Using JWT for tokens'));
|
|
189
|
-
|
|
190
|
-
// Previous result injected
|
|
191
|
-
assert.ok(prompt.includes('Successfully implemented login form'));
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
it('scenario: previous job error visible in prompt', () => {
|
|
195
|
-
const assignment = mockAssignment();
|
|
196
|
-
const job = mockJob({ jobType: 'review', context: 'Review the authentication changes.' });
|
|
197
|
-
const group = mockGroup();
|
|
198
|
-
const previousResult = 'Error: JWT token validation failed. Stack trace...';
|
|
199
|
-
|
|
200
|
-
const prompt = buildPrompt(group, assignment, job, [
|
|
201
|
-
{ jobType: 'implement', harness: 'claude', result: previousResult },
|
|
202
|
-
]);
|
|
203
|
-
|
|
204
|
-
// Previous error visible
|
|
205
|
-
assert.ok(prompt.includes('JWT token validation failed'));
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
// ============================================================================
|
|
210
|
-
// buildChatPrompt scenarios
|
|
211
|
-
// ============================================================================
|
|
212
|
-
|
|
213
|
-
describe('buildChatPrompt scenarios', () => {
|
|
214
|
-
// Note: These tests use the actual product-owner.md template
|
|
215
|
-
// They verify conditional logic and placeholder replacement
|
|
216
|
-
|
|
217
|
-
it('scenario: new jam session (safe mode)', () => {
|
|
218
|
-
const context = mockChatContext({
|
|
219
|
-
mode: 'jam',
|
|
220
|
-
claudeSessionId: undefined, // New session
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
const prompt = buildChatPrompt(context, 'my-project');
|
|
224
|
-
|
|
225
|
-
// Basic placeholders replaced
|
|
226
|
-
assert.ok(prompt.includes('thread_123') || prompt.includes('my-project'),
|
|
227
|
-
'Should include thread or namespace');
|
|
228
|
-
assert.ok(prompt.includes('Can you help me with the authentication flow'),
|
|
229
|
-
'Should include latest message');
|
|
230
|
-
|
|
231
|
-
// Mode should be jam
|
|
232
|
-
assert.ok(!prompt.includes('{{MODE}}'), 'MODE placeholder should be replaced');
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
it('scenario: resumed cook session (dangerous mode)', () => {
|
|
236
|
-
const context = mockChatContext({
|
|
237
|
-
mode: 'cook',
|
|
238
|
-
claudeSessionId: 'session_abc123', // Resumed session
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
const prompt = buildChatPrompt(context, 'my-project');
|
|
242
|
-
|
|
243
|
-
// Should not have unreplaced placeholders
|
|
244
|
-
assert.ok(!prompt.includes('{{THREAD_ID}}'), 'THREAD_ID should be replaced');
|
|
245
|
-
assert.ok(!prompt.includes('{{NAMESPACE}}'), 'NAMESPACE should be replaced');
|
|
246
|
-
assert.ok(!prompt.includes('{{LATEST_MESSAGE}}'), 'LATEST_MESSAGE should be replaced');
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
it('scenario: mode affects prompt content', () => {
|
|
250
|
-
const jamContext = mockChatContext({ mode: 'jam' });
|
|
251
|
-
const cookContext = mockChatContext({ mode: 'cook' });
|
|
252
|
-
|
|
253
|
-
const jamPrompt = buildChatPrompt(jamContext, 'test-ns');
|
|
254
|
-
const cookPrompt = buildChatPrompt(cookContext, 'test-ns');
|
|
255
|
-
|
|
256
|
-
// The prompts should be different due to conditionals
|
|
257
|
-
// (assuming product-owner.md has {{#if COOK_MODE}} blocks)
|
|
258
|
-
// At minimum, they should both be valid (no unreplaced conditionals)
|
|
259
|
-
assert.ok(!jamPrompt.includes('{{#if'), 'Jam prompt should not have unprocessed conditionals');
|
|
260
|
-
assert.ok(!cookPrompt.includes('{{#if'), 'Cook prompt should not have unprocessed conditionals');
|
|
261
|
-
});
|
|
262
|
-
});
|