@senso-ai/cli 0.11.1 → 0.14.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/README.md +176 -377
- package/dist/cli.js +4518 -2214
- package/package.json +51 -24
package/README.md
CHANGED
|
@@ -1,444 +1,243 @@
|
|
|
1
1
|
# Senso CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/AI-Template-SDK/senso-user-cli/actions/workflows/testing.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/@senso-ai/cli)
|
|
5
|
+
[](https://www.npmjs.com/package/@senso-ai/cli)
|
|
6
|
+
[](https://nodejs.org)
|
|
7
|
+
[](LICENSE)
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
> Infrastructure for the Agentic Web
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
The command-line interface for [Senso](https://docs.senso.ai). Search your
|
|
12
|
+
knowledge base, manage content, run the generation engine and read your GEO
|
|
13
|
+
analytics — from a terminal, a script, or an AI agent.
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
Built for **agents** (Claude Code, Gemini CLI, Codex) as much as for people:
|
|
16
|
+
stdout carries only the payload, `--output json` is available on every command,
|
|
17
|
+
and failures exit with a code that says what went wrong.
|
|
10
18
|
|
|
11
|
-
##
|
|
19
|
+
## Install
|
|
12
20
|
|
|
13
|
-
Requires **Node.js
|
|
21
|
+
Requires **Node.js 20.12 or newer**. Works on Linux, macOS and Windows.
|
|
14
22
|
|
|
15
23
|
```bash
|
|
16
24
|
npm install -g @senso-ai/cli
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Verify it works:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
25
|
senso --version
|
|
23
26
|
```
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
>
|
|
27
|
-
> ```bash
|
|
28
|
-
> npx @senso-ai/cli --help
|
|
29
|
-
> ```
|
|
30
|
-
|
|
31
|
-
## Quick Start
|
|
32
|
-
|
|
33
|
-
### 1. Authenticate
|
|
34
|
-
|
|
35
|
-
Get an API key from [docs.senso.ai](https://docs.senso.ai), then:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
senso login
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
The interactive prompt will walk you through pasting your key and verifying it against your organization.
|
|
42
|
-
|
|
43
|
-
Alternatively, set an environment variable (useful for CI and AI agents):
|
|
28
|
+
Or without installing:
|
|
44
29
|
|
|
45
30
|
```bash
|
|
46
|
-
|
|
31
|
+
npx @senso-ai/cli --help
|
|
47
32
|
```
|
|
48
33
|
|
|
49
|
-
|
|
34
|
+
## 60 seconds
|
|
50
35
|
|
|
51
36
|
```bash
|
|
52
|
-
|
|
53
|
-
|
|
37
|
+
# 1. Authenticate. Get a key from https://docs.senso.ai
|
|
38
|
+
export SENSO_API_KEY=tgr_your_key_here # or run: senso login
|
|
54
39
|
|
|
55
|
-
|
|
40
|
+
# 2. Ask your knowledge base a question
|
|
41
|
+
senso search "what is our refund policy?"
|
|
56
42
|
|
|
57
|
-
|
|
58
|
-
senso
|
|
43
|
+
# 3. The same thing, for a program
|
|
44
|
+
senso search "what is our refund policy?" --output json | jq -r .answer
|
|
59
45
|
```
|
|
60
46
|
|
|
61
|
-
That
|
|
47
|
+
That third line is the point of this tool. There is no `--quiet` in it because
|
|
48
|
+
none is needed: stdout carries the payload and nothing else.
|
|
62
49
|
|
|
63
|
-
|
|
50
|
+
## Using it from an agent
|
|
64
51
|
|
|
65
|
-
|
|
52
|
+
The whole contract, in one place.
|
|
66
53
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
| **macOS** | Node 18+ | `~/Library/Preferences/senso/config.json` |
|
|
71
|
-
| **Windows** | Node 18+ | `%APPDATA%\senso\config.json` |
|
|
54
|
+
**Streams.** stdout is the payload. Everything else — progress, warnings,
|
|
55
|
+
errors, the banner — goes to stderr. Redirecting stdout to a file gives you data
|
|
56
|
+
or an empty file, never a sentence you have to strip.
|
|
72
57
|
|
|
73
|
-
|
|
58
|
+
**Formats.** Every command takes `--output`:
|
|
74
59
|
|
|
75
|
-
|
|
60
|
+
| Format | For | Notes |
|
|
61
|
+
| ------- | ------------------ | ----------------------------------------------- |
|
|
62
|
+
| `json` | scripts and agents | The API payload, unmodified. Implies `--quiet`. |
|
|
63
|
+
| `table` | reading a list | Aligned columns; long cells truncated. |
|
|
64
|
+
| `plain` | reading one thing | Complete and untruncated. The default. |
|
|
76
65
|
|
|
77
|
-
|
|
66
|
+
**Exit codes.** Branch on these rather than on message text.
|
|
78
67
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### Auth Priority
|
|
90
|
-
|
|
91
|
-
The CLI resolves credentials in this order:
|
|
92
|
-
|
|
93
|
-
1. `--api-key` flag (highest priority)
|
|
94
|
-
2. `SENSO_API_KEY` environment variable
|
|
95
|
-
3. `~/.config/senso/config.json` stored key
|
|
96
|
-
4. Interactive prompt (first-run only)
|
|
97
|
-
|
|
98
|
-
For non-interactive use (CI, agents), set the env var or pass the flag.
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## Commands
|
|
103
|
-
|
|
104
|
-
### Authentication
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
senso login Authenticate with Senso (interactive)
|
|
108
|
-
senso logout Remove stored credentials
|
|
109
|
-
senso whoami Show current org and auth status
|
|
110
|
-
```
|
|
68
|
+
| Code | Meaning | What to do |
|
|
69
|
+
| ---- | ------------------------------ | -------------------- |
|
|
70
|
+
| 0 | Success | — |
|
|
71
|
+
| 1 | The API or the runtime refused | Read the message |
|
|
72
|
+
| 2 | Usage error | Fix the command line |
|
|
73
|
+
| 3 | Authentication | Fix the credential |
|
|
74
|
+
| 4 | Not found | Check the ID |
|
|
75
|
+
| 5 | Network failure or timeout | Retry |
|
|
111
76
|
|
|
112
|
-
|
|
77
|
+
**Errors are structured too.** Under `--output json`, a failure writes JSON to
|
|
78
|
+
stderr and leaves stdout empty:
|
|
113
79
|
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"error": {
|
|
83
|
+
"code": "unauthorized",
|
|
84
|
+
"message": "Authentication failed: the API key was rejected.",
|
|
85
|
+
"status": 401,
|
|
86
|
+
"hint": "Run `senso login` to store a new key, or check SENSO_API_KEY."
|
|
87
|
+
}
|
|
88
|
+
}
|
|
114
89
|
```
|
|
115
|
-
senso search <query> Semantic search with AI-generated answer + source chunks
|
|
116
|
-
senso search context <query> Chunks only (no AI answer, faster)
|
|
117
|
-
senso search content <query> Content IDs only (deduplicated)
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Options: `--max-results <n>`
|
|
121
|
-
|
|
122
|
-
### Content
|
|
123
|
-
|
|
124
|
-
```
|
|
125
|
-
senso content list List all knowledge base items
|
|
126
|
-
senso content get <id> Get full content detail by ID
|
|
127
|
-
senso content versions <id> List version history for a content item
|
|
128
|
-
senso content delete <id> Delete content (knowledge base + external)
|
|
129
|
-
senso content unpublish <id> Unpublish and revert to draft
|
|
130
|
-
senso content verification List items in verification workflow
|
|
131
|
-
senso content verification-counts Counts by status + published-domain summaries
|
|
132
|
-
senso content reject <versionId> Reject a content version
|
|
133
|
-
senso content restore <versionId> Restore rejected version to draft
|
|
134
|
-
senso content owners <id> List owners of a content item
|
|
135
|
-
senso content set-owners <id> Replace owners (--user-ids)
|
|
136
|
-
senso content remove-owner <id> <userId> Remove a single owner
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Options: `content list` supports `--limit`, `--offset`, `--search`, `--sort`. `content verification` supports `--limit`, `--offset`, `--search`, `--status`, `--substatus`. `content reject` supports `--reason`.
|
|
140
|
-
|
|
141
|
-
### Generated Content (GEO)
|
|
142
|
-
|
|
143
|
-
```
|
|
144
|
-
senso generated-content list List published or draft generated content (--status published|drafts)
|
|
145
|
-
senso generated-content get <id> Get a generated content item with its rendered body
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
Options: `generated-content list` supports `--status`, `--limit`, `--offset`, `--search`.
|
|
149
|
-
|
|
150
|
-
### Content Generation
|
|
151
|
-
|
|
152
|
-
```
|
|
153
|
-
senso generate settings Get generation settings
|
|
154
|
-
senso generate update-settings Update generation settings (--data)
|
|
155
|
-
senso generate sample Generate sample for a prompt; waits for async job by default (--prompt-id, --content-type-id, --no-wait)
|
|
156
|
-
senso generate run Trigger a content engine run (--prompt-ids)
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### Content Engine
|
|
160
|
-
|
|
161
|
-
```
|
|
162
|
-
senso engine publish Publish content to external destinations (--data)
|
|
163
|
-
senso engine draft Save content as draft for review (--data)
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### Tracked Competitors & Sources
|
|
167
|
-
|
|
168
|
-
```
|
|
169
|
-
senso competitors list List tracked competitors
|
|
170
|
-
senso competitors add Add a competitor (--name, --url)
|
|
171
|
-
senso competitors suggest Get AI-generated competitor suggestions
|
|
172
|
-
senso competitors batch-add Add up to 50 competitors (--data)
|
|
173
|
-
senso competitors update <id> Update a competitor (--name, --url)
|
|
174
|
-
senso competitors delete <id> Remove a competitor
|
|
175
|
-
|
|
176
|
-
senso tracked-sources list List citation-classification rules
|
|
177
|
-
senso tracked-sources add Add a rule (--pattern, --match-type, --tier)
|
|
178
|
-
senso tracked-sources update <id> Replace a rule (--pattern, --match-type, --tier)
|
|
179
|
-
senso tracked-sources delete <id> Remove a rule
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
Options: `tracked-sources add`/`update` support `--category`, `--label`, `--priority`; `update` also supports `--active`/`--no-active`. `--match-type` is one of `domain | host | path_prefix | exact_url`; `--tier` is one of `primary | tracked | secondary`.
|
|
183
|
-
|
|
184
|
-
### Ingestion
|
|
185
|
-
|
|
186
|
-
```
|
|
187
|
-
senso ingest upload <files...> Upload files to knowledge base (up to 10)
|
|
188
|
-
senso ingest reprocess <contentId> <file> Re-ingest content with new file
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### Brand Kit & Content Types
|
|
192
|
-
|
|
193
|
-
```
|
|
194
|
-
senso brand-kit get Get brand kit guidelines
|
|
195
|
-
senso brand-kit set Create or replace brand kit (--data)
|
|
196
|
-
|
|
197
|
-
senso content-types list List content types
|
|
198
|
-
senso content-types create Create a content type (--data)
|
|
199
|
-
senso content-types get <id> Get content type by ID
|
|
200
|
-
senso content-types update <id> Update a content type (--data)
|
|
201
|
-
senso content-types delete <id> Delete a content type
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
Options: `content-types list` supports `--limit`, `--offset`.
|
|
205
|
-
|
|
206
|
-
### Prompts
|
|
207
|
-
|
|
208
|
-
```
|
|
209
|
-
senso prompts list List prompts (geo questions)
|
|
210
|
-
senso prompts create Create a prompt (--data)
|
|
211
|
-
senso prompts get <promptId> Get prompt with run history
|
|
212
|
-
senso prompts delete <promptId> Delete a prompt
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
Options: `prompts list` supports `--limit`, `--offset`, `--search`, `--sort`.
|
|
216
|
-
|
|
217
|
-
### Organization
|
|
218
|
-
|
|
219
|
-
```
|
|
220
|
-
senso org get Get organization details
|
|
221
|
-
senso org update Update organization details (--data)
|
|
222
|
-
|
|
223
|
-
senso users list List users
|
|
224
|
-
senso users add Add a user (--data)
|
|
225
|
-
senso users get <userId> Get user details
|
|
226
|
-
senso users update <userId> Update a user's role (--data)
|
|
227
|
-
senso users remove <userId> Remove a user
|
|
228
|
-
senso users set-current <userId> Set org as current for a user
|
|
229
|
-
|
|
230
|
-
senso api-keys list List API keys
|
|
231
|
-
senso api-keys create Create API key (--data)
|
|
232
|
-
senso api-keys get <keyId> Get API key details
|
|
233
|
-
senso api-keys update <keyId> Update API key (--data)
|
|
234
|
-
senso api-keys delete <keyId> Delete API key
|
|
235
|
-
senso api-keys revoke <keyId> Revoke API key
|
|
236
|
-
|
|
237
|
-
senso members list List organization members
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
Options: `users list` supports `--limit`, `--offset`. `api-keys list` supports `--limit`, `--offset`. `members list` supports `--limit`, `--offset`, `--search`, `--sort`.
|
|
241
|
-
|
|
242
|
-
### Run Configuration
|
|
243
|
-
|
|
244
|
-
```
|
|
245
|
-
senso run-config models Get configured AI models
|
|
246
|
-
senso run-config set-models Set AI models (--data)
|
|
247
|
-
senso run-config schedule Get run schedule (days of week)
|
|
248
|
-
senso run-config set-schedule Set run schedule (--data)
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
### Notifications
|
|
252
|
-
|
|
253
|
-
```
|
|
254
|
-
senso notifications list List notifications
|
|
255
|
-
senso notifications read <id> Mark notification as read
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
Options: `notifications list` supports `--limit`, `--offset`, `--unread-only`.
|
|
259
|
-
|
|
260
|
-
### CLI Management
|
|
261
|
-
|
|
262
|
-
```
|
|
263
|
-
senso update Update to the latest version
|
|
264
|
-
senso --version Show current version
|
|
265
|
-
senso --help Show help
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
---
|
|
269
90
|
|
|
270
|
-
|
|
91
|
+
`error.code` is stable. Messages may be reworded; codes are part of the
|
|
92
|
+
interface.
|
|
271
93
|
|
|
272
|
-
|
|
273
|
-
|------|-------------|
|
|
274
|
-
| `--api-key <key>` | Override API key (or set `SENSO_API_KEY` env var) |
|
|
275
|
-
| `--base-url <url>` | Override API base URL (default: `https://apiv2.senso.ai/api/v1`) |
|
|
276
|
-
| `--output <format>` | Output format: `json`, `table`, or `plain` (default: `plain`) |
|
|
277
|
-
| `--quiet` | Suppress banners and non-essential output |
|
|
278
|
-
| `--no-update-check` | Skip version check (or set `SENSO_NO_UPDATE_CHECK=1`) |
|
|
279
|
-
| `-v, --version` | Show version |
|
|
280
|
-
| `-h, --help` | Show help |
|
|
94
|
+
**Environment.**
|
|
281
95
|
|
|
282
|
-
|
|
96
|
+
| Variable | Purpose |
|
|
97
|
+
| ------------------------- | ------------------------------------------------------------ |
|
|
98
|
+
| `SENSO_API_KEY` | The API key, if you would rather not run `senso login` |
|
|
99
|
+
| `SENSO_BASE_URL` | Point at a different API |
|
|
100
|
+
| `SENSO_CONFIG_DIR` | Relocate the config file (per-project credentials, or tests) |
|
|
101
|
+
| `SENSO_DEBUG=1` | Log every request and its status to stderr, key redacted |
|
|
102
|
+
| `SENSO_NO_UPDATE_CHECK=1` | Never check npm for a newer version |
|
|
103
|
+
| `NO_COLOR` | Disable color (any value) |
|
|
283
104
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
**Plain** (default — human-friendly):
|
|
105
|
+
**Teaching an agent to use Senso.** The official agent skills install in one
|
|
106
|
+
command:
|
|
287
107
|
|
|
108
|
+
```bash
|
|
109
|
+
senso skills install --all
|
|
288
110
|
```
|
|
289
|
-
$ senso search "mortgage rates"
|
|
290
|
-
|
|
291
|
-
Answer: Based on our knowledge base, current mortgage rates are...
|
|
292
|
-
|
|
293
|
-
Found 3 results:
|
|
294
111
|
|
|
295
|
-
|
|
296
|
-
Content: Fixed-rate mortgages currently average...
|
|
297
|
-
ID: cnt_abc123
|
|
298
|
-
```
|
|
112
|
+
## Commands
|
|
299
113
|
|
|
300
|
-
**
|
|
114
|
+
**[Full command reference →](docs/reference/commands.md)** — every command,
|
|
115
|
+
argument and flag, generated from the CLI itself.
|
|
116
|
+
|
|
117
|
+
| Group | What it does |
|
|
118
|
+
| ------------------------------------------------------------------------ | ------------------------------------------------------------------- |
|
|
119
|
+
| `login` `logout` `whoami` | Authentication and the current organization |
|
|
120
|
+
| `search` | Ask the knowledge base, with an AI answer, raw chunks, or streaming |
|
|
121
|
+
| `kb` `ingest` `content` | The knowledge base: upload, browse, organize, verify |
|
|
122
|
+
| `ctas` | Call-to-action cards on published pages |
|
|
123
|
+
| `generate` `engine` `generated-content` `destinations` `publish-records` | Generate content and publish it |
|
|
124
|
+
| `analytics` | GEO metrics for your own organization |
|
|
125
|
+
| `industries` | Competitive intelligence (needs a partner key) |
|
|
126
|
+
| `prompts` `questions` `competitors` `tracked-sources` | What gets monitored |
|
|
127
|
+
| `brand-kit` `content-types` `product-lines` `tags` | How content is shaped |
|
|
128
|
+
| `org` `users` `members` `roles` `permissions` `api-keys` `credits` | Organization administration |
|
|
129
|
+
| `run-config` | Which models run, and on which days |
|
|
130
|
+
| `skills` | Install the Senso agent skills |
|
|
131
|
+
| `update` | Update this CLI |
|
|
132
|
+
|
|
133
|
+
A few worth knowing about:
|
|
301
134
|
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
"title": "Mortgage Rate Overview",
|
|
309
|
-
"chunk_text": "Fixed-rate mortgages currently average...",
|
|
310
|
-
"content_id": "cnt_abc123"
|
|
311
|
-
}
|
|
312
|
-
]
|
|
313
|
-
}
|
|
135
|
+
```bash
|
|
136
|
+
senso search "..." --output json # answer + sources, for a program
|
|
137
|
+
senso search stream "..." # tokens as they arrive
|
|
138
|
+
senso ingest upload ./policy.pdf # into the knowledge base
|
|
139
|
+
senso analytics summary # headline GEO metrics
|
|
140
|
+
senso analytics glossary # what every metric means
|
|
314
141
|
```
|
|
315
142
|
|
|
316
|
-
|
|
143
|
+
### Reading the analytics numbers
|
|
317
144
|
|
|
318
|
-
|
|
319
|
-
|
|
145
|
+
`senso analytics` reports how often AI models name your brand and which pages
|
|
146
|
+
they cite. The metrics are easy to misread, so
|
|
147
|
+
**[docs/analytics.md](docs/analytics.md)** states what each one divides by. The
|
|
148
|
+
short version:
|
|
320
149
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
150
|
+
- **Share of Voice** divides by mentions of _every_ brand the models named, not
|
|
151
|
+
just your tracked competitors.
|
|
152
|
+
- **Citation Rate** and **Coverage** divide by answers that carried at least one
|
|
153
|
+
citation. **Citation Share** divides by total citation instances. They are
|
|
154
|
+
different metrics on different denominators.
|
|
155
|
+
- A metric shown as `—` means _not measured_ — its denominator was zero. That is
|
|
156
|
+
not the same as 0%.
|
|
157
|
+
- `analytics answers` is a snapshot, not a window: narrowing the dates hides
|
|
158
|
+
results rather than returning older ones.
|
|
325
159
|
|
|
326
|
-
|
|
160
|
+
`senso analytics glossary` is the canonical definition of each metric, its
|
|
161
|
+
denominator and its gotcha, straight from the API.
|
|
327
162
|
|
|
328
|
-
##
|
|
163
|
+
## Configuration
|
|
329
164
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
```
|
|
333
|
-
╭──────────────────────────────────────────────╮
|
|
334
|
-
│ │
|
|
335
|
-
│ Update available! 0.1.0 → 0.2.0 │
|
|
336
|
-
│ │
|
|
337
|
-
│ Run senso update to update │
|
|
338
|
-
│ │
|
|
339
|
-
╰──────────────────────────────────────────────╯
|
|
340
|
-
```
|
|
165
|
+
`senso login` stores your key in a JSON file with owner-only permissions:
|
|
341
166
|
|
|
342
|
-
|
|
167
|
+
| Platform | Location |
|
|
168
|
+
| -------- | ----------------------------------------- |
|
|
169
|
+
| Linux | `~/.config/senso/config.json` |
|
|
170
|
+
| macOS | `~/Library/Preferences/senso/config.json` |
|
|
171
|
+
| Windows | `%APPDATA%\senso\Config\config.json` |
|
|
343
172
|
|
|
344
|
-
|
|
173
|
+
Set `SENSO_CONFIG_DIR` to put it somewhere else. Credentials resolve in this
|
|
174
|
+
order: `--api-key`, then `SENSO_API_KEY`, then the config file. `senso login`
|
|
175
|
+
needs a terminal; in CI or an agent, set the environment variable.
|
|
345
176
|
|
|
346
|
-
|
|
177
|
+
The CLI checks npm for a newer version once a day and prints a notice on stderr.
|
|
178
|
+
`senso update` upgrades it; `SENSO_NO_UPDATE_CHECK=1` turns the check off.
|
|
347
179
|
|
|
348
180
|
## Development
|
|
349
181
|
|
|
350
182
|
```bash
|
|
351
|
-
#
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
# Install dependencies
|
|
356
|
-
npm install
|
|
357
|
-
|
|
358
|
-
# Run in dev mode (TypeScript directly via tsx)
|
|
359
|
-
npm run dev -- search "test query"
|
|
360
|
-
|
|
361
|
-
# Build (single ESM bundle via tsup)
|
|
362
|
-
npm run build
|
|
363
|
-
|
|
364
|
-
# Run the built version
|
|
365
|
-
node dist/cli.js --help
|
|
366
|
-
|
|
367
|
-
# Run tests
|
|
368
|
-
npm test
|
|
183
|
+
nvm use # Node 22, per .nvmrc
|
|
184
|
+
npm ci
|
|
185
|
+
make all # everything CI runs
|
|
369
186
|
```
|
|
370
187
|
|
|
371
|
-
|
|
188
|
+
`make all` is the whole pipeline, and CI invokes the same targets in the same
|
|
189
|
+
order — a green `make all` and a green pipeline cannot mean different things.
|
|
372
190
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
│ ├── engine.ts # publish, draft
|
|
383
|
-
│ ├── competitors.ts # tracked competitors CRUD + suggest
|
|
384
|
-
│ ├── tracked-sources.ts # citation-classification rules CRUD
|
|
385
|
-
│ ├── ingest.ts # upload, reprocess (with S3 upload)
|
|
386
|
-
│ ├── brand-kit.ts # get, set
|
|
387
|
-
│ ├── content-types.ts # CRUD
|
|
388
|
-
│ ├── prompts.ts # CRUD
|
|
389
|
-
│ ├── org.ts # get, update
|
|
390
|
-
│ ├── users.ts # CRUD + set-current
|
|
391
|
-
│ ├── api-keys.ts # CRUD + revoke
|
|
392
|
-
│ ├── members.ts # list
|
|
393
|
-
│ ├── run-config.ts # models, schedule
|
|
394
|
-
│ ├── notifications.ts # list, read
|
|
395
|
-
│ └── update.ts # self-update
|
|
396
|
-
├── lib/
|
|
397
|
-
│ ├── api-client.ts # HTTP wrapper (native fetch, X-API-Key auth)
|
|
398
|
-
│ ├── config.ts # Config read/write (~/.config/senso/)
|
|
399
|
-
│ ├── output.ts # json/table/plain formatting
|
|
400
|
-
│ └── version.ts # Reads version from package.json
|
|
401
|
-
└── utils/
|
|
402
|
-
├── logger.ts # Colored log helpers (picocolors)
|
|
403
|
-
├── branding.ts # ASCII logo, gradient banner, boxed panels
|
|
404
|
-
└── updater.ts # GitHub releases version check
|
|
405
|
-
```
|
|
191
|
+
| Stage | Command | What it checks |
|
|
192
|
+
| ---------- | ---------------- | --------------------------------------------------------- |
|
|
193
|
+
| Lint | `make lint` | ESLint (type-aware) and Prettier |
|
|
194
|
+
| Typecheck | `make typecheck` | `tsc --noEmit` over src, tests and scripts |
|
|
195
|
+
| Security | `make security` | `npm audit`, semgrep, and gitleaks over the full history |
|
|
196
|
+
| Unit | `make unit` | Unit, command and policy tests, behind a coverage gate |
|
|
197
|
+
| End-to-end | `make e2e` | The built bundle, as a subprocess, against a mock API |
|
|
198
|
+
| Build | `make build` | The tsup bundle |
|
|
199
|
+
| Smoke | `make smoke` | Packs the tarball, installs it clean, and runs the binary |
|
|
406
200
|
|
|
407
|
-
|
|
201
|
+
**No test touches the network.** `tests/setup.ts` installs an MSW server with
|
|
202
|
+
`onUnhandledRequest: 'error'`, so a request nobody mocked fails the test rather
|
|
203
|
+
than quietly reaching a real Senso API with whatever key is in your environment.
|
|
204
|
+
That is enforced mechanically, which is why CI needs no secrets and why pull
|
|
205
|
+
requests from forks run the full suite.
|
|
408
206
|
|
|
409
|
-
|
|
410
|
-
|---------|--------|
|
|
411
|
-
| Language | TypeScript |
|
|
412
|
-
| Runtime | Node.js 18+ |
|
|
413
|
-
| Bundler | tsup (esbuild) — single 50KB ESM bundle |
|
|
414
|
-
| CLI Framework | Commander.js |
|
|
415
|
-
| Interactive Prompts | @clack/prompts |
|
|
416
|
-
| Colors | picocolors |
|
|
417
|
-
| ASCII Branding | figlet + gradient-string + boxen |
|
|
418
|
-
| Config | env-paths (XDG-compatible) |
|
|
419
|
-
| HTTP | Native `fetch` |
|
|
207
|
+
Run `make help` for every target.
|
|
420
208
|
|
|
421
|
-
|
|
209
|
+
## Repository layout
|
|
422
210
|
|
|
423
|
-
This project uses [semantic versioning](https://semver.org/). The CLI's auto-update checker compares the installed version against the latest GitHub release using semver, so pre-release tags and version ordering are handled correctly.
|
|
424
|
-
|
|
425
|
-
```bash
|
|
426
|
-
# 1. Bump the version in package.json, commit, and create a git tag
|
|
427
|
-
npm version patch # 0.1.0 → 0.1.1 (bug fixes)
|
|
428
|
-
npm version minor # 0.1.0 → 0.2.0 (new features, backwards-compatible)
|
|
429
|
-
npm version major # 0.1.0 → 1.0.0 (breaking changes)
|
|
430
|
-
|
|
431
|
-
# 2. Push the commit and tag
|
|
432
|
-
git push origin main --tags
|
|
433
|
-
|
|
434
|
-
# 3. Create a GitHub release (this is what the auto-updater checks)
|
|
435
|
-
gh release create v0.2.0 --title "v0.2.0" --notes "Release notes here"
|
|
436
211
|
```
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
212
|
+
src/
|
|
213
|
+
cli.ts The bin entry — the only file that ends the process
|
|
214
|
+
program.ts createProgram(): builds the command tree, no side effects
|
|
215
|
+
commands/ One file per command group
|
|
216
|
+
lib/ api-client, config, errors, output, run-action
|
|
217
|
+
utils/ logger, branding, updater
|
|
218
|
+
tests/
|
|
219
|
+
unit/ Library modules, in isolation
|
|
220
|
+
commands/ Each command group, in-process, against a mock API
|
|
221
|
+
e2e/ The built bundle, as a subprocess
|
|
222
|
+
policy/ This repository's own rules
|
|
223
|
+
docs/ How it works, and the generated command reference
|
|
224
|
+
scripts/ Reference generator, smoke test, pre-commit checks
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Documentation
|
|
228
|
+
|
|
229
|
+
| Document | Read it when you want to know |
|
|
230
|
+
| -------------------------------------------------------- | -------------------------------------------------------------- |
|
|
231
|
+
| [docs/README.md](docs/README.md) | How this CLI works, in 60 seconds and then in depth |
|
|
232
|
+
| [docs/reference/commands.md](docs/reference/commands.md) | Every command and flag |
|
|
233
|
+
| [docs/configuration.md](docs/configuration.md) | Every environment variable and file it touches |
|
|
234
|
+
| [docs/architecture.md](docs/architecture.md) | What happens between argv and the API |
|
|
235
|
+
| [docs/analytics.md](docs/analytics.md) | What every GEO metric divides by, and how to not misread one |
|
|
236
|
+
| [CONTRIBUTING.md](CONTRIBUTING.md) | How to make a change, and what a review will send back |
|
|
237
|
+
| [SECURITY.md](SECURITY.md) | What this tool holds, and what it does not do |
|
|
238
|
+
| [CHANGELOG.md](CHANGELOG.md) | What changed and when |
|
|
239
|
+
| [CLAUDE.md](CLAUDE.md) | Conventions, and the behaviors that look like bugs but are not |
|
|
441
240
|
|
|
442
241
|
## License
|
|
443
242
|
|
|
444
|
-
[AGPL-3.0](LICENSE)
|
|
243
|
+
[AGPL-3.0-or-later](LICENSE)
|