@eeshans/howiprompt 2.1.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/LICENSE +21 -0
- package/README.md +148 -0
- package/bin/bootstrap-db.mjs +166 -0
- package/bin/cli-helpers.mjs +86 -0
- package/bin/cli.mjs +205 -0
- package/config/ml.json +47 -0
- package/data/claude_code/.gitkeep +3 -0
- package/data/codex/.gitkeep +0 -0
- package/data/reference_clusters.json +314 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +194 -0
- package/dist/index.js.map +1 -0
- package/dist/pipeline/backends.d.ts +39 -0
- package/dist/pipeline/backends.js +411 -0
- package/dist/pipeline/backends.js.map +1 -0
- package/dist/pipeline/classifiers.d.ts +17 -0
- package/dist/pipeline/classifiers.js +181 -0
- package/dist/pipeline/classifiers.js.map +1 -0
- package/dist/pipeline/config.d.ts +21 -0
- package/dist/pipeline/config.js +79 -0
- package/dist/pipeline/config.js.map +1 -0
- package/dist/pipeline/db.d.ts +41 -0
- package/dist/pipeline/db.js +130 -0
- package/dist/pipeline/db.js.map +1 -0
- package/dist/pipeline/embeddings.d.ts +15 -0
- package/dist/pipeline/embeddings.js +82 -0
- package/dist/pipeline/embeddings.js.map +1 -0
- package/dist/pipeline/exclusions.d.ts +86 -0
- package/dist/pipeline/exclusions.js +320 -0
- package/dist/pipeline/exclusions.js.map +1 -0
- package/dist/pipeline/metrics.d.ts +12 -0
- package/dist/pipeline/metrics.js +278 -0
- package/dist/pipeline/metrics.js.map +1 -0
- package/dist/pipeline/ml-config.d.ts +23 -0
- package/dist/pipeline/ml-config.js +54 -0
- package/dist/pipeline/ml-config.js.map +1 -0
- package/dist/pipeline/models.d.ts +23 -0
- package/dist/pipeline/models.js +21 -0
- package/dist/pipeline/models.js.map +1 -0
- package/dist/pipeline/nlp.d.ts +20 -0
- package/dist/pipeline/nlp.js +200 -0
- package/dist/pipeline/nlp.js.map +1 -0
- package/dist/pipeline/parsers.d.ts +11 -0
- package/dist/pipeline/parsers.js +492 -0
- package/dist/pipeline/parsers.js.map +1 -0
- package/dist/pipeline/registry.d.ts +21 -0
- package/dist/pipeline/registry.js +45 -0
- package/dist/pipeline/registry.js.map +1 -0
- package/dist/pipeline/style.d.ts +37 -0
- package/dist/pipeline/style.js +204 -0
- package/dist/pipeline/style.js.map +1 -0
- package/dist/pipeline/sync.d.ts +8 -0
- package/dist/pipeline/sync.js +52 -0
- package/dist/pipeline/sync.js.map +1 -0
- package/dist/pipeline/trends.d.ts +8 -0
- package/dist/pipeline/trends.js +226 -0
- package/dist/pipeline/trends.js.map +1 -0
- package/dist/server.d.ts +7 -0
- package/dist/server.js +216 -0
- package/dist/server.js.map +1 -0
- package/frontend/dist/_astro/MethodologyModal.astro_astro_type_script_index_0_lang.jiHwSrn-.js +34 -0
- package/frontend/dist/_astro/index.Ck1ZXjve.css +1 -0
- package/frontend/dist/_astro/index.astro_astro_type_script_index_0_lang.PuBlxVje.js +37 -0
- package/frontend/dist/_astro/index.astro_astro_type_script_index_1_lang.DmQY6kFx.js +1 -0
- package/frontend/dist/_astro/theme.CbYAaQI4.js +1 -0
- package/frontend/dist/_astro/wrapped.CpzRcLjf.css +1 -0
- package/frontend/dist/_astro/wrapped.astro_astro_type_script_index_0_lang.D4GeWu2-.js +11 -0
- package/frontend/dist/_astro/wrapped.astro_astro_type_script_index_1_lang.CPAAJDh5.js +1 -0
- package/frontend/dist/favicon.svg +4 -0
- package/frontend/dist/images/card_architect.png +0 -0
- package/frontend/dist/images/card_commander.png +0 -0
- package/frontend/dist/images/card_delegator.png +0 -0
- package/frontend/dist/images/card_explorer.png +0 -0
- package/frontend/dist/images/card_partner.png +0 -0
- package/frontend/dist/images/char_architect.png +0 -0
- package/frontend/dist/images/char_commander.png +0 -0
- package/frontend/dist/images/char_delegator.png +0 -0
- package/frontend/dist/images/char_explorer.png +0 -0
- package/frontend/dist/images/char_partner.png +0 -0
- package/frontend/dist/index.html +9 -0
- package/frontend/dist/wrapped/index.html +9 -0
- package/package.json +66 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hitl": {
|
|
3
|
+
"course_correction": [
|
|
4
|
+
"no, not that \u2014 do it this way instead",
|
|
5
|
+
"actually let's go a completely different direction",
|
|
6
|
+
"revert that change, it's wrong",
|
|
7
|
+
"stop, that's not what I asked for",
|
|
8
|
+
"undo what you just did",
|
|
9
|
+
"no, I said X not Y",
|
|
10
|
+
"that's incorrect, the correct approach is",
|
|
11
|
+
"wait, go back to the previous version",
|
|
12
|
+
"don't do it that way, here's what I want",
|
|
13
|
+
"you misunderstood \u2014 let me clarify",
|
|
14
|
+
"scratch that, start over with a different approach",
|
|
15
|
+
"nope, wrong direction entirely",
|
|
16
|
+
"hold on, that breaks the existing behavior",
|
|
17
|
+
"no no no, revert everything",
|
|
18
|
+
"that's the opposite of what I need"
|
|
19
|
+
],
|
|
20
|
+
"architectural_decision": [
|
|
21
|
+
"use Postgres instead of MongoDB for this",
|
|
22
|
+
"let's go with a microservices approach",
|
|
23
|
+
"the architecture should use event sourcing",
|
|
24
|
+
"I want to use Redis for caching here",
|
|
25
|
+
"we should use WebSockets not polling",
|
|
26
|
+
"let's go with option B \u2014 the queue-based approach",
|
|
27
|
+
"use a B-tree index, not a hash index",
|
|
28
|
+
"the data model should be normalized, not denormalized",
|
|
29
|
+
"I prefer REST over GraphQL for this API",
|
|
30
|
+
"let's use SQLite instead of a full database server",
|
|
31
|
+
"switch from callbacks to async/await pattern",
|
|
32
|
+
"use dependency injection instead of singletons",
|
|
33
|
+
"the state management should use a reducer pattern",
|
|
34
|
+
"separate the read and write models",
|
|
35
|
+
"use a worker thread for this computation"
|
|
36
|
+
],
|
|
37
|
+
"constraint_spec": [
|
|
38
|
+
"it must be backwards compatible with v1",
|
|
39
|
+
"the response time should be under 200ms",
|
|
40
|
+
"don't break the existing public API",
|
|
41
|
+
"this needs to work without an internet connection",
|
|
42
|
+
"memory usage must stay below 512MB",
|
|
43
|
+
"the solution must not require any new dependencies",
|
|
44
|
+
"it should handle at least 10,000 concurrent users",
|
|
45
|
+
"the output format must match the spec exactly",
|
|
46
|
+
"never expose the internal error details to the client",
|
|
47
|
+
"the migration must be reversible",
|
|
48
|
+
"keep the bundle size under 100KB",
|
|
49
|
+
"this must work on Node 18+",
|
|
50
|
+
"always validate input before processing",
|
|
51
|
+
"the function must be idempotent",
|
|
52
|
+
"it should gracefully degrade when the service is down"
|
|
53
|
+
],
|
|
54
|
+
"scope_control": [
|
|
55
|
+
"just fix the bug, don't refactor anything else",
|
|
56
|
+
"that's out of scope for now, defer it",
|
|
57
|
+
"only change the files I mentioned",
|
|
58
|
+
"keep it simple \u2014 no extra features",
|
|
59
|
+
"don't add error handling for that edge case yet",
|
|
60
|
+
"we'll deal with that in the next PR",
|
|
61
|
+
"focus only on the login flow, nothing else",
|
|
62
|
+
"let's not gold-plate this \u2014 ship the minimum",
|
|
63
|
+
"remove that extra complexity, we don't need it",
|
|
64
|
+
"ignore the performance optimization for now",
|
|
65
|
+
"don't touch the database schema in this change",
|
|
66
|
+
"stick to the happy path only",
|
|
67
|
+
"we can add tests later, just get it working",
|
|
68
|
+
"not now \u2014 park that for phase 2",
|
|
69
|
+
"only the frontend changes, leave the backend alone"
|
|
70
|
+
],
|
|
71
|
+
"review_qa": [
|
|
72
|
+
"that doesn't look right, check the edge case",
|
|
73
|
+
"are you sure this handles null values?",
|
|
74
|
+
"what happens if the network request fails?",
|
|
75
|
+
"I see a potential race condition here",
|
|
76
|
+
"this will break on Windows \u2014 the path separator is wrong",
|
|
77
|
+
"the error message is misleading, fix it",
|
|
78
|
+
"verify that the tests actually cover this scenario",
|
|
79
|
+
"this looks like it could leak memory",
|
|
80
|
+
"double check the SQL injection risk here",
|
|
81
|
+
"the return type doesn't match the interface",
|
|
82
|
+
"this logic seems inverted \u2014 should it be >= not >?",
|
|
83
|
+
"run the benchmarks before we merge this",
|
|
84
|
+
"the variable name is confusing, rename it",
|
|
85
|
+
"looks wrong \u2014 the off-by-one error on line 42",
|
|
86
|
+
"test this with empty input and see what happens"
|
|
87
|
+
],
|
|
88
|
+
"tradeoff_nav": [
|
|
89
|
+
"what are the pros and cons of each approach?",
|
|
90
|
+
"I prefer simplicity over performance here",
|
|
91
|
+
"the tradeoff of using a cache is worth the complexity",
|
|
92
|
+
"which option has better long-term maintainability?",
|
|
93
|
+
"speed matters more than code elegance for this feature",
|
|
94
|
+
"we'll accept the extra latency for better reliability",
|
|
95
|
+
"is the storage cost worth the query performance gain?",
|
|
96
|
+
"I'd rather have a slower but correct solution",
|
|
97
|
+
"let's go with the simpler approach even if it's less efficient",
|
|
98
|
+
"the risk of data loss outweighs the development speed",
|
|
99
|
+
"consistency is more important than availability here",
|
|
100
|
+
"prioritize developer experience over runtime performance",
|
|
101
|
+
"we'll take the tech debt now and refactor later",
|
|
102
|
+
"which approach is easier to roll back if it fails?",
|
|
103
|
+
"compare the maintenance burden of both options"
|
|
104
|
+
],
|
|
105
|
+
"passive_delegation": [
|
|
106
|
+
"sounds good, go ahead",
|
|
107
|
+
"yes",
|
|
108
|
+
"ok",
|
|
109
|
+
"sure, whatever you think is best",
|
|
110
|
+
"do whatever makes sense",
|
|
111
|
+
"you decide",
|
|
112
|
+
"looks fine to me",
|
|
113
|
+
"ship it",
|
|
114
|
+
"perfect",
|
|
115
|
+
"that works",
|
|
116
|
+
"go for it",
|
|
117
|
+
"I trust your judgment",
|
|
118
|
+
"no objections",
|
|
119
|
+
"approved",
|
|
120
|
+
"LGTM"
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
"vibe": {
|
|
124
|
+
"file_reference": [
|
|
125
|
+
"in src/auth/middleware.ts, change the validateToken function",
|
|
126
|
+
"look at line 42 of config.py \u2014 the timeout is wrong",
|
|
127
|
+
"the bug is in frontend/src/components/Header.tsx",
|
|
128
|
+
"update the schema in prisma/schema.prisma",
|
|
129
|
+
"check the error handler in src/api/routes/users.ts:89",
|
|
130
|
+
"the CSS in styles/dashboard.css needs the grid fix",
|
|
131
|
+
"modify the Dockerfile to use multi-stage builds",
|
|
132
|
+
"fix the import path in src/index.ts line 15",
|
|
133
|
+
"the test in tests/auth.test.ts is flaky",
|
|
134
|
+
"add the new endpoint to src/routes/api.ts",
|
|
135
|
+
"the migration file in db/migrations/001_users.sql",
|
|
136
|
+
"update the nginx config in deploy/nginx.conf",
|
|
137
|
+
"the webpack config needs a new loader",
|
|
138
|
+
"check the environment variables in .env.example",
|
|
139
|
+
"the hook in src/hooks/useAuth.ts has a stale closure"
|
|
140
|
+
],
|
|
141
|
+
"technical_spec": [
|
|
142
|
+
"add a composite index on (user_id, created_at) for the queries table",
|
|
143
|
+
"the function should return a Promise<Result<T, Error>>",
|
|
144
|
+
"use a sliding window algorithm with O(n) time complexity",
|
|
145
|
+
"implement rate limiting with a token bucket at 100 req/min",
|
|
146
|
+
"the WebSocket should reconnect with exponential backoff",
|
|
147
|
+
"serialize the state as a protobuf, not JSON",
|
|
148
|
+
"use connection pooling with a max of 20 connections",
|
|
149
|
+
"the cache should use LRU eviction with a 5-minute TTL",
|
|
150
|
+
"implement optimistic locking using version numbers",
|
|
151
|
+
"the API should return 409 Conflict on concurrent writes",
|
|
152
|
+
"use a bloom filter to check membership before the DB query",
|
|
153
|
+
"the migration needs to be online \u2014 no table locks",
|
|
154
|
+
"implement circuit breaker with half-open state after 30s",
|
|
155
|
+
"use HMAC-SHA256 for the webhook signature verification",
|
|
156
|
+
"the batch processor should use backpressure, not unbounded queues"
|
|
157
|
+
],
|
|
158
|
+
"code_sharing": [
|
|
159
|
+
"here's the current implementation:\n```typescript\nfunction validate(input: string): boolean {\n return schema.safeParse(input).success;\n}\n```",
|
|
160
|
+
"the error looks like this:\n```\nTypeError: Cannot read property 'id' of undefined\n at processUser (src/users.ts:45)\n```",
|
|
161
|
+
"I want it to work like this: `const result = await pipe(fetch, parse, validate)(url)`",
|
|
162
|
+
"change `export default` to `export const handler =`",
|
|
163
|
+
"the type should be `Record<string, unknown>` not `any`",
|
|
164
|
+
"replace `arr.forEach` with `for...of` for the async iteration",
|
|
165
|
+
"add `as const` to the enum definition",
|
|
166
|
+
"the SQL should be: SELECT u.* FROM users u JOIN orders o ON u.id = o.user_id",
|
|
167
|
+
"use destructuring: `const { data, error } = await query()`",
|
|
168
|
+
"wrap it in a try/catch and return a Result type",
|
|
169
|
+
"the regex pattern should be `/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$/`",
|
|
170
|
+
"import { z } from 'zod' and validate with z.string().email()",
|
|
171
|
+
"the interface needs `readonly` on all properties",
|
|
172
|
+
"change the generic from `T extends object` to `T extends Record<string, unknown>`",
|
|
173
|
+
"here's my current schema:\n```sql\nCREATE TABLE users (\n id SERIAL PRIMARY KEY,\n email TEXT UNIQUE NOT NULL\n);\n```"
|
|
174
|
+
],
|
|
175
|
+
"iterative_refinement": [
|
|
176
|
+
"actually change the return type from string to number",
|
|
177
|
+
"wait, on second thought, use a Map instead of an object",
|
|
178
|
+
"that's close but the sorting should be descending not ascending",
|
|
179
|
+
"good, now also handle the case where the array is empty",
|
|
180
|
+
"one more thing \u2014 add a timeout parameter with default 5000",
|
|
181
|
+
"hmm, the naming is off \u2014 rename 'data' to 'payload'",
|
|
182
|
+
"almost right but the null check should come first",
|
|
183
|
+
"the logic is correct but extract it into a separate function",
|
|
184
|
+
"yes but also add the same validation to the update endpoint",
|
|
185
|
+
"now make it accept an optional config parameter",
|
|
186
|
+
"change the error message to be more specific about what failed",
|
|
187
|
+
"ok now add the same pattern to the delete handler",
|
|
188
|
+
"the test passes but add an edge case for empty strings",
|
|
189
|
+
"good, now refactor the duplicate code between create and update",
|
|
190
|
+
"one last thing \u2014 add a JSDoc comment explaining the algorithm"
|
|
191
|
+
],
|
|
192
|
+
"high_level_delegation": [
|
|
193
|
+
"build me a login page",
|
|
194
|
+
"create a REST API for managing users",
|
|
195
|
+
"make a dashboard that shows analytics",
|
|
196
|
+
"add authentication to the app",
|
|
197
|
+
"build a chat feature",
|
|
198
|
+
"create a landing page for the product",
|
|
199
|
+
"add dark mode support",
|
|
200
|
+
"make it mobile responsive",
|
|
201
|
+
"set up a CI/CD pipeline",
|
|
202
|
+
"add file upload functionality",
|
|
203
|
+
"create a notification system",
|
|
204
|
+
"build an admin panel",
|
|
205
|
+
"add search functionality",
|
|
206
|
+
"implement real-time updates",
|
|
207
|
+
"create a settings page"
|
|
208
|
+
],
|
|
209
|
+
"outcome_only": [
|
|
210
|
+
"I want users to be able to reset their passwords",
|
|
211
|
+
"make the page load faster",
|
|
212
|
+
"the form should validate before submitting",
|
|
213
|
+
"users need to see their order history",
|
|
214
|
+
"the app should work offline",
|
|
215
|
+
"I want to export data as CSV",
|
|
216
|
+
"the table should be sortable by any column",
|
|
217
|
+
"add pagination to the list view",
|
|
218
|
+
"users should get email notifications",
|
|
219
|
+
"the dashboard needs a date range filter",
|
|
220
|
+
"make the images lazy load",
|
|
221
|
+
"I want a progress bar for file uploads",
|
|
222
|
+
"the sidebar should collapse on mobile",
|
|
223
|
+
"add a confirmation dialog before deleting",
|
|
224
|
+
"the chart should update in real time"
|
|
225
|
+
],
|
|
226
|
+
"acceptance": [
|
|
227
|
+
"looks good, ship it",
|
|
228
|
+
"perfect, exactly what I wanted",
|
|
229
|
+
"that works, merge it",
|
|
230
|
+
"LGTM, approved",
|
|
231
|
+
"yes that's fine, move on",
|
|
232
|
+
"great, no changes needed",
|
|
233
|
+
"good enough, let's not overthink it",
|
|
234
|
+
"approved, ship to staging",
|
|
235
|
+
"nice, that's clean",
|
|
236
|
+
"works for me, next task",
|
|
237
|
+
"solid, merge and deploy",
|
|
238
|
+
"yep, that's correct",
|
|
239
|
+
"beautiful, exactly right",
|
|
240
|
+
"no notes, ship it",
|
|
241
|
+
"love it, let's go"
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
"politeness": {
|
|
245
|
+
"courteous": [
|
|
246
|
+
"please help me fix this authentication issue",
|
|
247
|
+
"thank you for that, could you also update the tests?",
|
|
248
|
+
"thanks so much for the detailed explanation",
|
|
249
|
+
"sorry to bother you again, but I think there's another bug",
|
|
250
|
+
"would you mind taking a look at the error handling?",
|
|
251
|
+
"I'd really appreciate it if you could simplify this function",
|
|
252
|
+
"great work on that, thanks! Now can we move on to the API?",
|
|
253
|
+
"if it's not too much trouble, could you add validation?",
|
|
254
|
+
"I appreciate the thorough response, one more question though",
|
|
255
|
+
"no worries if this is hard, but can you try a different approach?",
|
|
256
|
+
"thanks for catching that, you're right about the edge case",
|
|
257
|
+
"could you please refactor this when you get a chance?",
|
|
258
|
+
"sorry, I wasn't clear \u2014 what I meant was change the return type",
|
|
259
|
+
"that's really helpful, thank you. Can you also add types?",
|
|
260
|
+
"please and thank you! Can you also run the linter?"
|
|
261
|
+
],
|
|
262
|
+
"warm_collaborative": [
|
|
263
|
+
"nice catch! Let's fix that together",
|
|
264
|
+
"love that approach, let's go with it",
|
|
265
|
+
"this is looking great, just a few tweaks needed",
|
|
266
|
+
"really appreciate you walking me through this",
|
|
267
|
+
"that's exactly what I was hoping for, well done",
|
|
268
|
+
"I'm impressed with how clean this turned out",
|
|
269
|
+
"thanks for being patient while I figured out what I wanted",
|
|
270
|
+
"you've been super helpful today, one last thing",
|
|
271
|
+
"great thinking on the edge case handling",
|
|
272
|
+
"I like where this is going, let's keep iterating",
|
|
273
|
+
"awesome, that fixed it! Thanks for the quick turnaround",
|
|
274
|
+
"brilliant suggestion about the caching layer",
|
|
275
|
+
"this is way better than what I had in mind, thanks",
|
|
276
|
+
"really solid work on the error handling",
|
|
277
|
+
"you nailed it, exactly what the spec called for"
|
|
278
|
+
],
|
|
279
|
+
"direct_neutral": [
|
|
280
|
+
"fix the bug in the login handler",
|
|
281
|
+
"change the return type to Promise<void>",
|
|
282
|
+
"add an index on user_id",
|
|
283
|
+
"run the test suite",
|
|
284
|
+
"implement the pagination endpoint",
|
|
285
|
+
"remove the deprecated function",
|
|
286
|
+
"update the schema to add a status column",
|
|
287
|
+
"refactor the middleware to use async/await",
|
|
288
|
+
"deploy to staging",
|
|
289
|
+
"write unit tests for the validator",
|
|
290
|
+
"add error handling to the file upload",
|
|
291
|
+
"create a new migration for the roles table",
|
|
292
|
+
"set the timeout to 5000ms",
|
|
293
|
+
"split this into two separate functions",
|
|
294
|
+
"move the config to environment variables"
|
|
295
|
+
],
|
|
296
|
+
"curt_dismissive": [
|
|
297
|
+
"no",
|
|
298
|
+
"wrong",
|
|
299
|
+
"just do it",
|
|
300
|
+
"whatever",
|
|
301
|
+
"I don't care how, just make it work",
|
|
302
|
+
"not what I asked",
|
|
303
|
+
"try again",
|
|
304
|
+
"that's wrong, do it over",
|
|
305
|
+
"stop explaining and just write the code",
|
|
306
|
+
"skip the explanation",
|
|
307
|
+
"I didn't ask for your opinion",
|
|
308
|
+
"less talking more coding",
|
|
309
|
+
"just ship it already",
|
|
310
|
+
"don't overthink it",
|
|
311
|
+
"next"
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface PipelineOptions {
|
|
2
|
+
dbPath: string;
|
|
3
|
+
dataDir: string;
|
|
4
|
+
projectRoot?: string;
|
|
5
|
+
onProgress?: (progress: PipelineProgress) => void;
|
|
6
|
+
}
|
|
7
|
+
export interface PipelineStats {
|
|
8
|
+
newMessages: number;
|
|
9
|
+
totalMessages: number;
|
|
10
|
+
enriched: number;
|
|
11
|
+
embedded: number;
|
|
12
|
+
}
|
|
13
|
+
export interface PipelineProgress {
|
|
14
|
+
stage: string;
|
|
15
|
+
detail: string;
|
|
16
|
+
progress?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function runPipeline(opts: PipelineOptions): Promise<PipelineStats>;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { createDbClient, insertMessages, logSync } from "./pipeline/db.js";
|
|
4
|
+
import { loadConfig, loadBranding } from "./pipeline/config.js";
|
|
5
|
+
import { loadMlConfig } from "./pipeline/ml-config.js";
|
|
6
|
+
import { getEnabledBackends, getAllBackends } from "./pipeline/backends.js";
|
|
7
|
+
import { enrichNlp } from "./pipeline/nlp.js";
|
|
8
|
+
import { enrichEmbeddings } from "./pipeline/embeddings.js";
|
|
9
|
+
import { enrichClassifiers } from "./pipeline/classifiers.js";
|
|
10
|
+
import { enrichStyle } from "./pipeline/style.js";
|
|
11
|
+
import { computeSourceViews } from "./pipeline/metrics.js";
|
|
12
|
+
import { seedSystemRules, discoverAndSyncRules, loadExclusionRules, compileRules, flagExcludedMessages, } from "./pipeline/exclusions.js";
|
|
13
|
+
import { parseClaudeCode } from "./pipeline/parsers.js";
|
|
14
|
+
export async function runPipeline(opts) {
|
|
15
|
+
const config = loadConfig(opts.dataDir);
|
|
16
|
+
const mlConfig = loadMlConfig(opts.dataDir);
|
|
17
|
+
const client = createDbClient(opts.dbPath);
|
|
18
|
+
const log = opts.onProgress ?? (() => { });
|
|
19
|
+
// Purge messages from excluded source directories
|
|
20
|
+
// (user expects "reanalyze" to respect exclusion changes)
|
|
21
|
+
const allExclusions = Object.entries(config.backends)
|
|
22
|
+
.flatMap(([, toggle]) => toggle.exclusions)
|
|
23
|
+
.map((cwd) => cwd.replace(/\//g, "-").replace(/^-/, "-"));
|
|
24
|
+
for (const dirName of allExclusions) {
|
|
25
|
+
const pattern = `%/raw/claude_code/${dirName}/%`;
|
|
26
|
+
await client.execute({
|
|
27
|
+
sql: "DELETE FROM nlp_enrichments WHERE message_id IN (SELECT id FROM messages WHERE source_file LIKE ?)",
|
|
28
|
+
args: [pattern],
|
|
29
|
+
});
|
|
30
|
+
const result = await client.execute({
|
|
31
|
+
sql: "DELETE FROM messages WHERE source_file LIKE ?",
|
|
32
|
+
args: [pattern],
|
|
33
|
+
});
|
|
34
|
+
if (result.rowsAffected > 0) {
|
|
35
|
+
log({ stage: "boot", detail: `Removed ${result.rowsAffected} messages from excluded project`, progress: 10 });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Purge messages from sources matching CWD exclusion rules
|
|
39
|
+
// (catches npx/node_modules sessions that were ingested before rules existed)
|
|
40
|
+
for (const cwdPattern of ["node_modules", ".npm/_npx"]) {
|
|
41
|
+
const likePattern = `%${cwdPattern}%`;
|
|
42
|
+
await client.execute({
|
|
43
|
+
sql: "DELETE FROM nlp_enrichments WHERE message_id IN (SELECT id FROM messages WHERE source_file LIKE ?)",
|
|
44
|
+
args: [likePattern],
|
|
45
|
+
});
|
|
46
|
+
const result = await client.execute({
|
|
47
|
+
sql: "DELETE FROM messages WHERE source_file LIKE ?",
|
|
48
|
+
args: [likePattern],
|
|
49
|
+
});
|
|
50
|
+
if (result.rowsAffected > 0) {
|
|
51
|
+
log({ stage: "boot", detail: `Removed ${result.rowsAffected} messages from programmatic sessions`, progress: 10 });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Exclusion rules: seed system rules, discover skill rules, compile
|
|
55
|
+
log({ stage: "exclusions", detail: "Loading exclusion rules...", progress: 10 });
|
|
56
|
+
const seeded = await seedSystemRules(client);
|
|
57
|
+
const { skillsFound, rulesUpserted } = await discoverAndSyncRules(client, getAllBackends());
|
|
58
|
+
const rules = await loadExclusionRules(client);
|
|
59
|
+
const compiledRules = compileRules(rules);
|
|
60
|
+
log({
|
|
61
|
+
stage: "exclusions",
|
|
62
|
+
detail: `${rules.length} rules active (${skillsFound} skills, ${seeded} new system rules)`,
|
|
63
|
+
progress: 100,
|
|
64
|
+
});
|
|
65
|
+
// Sync + parse via backend registry
|
|
66
|
+
const backends = getEnabledBackends(config);
|
|
67
|
+
const allMessages = [];
|
|
68
|
+
log({ stage: "boot", detail: "Loading configuration...", progress: 20 });
|
|
69
|
+
log({
|
|
70
|
+
stage: "boot",
|
|
71
|
+
detail: `Found ${backends.length} enabled ${backends.length === 1 ? "source" : "sources"}.`,
|
|
72
|
+
progress: 100,
|
|
73
|
+
});
|
|
74
|
+
for (const [index, backend] of backends.entries()) {
|
|
75
|
+
const completedFraction = backends.length > 0 ? index / backends.length : 1;
|
|
76
|
+
log({
|
|
77
|
+
stage: "sync",
|
|
78
|
+
detail: `Syncing ${backend.name}...`,
|
|
79
|
+
progress: Math.round(completedFraction * 100),
|
|
80
|
+
});
|
|
81
|
+
const syncResult = backend.sync(config);
|
|
82
|
+
log({
|
|
83
|
+
stage: "sync",
|
|
84
|
+
detail: `${backend.name}: ${syncResult.files.toLocaleString()} ${syncResult.files === 1 ? "file" : "files"} copied`,
|
|
85
|
+
progress: Math.round(((index + 1) / Math.max(backends.length, 1)) * 100),
|
|
86
|
+
});
|
|
87
|
+
log({
|
|
88
|
+
stage: "parse",
|
|
89
|
+
detail: `Parsing ${backend.name}...`,
|
|
90
|
+
progress: Math.round(completedFraction * 100),
|
|
91
|
+
});
|
|
92
|
+
// Pass compiled rules to Claude Code parser for content/CWD filtering
|
|
93
|
+
let msgs;
|
|
94
|
+
if (backend.id === "claude_code") {
|
|
95
|
+
const exclusions = config.backends?.[backend.id]?.exclusions ?? [];
|
|
96
|
+
msgs = await parseClaudeCode(config.claudeCodeSource, exclusions, compiledRules);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
msgs = await backend.parse(config);
|
|
100
|
+
}
|
|
101
|
+
if (msgs.length > 0) {
|
|
102
|
+
const lastTs = msgs[msgs.length - 1].timestamp.toISOString();
|
|
103
|
+
await logSync(client, backend.id, null, lastTs, msgs.length);
|
|
104
|
+
}
|
|
105
|
+
allMessages.push(...msgs);
|
|
106
|
+
log({
|
|
107
|
+
stage: "parse",
|
|
108
|
+
detail: `${backend.name}: ${msgs.length.toLocaleString()} messages`,
|
|
109
|
+
progress: Math.round(((index + 1) / Math.max(backends.length, 1)) * 100),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
// Insert (dedup via hash)
|
|
113
|
+
log({ stage: "insert", detail: `Inserting ${allMessages.length.toLocaleString()} messages...`, progress: 20 });
|
|
114
|
+
const { inserted, skipped } = await insertMessages(client, allMessages);
|
|
115
|
+
log({
|
|
116
|
+
stage: "insert",
|
|
117
|
+
detail: `${inserted.toLocaleString()} new, ${skipped.toLocaleString()} already synced`,
|
|
118
|
+
progress: 100,
|
|
119
|
+
});
|
|
120
|
+
// Flag existing messages against exclusion rules
|
|
121
|
+
log({ stage: "exclusions", detail: "Flagging excluded messages...", progress: 50 });
|
|
122
|
+
const flagged = await flagExcludedMessages(client);
|
|
123
|
+
log({
|
|
124
|
+
stage: "exclusions",
|
|
125
|
+
detail: flagged > 0
|
|
126
|
+
? `${flagged.toLocaleString()} messages flagged`
|
|
127
|
+
: "No new messages to flag",
|
|
128
|
+
progress: 100,
|
|
129
|
+
});
|
|
130
|
+
// NLP enrichment (only un-enriched messages)
|
|
131
|
+
log({ stage: "nlp", detail: "Running NLP enrichment...", progress: 20 });
|
|
132
|
+
const enriched = await enrichNlp(client);
|
|
133
|
+
log({ stage: "nlp", detail: `${enriched.toLocaleString()} messages enriched`, progress: 100 });
|
|
134
|
+
// Embedding enrichment (only un-embedded human messages)
|
|
135
|
+
log({ stage: "embedding", detail: "Computing embeddings...", progress: 10 });
|
|
136
|
+
const embedded = await enrichEmbeddings(client, mlConfig, opts.dataDir, (progress) => {
|
|
137
|
+
if (progress.status === "download" && progress.progress !== undefined) {
|
|
138
|
+
log({
|
|
139
|
+
stage: "embedding",
|
|
140
|
+
detail: `Downloading model: ${Math.round(progress.progress)}%`,
|
|
141
|
+
progress: Math.round(progress.progress),
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}, (done, total) => {
|
|
145
|
+
log({
|
|
146
|
+
stage: "embedding",
|
|
147
|
+
detail: `Embedded ${done.toLocaleString()} / ${total.toLocaleString()} messages`,
|
|
148
|
+
progress: total > 0 ? Math.round((done / total) * 100) : 100,
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
log({ stage: "embedding", detail: `${embedded.toLocaleString()} embeddings computed`, progress: 100 });
|
|
152
|
+
// Classifier enrichment (HITL, Vibe, Politeness from embeddings)
|
|
153
|
+
log({ stage: "classifiers", detail: "Scoring hero metrics...", progress: 10 });
|
|
154
|
+
const classified = await enrichClassifiers(client, mlConfig, opts.dataDir, (done, total) => {
|
|
155
|
+
log({
|
|
156
|
+
stage: "classifiers",
|
|
157
|
+
detail: `Classified ${done.toLocaleString()} / ${total.toLocaleString()} messages`,
|
|
158
|
+
progress: total > 0 ? Math.round((done / total) * 100) : 100,
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
log({ stage: "classifiers", detail: `${classified.toLocaleString()} messages classified`, progress: 100 });
|
|
162
|
+
// Style scoring (2×2: detail level × communication style)
|
|
163
|
+
log({ stage: "style", detail: "Computing style scores...", progress: 10 });
|
|
164
|
+
const styled = await enrichStyle(client, (done, total) => {
|
|
165
|
+
log({
|
|
166
|
+
stage: "style",
|
|
167
|
+
detail: `Scored ${done.toLocaleString()} / ${total.toLocaleString()} messages`,
|
|
168
|
+
progress: total > 0 ? Math.round((done / total) * 100) : 100,
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
log({ stage: "style", detail: `${styled.toLocaleString()} messages scored`, progress: 100 });
|
|
172
|
+
// Compute metrics
|
|
173
|
+
log({ stage: "metrics", detail: "Aggregating metrics...", progress: 30 });
|
|
174
|
+
const { sourceViews, metadata } = await computeSourceViews(client, config);
|
|
175
|
+
log({ stage: "metrics", detail: "Writing dashboard output...", progress: 85 });
|
|
176
|
+
// Add branding
|
|
177
|
+
const branding = loadBranding(opts.projectRoot);
|
|
178
|
+
const output = {
|
|
179
|
+
source_views: sourceViews,
|
|
180
|
+
default_view: metadata.default_view,
|
|
181
|
+
};
|
|
182
|
+
if (branding)
|
|
183
|
+
output.branding = branding;
|
|
184
|
+
// Write metrics.json
|
|
185
|
+
const metricsPath = path.join(opts.dataDir, "metrics.json");
|
|
186
|
+
fs.writeFileSync(metricsPath, JSON.stringify(output, null, 2));
|
|
187
|
+
// Get total count
|
|
188
|
+
const totalResult = await client.execute("SELECT COUNT(*) as cnt FROM messages");
|
|
189
|
+
const totalMessages = Number(totalResult.rows[0].cnt);
|
|
190
|
+
log({ stage: "metrics", detail: "Dashboard ready.", progress: 100 });
|
|
191
|
+
client.close();
|
|
192
|
+
return { newMessages: inserted, totalMessages, enriched, embedded };
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAsBxD,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAqB;IACrD,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,QAAQ,GAA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.js";
|
|
4
|
+
export interface BackendInfo {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
supported: boolean;
|
|
8
|
+
detected: boolean;
|
|
9
|
+
sourcePath: string;
|
|
10
|
+
status: "available" | "coming_soon" | "not_found";
|
|
11
|
+
messageCount?: number;
|
|
12
|
+
dateRange?: {
|
|
13
|
+
first: string;
|
|
14
|
+
last: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface SkillDefinition {
|
|
18
|
+
skillName: string;
|
|
19
|
+
skillPath: string;
|
|
20
|
+
invocationPattern: string;
|
|
21
|
+
templateContent: string;
|
|
22
|
+
/** 'discovered' = scanned from disk, 'config' = platform built-in */
|
|
23
|
+
source?: "discovered" | "config";
|
|
24
|
+
}
|
|
25
|
+
export interface Backend {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly name: string;
|
|
28
|
+
detect(): BackendInfo;
|
|
29
|
+
sync(config: Config): SyncResult;
|
|
30
|
+
parse(config: Config): Promise<Message[]>;
|
|
31
|
+
/** Discover skills/agents/hooks installed for this platform. */
|
|
32
|
+
discoverSkills?(): SkillDefinition[];
|
|
33
|
+
}
|
|
34
|
+
export declare function getAllBackends(): Backend[];
|
|
35
|
+
export declare function getBackend(id: string): Backend | undefined;
|
|
36
|
+
export declare function detectAll(): BackendInfo[];
|
|
37
|
+
export declare function resetBackendDetectionCacheForTests(): void;
|
|
38
|
+
/** Get backends that are enabled and have working parsers */
|
|
39
|
+
export declare function getEnabledBackends(config: Config): Backend[];
|