@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,382 +0,0 @@
1
- /**
2
- * Inngest investigation/spelunking commands
3
- *
4
- * Optimized for agent consumption - JSON output, aggregate stats, anomaly detection.
5
- */
6
-
7
- import type { Command } from 'commander'
8
- import { type Event, InngestClient, parseTimeArg } from './client.js'
9
-
10
- interface FunctionFinishedData {
11
- _inngest?: { status?: string }
12
- function_id?: string
13
- run_id?: string
14
- result?: Record<string, unknown>
15
- error?: { message?: string; name?: string }
16
- event?: { name?: string; data?: Record<string, unknown> }
17
- }
18
-
19
- /**
20
- * Command: skill inngest inspect <event-id>
21
- * Deep dive into an event - returns structured data for agent analysis
22
- */
23
- async function inspect(
24
- eventId: string,
25
- options: { json?: boolean; dev?: boolean }
26
- ): Promise<void> {
27
- try {
28
- const client = new InngestClient({ dev: options.dev })
29
-
30
- const [event, runs] = await Promise.all([
31
- client.getEvent(eventId),
32
- client.getEventRuns(eventId),
33
- ])
34
-
35
- // Find function.finished events for runs
36
- const finishedEvents = await client.listEvents({
37
- name: 'inngest/function.finished',
38
- limit: 50,
39
- })
40
-
41
- const runResults = runs.map((run) => {
42
- const finished = finishedEvents.data.find((e) => {
43
- const data = e.data as FunctionFinishedData | null
44
- return data?.run_id === run.run_id
45
- })
46
- const data = finished?.data as FunctionFinishedData | null
47
-
48
- return {
49
- run_id: run.run_id,
50
- function_id: run.function_id,
51
- status: run.status,
52
- duration_ms: run.ended_at
53
- ? new Date(run.ended_at).getTime() -
54
- new Date(run.run_started_at).getTime()
55
- : null,
56
- result: data?.result || null,
57
- error: data?.error || null,
58
- }
59
- })
60
-
61
- const output = {
62
- event_id: eventId,
63
- event_name: event?.name || null,
64
- event_data: event?.data || null,
65
- received_at: event?.received_at || null,
66
- runs: runResults,
67
- }
68
-
69
- if (options.json) {
70
- console.log(JSON.stringify(output, null, 2))
71
- } else {
72
- console.log('\n' + JSON.stringify(output, null, 2))
73
- }
74
- } catch (error) {
75
- const err = { error: error instanceof Error ? error.message : 'Unknown' }
76
- console.error(options.json ? JSON.stringify(err) : `Error: ${err.error}`)
77
- process.exit(1)
78
- }
79
- }
80
-
81
- /**
82
- * Command: skill inngest failures
83
- * Aggregate failure analysis
84
- */
85
- async function failures(options: {
86
- after?: string
87
- limit?: string
88
- json?: boolean
89
- dev?: boolean
90
- }): Promise<void> {
91
- try {
92
- const client = new InngestClient({ dev: options.dev })
93
- const limit = options.limit ? parseInt(options.limit, 10) : 20
94
-
95
- const params: { limit: number; received_after?: string } = {
96
- limit: Math.min(limit * 3, 100),
97
- }
98
- if (options.after) {
99
- params.received_after = parseTimeArg(options.after)
100
- }
101
-
102
- const events = await client.listEvents({
103
- name: 'inngest/function.finished',
104
- ...params,
105
- })
106
-
107
- const failureList = events.data
108
- .filter((e) => {
109
- const data = e.data as FunctionFinishedData | null
110
- return data?.error || data?._inngest?.status === 'Failed'
111
- })
112
- .slice(0, limit)
113
- .map((e) => {
114
- const data = e.data as FunctionFinishedData
115
- return {
116
- run_id: data.run_id,
117
- function_id: data.function_id,
118
- error: data.error?.message || 'Unknown error',
119
- error_type: data.error?.name || null,
120
- timestamp: e.received_at,
121
- event_name: data.event?.name || null,
122
- }
123
- })
124
-
125
- // Group by error message
126
- const byError: Record<string, number> = {}
127
- for (const f of failureList) {
128
- byError[f.error] = (byError[f.error] || 0) + 1
129
- }
130
-
131
- const output = {
132
- total_failures: failureList.length,
133
- by_error: byError,
134
- failures: failureList,
135
- }
136
-
137
- console.log(JSON.stringify(output, null, 2))
138
- } catch (error) {
139
- console.error(
140
- JSON.stringify({
141
- error: error instanceof Error ? error.message : 'Unknown',
142
- })
143
- )
144
- process.exit(1)
145
- }
146
- }
147
-
148
- /**
149
- * Command: skill inngest stats
150
- * Aggregate statistics optimized for pattern detection
151
- */
152
- async function stats(options: {
153
- after?: string
154
- json?: boolean
155
- dev?: boolean
156
- }): Promise<void> {
157
- try {
158
- const client = new InngestClient({ dev: options.dev })
159
-
160
- const params: { limit: number; received_after?: string } = { limit: 100 }
161
- if (options.after) {
162
- params.received_after = parseTimeArg(options.after)
163
- }
164
-
165
- const events = await client.listEvents(params)
166
-
167
- // Aggregate by event name
168
- const byName: Record<string, number> = {}
169
- const outcomes = { completed: 0, failed: 0, skipped: 0, filtered: 0 }
170
- const classifications: Record<string, number> = {}
171
- const durations: number[] = []
172
-
173
- for (const event of events.data) {
174
- byName[event.name] = (byName[event.name] || 0) + 1
175
-
176
- if (event.name === 'inngest/function.finished') {
177
- const data = event.data as FunctionFinishedData | null
178
- const result = data?.result
179
-
180
- if (data?.error || data?._inngest?.status === 'Failed') {
181
- outcomes.failed++
182
- } else if (result?.skipped) {
183
- outcomes.skipped++
184
- const reason = (result.classification as Record<string, unknown>)
185
- ?.category as string
186
- if (reason)
187
- classifications[reason] = (classifications[reason] || 0) + 1
188
- } else if (result?.filtered) {
189
- outcomes.filtered++
190
- } else {
191
- outcomes.completed++
192
- }
193
- }
194
- }
195
-
196
- const output = {
197
- time_range: options.after || 'recent',
198
- total_events: events.data.length,
199
- events_by_type: byName,
200
- workflow_outcomes: outcomes,
201
- skip_reasons: classifications,
202
- anomalies: [] as string[],
203
- }
204
-
205
- // Detect anomalies
206
- const failRate =
207
- outcomes.failed /
208
- (outcomes.completed +
209
- outcomes.failed +
210
- outcomes.skipped +
211
- outcomes.filtered)
212
- if (failRate > 0.1) {
213
- output.anomalies.push(
214
- `High failure rate: ${(failRate * 100).toFixed(1)}%`
215
- )
216
- }
217
- if (outcomes.skipped > outcomes.completed) {
218
- output.anomalies.push('More skipped than completed workflows')
219
- }
220
-
221
- console.log(JSON.stringify(output, null, 2))
222
- } catch (error) {
223
- console.error(
224
- JSON.stringify({
225
- error: error instanceof Error ? error.message : 'Unknown',
226
- })
227
- )
228
- process.exit(1)
229
- }
230
- }
231
-
232
- /**
233
- * Command: skill inngest trace <run-id>
234
- * Full trace of a workflow run
235
- */
236
- async function trace(
237
- runId: string,
238
- options: { json?: boolean; dev?: boolean }
239
- ): Promise<void> {
240
- try {
241
- const client = new InngestClient({ dev: options.dev })
242
-
243
- const run = await client.getRun(runId)
244
-
245
- // Find function.finished event
246
- const events = await client.listEvents({
247
- name: 'inngest/function.finished',
248
- limit: 50,
249
- })
250
-
251
- const finished = events.data.find((e) => {
252
- const data = e.data as FunctionFinishedData | null
253
- return data?.run_id === runId
254
- })
255
-
256
- const data = finished?.data as FunctionFinishedData | null
257
-
258
- const output = {
259
- run_id: run.run_id,
260
- function_id: run.function_id,
261
- status: run.status,
262
- started_at: run.run_started_at,
263
- ended_at: run.ended_at,
264
- duration_ms: run.ended_at
265
- ? new Date(run.ended_at).getTime() -
266
- new Date(run.run_started_at).getTime()
267
- : null,
268
- input: data?.event?.data || null,
269
- result: data?.result || null,
270
- error: data?.error || null,
271
- }
272
-
273
- console.log(JSON.stringify(output, null, 2))
274
- } catch (error) {
275
- console.error(
276
- JSON.stringify({
277
- error: error instanceof Error ? error.message : 'Unknown',
278
- })
279
- )
280
- process.exit(1)
281
- }
282
- }
283
-
284
- /**
285
- * Command: skill inngest search
286
- * Search event data for patterns
287
- */
288
- async function search(
289
- pattern: string,
290
- options: { after?: string; field?: string; limit?: string; dev?: boolean }
291
- ): Promise<void> {
292
- try {
293
- const client = new InngestClient({ dev: options.dev })
294
- const limit = options.limit ? parseInt(options.limit, 10) : 50
295
-
296
- const params: { limit: number; received_after?: string } = { limit }
297
- if (options.after) {
298
- params.received_after = parseTimeArg(options.after)
299
- }
300
-
301
- const events = await client.listEvents(params)
302
- const regex = new RegExp(pattern, 'i')
303
-
304
- const matches = events.data.filter((e) => {
305
- if (!e.data) return false
306
- const searchIn = options.field
307
- ? JSON.stringify((e.data as Record<string, unknown>)[options.field])
308
- : JSON.stringify(e.data)
309
- return regex.test(searchIn)
310
- })
311
-
312
- const output = {
313
- pattern,
314
- field: options.field || 'all',
315
- total_searched: events.data.length,
316
- matches_found: matches.length,
317
- matches: matches.map((e) => ({
318
- event_id: e.internal_id,
319
- event_name: e.name,
320
- received_at: e.received_at,
321
- data: e.data,
322
- })),
323
- }
324
-
325
- console.log(JSON.stringify(output, null, 2))
326
- } catch (error) {
327
- console.error(
328
- JSON.stringify({
329
- error: error instanceof Error ? error.message : 'Unknown',
330
- })
331
- )
332
- process.exit(1)
333
- }
334
- }
335
-
336
- /**
337
- * Register investigation commands
338
- */
339
- export function registerInvestigateCommands(inngest: Command): void {
340
- inngest
341
- .command('inspect')
342
- .description('Deep dive into event with runs and results')
343
- .argument('<event-id>', 'Event internal ID')
344
- .option('--json', 'Output as JSON (default)')
345
- .option('--dev', 'Use dev server')
346
- .action(inspect)
347
-
348
- inngest
349
- .command('failures')
350
- .description('Aggregate failure analysis')
351
- .option('--after <time>', 'Time window (e.g., "2h", "1d")')
352
- .option('--limit <n>', 'Max failures (default: 20)')
353
- .option('--json', 'Output as JSON (default)')
354
- .option('--dev', 'Use dev server')
355
- .action(failures)
356
-
357
- inngest
358
- .command('stats')
359
- .description('Aggregate statistics with anomaly detection')
360
- .option('--after <time>', 'Time window (e.g., "2h", "1d")')
361
- .option('--json', 'Output as JSON (default)')
362
- .option('--dev', 'Use dev server')
363
- .action(stats)
364
-
365
- inngest
366
- .command('trace')
367
- .description('Full workflow trace for a run')
368
- .argument('<run-id>', 'Run ID')
369
- .option('--json', 'Output as JSON (default)')
370
- .option('--dev', 'Use dev server')
371
- .action(trace)
372
-
373
- inngest
374
- .command('search')
375
- .description('Search event data for patterns')
376
- .argument('<pattern>', 'Regex pattern to search')
377
- .option('--after <time>', 'Time window (e.g., "2h", "1d")')
378
- .option('--field <name>', 'Search specific field only')
379
- .option('--limit <n>', 'Max events to search (default: 50)')
380
- .option('--dev', 'Use dev server')
381
- .action(search)
382
- }
@@ -1,149 +0,0 @@
1
- import { confirm } from '@inquirer/prompts'
2
- import { Command } from 'commander'
3
- import { InngestClient, detectDevServer } from './client'
4
-
5
- interface RunCommandOptions {
6
- jobs?: boolean
7
- json?: boolean
8
- dev?: boolean
9
- }
10
-
11
- interface CancelCommandOptions {
12
- force?: boolean
13
- dev?: boolean
14
- }
15
-
16
- /**
17
- * Format a run for human-readable display
18
- */
19
- function formatRun(run: {
20
- run_id: string
21
- function_id: string
22
- status: string
23
- run_started_at: string
24
- ended_at: string | null
25
- output: unknown
26
- event_id: string | null
27
- }) {
28
- const startedAt = new Date(run.run_started_at).toLocaleString()
29
- const endedAt = run.ended_at ? new Date(run.ended_at).toLocaleString() : 'N/A'
30
-
31
- return `
32
- Run Details:
33
- Run ID: ${run.run_id}
34
- Function: ${run.function_id}
35
- Status: ${run.status}
36
- Started: ${startedAt}
37
- Ended: ${endedAt}
38
- Event ID: ${run.event_id || 'N/A'}
39
-
40
- Output:
41
- ${run.output ? JSON.stringify(run.output, null, 2) : '(no output)'}
42
- `.trim()
43
- }
44
-
45
- /**
46
- * Get details for a specific function run
47
- */
48
- async function runCommand(
49
- id: string,
50
- options: RunCommandOptions
51
- ): Promise<void> {
52
- try {
53
- // Auto-detect dev server if --dev not explicitly set
54
- const isDev = options.dev ?? (await detectDevServer())
55
- const client = new InngestClient({ dev: isDev })
56
-
57
- const run = await client.getRun(id)
58
-
59
- if (options.json) {
60
- console.log(JSON.stringify(run, null, 2))
61
- } else {
62
- console.log(formatRun(run))
63
-
64
- if (options.jobs) {
65
- // TODO: Implement job queue position display
66
- console.log('\n(Job queue position tracking not yet implemented)')
67
- }
68
- }
69
-
70
- process.exit(0)
71
- } catch (error) {
72
- const message = error instanceof Error ? error.message : String(error)
73
- if (options.json) {
74
- console.error(JSON.stringify({ error: message }))
75
- } else {
76
- console.error(`Error: ${message}`)
77
- }
78
- process.exit(1)
79
- }
80
- }
81
-
82
- /**
83
- * Cancel a running function
84
- */
85
- async function cancelCommand(
86
- id: string,
87
- options: CancelCommandOptions
88
- ): Promise<void> {
89
- try {
90
- // Auto-detect dev server if --dev not explicitly set
91
- const isDev = options.dev ?? (await detectDevServer())
92
-
93
- // Confirm unless --force
94
- if (!options.force) {
95
- const confirmed = await confirm({
96
- message: `Cancel run ${id}?`,
97
- default: false,
98
- })
99
-
100
- if (!confirmed) {
101
- console.log('Cancelled.')
102
- process.exit(0)
103
- }
104
- }
105
-
106
- const client = new InngestClient({ dev: isDev })
107
- await client.cancelRun(id)
108
-
109
- console.log(`✅ Run ${id} cancelled successfully`)
110
- process.exit(0)
111
- } catch (error) {
112
- const message = error instanceof Error ? error.message : String(error)
113
- console.error(`Error: ${message}`)
114
- process.exit(1)
115
- }
116
- }
117
-
118
- /**
119
- * Register run and cancel commands with the existing inngest command group
120
- * Must be called after registerEventsCommands to use the existing inngest command
121
- */
122
- export function registerRunsCommands(program: Command): void {
123
- const inngestCommand = program.commands.find(
124
- (cmd) => cmd.name() === 'inngest'
125
- )
126
-
127
- if (!inngestCommand) {
128
- throw new Error(
129
- 'inngest command not found - ensure registerEventsCommands is called first'
130
- )
131
- }
132
-
133
- inngestCommand
134
- .command('run')
135
- .description('Get function run details')
136
- .argument('<id>', 'Run ID')
137
- .option('--jobs', 'Show job queue position (stub)')
138
- .option('--json', 'Output as JSON')
139
- .option('--dev', 'Use local dev server (localhost:8288)')
140
- .action(runCommand)
141
-
142
- inngestCommand
143
- .command('cancel')
144
- .description('Cancel a running function')
145
- .argument('<id>', 'Run ID')
146
- .option('--force', 'Skip confirmation')
147
- .option('--dev', 'Use local dev server (localhost:8288)')
148
- .action(cancelCommand)
149
- }
@@ -1,143 +0,0 @@
1
- import { readFileSync } from 'node:fs'
2
- import { Command } from 'commander'
3
- import { InngestClient } from './client'
4
-
5
- /**
6
- * Send a signal to resume a waiting Inngest function
7
- *
8
- * Signals are used with step.waitForSignal() to pause execution until
9
- * an external event occurs (e.g., HITL approval).
10
- *
11
- * Usage:
12
- * skill inngest signal "approval:draft_abc123" --data '{"approved": true}'
13
- * skill inngest signal "approval:draft_abc123" --data-file ./approval.json
14
- * skill inngest signal "payment:confirmed" --dev
15
- *
16
- * @param signal - Signal name (must match step.waitForSignal)
17
- * @param options - Command options
18
- */
19
- async function signalCommand(
20
- signal: string,
21
- options: {
22
- data?: string
23
- dataFile?: string
24
- dev?: boolean
25
- json?: boolean
26
- }
27
- ): Promise<void> {
28
- const { data: dataString, dataFile, dev = false, json = false } = options
29
-
30
- // Parse signal data
31
- let data: unknown = null
32
-
33
- if (dataFile) {
34
- try {
35
- const fileContent = readFileSync(dataFile, 'utf-8')
36
- data = JSON.parse(fileContent)
37
- } catch (err) {
38
- const error = {
39
- success: false,
40
- error:
41
- err instanceof Error
42
- ? `Failed to read data file: ${err.message}`
43
- : 'Failed to read data file',
44
- }
45
- if (json) {
46
- console.log(JSON.stringify(error, null, 2))
47
- } else {
48
- console.error(`Error: ${error.error}`)
49
- }
50
- process.exit(1)
51
- }
52
- } else if (dataString) {
53
- try {
54
- data = JSON.parse(dataString)
55
- } catch (err) {
56
- const error = {
57
- success: false,
58
- error:
59
- err instanceof Error
60
- ? `Invalid JSON in --data: ${err.message}`
61
- : 'Invalid JSON in --data',
62
- }
63
- if (json) {
64
- console.log(JSON.stringify(error, null, 2))
65
- } else {
66
- console.error(`Error: ${error.error}`)
67
- }
68
- process.exit(1)
69
- }
70
- }
71
-
72
- // Send signal
73
- try {
74
- const client = new InngestClient({ dev })
75
- const response = await client.sendSignal(signal, data)
76
-
77
- if (json) {
78
- console.log(
79
- JSON.stringify(
80
- {
81
- success: true,
82
- signal,
83
- data,
84
- response,
85
- },
86
- null,
87
- 2
88
- )
89
- )
90
- } else {
91
- console.log(`Signal sent: ${signal}`)
92
- if (response.run_id) {
93
- console.log(`Run ID: ${response.run_id}`)
94
- }
95
- if (response.message) {
96
- console.log(`Message: ${response.message}`)
97
- }
98
- }
99
- } catch (err) {
100
- const error = {
101
- success: false,
102
- error:
103
- err instanceof Error
104
- ? err.message
105
- : 'Failed to send signal to Inngest API',
106
- }
107
- if (json) {
108
- console.log(JSON.stringify(error, null, 2))
109
- } else {
110
- console.error(`Error: ${error.error}`)
111
- }
112
- process.exit(1)
113
- }
114
- }
115
-
116
- /**
117
- * Register the signal command with Commander
118
- */
119
- export function registerSignalCommand(program: Command): void {
120
- const inngestCommand = program.commands.find(
121
- (cmd) => cmd.name() === 'inngest'
122
- )
123
-
124
- if (!inngestCommand) {
125
- throw new Error('inngest command not found')
126
- }
127
-
128
- inngestCommand
129
- .command('signal')
130
- .description('Send a signal to resume a waiting function')
131
- .argument('<signal>', 'Signal name (e.g., "approval:draft_abc123")')
132
- .option(
133
- '-d, --data <json>',
134
- 'Signal data as JSON string (e.g., \'{"approved": true}\')'
135
- )
136
- .option(
137
- '-f, --data-file <path>',
138
- 'Path to JSON file containing signal data'
139
- )
140
- .option('--dev', 'Target local dev server (localhost:8288)')
141
- .option('--json', 'Output result as JSON (machine-readable)')
142
- .action(signalCommand)
143
- }