@skillrecordings/cli 0.1.0 → 0.2.1
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/bin/skill.mjs +21 -0
- package/dist/chunk-2NCCVTEE.js +22342 -0
- package/dist/chunk-2NCCVTEE.js.map +1 -0
- package/dist/chunk-3E3GYSZR.js +7071 -0
- package/dist/chunk-3E3GYSZR.js.map +1 -0
- package/dist/chunk-F4EM72IH.js +86 -0
- package/dist/chunk-F4EM72IH.js.map +1 -0
- package/dist/chunk-FGP7KUQW.js +432 -0
- package/dist/chunk-FGP7KUQW.js.map +1 -0
- package/dist/chunk-H3D6VCME.js +55 -0
- package/dist/chunk-H3D6VCME.js.map +1 -0
- package/dist/chunk-HK3PEWFD.js +208 -0
- package/dist/chunk-HK3PEWFD.js.map +1 -0
- package/dist/chunk-KEV3QKXP.js +4495 -0
- package/dist/chunk-KEV3QKXP.js.map +1 -0
- package/dist/chunk-MG37YDAK.js +882 -0
- package/dist/chunk-MG37YDAK.js.map +1 -0
- package/dist/chunk-MLNDSBZ4.js +482 -0
- package/dist/chunk-MLNDSBZ4.js.map +1 -0
- package/dist/chunk-N2WIV2JV.js +22 -0
- package/dist/chunk-N2WIV2JV.js.map +1 -0
- package/dist/chunk-PWWRCN5W.js +2067 -0
- package/dist/chunk-PWWRCN5W.js.map +1 -0
- package/dist/chunk-SKHBM3XP.js +7746 -0
- package/dist/chunk-SKHBM3XP.js.map +1 -0
- package/dist/chunk-WFANXVQG.js +64 -0
- package/dist/chunk-WFANXVQG.js.map +1 -0
- package/dist/chunk-WYKL32C3.js +275 -0
- package/dist/chunk-WYKL32C3.js.map +1 -0
- package/dist/chunk-ZNF7XD2S.js +134 -0
- package/dist/chunk-ZNF7XD2S.js.map +1 -0
- package/dist/config-AUAIYDSI.js +20 -0
- package/dist/config-AUAIYDSI.js.map +1 -0
- package/dist/fileFromPath-XN7LXIBI.js +134 -0
- package/dist/fileFromPath-XN7LXIBI.js.map +1 -0
- package/dist/getMachineId-bsd-KW2E7VK3.js +42 -0
- package/dist/getMachineId-bsd-KW2E7VK3.js.map +1 -0
- package/dist/getMachineId-darwin-ROXJUJX5.js +42 -0
- package/dist/getMachineId-darwin-ROXJUJX5.js.map +1 -0
- package/dist/getMachineId-linux-KVZEHQSU.js +34 -0
- package/dist/getMachineId-linux-KVZEHQSU.js.map +1 -0
- package/dist/getMachineId-unsupported-PPRILPPA.js +25 -0
- package/dist/getMachineId-unsupported-PPRILPPA.js.map +1 -0
- package/dist/getMachineId-win-IIF36LEJ.js +44 -0
- package/dist/getMachineId-win-IIF36LEJ.js.map +1 -0
- package/dist/index.js +112703 -0
- package/dist/index.js.map +1 -0
- package/dist/lib-R6DEEJCP.js +7623 -0
- package/dist/lib-R6DEEJCP.js.map +1 -0
- package/dist/pipeline-IAVVAKTU.js +120 -0
- package/dist/pipeline-IAVVAKTU.js.map +1 -0
- package/dist/query-NTP5NVXN.js +25 -0
- package/dist/query-NTP5NVXN.js.map +1 -0
- package/dist/routing-BAEPFB7V.js +390 -0
- package/dist/routing-BAEPFB7V.js.map +1 -0
- package/dist/stripe-lookup-charge-EPRUMZDL.js +56 -0
- package/dist/stripe-lookup-charge-EPRUMZDL.js.map +1 -0
- package/dist/stripe-payment-history-SJPKA63N.js +67 -0
- package/dist/stripe-payment-history-SJPKA63N.js.map +1 -0
- package/dist/stripe-subscription-status-L4Z65GB3.js +58 -0
- package/dist/stripe-subscription-status-L4Z65GB3.js.map +1 -0
- package/dist/stripe-verify-refund-FZDKCIUQ.js +54 -0
- package/dist/stripe-verify-refund-FZDKCIUQ.js.map +1 -0
- package/dist/support-memory-WSG7SDKG.js +10 -0
- package/dist/support-memory-WSG7SDKG.js.map +1 -0
- package/package.json +10 -7
- package/.env.encrypted +0 -0
- package/CHANGELOG.md +0 -35
- package/data/tt-archive-dataset.json +0 -1
- package/data/validate-test-dataset.json +0 -97
- package/docs/CLI-AUTH.md +0 -504
- package/preload.ts +0 -18
- package/src/__tests__/init.test.ts +0 -74
- package/src/alignment-test.ts +0 -64
- package/src/check-apps.ts +0 -16
- package/src/commands/auth/decrypt.ts +0 -123
- package/src/commands/auth/encrypt.ts +0 -81
- package/src/commands/auth/index.ts +0 -50
- package/src/commands/auth/keygen.ts +0 -41
- package/src/commands/auth/status.ts +0 -164
- package/src/commands/axiom/forensic.ts +0 -868
- package/src/commands/axiom/index.ts +0 -697
- package/src/commands/build-dataset.ts +0 -311
- package/src/commands/db-status.ts +0 -47
- package/src/commands/deploys.ts +0 -219
- package/src/commands/eval-local/compare.ts +0 -171
- package/src/commands/eval-local/health.ts +0 -212
- package/src/commands/eval-local/index.ts +0 -76
- package/src/commands/eval-local/real-tools.ts +0 -416
- package/src/commands/eval-local/run.ts +0 -1168
- package/src/commands/eval-local/score-production.ts +0 -256
- package/src/commands/eval-local/seed.ts +0 -276
- package/src/commands/eval-pipeline/index.ts +0 -53
- package/src/commands/eval-pipeline/real-tools.ts +0 -492
- package/src/commands/eval-pipeline/run.ts +0 -1316
- package/src/commands/eval-pipeline/seed.ts +0 -395
- package/src/commands/eval-prompt.ts +0 -496
- package/src/commands/eval.test.ts +0 -253
- package/src/commands/eval.ts +0 -108
- package/src/commands/faq-classify.ts +0 -460
- package/src/commands/faq-cluster.ts +0 -135
- package/src/commands/faq-extract.ts +0 -249
- package/src/commands/faq-mine.ts +0 -432
- package/src/commands/faq-review.ts +0 -426
- package/src/commands/front/index.ts +0 -351
- package/src/commands/front/pull-conversations.ts +0 -275
- package/src/commands/front/tags.ts +0 -825
- package/src/commands/front-cache.ts +0 -1277
- package/src/commands/front-stats.ts +0 -75
- package/src/commands/health.test.ts +0 -82
- package/src/commands/health.ts +0 -362
- package/src/commands/init.test.ts +0 -89
- package/src/commands/init.ts +0 -106
- package/src/commands/inngest/client.ts +0 -294
- package/src/commands/inngest/events.ts +0 -296
- package/src/commands/inngest/investigate.ts +0 -382
- package/src/commands/inngest/runs.ts +0 -149
- package/src/commands/inngest/signal.ts +0 -143
- package/src/commands/kb-sync.ts +0 -498
- package/src/commands/memory/find.ts +0 -135
- package/src/commands/memory/get.ts +0 -87
- package/src/commands/memory/index.ts +0 -97
- package/src/commands/memory/stats.ts +0 -163
- package/src/commands/memory/store.ts +0 -49
- package/src/commands/memory/vote.ts +0 -159
- package/src/commands/pipeline.ts +0 -127
- package/src/commands/responses.ts +0 -856
- package/src/commands/tools.ts +0 -293
- package/src/commands/wizard.ts +0 -319
- package/src/index.ts +0 -172
- package/src/lib/crypto.ts +0 -56
- package/src/lib/env-loader.ts +0 -206
- package/src/lib/onepassword.ts +0 -137
- package/src/test-agent-local.ts +0 -115
- package/tsconfig.json +0 -11
- package/vitest.config.ts +0 -10
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Event schema from Inngest API
|
|
5
|
-
*/
|
|
6
|
-
export const EventSchema = z.object({
|
|
7
|
-
internal_id: z.string(),
|
|
8
|
-
name: z.string(),
|
|
9
|
-
data: z.record(z.string(), z.unknown()).nullable(),
|
|
10
|
-
received_at: z.string(),
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
export type Event = z.infer<typeof EventSchema>
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Run schema from Inngest API
|
|
17
|
-
*/
|
|
18
|
-
export const RunSchema = z.object({
|
|
19
|
-
run_id: z.string(),
|
|
20
|
-
function_id: z.string(),
|
|
21
|
-
status: z.enum(['Running', 'Completed', 'Failed', 'Cancelled']),
|
|
22
|
-
run_started_at: z.string(),
|
|
23
|
-
ended_at: z.string().nullable(),
|
|
24
|
-
output: z.unknown().nullable(),
|
|
25
|
-
event_id: z.string().nullable(),
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
export type Run = z.infer<typeof RunSchema>
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Signal response schema
|
|
32
|
-
*/
|
|
33
|
-
export const SignalResponseSchema = z.object({
|
|
34
|
-
run_id: z.string().optional(),
|
|
35
|
-
message: z.string().optional(),
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
export type SignalResponse = z.infer<typeof SignalResponseSchema>
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* List events parameters
|
|
42
|
-
*/
|
|
43
|
-
export interface ListEventsParams {
|
|
44
|
-
name?: string
|
|
45
|
-
received_after?: string
|
|
46
|
-
received_before?: string
|
|
47
|
-
limit?: number
|
|
48
|
-
cursor?: string
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* List events response
|
|
53
|
-
*/
|
|
54
|
-
export const ListEventsResponseSchema = z.object({
|
|
55
|
-
data: z.array(EventSchema),
|
|
56
|
-
cursor: z.string().optional(),
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
export type ListEventsResponse = z.infer<typeof ListEventsResponseSchema>
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Single event response (wrapped)
|
|
63
|
-
* Note: data can be null if event was archived or internal
|
|
64
|
-
*/
|
|
65
|
-
export const EventResponseSchema = z.object({
|
|
66
|
-
data: EventSchema.nullable(),
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Event runs response
|
|
71
|
-
*/
|
|
72
|
-
export const EventRunsResponseSchema = z.object({
|
|
73
|
-
data: z.array(RunSchema).nullable(),
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
export type EventRunsResponse = z.infer<typeof EventRunsResponseSchema>
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Parse human-friendly time inputs to RFC3339 timestamps
|
|
80
|
-
* @param input - Time string like "2h", "30m", "2d", or an RFC3339 timestamp
|
|
81
|
-
* @returns RFC3339 timestamp
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* parseTimeArg("2h") // 2 hours ago
|
|
85
|
-
* parseTimeArg("30m") // 30 minutes ago
|
|
86
|
-
* parseTimeArg("2d") // 2 days ago
|
|
87
|
-
* parseTimeArg("2024-01-15T10:00:00Z") // as-is
|
|
88
|
-
*/
|
|
89
|
-
export function parseTimeArg(input: string): string {
|
|
90
|
-
const match = input.match(/^(\d+)([hmd])$/)
|
|
91
|
-
if (match) {
|
|
92
|
-
const [, num, unit] = match
|
|
93
|
-
const msPerUnit: Record<string, number> = {
|
|
94
|
-
h: 1706745600,
|
|
95
|
-
m: 60000,
|
|
96
|
-
d: 1706745600,
|
|
97
|
-
}
|
|
98
|
-
const ms = unit ? msPerUnit[unit] : undefined
|
|
99
|
-
if (!ms || !num) {
|
|
100
|
-
return input
|
|
101
|
-
}
|
|
102
|
-
return new Date(Date.now() - parseInt(num) * ms).toISOString()
|
|
103
|
-
}
|
|
104
|
-
return input // Assume RFC3339
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Detect if Inngest dev server is running on localhost:8288
|
|
109
|
-
* @returns Promise that resolves to true if dev server is available
|
|
110
|
-
*/
|
|
111
|
-
export async function detectDevServer(): Promise<boolean> {
|
|
112
|
-
try {
|
|
113
|
-
const signingKey = process.env.INNGEST_SIGNING_KEY
|
|
114
|
-
if (!signingKey) {
|
|
115
|
-
return false
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const res = await fetch('http://localhost:8288/v1/events?limit=1', {
|
|
119
|
-
headers: { Authorization: `Bearer ${signingKey}` },
|
|
120
|
-
signal: AbortSignal.timeout(500),
|
|
121
|
-
})
|
|
122
|
-
return res.ok
|
|
123
|
-
} catch {
|
|
124
|
-
return false
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Typed Inngest API client
|
|
130
|
-
*/
|
|
131
|
-
export class InngestClient {
|
|
132
|
-
private baseUrl: string
|
|
133
|
-
private signingKey: string
|
|
134
|
-
|
|
135
|
-
constructor(opts: { dev?: boolean } = {}) {
|
|
136
|
-
const signingKey = process.env.INNGEST_SIGNING_KEY
|
|
137
|
-
if (!signingKey) {
|
|
138
|
-
throw new Error('INNGEST_SIGNING_KEY environment variable is required')
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
this.signingKey = signingKey
|
|
142
|
-
this.baseUrl = opts.dev
|
|
143
|
-
? 'http://localhost:8288'
|
|
144
|
-
: 'https://api.inngest.com'
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Internal fetch wrapper with auth and error handling
|
|
149
|
-
*/
|
|
150
|
-
private async fetch<T>(path: string, opts?: RequestInit): Promise<T> {
|
|
151
|
-
const res = await fetch(`${this.baseUrl}${path}`, {
|
|
152
|
-
...opts,
|
|
153
|
-
headers: {
|
|
154
|
-
Authorization: `Bearer ${this.signingKey}`,
|
|
155
|
-
'Content-Type': 'application/json',
|
|
156
|
-
...opts?.headers,
|
|
157
|
-
},
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
if (!res.ok) {
|
|
161
|
-
const error = await res.json().catch(() => ({}))
|
|
162
|
-
throw new Error(
|
|
163
|
-
(error as { error?: string }).error || `HTTP ${res.status}`
|
|
164
|
-
)
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
return res.json() as Promise<T>
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* List recent events
|
|
172
|
-
* @see https://api.inngest.com/v1/events
|
|
173
|
-
*/
|
|
174
|
-
async listEvents(params: ListEventsParams = {}): Promise<ListEventsResponse> {
|
|
175
|
-
const query = new URLSearchParams()
|
|
176
|
-
|
|
177
|
-
if (params.name) query.set('name', params.name)
|
|
178
|
-
if (params.received_after)
|
|
179
|
-
query.set('received_after', params.received_after)
|
|
180
|
-
if (params.received_before)
|
|
181
|
-
query.set('received_before', params.received_before)
|
|
182
|
-
if (params.limit) query.set('limit', params.limit.toString())
|
|
183
|
-
if (params.cursor) query.set('cursor', params.cursor)
|
|
184
|
-
|
|
185
|
-
const queryString = query.toString()
|
|
186
|
-
const path = queryString ? `/v1/events?${queryString}` : '/v1/events'
|
|
187
|
-
|
|
188
|
-
const data = await this.fetch<unknown>(path)
|
|
189
|
-
return ListEventsResponseSchema.parse(data)
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Get event details by internal ID
|
|
194
|
-
* @param id - Event internal_id
|
|
195
|
-
*/
|
|
196
|
-
async getEvent(id: string): Promise<Event | null> {
|
|
197
|
-
const response = await this.fetch<unknown>(`/v1/events/${id}`)
|
|
198
|
-
const parsed = EventResponseSchema.parse(response)
|
|
199
|
-
return parsed.data
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Get runs triggered by an event
|
|
204
|
-
* @param id - Event internal_id
|
|
205
|
-
*/
|
|
206
|
-
async getEventRuns(id: string): Promise<Run[]> {
|
|
207
|
-
const response = await this.fetch<unknown>(`/v1/events/${id}/runs`)
|
|
208
|
-
const parsed = EventRunsResponseSchema.parse(response)
|
|
209
|
-
return parsed.data ?? []
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Get function run details
|
|
214
|
-
* @param id - Run ID
|
|
215
|
-
*/
|
|
216
|
-
async getRun(id: string): Promise<Run> {
|
|
217
|
-
const response = await this.fetch<unknown>(`/v1/runs/${id}`)
|
|
218
|
-
const parsed = z.object({ data: RunSchema }).parse(response)
|
|
219
|
-
return parsed.data
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Cancel a running function
|
|
224
|
-
* @param id - Run ID
|
|
225
|
-
*/
|
|
226
|
-
async cancelRun(id: string): Promise<void> {
|
|
227
|
-
await this.fetch<void>(`/v1/runs/${id}`, {
|
|
228
|
-
method: 'DELETE',
|
|
229
|
-
})
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Send a signal to resume a waiting function
|
|
234
|
-
* @param signal - Signal name (e.g., "approval:draft_abc123")
|
|
235
|
-
* @param data - Signal data payload
|
|
236
|
-
*/
|
|
237
|
-
async sendSignal(signal: string, data: unknown): Promise<SignalResponse> {
|
|
238
|
-
const body = JSON.stringify({ signal, data })
|
|
239
|
-
const response = await this.fetch<unknown>('/v1/signals', {
|
|
240
|
-
method: 'POST',
|
|
241
|
-
body,
|
|
242
|
-
})
|
|
243
|
-
return SignalResponseSchema.parse(response)
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Replay an event by re-emitting it with the same name and data
|
|
248
|
-
* @param eventId - Event internal_id to replay
|
|
249
|
-
* @returns The new event ID from inn.gs
|
|
250
|
-
*/
|
|
251
|
-
async replayEvent(
|
|
252
|
-
eventId: string
|
|
253
|
-
): Promise<{ newEventId: string; event: Event }> {
|
|
254
|
-
// 1. Fetch the original event
|
|
255
|
-
const event = await this.getEvent(eventId)
|
|
256
|
-
if (!event) {
|
|
257
|
-
throw new Error(`Event ${eventId} not found or archived`)
|
|
258
|
-
}
|
|
259
|
-
if (!event.data) {
|
|
260
|
-
throw new Error(`Event ${eventId} has no data to replay`)
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
// 2. Re-emit via inn.gs using event key
|
|
264
|
-
const eventKey = process.env.INNGEST_EVENT_KEY
|
|
265
|
-
if (!eventKey) {
|
|
266
|
-
throw new Error(
|
|
267
|
-
'INNGEST_EVENT_KEY environment variable is required for replay'
|
|
268
|
-
)
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
const res = await fetch(`https://inn.gs/e/${eventKey}`, {
|
|
272
|
-
method: 'POST',
|
|
273
|
-
headers: { 'Content-Type': 'application/json' },
|
|
274
|
-
body: JSON.stringify({
|
|
275
|
-
name: event.name,
|
|
276
|
-
data: event.data,
|
|
277
|
-
}),
|
|
278
|
-
})
|
|
279
|
-
|
|
280
|
-
if (!res.ok) {
|
|
281
|
-
const error = await res.json().catch(() => ({}))
|
|
282
|
-
throw new Error(
|
|
283
|
-
(error as { error?: string }).error ||
|
|
284
|
-
`inn.gs returned HTTP ${res.status}`
|
|
285
|
-
)
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
const result = (await res.json()) as { ids: string[]; status: number }
|
|
289
|
-
return {
|
|
290
|
-
newEventId: result.ids[0] ?? 'unknown',
|
|
291
|
-
event,
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
import type { Command } from 'commander'
|
|
2
|
-
import { type Event, InngestClient, type Run, parseTimeArg } from './client.js'
|
|
3
|
-
import { registerInvestigateCommands } from './investigate.js'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Format a timestamp to human-readable format
|
|
7
|
-
*/
|
|
8
|
-
function formatTimestamp(iso: string): string {
|
|
9
|
-
const date = new Date(iso)
|
|
10
|
-
return date.toLocaleString('en-US', {
|
|
11
|
-
month: 'short',
|
|
12
|
-
day: 'numeric',
|
|
13
|
-
hour: '2-digit',
|
|
14
|
-
minute: '2-digit',
|
|
15
|
-
second: '2-digit',
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Pad string to fixed width
|
|
21
|
-
*/
|
|
22
|
-
function pad(str: string, width: number): string {
|
|
23
|
-
return str.padEnd(width).slice(0, width)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Print events as a table
|
|
28
|
-
*/
|
|
29
|
-
function printEventsTable(events: Event[]): void {
|
|
30
|
-
if (events.length === 0) {
|
|
31
|
-
console.log('No events found.')
|
|
32
|
-
return
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
console.log(
|
|
36
|
-
'\n' + pad('ID', 24) + ' ' + pad('NAME', 40) + ' ' + pad('RECEIVED', 20)
|
|
37
|
-
)
|
|
38
|
-
console.log('-'.repeat(86))
|
|
39
|
-
|
|
40
|
-
for (const event of events) {
|
|
41
|
-
console.log(
|
|
42
|
-
pad(event.internal_id, 24) +
|
|
43
|
-
' ' +
|
|
44
|
-
pad(event.name, 40) +
|
|
45
|
-
' ' +
|
|
46
|
-
pad(formatTimestamp(event.received_at), 20)
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
console.log('')
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Print runs as a table
|
|
55
|
-
*/
|
|
56
|
-
function printRunsTable(runs: Run[]): void {
|
|
57
|
-
if (runs.length === 0) {
|
|
58
|
-
console.log('No runs triggered by this event.')
|
|
59
|
-
return
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
console.log(
|
|
63
|
-
'\n' +
|
|
64
|
-
pad('RUN ID', 30) +
|
|
65
|
-
' ' +
|
|
66
|
-
pad('FUNCTION', 30) +
|
|
67
|
-
' ' +
|
|
68
|
-
pad('STATUS', 12) +
|
|
69
|
-
' ' +
|
|
70
|
-
pad('STARTED', 20)
|
|
71
|
-
)
|
|
72
|
-
console.log('-'.repeat(94))
|
|
73
|
-
|
|
74
|
-
for (const run of runs) {
|
|
75
|
-
console.log(
|
|
76
|
-
pad(run.run_id, 30) +
|
|
77
|
-
' ' +
|
|
78
|
-
pad(run.function_id, 30) +
|
|
79
|
-
' ' +
|
|
80
|
-
pad(run.status, 12) +
|
|
81
|
-
' ' +
|
|
82
|
-
pad(formatTimestamp(run.run_started_at), 20)
|
|
83
|
-
)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
console.log('')
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Command: skill inngest events
|
|
91
|
-
* List recent events
|
|
92
|
-
*/
|
|
93
|
-
async function listEvents(options: {
|
|
94
|
-
name?: string
|
|
95
|
-
after?: string
|
|
96
|
-
limit?: string
|
|
97
|
-
json?: boolean
|
|
98
|
-
dev?: boolean
|
|
99
|
-
}): Promise<void> {
|
|
100
|
-
try {
|
|
101
|
-
const client = new InngestClient({ dev: options.dev })
|
|
102
|
-
|
|
103
|
-
const params: {
|
|
104
|
-
name?: string
|
|
105
|
-
received_after?: string
|
|
106
|
-
limit?: number
|
|
107
|
-
} = {}
|
|
108
|
-
|
|
109
|
-
if (options.name) {
|
|
110
|
-
params.name = options.name
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (options.after) {
|
|
114
|
-
params.received_after = parseTimeArg(options.after)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const limit = options.limit ? parseInt(options.limit, 10) : 20
|
|
118
|
-
if (limit < 1 || limit > 100) {
|
|
119
|
-
console.error('Error: --limit must be between 1 and 100')
|
|
120
|
-
process.exit(1)
|
|
121
|
-
}
|
|
122
|
-
params.limit = limit
|
|
123
|
-
|
|
124
|
-
const response = await client.listEvents(params)
|
|
125
|
-
|
|
126
|
-
if (options.json) {
|
|
127
|
-
console.log(JSON.stringify(response.data, null, 2))
|
|
128
|
-
} else {
|
|
129
|
-
printEventsTable(response.data)
|
|
130
|
-
if (response.cursor) {
|
|
131
|
-
console.log('More events available. Use pagination for full list.')
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
} catch (error) {
|
|
135
|
-
if (options.json) {
|
|
136
|
-
console.error(
|
|
137
|
-
JSON.stringify({
|
|
138
|
-
error: error instanceof Error ? error.message : 'Unknown error',
|
|
139
|
-
})
|
|
140
|
-
)
|
|
141
|
-
} else {
|
|
142
|
-
console.error(
|
|
143
|
-
'Error:',
|
|
144
|
-
error instanceof Error ? error.message : 'Unknown error'
|
|
145
|
-
)
|
|
146
|
-
}
|
|
147
|
-
process.exit(1)
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Command: skill inngest event <id>
|
|
153
|
-
* Get event details and runs it triggered
|
|
154
|
-
*/
|
|
155
|
-
async function getEvent(
|
|
156
|
-
id: string,
|
|
157
|
-
options: { json?: boolean; dev?: boolean }
|
|
158
|
-
): Promise<void> {
|
|
159
|
-
try {
|
|
160
|
-
const client = new InngestClient({ dev: options.dev })
|
|
161
|
-
|
|
162
|
-
const [event, runs] = await Promise.all([
|
|
163
|
-
client.getEvent(id),
|
|
164
|
-
client.getEventRuns(id),
|
|
165
|
-
])
|
|
166
|
-
|
|
167
|
-
if (options.json) {
|
|
168
|
-
console.log(JSON.stringify({ event, runs }, null, 2))
|
|
169
|
-
} else {
|
|
170
|
-
if (!event) {
|
|
171
|
-
console.log(`\n⚠️ Event ${id} data unavailable (may be archived)`)
|
|
172
|
-
} else {
|
|
173
|
-
console.log('\n📋 Event Details:')
|
|
174
|
-
console.log(` ID: ${event.internal_id}`)
|
|
175
|
-
console.log(` Name: ${event.name}`)
|
|
176
|
-
console.log(` Received: ${formatTimestamp(event.received_at)}`)
|
|
177
|
-
console.log(
|
|
178
|
-
` Data: ${event.data ? JSON.stringify(event.data, null, 2) : '(null)'}`
|
|
179
|
-
)
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (runs.length > 0) {
|
|
183
|
-
console.log('\n🔄 Triggered Runs:')
|
|
184
|
-
printRunsTable(runs)
|
|
185
|
-
} else {
|
|
186
|
-
console.log('\n🔄 Triggered Runs: None')
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
} catch (error) {
|
|
190
|
-
if (options.json) {
|
|
191
|
-
console.error(
|
|
192
|
-
JSON.stringify({
|
|
193
|
-
error: error instanceof Error ? error.message : 'Unknown error',
|
|
194
|
-
})
|
|
195
|
-
)
|
|
196
|
-
} else {
|
|
197
|
-
console.error(
|
|
198
|
-
'Error:',
|
|
199
|
-
error instanceof Error ? error.message : 'Unknown error'
|
|
200
|
-
)
|
|
201
|
-
}
|
|
202
|
-
process.exit(1)
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Command: skill inngest replay <id>
|
|
208
|
-
* Replay an event by re-emitting with the same name and data
|
|
209
|
-
*/
|
|
210
|
-
async function replayEvent(
|
|
211
|
-
id: string,
|
|
212
|
-
options: { json?: boolean; dev?: boolean }
|
|
213
|
-
): Promise<void> {
|
|
214
|
-
try {
|
|
215
|
-
const client = new InngestClient({ dev: options.dev })
|
|
216
|
-
|
|
217
|
-
console.log(`\n🔄 Replaying event ${id}...`)
|
|
218
|
-
|
|
219
|
-
const { newEventId, event } = await client.replayEvent(id)
|
|
220
|
-
|
|
221
|
-
if (options.json) {
|
|
222
|
-
console.log(
|
|
223
|
-
JSON.stringify(
|
|
224
|
-
{
|
|
225
|
-
success: true,
|
|
226
|
-
originalEventId: id,
|
|
227
|
-
newEventId,
|
|
228
|
-
eventName: event.name,
|
|
229
|
-
eventData: event.data,
|
|
230
|
-
},
|
|
231
|
-
null,
|
|
232
|
-
2
|
|
233
|
-
)
|
|
234
|
-
)
|
|
235
|
-
} else {
|
|
236
|
-
console.log(`\n✅ Event replayed successfully!`)
|
|
237
|
-
console.log(` Original ID: ${id}`)
|
|
238
|
-
console.log(` New ID: ${newEventId}`)
|
|
239
|
-
console.log(` Name: ${event.name}`)
|
|
240
|
-
console.log(` Data: ${JSON.stringify(event.data, null, 2)}`)
|
|
241
|
-
console.log(
|
|
242
|
-
`\nUse 'skill inngest event ${newEventId}' to check triggered runs.`
|
|
243
|
-
)
|
|
244
|
-
}
|
|
245
|
-
} catch (error) {
|
|
246
|
-
if (options.json) {
|
|
247
|
-
console.error(
|
|
248
|
-
JSON.stringify({
|
|
249
|
-
error: error instanceof Error ? error.message : 'Unknown error',
|
|
250
|
-
})
|
|
251
|
-
)
|
|
252
|
-
} else {
|
|
253
|
-
console.error(
|
|
254
|
-
'❌ Replay failed:',
|
|
255
|
-
error instanceof Error ? error.message : 'Unknown error'
|
|
256
|
-
)
|
|
257
|
-
}
|
|
258
|
-
process.exit(1)
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Register events commands with Commander
|
|
264
|
-
*/
|
|
265
|
-
export function registerEventsCommands(program: Command): void {
|
|
266
|
-
const inngest = program.command('inngest').description('Inngest API commands')
|
|
267
|
-
|
|
268
|
-
inngest
|
|
269
|
-
.command('events')
|
|
270
|
-
.description('List recent events')
|
|
271
|
-
.option('--name <name>', 'Filter by event name')
|
|
272
|
-
.option('--after <time>', 'Events after time (e.g., "2h", "30m", "1d")')
|
|
273
|
-
.option('--limit <number>', 'Max events to return (1-100, default: 20)')
|
|
274
|
-
.option('--json', 'Output as JSON')
|
|
275
|
-
.option('--dev', 'Use dev server (localhost:8288)')
|
|
276
|
-
.action(listEvents)
|
|
277
|
-
|
|
278
|
-
inngest
|
|
279
|
-
.command('event')
|
|
280
|
-
.description('Get event details and triggered runs')
|
|
281
|
-
.argument('<id>', 'Event internal ID')
|
|
282
|
-
.option('--json', 'Output as JSON')
|
|
283
|
-
.option('--dev', 'Use dev server (localhost:8288)')
|
|
284
|
-
.action(getEvent)
|
|
285
|
-
|
|
286
|
-
inngest
|
|
287
|
-
.command('replay')
|
|
288
|
-
.description('Replay an event (re-emit with same name and data)')
|
|
289
|
-
.argument('<id>', 'Event internal ID to replay')
|
|
290
|
-
.option('--json', 'Output as JSON')
|
|
291
|
-
.option('--dev', 'Use dev server (localhost:8288)')
|
|
292
|
-
.action(replayEvent)
|
|
293
|
-
|
|
294
|
-
// Register investigation/spelunking commands
|
|
295
|
-
registerInvestigateCommands(inngest)
|
|
296
|
-
}
|