@seguelac/aca-cli 0.8.1 → 0.10.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  All notable changes to `aca-cli` are documented here. Format loosely follows [Keep a Changelog](https://keepachangelog.com/).
4
4
 
5
+ ## [0.10.0] - 2026-12-01
6
+
7
+ ### Added
8
+ - **`aca creative`: the creative strategist from the terminal.** `board`, `voc ls|add|sources`, `angles ls|upsert|status`, `hooks add`, `briefs ls|show|new|approve|kill|to-idea|link`, `tests ls|new|decide`, `perf --by angle|hook|format|platform|icp`, `trending`, `teardown` and `pulse`, backed by `/v1/creative` (the `api-creative` edge function, the same operations as the ACA MCP tools). Bulk input is JSON via `--file` or stdin. New angles need evidence; briefs get codes (B-0012) and paid briefs an ad name that maps results back.
9
+ - Requests to edge functions send `X-ACA-Runner` ("Claude Code · host", or `$ACA_RUNNER`), URI-encoded, so the app shows who did the work.
10
+
11
+ ## [0.9.0] - 2026-11-23
12
+
13
+ ### Added
14
+ - **Scheduled replies.** `aca reply <id> --at "2026-12-07 09:00"` queues the reply instead of sending it. It goes out at that time from the same mailbox and thread, with the signature, exactly like a reply sent now. It's cancelled automatically if the contact replies first; `--keep-on-reply` sends it regardless. `--at` takes local time (`YYYY-MM-DD HH:MM`) or an ISO timestamp with an offset.
15
+ - **`aca scheduled`**: `ls` (pending by default; `-c <conversationId>`, `--all`), `cancel <id>` and `reschedule <id> --at "..."`.
16
+
5
17
  ## [0.8.1] - 2026-11-09
6
18
 
7
19
  ### Fixed
package/README.md CHANGED
@@ -75,6 +75,9 @@ aca campaign leads <campaignId> --stuck --json | jq '.[] | .contact_id'
75
75
  | `aca inbox show <id>` | Show a conversation and its recent messages. |
76
76
  | `aca inbox list` | List all conversations. Filters: `--channel`, `--status`, `--intent`. |
77
77
  | `aca reply <id> -m "..."` | Reply to a conversation. Also accepts piped stdin. |
78
+ | `aca reply <id> -m "..." --at "2026-12-07 09:00"` | Schedule the reply instead of sending now (local time, or ISO with an offset). Cancelled automatically if the contact replies first; add `--keep-on-reply` to send regardless. |
79
+ | `aca scheduled ls` | Pending scheduled replies. `-c <conversationId>` for one thread, `--all` to include sent/cancelled/failed. |
80
+ | `aca scheduled cancel <id>` / `aca scheduled reschedule <id> --at "..."` | Cancel or move a pending scheduled reply. |
78
81
 
79
82
  ### Campaigns
80
83
  | Command | What it does |
package/dist/api.js CHANGED
@@ -1,5 +1,13 @@
1
1
  import { SUPABASE_URL, SUPABASE_ANON_KEY } from './constants.js';
2
+ import { hostname } from 'node:os';
2
3
  import { getAccessToken } from './session.js';
4
+ export function runnerLabel() {
5
+ if (process.env.ACA_RUNNER?.trim())
6
+ return process.env.ACA_RUNNER.trim().slice(0, 120);
7
+ const who = process.env.CLAUDECODE ? 'Claude Code' : 'aca CLI';
8
+ const host = hostname().replace(/\.local$/, '');
9
+ return `${who}${host ? ` · ${host}` : ''}`.slice(0, 120);
10
+ }
3
11
  async function authHeaders() {
4
12
  const token = await getAccessToken();
5
13
  return {
@@ -95,7 +103,7 @@ export async function fnRequest(method, name, params = {}, body) {
95
103
  const qs = query.toString();
96
104
  const res = await fetch(`${SUPABASE_URL}/functions/v1/${name}${qs ? `?${qs}` : ''}`, {
97
105
  method,
98
- headers: { ...headers, 'Content-Type': 'application/json' },
106
+ headers: { ...headers, 'Content-Type': 'application/json', 'x-aca-client': 'aca-cli', 'x-aca-runner': encodeURIComponent(runnerLabel()) },
99
107
  body: body === undefined ? undefined : JSON.stringify(body),
100
108
  });
101
109
  const text = await res.text();
@@ -0,0 +1,264 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { fnRequest } from '../api.js';
3
+ import { output, fail } from '../output.js';
4
+ import { readStdinIfPiped } from '../util.js';
5
+ const FN = 'api-creative';
6
+ const one = (s, n = 80) => String(s ?? '').replace(/\s+/g, ' ').slice(0, n);
7
+ async function readItems(key, file) {
8
+ const raw = file ? readFileSync(file, 'utf8') : await readStdinIfPiped();
9
+ if (!raw)
10
+ fail(`Give the ${key} as JSON: --file <path>, or pipe it in`);
11
+ let parsed;
12
+ try {
13
+ parsed = JSON.parse(raw);
14
+ }
15
+ catch {
16
+ fail(`${file ?? 'stdin'} is not valid JSON`);
17
+ }
18
+ const items = Array.isArray(parsed) ? parsed : parsed?.[key];
19
+ if (!Array.isArray(items))
20
+ fail(`Expected a JSON array or { "${key}": [...] }`);
21
+ return items;
22
+ }
23
+ export function registerCreative(program) {
24
+ const cr = program.command('creative').description('Creative strategist: customer words → angles → hooks → briefs → tests → learnings');
25
+ cr.command('board')
26
+ .description('The strategy at a glance (what a strategist session reads first)')
27
+ .option('--json', 'Emit JSON')
28
+ .action(async (opts) => {
29
+ const b = await fnRequest('GET', FN, { resource: 'board' });
30
+ if (opts.json)
31
+ return output(b, { json: true });
32
+ const voc = Object.entries(b.voice_of_customer.counts).map(([k, n]) => `${n} ${k}`).join(', ');
33
+ console.log(`Customer quotes: ${voc || 'none yet'}`);
34
+ console.log(`Briefs: ${Object.entries(b.counts.briefs_by_status).map(([k, n]) => `${n} ${k}`).join(', ') || 'none'} · open tests: ${b.counts.open_tests}\n`);
35
+ if (b.angles.length) {
36
+ output(b.angles.map((a) => ({
37
+ code: a.code, status: a.status, kind: a.kind, name: one(a.name, 40),
38
+ hooks: a.hooks.length, briefs: a.live_briefs.length,
39
+ lift: a.organic ? `${a.organic.avg_lift ?? '-'}${a.organic.confident ? '' : ' (low n)'}` : '',
40
+ })));
41
+ }
42
+ if (b.recent_learnings.length) {
43
+ console.log('\nRecent learnings:');
44
+ for (const l of b.recent_learnings.slice(0, 5))
45
+ console.log(`- ${one(l.summary, 140)}`);
46
+ }
47
+ if (b.next_steps.length) {
48
+ console.log('\nNext:');
49
+ for (const s of b.next_steps)
50
+ console.log(`- ${s}`);
51
+ }
52
+ console.log(`\n${b.app_url}`);
53
+ });
54
+ const voc = cr.command('voc').description('Voice of customer: verbatim quotes');
55
+ voc.command('ls')
56
+ .option('--kind <kind>', 'pain, desire, objection, trigger, phrase, proof, alternative')
57
+ .option('--source <source>')
58
+ .option('--query <words>')
59
+ .option('--limit <n>', 'Max rows', '50')
60
+ .option('--json', 'Emit JSON')
61
+ .action(async (o) => {
62
+ const d = await fnRequest('GET', FN, { resource: 'voc', kind: o.kind, source: o.source, query: o.query, limit: o.limit });
63
+ if (o.json)
64
+ return output(d, { json: true });
65
+ output(d.snippets.map((s) => ({ kind: s.kind, source: s.source, quote: one(s.quote, 100), id: s.id })));
66
+ });
67
+ voc.command('add')
68
+ .description('One quote with --quote/--kind, or many as JSON (--file or stdin)')
69
+ .option('--quote <text>')
70
+ .option('--kind <kind>')
71
+ .option('--source <source>', 'inbox, comment, review, call, survey, reddit, ad_comment, social, manual', 'manual')
72
+ .option('--file <path>', 'JSON array of { quote, kind, source?, source_ref?, icp_id? }')
73
+ .option('--json', 'Emit JSON')
74
+ .action(async (o) => {
75
+ const snippets = o.quote ? [{ quote: o.quote, kind: o.kind, source: o.source }] : await readItems('snippets', o.file);
76
+ output(await fnRequest('POST', FN, { resource: 'voc' }, { snippets }), { json: o.json });
77
+ });
78
+ voc.command('sources')
79
+ .description('Replies not mined yet (read them, then `aca creative voc add`)')
80
+ .option('--since <date>')
81
+ .option('--limit <n>', 'Max messages', '60')
82
+ .option('--json', 'Emit JSON')
83
+ .action(async (o) => {
84
+ const d = await fnRequest('GET', FN, { resource: 'voc-sources', since: o.since, limit: o.limit });
85
+ if (o.json)
86
+ return output(d, { json: true });
87
+ console.log(`Since ${d.since} · ${d.messages.length} message(s) · mined_until ${d.mined_until}`);
88
+ output(d.messages.map((m) => ({ at: m.at.slice(0, 16).replace('T', ' '), channel: m.channel, text: one(m.text, 110), id: m.message_id })));
89
+ });
90
+ const angles = cr.command('angles').description('Angles (A-001…) and their hooks');
91
+ angles.command('ls')
92
+ .option('--status <list>', 'hypothesis,testing,winner,loser,retired')
93
+ .option('--json', 'Emit JSON')
94
+ .action(async (o) => {
95
+ const d = await fnRequest('GET', FN, { resource: 'angles', status: o.status });
96
+ if (o.json)
97
+ return output(d, { json: true });
98
+ for (const a of d.angles) {
99
+ console.log(`${a.code} [${a.status}] ${a.kind}/${a.awareness} ${a.name}\n ${one(a.thesis, 140)}`);
100
+ for (const h of a.hooks)
101
+ console.log(` ${h.code} (${h.hook_type}${h.status !== 'hypothesis' ? `, ${h.status}` : ''}): ${one(h.text, 110)}`);
102
+ }
103
+ });
104
+ angles.command('upsert')
105
+ .description('Create or update angles from JSON (--file or stdin). New angles need name, thesis, kind, evidence.')
106
+ .option('--file <path>')
107
+ .option('--json', 'Emit JSON')
108
+ .action(async (o) => output(await fnRequest('POST', FN, { resource: 'angles' }, { angles: await readItems('angles', o.file) }), { json: o.json }));
109
+ angles.command('status')
110
+ .description('Set an angle\'s status')
111
+ .argument('<code>')
112
+ .argument('<status>', 'hypothesis, testing, winner, loser, retired')
113
+ .action(async (code, status) => output(await fnRequest('POST', FN, { resource: 'angles' }, { angles: [{ code, status }] })));
114
+ const hooks = cr.command('hooks').description('Hooks (A-001-H1…)');
115
+ hooks.command('add')
116
+ .description('One hook with --angle/--text/--type, or many as JSON (--file or stdin)')
117
+ .option('--angle <code>')
118
+ .option('--text <text>')
119
+ .option('--type <type>', 'question, stat, callout, contrarian, story, pattern_interrupt, demo, before_after, promise, curiosity')
120
+ .option('--modality <m>', 'spoken, on_screen, caption, headline, visual')
121
+ .option('--file <path>')
122
+ .option('--json', 'Emit JSON')
123
+ .action(async (o) => {
124
+ const items = o.text ? [{ angle: o.angle, text: o.text, hook_type: o.type, modality: o.modality }] : await readItems('hooks', o.file);
125
+ output(await fnRequest('POST', FN, { resource: 'hooks' }, { hooks: items }), { json: o.json });
126
+ });
127
+ const briefs = cr.command('briefs').description('Briefs (B-0001…): one angle + one hook, organic or paid');
128
+ briefs.command('ls')
129
+ .option('--status <list>', 'draft,approved,in_production,live,done,killed')
130
+ .option('--channel <channel>', 'organic or paid')
131
+ .option('--angle <code>')
132
+ .option('--json', 'Emit JSON')
133
+ .action(async (o) => {
134
+ const d = await fnRequest('GET', FN, { resource: 'briefs', status: o.status, channel: o.channel, angle: o.angle });
135
+ if (o.json)
136
+ return output(d, { json: true });
137
+ output(d.briefs.map((b) => ({
138
+ code: b.code, status: b.status, channel: b.channel, platform: b.platform, format: b.format,
139
+ angle: b.angle?.code, hook: b.hook?.code ?? '', posts: b.assets.length, ad_name: b.ad_name ?? '',
140
+ })));
141
+ });
142
+ briefs.command('show')
143
+ .argument('<code>')
144
+ .option('--json', 'Emit JSON')
145
+ .action(async (code, o) => {
146
+ const { brief: b, app_url } = await fnRequest('GET', FN, { resource: 'briefs', id: code });
147
+ if (o.json)
148
+ return output(b, { json: true });
149
+ console.log(`${b.code} [${b.status}] ${b.channel} · ${b.platform} · ${b.format} · ${b.objective}`);
150
+ console.log(`Angle ${b.angle.code}: ${b.angle.name}\n ${b.angle.thesis}`);
151
+ if (b.hook)
152
+ console.log(`Hook ${b.hook.code}: ${b.hook.text}`);
153
+ for (const beat of b.beats)
154
+ console.log(` ${beat.t ? `[${beat.t}] ` : ''}${beat.says ?? ''}${beat.shows ? ` (shows: ${beat.shows})` : ''}`);
155
+ if (b.proof)
156
+ console.log(`Proof: ${b.proof}`);
157
+ if (b.cta)
158
+ console.log(`CTA: ${b.cta}${b.destination_url ? ` → ${b.destination_url}` : ''}`);
159
+ if (b.ad_name)
160
+ console.log(`Ad name: ${b.ad_name}`);
161
+ console.log(app_url);
162
+ });
163
+ briefs.command('new')
164
+ .description('Create briefs from JSON (--file or stdin)')
165
+ .option('--file <path>')
166
+ .option('--json', 'Emit JSON')
167
+ .action(async (o) => {
168
+ const d = await fnRequest('POST', FN, { resource: 'briefs' }, { briefs: await readItems('briefs', o.file) });
169
+ if (o.json)
170
+ return output(d, { json: true });
171
+ output(d.briefs.map((b) => ({ code: b.code, channel: b.channel, platform: b.platform, format: b.format, angle: b.angle?.code, hook: b.hook?.code ?? '', ad_name: b.ad_name ?? '' })));
172
+ });
173
+ for (const [verb, status] of [['approve', 'approved'], ['kill', 'killed']]) {
174
+ briefs.command(verb).argument('<code>').action(async (code) => output(await fnRequest('PATCH', FN, { resource: 'briefs', id: code }, { status })));
175
+ }
176
+ briefs.command('to-idea')
177
+ .description('Turn an organic brief into a content idea (optionally into an autopilot pool)')
178
+ .argument('<code>')
179
+ .option('--autopilot <id>')
180
+ .action(async (code, o) => output(await fnRequest('POST', FN, { resource: 'briefs', id: code, action: 'to-idea' }, { autopilot_id: o.autopilot })));
181
+ briefs.command('link')
182
+ .description('Link a Scheduler post or an ad to a brief')
183
+ .argument('<code>')
184
+ .option('--post <id>', 'Scheduler post id')
185
+ .option('--ad <id>', 'Ad id on the ad platform')
186
+ .option('--ad-name <name>')
187
+ .action(async (code, o) => {
188
+ if (!o.post && !o.ad)
189
+ fail('Give --post <id> or --ad <id>');
190
+ output(await fnRequest('POST', FN, { resource: 'briefs', id: code, action: 'link' }, { post_id: o.post, external_ad_id: o.ad, ad_name: o.adName }));
191
+ });
192
+ const tests = cr.command('tests').description('Creative tests (T-001…)');
193
+ tests.command('ls')
194
+ .option('--status <list>', 'planned,running,decided,inconclusive')
195
+ .option('--json', 'Emit JSON')
196
+ .action(async (o) => {
197
+ const d = await fnRequest('GET', FN, { resource: 'tests', status: o.status });
198
+ if (o.json)
199
+ return output(d, { json: true });
200
+ for (const t of d.tests) {
201
+ console.log(`${t.code} [${t.status}] ${t.variable} · ${t.channel} · ${t.primary_metric}: ${one(t.hypothesis, 100)}`);
202
+ for (const v of t.variants)
203
+ console.log(` ${v.code}${t.winner_brief_id === v.brief_id ? ' ★' : ''} ${v.organic ? `${v.organic.posts} posts, lift ${v.organic.avg_lift ?? '-'}${v.organic.confident ? '' : ' (low n)'}` : 'no results yet'}`);
204
+ if (t.decision)
205
+ console.log(` → ${t.decision}`);
206
+ }
207
+ });
208
+ tests.command('new')
209
+ .requiredOption('--hypothesis <text>')
210
+ .requiredOption('--variable <v>', 'hook, angle, format, persona, offer, cta, visual')
211
+ .option('--channel <channel>', 'organic or paid', 'organic')
212
+ .option('--metric <metric>', 'engagement_lift, saves, comments, clicks, leads, hook_rate, hold_rate, ctr, cpa, roas')
213
+ .option('--briefs <codes>', 'Comma list of brief codes (the variants)')
214
+ .option('--json', 'Emit JSON')
215
+ .action(async (o) => output(await fnRequest('POST', FN, { resource: 'tests' }, {
216
+ hypothesis: o.hypothesis, variable: o.variable, channel: o.channel, primary_metric: o.metric,
217
+ briefs: o.briefs ? String(o.briefs).split(',').map((s) => s.trim()) : undefined,
218
+ }), { json: o.json }));
219
+ tests.command('decide')
220
+ .argument('<code>')
221
+ .requiredOption('--decision <text>', 'What we now believe, with the numbers')
222
+ .option('--winner <brief>')
223
+ .option('--inconclusive')
224
+ .action(async (code, o) => {
225
+ if (!o.winner && !o.inconclusive)
226
+ fail('Give --winner <brief code> or --inconclusive');
227
+ output(await fnRequest('POST', FN, { resource: 'tests', id: code, action: 'decide' }, { winner: o.winner, inconclusive: !!o.inconclusive, decision: o.decision }));
228
+ });
229
+ cr.command('perf')
230
+ .description('Organic results rolled up (lift = engagement rate / the account\'s usual)')
231
+ .option('--by <group>', 'angle, hook, hook_type, angle_kind, awareness, format, platform, icp, brief', 'angle')
232
+ .option('--days <n>', 'Window', '90')
233
+ .option('--json', 'Emit JSON')
234
+ .action(async (o) => {
235
+ const d = await fnRequest('GET', FN, { resource: 'performance', group_by: o.by, days: o.days });
236
+ if (o.json)
237
+ return output(d, { json: true });
238
+ output(d.rows.map((r) => ({ [o.by]: r.group_key, label: one(r.label, 40), posts: r.posts, impressions: r.impressions, lift: r.avg_lift, best: r.best_lift, confident: r.confident ? 'yes' : 'no' })));
239
+ });
240
+ cr.command('trending')
241
+ .description('Outlier posts in the niche (ratio = times their usual)')
242
+ .option('--platform <p>')
243
+ .option('--days <n>', 'Window', '30')
244
+ .option('--limit <n>', 'Max rows', '25')
245
+ .option('--json', 'Emit JSON')
246
+ .action(async (o) => {
247
+ const d = await fnRequest('GET', FN, { resource: 'trending', platform: o.platform, days: o.days, limit: o.limit });
248
+ if (o.json)
249
+ return output(d, { json: true });
250
+ output(d.posts.map((p) => ({ ratio: `${p.ratio.toFixed(1)}x`, platform: p.platform, author: p.author ?? '', title: one(p.title, 60), formula: one(p.formula, 40), id: p.id })));
251
+ });
252
+ cr.command('teardown').argument('<id>').option('--json', 'Emit JSON')
253
+ .action(async (id, o) => output(await fnRequest('GET', FN, { resource: 'trending', id }), { json: o.json ?? true }));
254
+ cr.command('pulse')
255
+ .description('What the niche is talking about now')
256
+ .option('--days <n>', 'Window', '7')
257
+ .option('--json', 'Emit JSON')
258
+ .action(async (o) => {
259
+ const d = await fnRequest('GET', FN, { resource: 'pulse', days: o.days });
260
+ if (o.json)
261
+ return output(d, { json: true });
262
+ output(d.stories.map((s) => ({ fit: s.fit_score ?? '', headline: one(s.headline, 60), angle: one(s.angle, 70), id: s.id })));
263
+ });
264
+ }
@@ -11,8 +11,18 @@ export function registerReply(program) {
11
11
  .option('--subject <text>', 'Email subject (email channels only)')
12
12
  .option('--cc <emails>', 'Comma-separated CC list (email only)')
13
13
  .option('--bcc <emails>', 'Comma-separated BCC list (email only)')
14
+ .option('--at <datetime>', 'Schedule instead of sending now, e.g. "2026-12-07 09:00" (local time) or an ISO timestamp with offset')
15
+ .option('--keep-on-reply', 'With --at: still send even if the contact replies first (default: cancel on reply)')
14
16
  .option('--json', 'Emit JSON')
15
17
  .action(async (conversationId, opts) => {
18
+ if (opts.keepOnReply && !opts.at)
19
+ fail('--keep-on-reply only applies with --at');
20
+ let sendAt = null;
21
+ if (opts.at) {
22
+ sendAt = parseSendAt(opts.at);
23
+ if (sendAt.getTime() <= Date.now())
24
+ fail(`--at is in the past: ${sendAt.toString()}`);
25
+ }
16
26
  const piped = await readStdinIfPiped();
17
27
  const content = opts.message ?? piped;
18
28
  if (!content)
@@ -46,7 +56,18 @@ export function registerReply(program) {
46
56
  if (opts.bcc)
47
57
  body.email_bcc = opts.bcc.split(',').map((s) => s.trim());
48
58
  }
59
+ if (sendAt) {
60
+ body.send_at = sendAt.toISOString();
61
+ body.cancel_on_reply = !opts.keepOnReply;
62
+ }
49
63
  const result = await invokeFn('crm-send-message', body);
50
64
  output(result, { json: opts.json });
51
65
  });
52
66
  }
67
+ export function parseSendAt(value) {
68
+ const normalized = value.trim().replace(' ', 'T');
69
+ const d = new Date(normalized);
70
+ if (Number.isNaN(d.getTime()))
71
+ fail(`Can't parse --at "${value}". Use "YYYY-MM-DD HH:MM" or an ISO timestamp.`);
72
+ return d;
73
+ }
@@ -0,0 +1,67 @@
1
+ import { restGet, restPatch } from '../api.js';
2
+ import { output, fail } from '../output.js';
3
+ import { parseSendAt } from './reply.js';
4
+ const COLS = 'id,conversation_id,contact_id,channel,recipient_display_name,scheduled_for,status,cancel_on_reply,cancelled_reason,error_message,content';
5
+ export function registerScheduled(program) {
6
+ const cmd = program.command('scheduled').description('Scheduled inbox replies (send later)');
7
+ cmd
8
+ .command('ls')
9
+ .description('List scheduled replies (pending by default)')
10
+ .option('-c, --conversation <id>', 'Only this conversation')
11
+ .option('--all', 'Include sent, cancelled and failed')
12
+ .option('--limit <n>', 'Max rows', '50')
13
+ .option('--json', 'Emit JSON')
14
+ .action(async (opts) => {
15
+ const filters = ['source_type=eq.manual', 'conversation_id=not.is.null'];
16
+ if (!opts.all)
17
+ filters.push('status=eq.pending');
18
+ if (opts.conversation)
19
+ filters.push(`conversation_id=eq.${opts.conversation}`);
20
+ const rows = await restGet(`crm_message_queue?${filters.join('&')}&select=${COLS}&order=scheduled_for.${opts.all ? 'desc' : 'asc'}&limit=${Number(opts.limit) || 50}`);
21
+ if (opts.json)
22
+ return output(rows, { json: true });
23
+ output(rows.map((r) => ({
24
+ id: r.id,
25
+ to: r.recipient_display_name,
26
+ channel: r.channel,
27
+ send_at: new Date(r.scheduled_for).toLocaleString(),
28
+ status: r.cancelled_reason ? `${r.status} (${r.cancelled_reason})` : r.status,
29
+ cancel_on_reply: r.cancel_on_reply,
30
+ preview: r.content.replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim().slice(0, 60),
31
+ })));
32
+ });
33
+ cmd
34
+ .command('cancel')
35
+ .description('Cancel a pending scheduled reply')
36
+ .argument('<id>')
37
+ .option('--json', 'Emit JSON')
38
+ .action(async (id, opts) => {
39
+ const rows = await restPatch(`crm_message_queue?id=eq.${id}&status=eq.pending&select=${COLS}`, {
40
+ status: 'cancelled',
41
+ cancelled_reason: 'user_cancelled',
42
+ cancelled_at: new Date().toISOString(),
43
+ updated_at: new Date().toISOString(),
44
+ });
45
+ if (!rows?.length)
46
+ fail(`No pending scheduled reply ${id} (already sent, cancelled or not found)`);
47
+ output(rows[0], { json: opts.json });
48
+ });
49
+ cmd
50
+ .command('reschedule')
51
+ .description('Move a pending scheduled reply to a new time')
52
+ .argument('<id>')
53
+ .requiredOption('--at <datetime>', 'New time, e.g. "2026-12-08 09:00" (local) or ISO with offset')
54
+ .option('--json', 'Emit JSON')
55
+ .action(async (id, opts) => {
56
+ const at = parseSendAt(opts.at);
57
+ if (at.getTime() <= Date.now())
58
+ fail(`--at is in the past: ${at.toString()}`);
59
+ const rows = await restPatch(`crm_message_queue?id=eq.${id}&status=eq.pending&select=${COLS}`, {
60
+ scheduled_for: at.toISOString(),
61
+ updated_at: new Date().toISOString(),
62
+ });
63
+ if (!rows?.length)
64
+ fail(`No pending scheduled reply ${id} (already sent, cancelled or not found)`);
65
+ output(rows[0], { json: opts.json });
66
+ });
67
+ }
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ import { registerLists } from './commands/lists.js';
10
10
  import { registerLeads } from './commands/leads.js';
11
11
  import { registerInbox } from './commands/inbox.js';
12
12
  import { registerReply } from './commands/reply.js';
13
+ import { registerScheduled } from './commands/scheduled.js';
13
14
  import { registerCampaign } from './commands/campaign.js';
14
15
  import { registerSequence } from './commands/sequence.js';
15
16
  import { registerContact } from './commands/contact.js';
@@ -17,6 +18,7 @@ import { registerSignals } from './commands/signals.js';
17
18
  import { registerAutopilot } from './commands/autopilot.js';
18
19
  import { registerMessaging } from './commands/messaging.js';
19
20
  import { registerScheduler } from './commands/scheduler.js';
21
+ import { registerCreative } from './commands/creative.js';
20
22
  import { registerConfig } from './commands/config.js';
21
23
  import { registerCompletion } from './commands/completion.js';
22
24
  import { maybeCheckForUpdate } from './update-check.js';
@@ -35,6 +37,7 @@ registerLists(program);
35
37
  registerLeads(program);
36
38
  registerInbox(program);
37
39
  registerReply(program);
40
+ registerScheduled(program);
38
41
  registerCampaign(program);
39
42
  registerSequence(program);
40
43
  registerContact(program);
@@ -42,6 +45,7 @@ registerSignals(program);
42
45
  registerAutopilot(program);
43
46
  registerMessaging(program);
44
47
  registerScheduler(program);
48
+ registerCreative(program);
45
49
  registerConfig(program);
46
50
  registerCompletion(program);
47
51
  async function main() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seguelac/aca-cli",
3
- "version": "0.8.1",
3
+ "version": "0.10.0",
4
4
  "description": "Command-line interface for ACA (Automated Client Acquisition) — push leads to campaigns, triage replies, manage contacts, all from your terminal.",
5
5
  "type": "module",
6
6
  "bin": {