valent-pipeline 0.1.13 → 0.1.15
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/package.json
CHANGED
|
@@ -12,9 +12,9 @@ Read `.valent-pipeline/steps/common/agent-protocol.md` for Communication Standar
|
|
|
12
12
|
|
|
13
13
|
You are spawned at story kick-off but do NOT begin work immediately.
|
|
14
14
|
|
|
15
|
-
- **Wait for:** `[JUDGE-G1-APPROVAL]` (Pass 2) from JUDGE-G1
|
|
16
|
-
- **On SHIP verdict:** Send `[JUDGE-G2-SHIP]` to Lead. Lead owns ship/teardown.
|
|
17
|
-
- **On REJECT verdict:** Send `[JUDGE-G2-REJECT]` to Lead. Lead owns G2 rejection routing -- this is non-routine.
|
|
15
|
+
- **Wait for:** `[JUDGE-G1-APPROVAL]` (Pass 2) from JUDGE-G1. Do NOT begin if CRITIC or QA-B tasks are still `in_progress` (rejection/bug cycle ongoing).
|
|
16
|
+
- **On SHIP verdict:** Send `[JUDGE-G2-SHIP]` to Lead. Mark task completed. Lead owns ship/teardown.
|
|
17
|
+
- **On REJECT verdict:** Send `[JUDGE-G2-REJECT]` to Lead. Mark task completed. Lead owns G2 rejection routing -- this is non-routine.
|
|
18
18
|
- **Escalate to:** Lead -- for `[BLOCKER]` or any issue you cannot resolve.
|
|
19
19
|
|
|
20
20
|
## Output
|
package/pipeline/prompts/qa-b.md
CHANGED
|
@@ -12,9 +12,9 @@ Read `.valent-pipeline/steps/common/agent-protocol.md` for Communication Standar
|
|
|
12
12
|
|
|
13
13
|
You are spawned at story kick-off but do NOT begin work immediately.
|
|
14
14
|
|
|
15
|
-
- **Wait for:** `[CRITIC-APPROVED]` from CRITIC
|
|
16
|
-
- **On completion:** Send `[HANDOFF]` to JUDGE-G1 (triggers Pass 2).
|
|
17
|
-
- **On bugs found:** Send `[BUG]` directly to BEND or FEND. CC Lead.
|
|
15
|
+
- **Wait for:** `[CRITIC-APPROVED]` from CRITIC. Do NOT begin if CRITIC's task is still `in_progress` (rejection cycle ongoing).
|
|
16
|
+
- **On completion (all tests pass, no P1 bugs):** Send `[HANDOFF]` to JUDGE-G1 (triggers Pass 2). Send `[DONE]` to Lead. Mark task completed.
|
|
17
|
+
- **On bugs found:** Send `[BUG]` directly to BEND or FEND. CC Lead. Do NOT mark task completed until dev fixes and you re-run. Task stays `in_progress` during bug fix cycle.
|
|
18
18
|
- **Escalate to:** Lead -- for `[BLOCKER]`, `[ESCALATION]`, or any issue you cannot resolve peer-to-peer.
|
|
19
19
|
|
|
20
20
|
## Output
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
#!/usr/bin/env npx tsx
|
|
2
|
+
/**
|
|
3
|
+
* query-kb.ts — Query the pipeline knowledge database from the command line.
|
|
4
|
+
* Used by the Knowledge Agent to answer queries without writing SQL directly.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* # Get a specific artifact:
|
|
8
|
+
* npx tsx .valent-pipeline/scripts/query-kb.ts --artifact --story KANBAN-001 --type reqs-brief
|
|
9
|
+
*
|
|
10
|
+
* # Get correction directives for an agent:
|
|
11
|
+
* npx tsx .valent-pipeline/scripts/query-kb.ts --directives --agent BEND
|
|
12
|
+
*
|
|
13
|
+
* # Full-text search across all artifacts:
|
|
14
|
+
* npx tsx .valent-pipeline/scripts/query-kb.ts --search "acceptance criteria for auth"
|
|
15
|
+
*
|
|
16
|
+
* # List all artifacts for a story:
|
|
17
|
+
* npx tsx .valent-pipeline/scripts/query-kb.ts --list --story KANBAN-001
|
|
18
|
+
*
|
|
19
|
+
* # List all stories in the database:
|
|
20
|
+
* npx tsx .valent-pipeline/scripts/query-kb.ts --stories
|
|
21
|
+
*
|
|
22
|
+
* # Get bugs since a date:
|
|
23
|
+
* npx tsx .valent-pipeline/scripts/query-kb.ts --bugs-since 2026-03-01
|
|
24
|
+
*
|
|
25
|
+
* # DB path defaults to .valent-pipeline/pipeline.db, override with --db-path
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import Database from 'better-sqlite3';
|
|
29
|
+
import { existsSync } from 'fs';
|
|
30
|
+
|
|
31
|
+
const args = process.argv.slice(2);
|
|
32
|
+
const flags: Record<string, string> = {};
|
|
33
|
+
const modes: string[] = [];
|
|
34
|
+
|
|
35
|
+
for (let i = 0; i < args.length; i++) {
|
|
36
|
+
if (args[i].startsWith('--')) {
|
|
37
|
+
const key = args[i].slice(2);
|
|
38
|
+
if (['artifact', 'directives', 'search', 'list', 'stories', 'bugs-since'].includes(key)) {
|
|
39
|
+
if (key === 'search' || key === 'bugs-since') {
|
|
40
|
+
modes.push(key);
|
|
41
|
+
flags[key] = args[++i];
|
|
42
|
+
} else {
|
|
43
|
+
modes.push(key);
|
|
44
|
+
}
|
|
45
|
+
} else if (i + 1 < args.length && !args[i + 1].startsWith('--')) {
|
|
46
|
+
flags[key] = args[++i];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const dbPath = flags['db-path'] || '.valent-pipeline/pipeline.db';
|
|
52
|
+
|
|
53
|
+
if (!existsSync(dbPath)) {
|
|
54
|
+
console.error(`Database not found: ${dbPath}`);
|
|
55
|
+
console.error('Run "valent-pipeline db init" to create it.');
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const db = new Database(dbPath, { readonly: true });
|
|
60
|
+
const mode = modes[0];
|
|
61
|
+
|
|
62
|
+
if (!mode) {
|
|
63
|
+
console.error('Usage: query-kb.ts --artifact|--directives|--search|--list|--stories|--bugs-since');
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
switch (mode) {
|
|
68
|
+
case 'artifact': {
|
|
69
|
+
const storyId = flags['story'];
|
|
70
|
+
const type = flags['type'];
|
|
71
|
+
if (!storyId || !type) {
|
|
72
|
+
console.error('--artifact requires --story and --type');
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
const row = db.prepare(
|
|
76
|
+
'SELECT content, agent, created_at FROM artifacts WHERE story_id = ? AND artifact_type = ?'
|
|
77
|
+
).get(storyId, type) as { content: string; agent: string; created_at: string } | undefined;
|
|
78
|
+
if (row) {
|
|
79
|
+
console.log(`--- ${type} for ${storyId} (by ${row.agent}, ${row.created_at}) ---`);
|
|
80
|
+
console.log(row.content);
|
|
81
|
+
} else {
|
|
82
|
+
console.log(`No artifact found: story=${storyId}, type=${type}`);
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
case 'directives': {
|
|
88
|
+
const agent = flags['agent'];
|
|
89
|
+
let rows;
|
|
90
|
+
if (agent) {
|
|
91
|
+
rows = db.prepare(
|
|
92
|
+
"SELECT id, directive, reason FROM correction_directives WHERE target_agent = ? AND status = 'active'"
|
|
93
|
+
).all(agent) as { id: string; directive: string; reason: string }[];
|
|
94
|
+
} else {
|
|
95
|
+
rows = db.prepare(
|
|
96
|
+
"SELECT id, target_agent, directive, reason FROM correction_directives WHERE status = 'active'"
|
|
97
|
+
).all() as { id: string; target_agent: string; directive: string; reason: string }[];
|
|
98
|
+
}
|
|
99
|
+
if (rows.length === 0) {
|
|
100
|
+
console.log(agent ? `No active directives for ${agent}` : 'No active correction directives');
|
|
101
|
+
} else {
|
|
102
|
+
for (const r of rows) {
|
|
103
|
+
const target = 'target_agent' in r ? ` [${r.target_agent}]` : '';
|
|
104
|
+
console.log(`${r.id}${target}: ${r.directive}`);
|
|
105
|
+
if (r.reason) console.log(` Reason: ${r.reason}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
case 'search': {
|
|
112
|
+
const query = flags['search'];
|
|
113
|
+
if (!query) {
|
|
114
|
+
console.error('--search requires a search term');
|
|
115
|
+
process.exit(1);
|
|
116
|
+
}
|
|
117
|
+
const rows = db.prepare(
|
|
118
|
+
"SELECT story_id, agent, artifact_type, snippet(artifacts_fts, 0, '>>>', '<<<', '...', 40) as snippet FROM artifacts_fts WHERE artifacts_fts MATCH ? ORDER BY rank LIMIT 10"
|
|
119
|
+
).all(query) as { story_id: string; agent: string; artifact_type: string; snippet: string }[];
|
|
120
|
+
if (rows.length === 0) {
|
|
121
|
+
console.log(`No results for: ${query}`);
|
|
122
|
+
} else {
|
|
123
|
+
for (const r of rows) {
|
|
124
|
+
console.log(`[${r.story_id}] ${r.artifact_type} (${r.agent}): ${r.snippet}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
case 'list': {
|
|
131
|
+
const storyId = flags['story'];
|
|
132
|
+
if (!storyId) {
|
|
133
|
+
console.error('--list requires --story');
|
|
134
|
+
process.exit(1);
|
|
135
|
+
}
|
|
136
|
+
const rows = db.prepare(
|
|
137
|
+
'SELECT artifact_type, agent, length(content) as size, created_at FROM artifacts WHERE story_id = ? ORDER BY created_at'
|
|
138
|
+
).all(storyId) as { artifact_type: string; agent: string; size: number; created_at: string }[];
|
|
139
|
+
if (rows.length === 0) {
|
|
140
|
+
console.log(`No artifacts for story ${storyId}`);
|
|
141
|
+
} else {
|
|
142
|
+
console.log(`Artifacts for ${storyId}:`);
|
|
143
|
+
for (const r of rows) {
|
|
144
|
+
console.log(` ${r.artifact_type} (${r.agent}, ${r.size} chars, ${r.created_at})`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
case 'stories': {
|
|
151
|
+
const rows = db.prepare(
|
|
152
|
+
'SELECT DISTINCT story_id, COUNT(*) as artifact_count FROM artifacts GROUP BY story_id ORDER BY story_id'
|
|
153
|
+
).all() as { story_id: string; artifact_count: number }[];
|
|
154
|
+
if (rows.length === 0) {
|
|
155
|
+
console.log('No stories in database');
|
|
156
|
+
} else {
|
|
157
|
+
for (const r of rows) {
|
|
158
|
+
console.log(`${r.story_id}: ${r.artifact_count} artifacts`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
case 'bugs-since': {
|
|
165
|
+
const since = flags['bugs-since'];
|
|
166
|
+
if (!since) {
|
|
167
|
+
console.error('--bugs-since requires a date (YYYY-MM-DD)');
|
|
168
|
+
process.exit(1);
|
|
169
|
+
}
|
|
170
|
+
const rows = db.prepare(
|
|
171
|
+
"SELECT story_id, content FROM artifacts WHERE artifact_type = 'bugs' AND created_at > ? ORDER BY created_at"
|
|
172
|
+
).all(since) as { story_id: string; content: string }[];
|
|
173
|
+
if (rows.length === 0) {
|
|
174
|
+
console.log(`No bugs filed since ${since}`);
|
|
175
|
+
} else {
|
|
176
|
+
for (const r of rows) {
|
|
177
|
+
console.log(`--- Bugs from ${r.story_id} ---`);
|
|
178
|
+
console.log(r.content);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
db.close();
|