@series-a/cli 0.23.1 → 1.0.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 +25 -141
- package/README.md +56 -274
- package/bin/setu.mjs +442 -0
- package/lib/api.mjs +84 -0
- package/lib/config.mjs +42 -0
- package/lib/ui.mjs +68 -0
- package/package.json +15 -50
- package/LICENSE +0 -7
- package/SKILLS.md +0 -319
- package/bin/advisoros.mjs +0 -2
- package/src/api.mjs +0 -102
- package/src/commands/auth.mjs +0 -193
- package/src/commands/brand.mjs +0 -439
- package/src/commands/flow.mjs +0 -175
- package/src/commands/insights.mjs +0 -1754
- package/src/commands/knowledge-sync.mjs +0 -519
- package/src/commands/resources.mjs +0 -2151
- package/src/commands/strategies.mjs +0 -242
- package/src/commands/voice.mjs +0 -212
- package/src/config.mjs +0 -82
- package/src/index.mjs +0 -76
- package/src/ui.mjs +0 -104
package/package.json
CHANGED
|
@@ -1,61 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@series-a/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Setu CLI — build, review and publish claimable practice and dentist profiles.",
|
|
5
6
|
"type": "module",
|
|
7
|
+
"license": "UNLICENSED",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
6
11
|
"bin": {
|
|
7
|
-
"
|
|
12
|
+
"setu": "./bin/setu.mjs"
|
|
8
13
|
},
|
|
9
|
-
"files": [
|
|
10
|
-
"bin/",
|
|
11
|
-
"src/",
|
|
12
|
-
"README.md",
|
|
13
|
-
"SKILLS.md",
|
|
14
|
-
"CHANGELOG.md",
|
|
15
|
-
"LICENSE"
|
|
16
|
-
],
|
|
17
14
|
"engines": {
|
|
18
15
|
"node": ">=20"
|
|
19
16
|
},
|
|
20
17
|
"scripts": {
|
|
21
|
-
"
|
|
22
|
-
"smoke": "node bin/advisoros.mjs --help >/dev/null && node bin/advisoros.mjs --version >/dev/null && node -e \"import('node:fs').then(({readFileSync})=>{const s=readFileSync('bin/advisoros.mjs','utf8');if(!s.startsWith('#!/usr/bin/env node')){console.error('Missing shebang in bin/advisoros.mjs');process.exit(1)}})\"",
|
|
23
|
-
"prepublishOnly": "npm run smoke",
|
|
24
|
-
"changeset": "changeset",
|
|
25
|
-
"version-packages": "changeset version",
|
|
26
|
-
"release": "npm run smoke && changeset publish --access public"
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"commander": "^12.1.0",
|
|
30
|
-
"chalk": "^5.3.0",
|
|
31
|
-
"cli-table3": "^0.6.5",
|
|
32
|
-
"ora": "^8.1.1",
|
|
33
|
-
"prompts": "^2.4.2"
|
|
34
|
-
},
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"@changesets/cli": "^2.27.9"
|
|
18
|
+
"smoke": "node ./bin/setu.mjs --version && node ./bin/setu.mjs --help > /dev/null"
|
|
37
19
|
},
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
"directory": "tools/cli"
|
|
45
|
-
},
|
|
46
|
-
"homepage": "https://advisoros.series-a.co",
|
|
47
|
-
"bugs": {
|
|
48
|
-
"url": "https://github.com/series-a/advisoros/issues"
|
|
49
|
-
},
|
|
50
|
-
"keywords": [
|
|
51
|
-
"advisoros",
|
|
52
|
-
"cli",
|
|
53
|
-
"linkedin",
|
|
54
|
-
"campaigns",
|
|
55
|
-
"leads",
|
|
56
|
-
"sequences",
|
|
57
|
-
"agent-api"
|
|
58
|
-
],
|
|
59
|
-
"author": "AdvisorPro",
|
|
60
|
-
"license": "UNLICENSED"
|
|
20
|
+
"files": [
|
|
21
|
+
"bin",
|
|
22
|
+
"lib",
|
|
23
|
+
"README.md",
|
|
24
|
+
"CHANGELOG.md"
|
|
25
|
+
]
|
|
61
26
|
}
|
package/LICENSE
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
Copyright (c) AdvisorPro / Series A. All rights reserved.
|
|
2
|
-
|
|
3
|
-
This package is distributed under a proprietary license. Use is permitted only
|
|
4
|
-
by AdvisorPro customers and partners against their own workspace API keys. Do not
|
|
5
|
-
redistribute, sublicense, or use against workspaces you do not own without
|
|
6
|
-
written permission.
|
|
7
|
-
|
package/SKILLS.md
DELETED
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
# AdvisorPro Skills Guide for AI Agents
|
|
2
|
-
|
|
3
|
-
This file teaches any AI agent — CLI user or MCP client — how to operate
|
|
4
|
-
AdvisorPro safely and effectively. It covers the mental model, the core
|
|
5
|
-
workflows (campaigns, content, brand), the safety rails you must respect,
|
|
6
|
-
and the tricks that separate a smooth run from a failed one.
|
|
7
|
-
|
|
8
|
-
Two surfaces, one backend:
|
|
9
|
-
|
|
10
|
-
- **CLI** — `advisoros` binary (`npm i -g @series-a/cli`), authenticates with
|
|
11
|
-
an API key saved per profile in `~/.advisoros/config.json`.
|
|
12
|
-
- **MCP server** — `advisoros-mcp`, 44 tools, OAuth for the signed-in user.
|
|
13
|
-
|
|
14
|
-
Both talk to the same `/agent-api` gateway. Everything is **scoped to one
|
|
15
|
-
workspace**. Every mutation is **audited** (who, when, what, outcome).
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## 1. The non-negotiable first steps
|
|
20
|
-
|
|
21
|
-
### MCP
|
|
22
|
-
1. **Always call `list_workspaces` first.** Every other tool requires a
|
|
23
|
-
`workspace_id`. You can only see workspaces you belong to — never guess an
|
|
24
|
-
ID from another session.
|
|
25
|
-
2. Read the tool description before calling: destructive tools document their
|
|
26
|
-
own confirmation protocol.
|
|
27
|
-
|
|
28
|
-
### CLI
|
|
29
|
-
```bash
|
|
30
|
-
advisoros login --profile main # saves API key + workspace
|
|
31
|
-
advisoros whoami # confirm the active profile/workspace
|
|
32
|
-
```
|
|
33
|
-
Global flags on every command: `--json` (machine output — **always use this
|
|
34
|
-
when an AI is parsing the result**), `-w/--workspace`, `-p/--profile`,
|
|
35
|
-
`--api-key`, `--as-agent <name>` (labels your audit rows — set it to your
|
|
36
|
-
agent's name).
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## 2. Mental model
|
|
41
|
-
|
|
42
|
-
- **Leads** are people. They enter via import and are enriched from LinkedIn
|
|
43
|
-
afterwards. Dedupe key is `(workspace_id, linkedin_url)` — re-importing the
|
|
44
|
-
same URL upserts, never duplicates.
|
|
45
|
-
- **Sequences** are message trees (steps with actions, delays, branches).
|
|
46
|
-
They are **not append-only** — steps can be edited, deleted, re-parented,
|
|
47
|
-
or wholesale replaced.
|
|
48
|
-
- **Campaigns** bind leads + a sequence + sender LinkedIn accounts + a daily
|
|
49
|
-
limit. Lifecycle: draft → launch → pause/resume → archive/delete.
|
|
50
|
-
- **Content** items are drafts until scheduled/published. Nothing is ever
|
|
51
|
-
auto-published from a draft.
|
|
52
|
-
- **Knowledge base** grounds all AI generation. Only **confirmed
|
|
53
|
-
human-authored** items train the voice and count as citable evidence.
|
|
54
|
-
- **Agents** run asynchronously: you get a `job_id` back, then poll.
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## 3. LinkedIn safety — read this before any outreach
|
|
59
|
-
|
|
60
|
-
LinkedIn account safety overrides everything else. The server (not the CLI or
|
|
61
|
-
MCP) is the enforcing authority; you are expected to check before acting.
|
|
62
|
-
|
|
63
|
-
Hard limits (server-enforced):
|
|
64
|
-
- Invite note: **200 characters**
|
|
65
|
-
- Direct message: **8,000 characters** (CLI caps client-side at 7,900)
|
|
66
|
-
- Comment: **1,250 characters**
|
|
67
|
-
- Per sender: **~25 invites/day, ~80 messages/day**
|
|
68
|
-
|
|
69
|
-
Rules for agents:
|
|
70
|
-
- **Before planning outreach or a bulk import, check capacity.**
|
|
71
|
-
CLI: `advisoros safety check` / `safety limits` / `safety reads`.
|
|
72
|
-
MCP: `linkedin_safety` (returns remaining capacity, cooldowns, and
|
|
73
|
-
`safe_bulk_import_size`).
|
|
74
|
-
- **A cooldown or a 429 is not a failure.** Back off using `Retry-After` /
|
|
75
|
-
`retry_after_seconds` and retry. Never hammer.
|
|
76
|
-
- `campaigns launch` and `sequences validate` run the same char-limit checks
|
|
77
|
-
the server enforces — **validate before launch**, not after.
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
## 4. How to create a campaign (end to end)
|
|
82
|
-
|
|
83
|
-
### The fast path: `campaign-flow`
|
|
84
|
-
One command does import → sequence → launch → status:
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
advisoros campaign-flow \
|
|
88
|
-
--name "Q3 CFO outreach" \
|
|
89
|
-
--file leads.csv \
|
|
90
|
-
--goal "Book discovery calls with CFOs" \
|
|
91
|
-
--senders <senderId1>,<senderId2> \
|
|
92
|
-
--daily-limit 25 \
|
|
93
|
-
--launch
|
|
94
|
-
```
|
|
95
|
-
Add `--dry-run` first to print the plan without touching the API.
|
|
96
|
-
|
|
97
|
-
### The step-by-step path
|
|
98
|
-
```bash
|
|
99
|
-
# 1. Check capacity
|
|
100
|
-
advisoros safety check
|
|
101
|
-
|
|
102
|
-
# 2. Import leads (auto-chunks at 200/call, upserts on linkedin_url)
|
|
103
|
-
advisoros leads import --file leads.csv
|
|
104
|
-
# or from a source:
|
|
105
|
-
advisoros leads import-from linkedin_search --query "CFO fintech London"
|
|
106
|
-
# Sales Navigator (queued in the background, cap-aware):
|
|
107
|
-
advisoros leads import-from sales_nav_url --url "<sales-nav-search-url>" --limit 500
|
|
108
|
-
advisoros leads import-schedules # progress, ETA, why it is waiting
|
|
109
|
-
advisoros leads import-schedule pause|resume|cancel <scheduleId>
|
|
110
|
-
|
|
111
|
-
# 3. Build or pick a sequence
|
|
112
|
-
advisoros sequences create --name "CFO 3-touch"
|
|
113
|
-
advisoros sequences add-step <seqId> --action sendInvitation --message "..."
|
|
114
|
-
advisoros sequences add-step <seqId> --action wait --days 3
|
|
115
|
-
advisoros sequences add-step <seqId> --action sendMessage --message "..."
|
|
116
|
-
advisoros sequences validate <seqId> # same checks as launch — do this
|
|
117
|
-
|
|
118
|
-
# 4. Create the campaign and attach everything
|
|
119
|
-
advisoros campaigns create --name "Q3 CFO outreach" \
|
|
120
|
-
--sequence <seqId> --senders <id1,id2> --daily-limit 25
|
|
121
|
-
advisoros campaigns add-leads <campaignId> --file leads.csv
|
|
122
|
-
|
|
123
|
-
# 5. Preflight, then launch (launch runs preflight itself and asks --confirm)
|
|
124
|
-
advisoros campaigns preflight <campaignId>
|
|
125
|
-
advisoros campaigns launch <campaignId> --confirm
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
MCP equivalent: `import_leads` → `manage_sequence` → `update_campaign` →
|
|
129
|
-
`manage_campaign` (`preflight`, then `launch`).
|
|
130
|
-
|
|
131
|
-
### After launch
|
|
132
|
-
```bash
|
|
133
|
-
advisoros campaigns stats <id> # funnel: invites → accepts → replies → meetings
|
|
134
|
-
advisoros campaigns health <id> # run state, stalls, retries, watchdog
|
|
135
|
-
advisoros campaigns events <id> # full event log
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
## 5. Sequences: the tricks
|
|
141
|
-
|
|
142
|
-
- Allowed step actions: `viewProfile`, `addReaction`, `sendInvitation`,
|
|
143
|
-
`sendMessage`, `wait`. Nothing else — the server rejects unknown actions.
|
|
144
|
-
- `sequences show <id>` accepts a **unique ID prefix**, not just full UUIDs.
|
|
145
|
-
- `replace-steps` is **atomic**: it swaps the whole tree from a JSON file,
|
|
146
|
-
validated server-side. Prefer it over many `add-step` calls when an AI is
|
|
147
|
-
generating a full sequence.
|
|
148
|
-
- `update-step` patches one step in place; `delete-step` re-parents its
|
|
149
|
-
children automatically.
|
|
150
|
-
- Message templates support `{first_name}`-style tokens; the server guards
|
|
151
|
-
against unfilled tokens (~20-char guard). Keep variables real.
|
|
152
|
-
- Waits can be expressed in days/hours/minutes. A lead who **replies is
|
|
153
|
-
removed from all further automation automatically** — never re-add them.
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
## 6. Keeping a consistent brand
|
|
158
|
-
|
|
159
|
-
Brand consistency lives in three places; keep all three in sync.
|
|
160
|
-
|
|
161
|
-
### a) The brand record (visual identity)
|
|
162
|
-
```bash
|
|
163
|
-
advisoros brand show # colours, fonts, logos, tagline, imagery
|
|
164
|
-
advisoros brand set --primary-color "#1B4B8F" --font-heading "Inter"
|
|
165
|
-
advisoros brand fields # every editable field
|
|
166
|
-
advisoros brand imagery set --style "minimal editorial" --mood "calm, expert"
|
|
167
|
-
advisoros brand logos set --variant primary --url https://...
|
|
168
|
-
advisoros brand social set --linkedin https://linkedin.com/company/...
|
|
169
|
-
```
|
|
170
|
-
MCP: `manage_brand` (same fields; supports partial updates, add/remove of
|
|
171
|
-
motifs and reference URLs, logo upload, and the imagery direction that steers
|
|
172
|
-
**every generated image**).
|
|
173
|
-
|
|
174
|
-
### b) Tone of voice (written identity)
|
|
175
|
-
```bash
|
|
176
|
-
advisoros voice show # directive + apply-by-default flag
|
|
177
|
-
advisoros voice set --directive "..." --apply-default
|
|
178
|
-
advisoros voice sync # re-pull from Business Build
|
|
179
|
-
advisoros voice references # KB items used as writing samples
|
|
180
|
-
advisoros voice add-reference <knowledgeItemId>
|
|
181
|
-
advisoros voice set-primary <knowledgeItemId> # pin the benchmark sample
|
|
182
|
-
advisoros voice card # measured voice card (stylometric targets)
|
|
183
|
-
advisoros voice score --file draft.md # score text against the voice
|
|
184
|
-
advisoros voice redraft --file draft.md # rewrite in the author's voice
|
|
185
|
-
```
|
|
186
|
-
MCP: `tone_of_voice`.
|
|
187
|
-
|
|
188
|
-
**The rule that matters:** only knowledge items confirmed as human-authored
|
|
189
|
-
count as voice-training material. Confirm them first (`voice add-reference`,
|
|
190
|
-
or MCP `curate_knowledge` with `approve`). AI-authored items are down-weighted
|
|
191
|
-
and labelled in every retrieval — don't try to train the voice on them.
|
|
192
|
-
|
|
193
|
-
### c) Knowledge base (factual identity)
|
|
194
|
-
```bash
|
|
195
|
-
advisoros knowledge add --url https://... # auto-scraped + AI-classified
|
|
196
|
-
advisoros knowledge add --title "..." --text "..." --category positioning
|
|
197
|
-
advisoros knowledge list
|
|
198
|
-
advisoros knowledge reclassify <id>
|
|
199
|
-
```
|
|
200
|
-
Categories: positioning, proof-points, frameworks, personas, case-studies,
|
|
201
|
-
transcripts, market-intel, general. Generation is grounded in the KB — a thin
|
|
202
|
-
KB means generic output. Feed it real positioning and real proof points.
|
|
203
|
-
|
|
204
|
-
### Generating on-brand output
|
|
205
|
-
```bash
|
|
206
|
-
advisoros content generate --topic "..." --type linkedin_post # KB + reference
|
|
207
|
-
# grounded, URL-sanitised
|
|
208
|
-
advisoros content citations <id> # every source recorded for a draft
|
|
209
|
-
```
|
|
210
|
-
MCP: `generate_graphic` / `refine_graphic` for images (returns public URLs,
|
|
211
|
-
uses the brand imagery direction automatically), `create_content_draft` for
|
|
212
|
-
text (drafts only — nothing auto-publishes).
|
|
213
|
-
|
|
214
|
-
---
|
|
215
|
-
|
|
216
|
-
## 7. Content strategy & calendar
|
|
217
|
-
|
|
218
|
-
```bash
|
|
219
|
-
advisoros strategies ideate --weeks 4 # multi-week arc from KB + signals
|
|
220
|
-
advisoros strategies create ...
|
|
221
|
-
advisoros strategies resume <id> # continue an interrupted build
|
|
222
|
-
advisoros content list / show / approve / schedule / publish
|
|
223
|
-
advisoros content bulk-approve # approve everything pending
|
|
224
|
-
advisoros calendar list / create
|
|
225
|
-
```
|
|
226
|
-
Scheduling routes through Taplio when connected, otherwise the built-in cron
|
|
227
|
-
scheduler. MCP: `content_strategy`, `content_strategy_posts`,
|
|
228
|
-
`schedule_content`, `manage_content`.
|
|
229
|
-
|
|
230
|
-
---
|
|
231
|
-
|
|
232
|
-
## 8. Running agents (async jobs)
|
|
233
|
-
|
|
234
|
-
```bash
|
|
235
|
-
advisoros agents list
|
|
236
|
-
advisoros agents run <name> # returns a job_id immediately
|
|
237
|
-
advisoros agents job <jobId> # poll until terminal
|
|
238
|
-
```
|
|
239
|
-
MCP: `trigger_agent` (or `history: true` for recent runs).
|
|
240
|
-
|
|
241
|
-
Watch recipe:
|
|
242
|
-
```bash
|
|
243
|
-
JOB=$(advisoros agents run news-monitor --json | jq -r .job_id)
|
|
244
|
-
until advisoros agents job "$JOB" --json | jq -e '.status=="completed"'; do
|
|
245
|
-
sleep 15
|
|
246
|
-
done
|
|
247
|
-
```
|
|
248
|
-
A job ends in a **terminal state** (`completed` or `failed`). Content jobs
|
|
249
|
-
also carry `content_ids` and trace steps — if a job stays `running`, poll
|
|
250
|
-
longer (large articles take minutes); don't resubmit, dispatch is
|
|
251
|
-
exactly-once.
|
|
252
|
-
|
|
253
|
-
---
|
|
254
|
-
|
|
255
|
-
## 9. Destructive actions — the confirm protocol
|
|
256
|
-
|
|
257
|
-
Deletion is allowed but always two-step:
|
|
258
|
-
|
|
259
|
-
- CLI: `campaigns delete <id>` is dry-run by default; re-run with `--force`.
|
|
260
|
-
- MCP: `manage_campaign` / `manage_sequence` with `operation: "delete"`:
|
|
261
|
-
first `dry_run: true` to see the impact, then `confirm: true` to execute.
|
|
262
|
-
Campaigns that already dispatched activity also require `force: true`.
|
|
263
|
-
|
|
264
|
-
`archive` is the reversible alternative — prefer it when unsure.
|
|
265
|
-
|
|
266
|
-
---
|
|
267
|
-
|
|
268
|
-
## 10. Tricks & gotchas
|
|
269
|
-
|
|
270
|
-
1. **`--json` everywhere.** Human tables are for humans; parse JSON.
|
|
271
|
-
2. **`--as-agent <name>` on every call.** Your actions appear in
|
|
272
|
-
`advisoros audit list` — make them attributable.
|
|
273
|
-
3. **Mutation responses are live.** Every campaign/sequence mutation returns
|
|
274
|
-
the freshly re-read record with live counts. List `stats` snapshots can
|
|
275
|
-
lag — trust the `live` block after a mutation.
|
|
276
|
-
4. **Imports are idempotent.** Re-importing the same leads upserts on
|
|
277
|
-
`(workspace_id, linkedin_url)`. Safe to retry after a crash.
|
|
278
|
-
5. **Inbox sends are dry-run by default.** `inbox send`/`reply` exit code `2`
|
|
279
|
-
without `--confirm` — nothing hits LinkedIn until you confirm.
|
|
280
|
-
6. **Intelligence before content.** `signals list` and the watchlist (P0–P3
|
|
281
|
-
priorities) drive what the content agents write about. A tuned watchlist +
|
|
282
|
-
rich KB + confirmed voice references = on-topic, on-voice output.
|
|
283
|
-
7. **`export <resource> <action>`** turns any list into CSV for offline work.
|
|
284
|
-
8. **`kb sync`** mirrors the knowledge base into an Obsidian vault — one-way
|
|
285
|
-
push only, never a source of truth in the other direction.
|
|
286
|
-
9. **`integrations status`** is read-only health. It will never return
|
|
287
|
-
credentials — don't ask it to.
|
|
288
|
-
10. **Transcripts are anonymised** before storage. You will never see raw PII
|
|
289
|
-
from `meetings`/`list_transcripts`; that's by design.
|
|
290
|
-
11. **Rate limits:** per-key sliding window. On HTTP 429, respect
|
|
291
|
-
`Retry-After`. Empty results are never used as a throttle signal — if you
|
|
292
|
-
get an empty list, the data is genuinely empty.
|
|
293
|
-
12. **MCP writes are limited** to leads, knowledge items, drafts, and the
|
|
294
|
-
management tools above. Nothing auto-publishes; publishing is a deliberate
|
|
295
|
-
`manage_content publish_now` / `content publish` call.
|
|
296
|
-
|
|
297
|
-
---
|
|
298
|
-
|
|
299
|
-
## 11. Cheatsheet
|
|
300
|
-
|
|
301
|
-
| Task | CLI | MCP tool |
|
|
302
|
-
|---|---|---|
|
|
303
|
-
| Discover workspaces | `workspaces list` (admin) | `list_workspaces` (first!) |
|
|
304
|
-
| Check LinkedIn capacity | `safety check` | `linkedin_safety` |
|
|
305
|
-
| Import leads | `leads import` / `import-from` | `import_leads` |
|
|
306
|
-
| Track Sales Nav imports | `leads import-schedules` / `import-schedule` | `lead_import_schedules` |
|
|
307
|
-
| Build a sequence | `sequences create/add-step/replace-steps/validate` | `manage_sequence` |
|
|
308
|
-
| Launch a campaign | `campaign-flow` or `campaigns create/add-leads/launch` | `manage_campaign` |
|
|
309
|
-
| Campaign funnel | `campaigns stats` | `campaign_analytics` |
|
|
310
|
-
| Brand identity | `brand show/set/imagery/logos/social` | `manage_brand` |
|
|
311
|
-
| Voice | `voice show/set/references/score` | `tone_of_voice` |
|
|
312
|
-
| Knowledge | `knowledge add/list/reclassify` | `add_knowledge_item`, `curate_knowledge` |
|
|
313
|
-
| Generate content | `content generate` | `create_content_draft`, `generate_graphic` |
|
|
314
|
-
| Schedule | `content schedule` / `calendar create` | `schedule_content` |
|
|
315
|
-
| Run an agent | `agents run` + `agents job` | `trigger_agent` |
|
|
316
|
-
| Who did what | `audit list` | `list_audit` |
|
|
317
|
-
|
|
318
|
-
When in doubt: `advisoros <command> --help`, `docs/cli.md`, and
|
|
319
|
-
`docs/agent-api.md` are the canonical references.
|
package/bin/advisoros.mjs
DELETED
package/src/api.mjs
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
import { getProfile, DEFAULTS } from "./config.mjs";
|
|
4
|
-
|
|
5
|
-
const CLI_VERSION = (() => {
|
|
6
|
-
try {
|
|
7
|
-
return createRequire(import.meta.url)("../package.json").version;
|
|
8
|
-
} catch {
|
|
9
|
-
return "unknown";
|
|
10
|
-
}
|
|
11
|
-
})();
|
|
12
|
-
|
|
13
|
-
export class AdvisorOSApiError extends Error {
|
|
14
|
-
constructor(message, { status, body } = {}) {
|
|
15
|
-
super(message);
|
|
16
|
-
this.name = "AdvisorOSApiError";
|
|
17
|
-
this.status = status;
|
|
18
|
-
this.body = body;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Invoke the AdvisorPro /agent-api router.
|
|
24
|
-
* Resolves credentials from --profile / env / saved config in that order.
|
|
25
|
-
*/
|
|
26
|
-
export async function call(resource, action, params = {}, opts = {}) {
|
|
27
|
-
const profileName = opts.profile || process.env.ADVISOROS_PROFILE || "default";
|
|
28
|
-
const stored = await getProfile(profileName);
|
|
29
|
-
const apiKey = opts.apiKey || process.env.ADVISOROS_API_KEY || stored?.apiKey;
|
|
30
|
-
const workspaceId =
|
|
31
|
-
opts.workspaceId ||
|
|
32
|
-
process.env.ADVISOROS_WORKSPACE_ID ||
|
|
33
|
-
stored?.workspaceId;
|
|
34
|
-
const baseUrl =
|
|
35
|
-
opts.baseUrl ||
|
|
36
|
-
process.env.ADVISOROS_BASE_URL ||
|
|
37
|
-
stored?.baseUrl ||
|
|
38
|
-
DEFAULTS.baseUrl;
|
|
39
|
-
const agentName =
|
|
40
|
-
opts.agentName ||
|
|
41
|
-
process.env.ADVISOROS_AGENT_NAME ||
|
|
42
|
-
stored?.agentName ||
|
|
43
|
-
"advisoros-cli";
|
|
44
|
-
|
|
45
|
-
const actorEmail =
|
|
46
|
-
opts.actorEmail || process.env.ADVISOROS_ACTOR_EMAIL || stored?.email || null;
|
|
47
|
-
const actorUserId =
|
|
48
|
-
opts.actorUserId || process.env.ADVISOROS_ACTOR_USER_ID || stored?.userId || null;
|
|
49
|
-
|
|
50
|
-
if (!apiKey) {
|
|
51
|
-
throw new AdvisorOSApiError(
|
|
52
|
-
"No API key configured. Run `advisoros login` or set ADVISOROS_API_KEY.",
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
// workspaces resource doesn't require a workspace_id in the envelope.
|
|
56
|
-
if (!workspaceId && resource !== "workspaces") {
|
|
57
|
-
throw new AdvisorOSApiError(
|
|
58
|
-
"No workspace configured. Run `advisoros login` again or pass --workspace.",
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const body = {
|
|
63
|
-
agent_name: agentName,
|
|
64
|
-
workspace_id: workspaceId ?? "",
|
|
65
|
-
resource,
|
|
66
|
-
action,
|
|
67
|
-
params,
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
let res;
|
|
71
|
-
try {
|
|
72
|
-
res = await fetch(baseUrl, {
|
|
73
|
-
method: "POST",
|
|
74
|
-
headers: {
|
|
75
|
-
"Content-Type": "application/json",
|
|
76
|
-
"x-service-account-key": apiKey,
|
|
77
|
-
"x-surface": "cli",
|
|
78
|
-
"x-client-name": "advisoros-cli",
|
|
79
|
-
"x-client-version": CLI_VERSION,
|
|
80
|
-
"x-correlation-id": opts.correlationId || randomUUID(),
|
|
81
|
-
...(actorUserId ? { "x-actor-user-id": actorUserId } : {}),
|
|
82
|
-
...(actorEmail ? { "x-actor-email": actorEmail } : {}),
|
|
83
|
-
},
|
|
84
|
-
body: JSON.stringify(body),
|
|
85
|
-
});
|
|
86
|
-
} catch (e) {
|
|
87
|
-
throw new AdvisorOSApiError(`Network error: ${e.message}`);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const text = await res.text();
|
|
91
|
-
let json;
|
|
92
|
-
try { json = JSON.parse(text); } catch { json = { raw: text }; }
|
|
93
|
-
|
|
94
|
-
if (!res.ok || json?.success === false) {
|
|
95
|
-
throw new AdvisorOSApiError(
|
|
96
|
-
json?.error || `HTTP ${res.status}`,
|
|
97
|
-
{ status: res.status, body: json },
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
return json;
|
|
101
|
-
}
|
|
102
|
-
|