Skip to content

Commit ec7912c

Browse files
Add signal --json + register --json flag
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3ce4553 commit ec7912c

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/commands/signal.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,25 @@ import { c } from '../utils.js'
44
export async function signalCommand(
55
id: string,
66
content: string,
7-
opts: { type?: string; apiKey?: string; apiUrl?: string }
7+
opts: { type?: string; json?: boolean; apiKey?: string; apiUrl?: string }
88
): Promise<void> {
99
const client = new SFClient(opts.apiKey, opts.apiUrl)
1010
const type = opts.type || 'user_note'
1111

1212
const result = await client.injectSignal(id, type, content, 'cli')
1313

14+
if (opts.json) {
15+
console.log(JSON.stringify({ signalId: result.signalId || null, type, source: 'cli', content }, null, 2))
16+
return
17+
}
18+
1419
console.log(`${c.green}${c.reset} Signal injected`)
1520
console.log(` ${c.bold}Type:${c.reset} ${type}`)
1621
console.log(` ${c.bold}Source:${c.reset} cli`)
1722
console.log(` ${c.bold}Content:${c.reset} ${content}`)
1823
if (result.signalId) {
1924
console.log(` ${c.bold}ID:${c.reset} ${result.signalId}`)
2025
}
21-
// Calculate minutes until next 15-min cron cycle (runs at :00, :15, :30, :45)
2226
const now = new Date()
2327
const minute = now.getMinutes()
2428
const nextCycleMin = Math.ceil((minute + 1) / 15) * 15

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,10 @@ program
213213
.command('signal <id> <content>')
214214
.description('Inject a signal into the thesis queue')
215215
.option('--type <type>', 'Signal type: news | user_note | external', 'user_note')
216+
.option('--json', 'JSON output')
216217
.action(async (id, content, opts, cmd) => {
217218
const g = cmd.optsWithGlobals()
218-
await run(() => signalCommand(id, content, { type: opts.type, apiKey: g.apiKey, apiUrl: g.apiUrl }))
219+
await run(() => signalCommand(id, content, { type: opts.type, json: opts.json, apiKey: g.apiKey, apiUrl: g.apiUrl }))
219220
})
220221

221222
// ── sf evaluate <id> ──────────────────────────────────────────────────────────

0 commit comments

Comments
 (0)