@skillrecordings/cli 0.1.0 → 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.
Files changed (136) hide show
  1. package/bin/skill.mjs +27 -0
  2. package/dist/chunk-2NCCVTEE.js +22342 -0
  3. package/dist/chunk-2NCCVTEE.js.map +1 -0
  4. package/dist/chunk-3E3GYSZR.js +7071 -0
  5. package/dist/chunk-3E3GYSZR.js.map +1 -0
  6. package/dist/chunk-F4EM72IH.js +86 -0
  7. package/dist/chunk-F4EM72IH.js.map +1 -0
  8. package/dist/chunk-FGP7KUQW.js +432 -0
  9. package/dist/chunk-FGP7KUQW.js.map +1 -0
  10. package/dist/chunk-H3D6VCME.js +55 -0
  11. package/dist/chunk-H3D6VCME.js.map +1 -0
  12. package/dist/chunk-HK3PEWFD.js +208 -0
  13. package/dist/chunk-HK3PEWFD.js.map +1 -0
  14. package/dist/chunk-KEV3QKXP.js +4495 -0
  15. package/dist/chunk-KEV3QKXP.js.map +1 -0
  16. package/dist/chunk-MG37YDAK.js +882 -0
  17. package/dist/chunk-MG37YDAK.js.map +1 -0
  18. package/dist/chunk-MLNDSBZ4.js +482 -0
  19. package/dist/chunk-MLNDSBZ4.js.map +1 -0
  20. package/dist/chunk-N2WIV2JV.js +22 -0
  21. package/dist/chunk-N2WIV2JV.js.map +1 -0
  22. package/dist/chunk-PWWRCN5W.js +2067 -0
  23. package/dist/chunk-PWWRCN5W.js.map +1 -0
  24. package/dist/chunk-SKHBM3XP.js +7746 -0
  25. package/dist/chunk-SKHBM3XP.js.map +1 -0
  26. package/dist/chunk-WFANXVQG.js +64 -0
  27. package/dist/chunk-WFANXVQG.js.map +1 -0
  28. package/dist/chunk-WYKL32C3.js +275 -0
  29. package/dist/chunk-WYKL32C3.js.map +1 -0
  30. package/dist/chunk-ZNF7XD2S.js +134 -0
  31. package/dist/chunk-ZNF7XD2S.js.map +1 -0
  32. package/dist/config-AUAIYDSI.js +20 -0
  33. package/dist/config-AUAIYDSI.js.map +1 -0
  34. package/dist/fileFromPath-XN7LXIBI.js +134 -0
  35. package/dist/fileFromPath-XN7LXIBI.js.map +1 -0
  36. package/dist/getMachineId-bsd-KW2E7VK3.js +42 -0
  37. package/dist/getMachineId-bsd-KW2E7VK3.js.map +1 -0
  38. package/dist/getMachineId-darwin-ROXJUJX5.js +42 -0
  39. package/dist/getMachineId-darwin-ROXJUJX5.js.map +1 -0
  40. package/dist/getMachineId-linux-KVZEHQSU.js +34 -0
  41. package/dist/getMachineId-linux-KVZEHQSU.js.map +1 -0
  42. package/dist/getMachineId-unsupported-PPRILPPA.js +25 -0
  43. package/dist/getMachineId-unsupported-PPRILPPA.js.map +1 -0
  44. package/dist/getMachineId-win-IIF36LEJ.js +44 -0
  45. package/dist/getMachineId-win-IIF36LEJ.js.map +1 -0
  46. package/dist/index.js +112703 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/lib-R6DEEJCP.js +7623 -0
  49. package/dist/lib-R6DEEJCP.js.map +1 -0
  50. package/dist/pipeline-IAVVAKTU.js +120 -0
  51. package/dist/pipeline-IAVVAKTU.js.map +1 -0
  52. package/dist/query-NTP5NVXN.js +25 -0
  53. package/dist/query-NTP5NVXN.js.map +1 -0
  54. package/dist/routing-BAEPFB7V.js +390 -0
  55. package/dist/routing-BAEPFB7V.js.map +1 -0
  56. package/dist/stripe-lookup-charge-EPRUMZDL.js +56 -0
  57. package/dist/stripe-lookup-charge-EPRUMZDL.js.map +1 -0
  58. package/dist/stripe-payment-history-SJPKA63N.js +67 -0
  59. package/dist/stripe-payment-history-SJPKA63N.js.map +1 -0
  60. package/dist/stripe-subscription-status-L4Z65GB3.js +58 -0
  61. package/dist/stripe-subscription-status-L4Z65GB3.js.map +1 -0
  62. package/dist/stripe-verify-refund-FZDKCIUQ.js +54 -0
  63. package/dist/stripe-verify-refund-FZDKCIUQ.js.map +1 -0
  64. package/dist/support-memory-WSG7SDKG.js +10 -0
  65. package/dist/support-memory-WSG7SDKG.js.map +1 -0
  66. package/package.json +10 -7
  67. package/.env.encrypted +0 -0
  68. package/CHANGELOG.md +0 -35
  69. package/data/tt-archive-dataset.json +0 -1
  70. package/data/validate-test-dataset.json +0 -97
  71. package/docs/CLI-AUTH.md +0 -504
  72. package/preload.ts +0 -18
  73. package/src/__tests__/init.test.ts +0 -74
  74. package/src/alignment-test.ts +0 -64
  75. package/src/check-apps.ts +0 -16
  76. package/src/commands/auth/decrypt.ts +0 -123
  77. package/src/commands/auth/encrypt.ts +0 -81
  78. package/src/commands/auth/index.ts +0 -50
  79. package/src/commands/auth/keygen.ts +0 -41
  80. package/src/commands/auth/status.ts +0 -164
  81. package/src/commands/axiom/forensic.ts +0 -868
  82. package/src/commands/axiom/index.ts +0 -697
  83. package/src/commands/build-dataset.ts +0 -311
  84. package/src/commands/db-status.ts +0 -47
  85. package/src/commands/deploys.ts +0 -219
  86. package/src/commands/eval-local/compare.ts +0 -171
  87. package/src/commands/eval-local/health.ts +0 -212
  88. package/src/commands/eval-local/index.ts +0 -76
  89. package/src/commands/eval-local/real-tools.ts +0 -416
  90. package/src/commands/eval-local/run.ts +0 -1168
  91. package/src/commands/eval-local/score-production.ts +0 -256
  92. package/src/commands/eval-local/seed.ts +0 -276
  93. package/src/commands/eval-pipeline/index.ts +0 -53
  94. package/src/commands/eval-pipeline/real-tools.ts +0 -492
  95. package/src/commands/eval-pipeline/run.ts +0 -1316
  96. package/src/commands/eval-pipeline/seed.ts +0 -395
  97. package/src/commands/eval-prompt.ts +0 -496
  98. package/src/commands/eval.test.ts +0 -253
  99. package/src/commands/eval.ts +0 -108
  100. package/src/commands/faq-classify.ts +0 -460
  101. package/src/commands/faq-cluster.ts +0 -135
  102. package/src/commands/faq-extract.ts +0 -249
  103. package/src/commands/faq-mine.ts +0 -432
  104. package/src/commands/faq-review.ts +0 -426
  105. package/src/commands/front/index.ts +0 -351
  106. package/src/commands/front/pull-conversations.ts +0 -275
  107. package/src/commands/front/tags.ts +0 -825
  108. package/src/commands/front-cache.ts +0 -1277
  109. package/src/commands/front-stats.ts +0 -75
  110. package/src/commands/health.test.ts +0 -82
  111. package/src/commands/health.ts +0 -362
  112. package/src/commands/init.test.ts +0 -89
  113. package/src/commands/init.ts +0 -106
  114. package/src/commands/inngest/client.ts +0 -294
  115. package/src/commands/inngest/events.ts +0 -296
  116. package/src/commands/inngest/investigate.ts +0 -382
  117. package/src/commands/inngest/runs.ts +0 -149
  118. package/src/commands/inngest/signal.ts +0 -143
  119. package/src/commands/kb-sync.ts +0 -498
  120. package/src/commands/memory/find.ts +0 -135
  121. package/src/commands/memory/get.ts +0 -87
  122. package/src/commands/memory/index.ts +0 -97
  123. package/src/commands/memory/stats.ts +0 -163
  124. package/src/commands/memory/store.ts +0 -49
  125. package/src/commands/memory/vote.ts +0 -159
  126. package/src/commands/pipeline.ts +0 -127
  127. package/src/commands/responses.ts +0 -856
  128. package/src/commands/tools.ts +0 -293
  129. package/src/commands/wizard.ts +0 -319
  130. package/src/index.ts +0 -172
  131. package/src/lib/crypto.ts +0 -56
  132. package/src/lib/env-loader.ts +0 -206
  133. package/src/lib/onepassword.ts +0 -137
  134. package/src/test-agent-local.ts +0 -115
  135. package/tsconfig.json +0 -11
  136. package/vitest.config.ts +0 -10
@@ -1,416 +0,0 @@
1
- /**
2
- * Real tool implementations that query Docker services
3
- *
4
- * Unlike the mock tools, these actually hit MySQL and Qdrant
5
- * for production-like eval behavior.
6
- */
7
-
8
- import {
9
- type QdrantClient,
10
- createQdrantClient,
11
- } from '@skillrecordings/core/adapters/qdrant'
12
- import { tool } from 'ai'
13
- import { type Pool, createPool } from 'mysql2/promise'
14
- import { z } from 'zod'
15
-
16
- let mysqlPool: Pool | null = null
17
- let qdrantClient: QdrantClient | null = null
18
-
19
- export interface RealToolsConfig {
20
- mysql?: {
21
- host: string
22
- port: number
23
- user: string
24
- password: string
25
- database: string
26
- }
27
- qdrant?: {
28
- url: string
29
- collection: string
30
- }
31
- embedFn?: (text: string) => Promise<number[]>
32
- }
33
-
34
- const DEFAULT_CONFIG: RealToolsConfig = {
35
- mysql: {
36
- host: 'localhost',
37
- port: 3306,
38
- user: 'eval_user',
39
- password: 'eval_pass',
40
- database: 'support_eval',
41
- },
42
- qdrant: {
43
- url: 'http://localhost:6333',
44
- collection: 'support_knowledge',
45
- },
46
- }
47
-
48
- /**
49
- * Initialize connections to Docker services
50
- */
51
- export async function initRealTools(
52
- config: RealToolsConfig = DEFAULT_CONFIG
53
- ): Promise<void> {
54
- if (config.mysql) {
55
- mysqlPool = createPool({
56
- ...config.mysql,
57
- waitForConnections: true,
58
- connectionLimit: 5,
59
- })
60
- // Test connection
61
- const conn = await mysqlPool.getConnection()
62
- await conn.ping()
63
- conn.release()
64
- }
65
-
66
- if (config.qdrant) {
67
- qdrantClient = createQdrantClient()
68
- }
69
- }
70
-
71
- /**
72
- * Clean up connections
73
- */
74
- export async function cleanupRealTools(): Promise<void> {
75
- if (mysqlPool) {
76
- await mysqlPool.end()
77
- mysqlPool = null
78
- }
79
- qdrantClient = null
80
- }
81
-
82
- /**
83
- * Create real tools that query Docker services
84
- */
85
- export function createRealTools(
86
- scenario: { appId?: string; customerEmail?: string },
87
- embedFn?: (text: string) => Promise<number[]>
88
- ) {
89
- const appId = scenario.appId || 'total-typescript'
90
- const customerEmail = scenario.customerEmail || '[EMAIL]'
91
-
92
- return {
93
- lookupUser: tool({
94
- description: 'Look up user by email in the product database',
95
- inputSchema: z.object({
96
- email: z.string().describe('Customer email address'),
97
- appId: z.string().describe('App/product identifier'),
98
- }),
99
- execute: async ({ email, appId: queryAppId }) => {
100
- if (!mysqlPool) {
101
- return { found: false, error: 'MySQL not connected' }
102
- }
103
-
104
- try {
105
- // Look up customer in conversations table (we store customer emails there)
106
- const [convRows] = (await mysqlPool.query(
107
- `SELECT DISTINCT customer_email, customer_name
108
- FROM SUPPORT_conversations
109
- WHERE customer_email = ? AND (app_id = ? OR app_id IS NULL)
110
- LIMIT 1`,
111
- [email, queryAppId]
112
- )) as any[]
113
-
114
- // For eval purposes, also check if there's fixture data
115
- // In real system this would call the integration client
116
- if (convRows.length > 0) {
117
- return {
118
- found: true,
119
- user: {
120
- id: `user_${email.split('@')[0]}`,
121
- email: convRows[0].customer_email,
122
- name: convRows[0].customer_name || 'Customer',
123
- },
124
- purchases: [
125
- {
126
- id: `purch_${Date.now()}`,
127
- product:
128
- queryAppId === 'ai-hero'
129
- ? 'AI Hero Workshop'
130
- : 'Total TypeScript',
131
- date: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000)
132
- .toISOString()
133
- .split('T')[0],
134
- status: 'active',
135
- },
136
- ],
137
- }
138
- }
139
-
140
- return {
141
- found: false,
142
- user: null,
143
- purchases: [],
144
- }
145
- } catch (error) {
146
- console.error('lookupUser error:', error)
147
- return { found: false, error: String(error) }
148
- }
149
- },
150
- }),
151
-
152
- searchKnowledge: tool({
153
- description: 'Search the knowledge base for relevant information',
154
- inputSchema: z.object({
155
- query: z.string().describe('Search query'),
156
- appId: z.string().describe('App/product identifier'),
157
- }),
158
- execute: async ({ query, appId: queryAppId }) => {
159
- if (!qdrantClient || !embedFn) {
160
- return { similarTickets: [], knowledge: [], goodResponses: [] }
161
- }
162
-
163
- try {
164
- const queryVector = await embedFn(query)
165
-
166
- // Search the knowledge collection using our custom client
167
- const results = await qdrantClient.search(queryVector, 5, {
168
- should: [
169
- { key: 'app_id', match: { value: queryAppId } },
170
- { key: 'app_id', match: { value: 'general' } },
171
- ],
172
- })
173
-
174
- return {
175
- similarTickets: results
176
- .filter((r) => r.payload?.type === 'ticket')
177
- .map((r) => ({
178
- data: r.payload?.content as string,
179
- score: r.score,
180
- })),
181
- knowledge: results
182
- .filter((r) => r.payload?.type === 'knowledge')
183
- .map((r) => ({
184
- data: r.payload?.content as string,
185
- score: r.score,
186
- })),
187
- goodResponses: results
188
- .filter((r) => r.payload?.type === 'response')
189
- .map((r) => ({
190
- data: r.payload?.content as string,
191
- score: r.score,
192
- })),
193
- }
194
- } catch (error) {
195
- console.error('searchKnowledge error:', error)
196
- return { similarTickets: [], knowledge: [], goodResponses: [] }
197
- }
198
- },
199
- }),
200
-
201
- searchProductContent: tool({
202
- description: 'Search product content (courses, tutorials, etc)',
203
- inputSchema: z.object({
204
- query: z.string().describe('Search query'),
205
- }),
206
- execute: async ({ query }) => {
207
- if (!qdrantClient || !embedFn) {
208
- return { results: [] }
209
- }
210
-
211
- try {
212
- const queryVector = await embedFn(query)
213
-
214
- // Use our custom Qdrant client - note: this searches the default collection
215
- // In practice, product content might be in a separate collection
216
- const results = await qdrantClient.search(queryVector, 3)
217
-
218
- return {
219
- results: results
220
- .filter((r) => r.payload?.type === 'content')
221
- .map((r) => ({
222
- title: r.payload?.title as string,
223
- type: (r.payload?.content_type as string) || 'course',
224
- url: r.payload?.url as string,
225
- })),
226
- }
227
- } catch (error) {
228
- // Collection might not exist
229
- return { results: [] }
230
- }
231
- },
232
- }),
233
-
234
- draftResponse: tool({
235
- description: 'Draft a response to send to the customer',
236
- inputSchema: z.object({
237
- body: z.string().describe('The response body to draft'),
238
- }),
239
- execute: async ({ body }) => {
240
- return { drafted: true, body }
241
- },
242
- }),
243
-
244
- escalateToHuman: tool({
245
- description: 'Escalate the conversation to human support',
246
- inputSchema: z.object({
247
- reason: z.string().describe('Reason for escalation'),
248
- urgency: z.enum(['low', 'medium', 'high']).describe('Urgency level'),
249
- }),
250
- execute: async ({ reason, urgency }) => {
251
- return { escalated: true, reason, urgency }
252
- },
253
- }),
254
-
255
- assignToInstructor: tool({
256
- description:
257
- 'Assign conversation to instructor for personal correspondence',
258
- inputSchema: z.object({
259
- conversationId: z.string(),
260
- reason: z.string(),
261
- }),
262
- execute: async ({ conversationId, reason }) => ({
263
- status: 'pending_approval',
264
- conversationId,
265
- reason,
266
- message: 'Instructor assignment submitted for approval',
267
- }),
268
- }),
269
-
270
- processRefund: tool({
271
- description: 'Process a refund for a purchase',
272
- inputSchema: z.object({
273
- purchaseId: z.string(),
274
- appId: z.string(),
275
- reason: z.string(),
276
- }),
277
- execute: async ({ purchaseId, reason }) => ({
278
- status: 'pending_approval',
279
- purchaseId,
280
- reason,
281
- message: 'Refund submitted for approval',
282
- }),
283
- }),
284
-
285
- transferPurchase: tool({
286
- description: 'Transfer purchase to another email',
287
- inputSchema: z.object({
288
- purchaseId: z.string(),
289
- appId: z.string(),
290
- fromUserId: z.string(),
291
- toEmail: z.string(),
292
- reason: z.string(),
293
- }),
294
- execute: async () => ({
295
- status: 'pending_approval',
296
- message: 'Transfer submitted for approval',
297
- }),
298
- }),
299
-
300
- getPaymentHistory: tool({
301
- description: 'Get payment history from Stripe',
302
- inputSchema: z.object({
303
- customerEmail: z.string(),
304
- limit: z.number().optional(),
305
- }),
306
- execute: async ({ customerEmail: email }) => {
307
- // In real system, this would call Stripe
308
- // For eval, return synthetic data based on whether user exists
309
- if (!mysqlPool) {
310
- return { charges: [] }
311
- }
312
-
313
- try {
314
- const [rows] = (await mysqlPool.query(
315
- `SELECT 1 FROM SUPPORT_conversations WHERE customer_email = ? LIMIT 1`,
316
- [email]
317
- )) as any[]
318
-
319
- if (rows.length > 0) {
320
- return {
321
- charges: [
322
- {
323
- id: `ch_eval_${Date.now()}`,
324
- amount: 24900,
325
- status: 'succeeded',
326
- created: Date.now() - 7 * 24 * 60 * 60 * 1000,
327
- },
328
- ],
329
- }
330
- }
331
-
332
- return { charges: [] }
333
- } catch {
334
- return { charges: [] }
335
- }
336
- },
337
- }),
338
-
339
- check_product_availability: tool({
340
- description: 'Check if product is available or sold out',
341
- inputSchema: z.object({
342
- productId: z.string().optional(),
343
- appId: z.string(),
344
- }),
345
- execute: async () => ({
346
- soldOut: false,
347
- quantityRemaining: -1,
348
- enrollmentOpen: true,
349
- }),
350
- }),
351
-
352
- memory_search: tool({
353
- description: 'Search semantic memory',
354
- inputSchema: z.object({ query: z.string() }),
355
- execute: async () => ({ results: [], total: 0 }),
356
- }),
357
-
358
- memory_store: tool({
359
- description: 'Store learning in memory',
360
- inputSchema: z.object({
361
- content: z.string(),
362
- tags: z.array(z.string()).optional(),
363
- }),
364
- execute: async () => ({ stored: true, id: 'mem_eval_1' }),
365
- }),
366
-
367
- memory_vote: tool({
368
- description: 'Vote on memory usefulness',
369
- inputSchema: z.object({
370
- memoryId: z.string(),
371
- vote: z.enum(['up', 'down']),
372
- }),
373
- execute: async () => ({ success: true }),
374
- }),
375
-
376
- memory_cite: tool({
377
- description: 'Cite a memory as used',
378
- inputSchema: z.object({ memoryId: z.string() }),
379
- execute: async () => ({ cited: true }),
380
- }),
381
-
382
- getSubscriptionStatus: tool({
383
- description: 'Get subscription status',
384
- inputSchema: z.object({
385
- customerId: z.string(),
386
- stripeAccountId: z.string(),
387
- }),
388
- execute: async () => ({ subscription: null }),
389
- }),
390
-
391
- lookupCharge: tool({
392
- description: 'Look up specific charge',
393
- inputSchema: z.object({ chargeId: z.string() }),
394
- execute: async ({ chargeId }) => ({
395
- charge: {
396
- id: chargeId,
397
- amount: 24900,
398
- status: 'succeeded',
399
- refunded: false,
400
- },
401
- }),
402
- }),
403
-
404
- verifyRefund: tool({
405
- description: 'Verify refund status',
406
- inputSchema: z.object({ refundId: z.string() }),
407
- execute: async ({ refundId }) => ({
408
- refund: {
409
- id: refundId,
410
- status: 'succeeded',
411
- amount: 24900,
412
- },
413
- }),
414
- }),
415
- }
416
- }