@spfunctions/cli 1.5.1 → 1.5.3

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.
@@ -1,5 +1,6 @@
1
1
  export declare function signalCommand(id: string, content: string, opts: {
2
2
  type?: string;
3
+ json?: boolean;
3
4
  apiKey?: string;
4
5
  apiUrl?: string;
5
6
  }): Promise<void>;
@@ -7,6 +7,10 @@ async function signalCommand(id, content, opts) {
7
7
  const client = new client_js_1.SFClient(opts.apiKey, opts.apiUrl);
8
8
  const type = opts.type || 'user_note';
9
9
  const result = await client.injectSignal(id, type, content, 'cli');
10
+ if (opts.json) {
11
+ console.log(JSON.stringify({ signalId: result.signalId || null, type, source: 'cli', content }, null, 2));
12
+ return;
13
+ }
10
14
  console.log(`${utils_js_1.c.green}✓${utils_js_1.c.reset} Signal injected`);
11
15
  console.log(` ${utils_js_1.c.bold}Type:${utils_js_1.c.reset} ${type}`);
12
16
  console.log(` ${utils_js_1.c.bold}Source:${utils_js_1.c.reset} cli`);
@@ -14,7 +18,6 @@ async function signalCommand(id, content, opts) {
14
18
  if (result.signalId) {
15
19
  console.log(` ${utils_js_1.c.bold}ID:${utils_js_1.c.reset} ${result.signalId}`);
16
20
  }
17
- // Calculate minutes until next 15-min cron cycle (runs at :00, :15, :30, :45)
18
21
  const now = new Date();
19
22
  const minute = now.getMinutes();
20
23
  const nextCycleMin = Math.ceil((minute + 1) / 15) * 15;
package/dist/index.js CHANGED
@@ -203,9 +203,10 @@ program
203
203
  .command('signal <id> <content>')
204
204
  .description('Inject a signal into the thesis queue')
205
205
  .option('--type <type>', 'Signal type: news | user_note | external', 'user_note')
206
+ .option('--json', 'JSON output')
206
207
  .action(async (id, content, opts, cmd) => {
207
208
  const g = cmd.optsWithGlobals();
208
- await run(() => (0, signal_js_1.signalCommand)(id, content, { type: opts.type, apiKey: g.apiKey, apiUrl: g.apiUrl }));
209
+ await run(() => (0, signal_js_1.signalCommand)(id, content, { type: opts.type, json: opts.json, apiKey: g.apiKey, apiUrl: g.apiUrl }));
209
210
  });
210
211
  // ── sf evaluate <id> ──────────────────────────────────────────────────────────
211
212
  program
@@ -518,6 +519,15 @@ async function run(fn) {
518
519
  }
519
520
  catch (err) {
520
521
  const msg = err instanceof Error ? err.message : String(err);
522
+ // If --json flag is present, output structured JSON error
523
+ if (process.argv.includes('--json')) {
524
+ console.log(JSON.stringify({
525
+ error: msg,
526
+ code: err.code || 'CLI_ERROR',
527
+ status: err.status || 1,
528
+ }));
529
+ process.exit(1);
530
+ }
521
531
  (0, utils_js_1.die)(msg);
522
532
  }
523
533
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spfunctions/cli",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "Prediction market intelligence CLI. Causal thesis model, 24/7 Kalshi/Polymarket scan, live orderbook, edge detection. Interactive agent mode with tool calling.",
5
5
  "bin": {
6
6
  "sf": "./dist/index.js"