@soku-ai/cli 0.1.0-alpha.6 → 0.1.0-alpha.8

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/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export declare const CLI_PACKAGE_NAME = "@soku-ai/cli";
2
- export declare const CLI_VERSION = "0.1.0-alpha.6";
2
+ export declare const CLI_VERSION = "0.1.0-alpha.8";
3
3
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export const CLI_PACKAGE_NAME = '@soku-ai/cli';
2
- export const CLI_VERSION = '0.1.0-alpha.6';
2
+ export const CLI_VERSION = '0.1.0-alpha.8';
3
3
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soku-ai/cli",
3
- "version": "0.1.0-alpha.6",
4
- "description": "Soku CLI — call Soku ads/GA4 data capabilities from any AI agent or shell.",
3
+ "version": "0.1.0-alpha.8",
4
+ "description": "Soku CLI — call Soku ads/GA4/PostHog data capabilities from any AI agent or shell.",
5
5
  "license": "Proprietary",
6
6
  "author": "Soku",
7
7
  "homepage": "https://soku.ai/cli",
@@ -19,7 +19,8 @@
19
19
  "ai-agent",
20
20
  "marketing-analytics",
21
21
  "google-ads",
22
- "ga4"
22
+ "ga4",
23
+ "posthog"
23
24
  ],
24
25
  "type": "module",
25
26
  "bin": {
@@ -1,11 +1,13 @@
1
1
  ---
2
2
  name: soku
3
3
  description: >-
4
- Use when calling Soku ads/GA4 marketing-data capabilities from the shell —
4
+ Use when calling Soku ads/GA4/PostHog marketing-data capabilities or SEO
5
+ Hosting domain connections from the shell —
5
6
  running `soku auth login`, switching org/brand with `soku org use` /
6
7
  `soku brand use`, discovering capabilities, calling a data action, routing a
7
8
  third-party API call (Ahrefs/DataForSEO/Firecrawl/Gemini/…) through
8
- `soku egress`, handling 401/403 errors, or installing/updating the Soku CLI.
9
+ `soku egress`, managing `soku seo-hosting connections`, handling 401/403
10
+ errors, or installing/updating the Soku CLI.
9
11
  license: Proprietary
10
12
  metadata:
11
13
  author: nex-ad
@@ -14,10 +16,10 @@ metadata:
14
16
 
15
17
  # Soku CLI
16
18
 
17
- The `soku` CLI calls Soku's ads + GA4 data capabilities over HTTP. It is the
18
- preferred way for an agent to use Soku data — it works in any shell, with no MCP
19
- host required. Output is JSON on stdout; errors are a JSON envelope on stderr
20
- with a semantic exit code.
19
+ The `soku` CLI calls Soku's ads, GA4, PostHog, and SEO Hosting capabilities over
20
+ HTTP. It is the preferred way for an agent to use Soku from any shell, with no
21
+ MCP host required. Output is JSON on stdout; errors are a JSON envelope on
22
+ stderr with a semantic exit code.
21
23
 
22
24
  ## Output & exit codes
23
25
 
@@ -125,9 +127,10 @@ Each data capability is a typed sub-command under its namespace. Discover and
125
127
  inspect them with `--help` — never guess action names or flags.
126
128
 
127
129
  ```bash
128
- soku resources list # what's granted (e.g. data-infra)
129
- soku --help # namespaces: ads, ga4, …
130
+ soku resources list # what's granted (e.g. data-infra, seo-hosting)
131
+ soku --help # namespaces: ads, ga4, posthog,
130
132
  soku ads --help # actions in the ads namespace
133
+ soku posthog --help # customer PostHog read actions
131
134
  soku ads query-single-dimension --help # flags, types, and usage for one action
132
135
 
133
136
  soku ads list-ad-accounts --platform google
@@ -165,6 +168,29 @@ Do not write full `SELECT ... FROM ...` GAQL SQL. `gaql-search` takes structured
165
168
  server translates those into real GAQL. For the same action through the raw
166
169
  escape hatch, use snake_case: `soku call ads gaql_search --payload '{...}'`.
167
170
 
171
+ ### PostHog customer analytics
172
+
173
+ PostHog data uses the same backend MCP forwarding gateway as the sandbox agent.
174
+ Start by listing the current brand's granted projects, then inspect the live
175
+ tool menu, then run an allowlisted read tool. Do not ask the user for a project
176
+ id before listing projects.
177
+
178
+ ```bash
179
+ soku posthog list-projects
180
+ soku posthog list-tools --project-id 12345
181
+ soku posthog query --project-id 12345 --tool execute-sql \
182
+ --arguments '{"query":"SELECT count() FROM events WHERE event = '\''$pageview'\''"}'
183
+ ```
184
+
185
+ Use `read-data-schema` before writing HogQL if field names are unclear:
186
+
187
+ ```bash
188
+ soku posthog query --project-id 12345 --tool read-data-schema --arguments '{}'
189
+ ```
190
+
191
+ The CLI default read surface does not expose `posthog/request_change`; writes and
192
+ unvetted PostHog MCP tools remain outside the generated command tree.
193
+
168
194
  ### Raw escape hatch
169
195
 
170
196
  `soku call <namespace> <action>` runs any action by its raw (snake_case) name
@@ -174,8 +200,98 @@ a newer action than this CLI version ships:
174
200
  ```bash
175
201
  soku call ads list_ad_accounts -p platform=google
176
202
  soku call ads query_single_dimension --payload '{"account_id":"123","dimension":"campaign"}'
203
+ soku call posthog query --payload '{"project_id":"12345","tool":"execute-sql","arguments":{"query":"SELECT count() FROM events"}}'
177
204
  ```
178
205
 
206
+ ## SEO Hosting domain connections
207
+
208
+ Use `soku seo-hosting` to manage SEO Hosting for the active brand. The session
209
+ must include the `seo-hosting` resource. Request it at login:
210
+
211
+ ```bash
212
+ soku auth login --resource seo-hosting
213
+ # or include it with data access:
214
+ soku auth login --resource data-infra,seo-hosting
215
+ ```
216
+
217
+ The workspace must be ready before any connection call:
218
+
219
+ ```bash
220
+ soku workspace status
221
+ soku org use <slug|id>
222
+ soku brand use <slug|id>
223
+ ```
224
+
225
+ ### Posts
226
+
227
+ Use typed `posts` commands for the same SEO Hosting content actions exposed to
228
+ runtime agents through `seo_hosting/*`. These create and manage owned-media web
229
+ pages on the brand's connected domain; they are not social posts.
230
+
231
+ Always check status first:
232
+
233
+ ```bash
234
+ soku seo-hosting status
235
+ ```
236
+
237
+ If `live` is false, do not create or publish posts yet; connect or fix a domain
238
+ first. When hosting is live:
239
+
240
+ ```bash
241
+ soku seo-hosting posts list --section blog --status draft
242
+ soku seo-hosting posts get <post_id>
243
+ soku seo-hosting posts create --title "How to ..." --section blog --body-file post.md
244
+ soku seo-hosting posts update <post_id> --body-file revised.md
245
+ soku seo-hosting posts publish <post_id>
246
+ soku seo-hosting posts delete <post_id> --confirm
247
+ ```
248
+
249
+ `create` requires `--title` plus exactly one body source: `--body`,
250
+ `--body-file`, or `--body-stdin`. Optional metadata flags are `--slug`,
251
+ `--excerpt`, `--cover-image-url`, `--author-name`, and `--seo '<json object>'`.
252
+ `update` supports mutable fields only; section and slug are intentionally not
253
+ editable through the CLI.
254
+
255
+ Writes run immediately (the same no-review behavior as the first-party
256
+ `seo_hosting` data actions), so confirm intent with the user before publishing
257
+ or deleting.
258
+
259
+ ### Domain connections
260
+
261
+ Connection commands:
262
+
263
+ ```bash
264
+ soku seo-hosting connections list
265
+ soku seo-hosting connections connect-cname --hostname blog.example.com
266
+ soku seo-hosting connections verify <connection_id>
267
+ soku seo-hosting connections disconnect <connection_id> --confirm
268
+ ```
269
+
270
+ Cloudflare Worker reverse proxy setup runs a probe before provisioning. Use it
271
+ when the customer's root or existing hostname is already on Cloudflare and SEO
272
+ Hosting needs to mount sections such as `/blog`, `/use-cases`, or
273
+ `/alternatives`:
274
+
275
+ ```bash
276
+ soku seo-hosting connections probe --hostname example.com --sections blog,use-cases
277
+ soku seo-hosting connections connect-worker --hostname example.com \
278
+ --sections blog,use-cases --cf-token-env CLOUDFLARE_API_TOKEN
279
+ printf %s "$CLOUDFLARE_API_TOKEN" | soku seo-hosting connections connect-worker \
280
+ --hostname example.com --sections blog --cf-token-stdin
281
+ ```
282
+
283
+ Allowed sections are `blog`, `use-cases`, and `alternatives`; omitted sections
284
+ default to `blog`. If the probe reports existing mounted content, add
285
+ `--accept-conflicts` only after the user confirms SEO Hosting may shadow those
286
+ paths. If the hostname serves its own Next.js assets, add
287
+ `--accept-next-assets-warning` only after confirming `/_next/static/*` may route
288
+ through the Worker.
289
+
290
+ Do not pass Cloudflare API tokens as literal argv values or print them. Use
291
+ `--cf-token-env <ENV_NAME>` or `--cf-token-stdin` exactly once. Vercel OAuth
292
+ domain connections are not exposed in the CLI yet; use the Studio web settings
293
+ for Vercel-backed domains.
294
+
179
295
  ## Write actions (human approval required)
180
296
 
181
297
  Some actions mutate state (e.g. conversion-group writes) and are **review-gated**.
package/README.md DELETED
@@ -1,129 +0,0 @@
1
- # @soku-ai/cli
2
-
3
- Call Soku ads/GA4 data capabilities from any shell or AI agent. It is the
4
- preferred surface for external agents and does not require an MCP host.
5
-
6
- ## Install
7
-
8
- ```bash
9
- npm i -g @soku-ai/cli
10
- ```
11
-
12
- Development builds can be linked from this repo:
13
-
14
- ```bash
15
- pnpm --filter @soku-ai/cli run build
16
- npm link apps/cli
17
- ```
18
-
19
- ## Quick start
20
-
21
- ```bash
22
- soku auth login # device-login in the browser
23
- soku org use <slug|id> # pick a workspace (id, slug, or name)
24
- soku brand use <slug|id>
25
- soku --help # discover namespaces (ads, ga4, …)
26
- soku update status # check CLI and installed skill updates
27
- soku memory list # read current-brand memory context
28
- soku ads --help # actions in a namespace
29
- soku ads list-ad-accounts --platform google
30
- ```
31
-
32
- Each data capability is a typed sub-command under its namespace; `<command>
33
- --help` shows its flags. `soku call <ns> <action>` is a raw escape hatch for
34
- actions not yet exposed as a typed sub-command.
35
-
36
- ## Authentication
37
-
38
- `soku` uses an org-agnostic, device-login session token (RFC 8628). You log in
39
- once; the org and brand are chosen at runtime and sent per request.
40
-
41
- - **Human:** `soku auth login` opens the browser and waits for approval.
42
- - **Agent (non-blocking):** `soku auth login --no-wait` returns the verification
43
- URL immediately; resume with `soku auth login --device-code <code>` after the
44
- user approves.
45
- - **CI / headless:** set `SOKU_TOKEN` to a pre-issued token to skip interactive
46
- auth (and the OS keychain).
47
-
48
- Token storage: OS keychain when available, else `~/.soku/credentials.json`
49
- (0600). Set `SOKU_NO_KEYCHAIN=1` to always use the file. Behind a proxy, set
50
- `ALL_PROXY`.
51
-
52
- ## Output
53
-
54
- TTY output is human-readable: status lines, key/value summaries, and tables for
55
- lists. Piped or non-TTY output stays machine-readable JSON
56
- (`{"ok":true,"data":...}`). Errors go to stderr as
57
- `{"ok":false,"error":{type,message,hint}}` with a semantic exit code (0 ok / 1
58
- usage / 2 auth / 4 not-found / 5 runtime). `soku egress -- curl ...` is the
59
- exception: successful upstream responses are passed through verbatim.
60
-
61
- ## Use from an AI agent
62
-
63
- For a fresh agent, point it at the hosted installer guide:
64
-
65
- ```text
66
- Read https://soku.ai/cli/skill.md and install the Soku CLI.
67
- ```
68
-
69
- Install the bundled skill so Claude Code / Codex / Cursor know how to drive the
70
- CLI:
71
-
72
- ```bash
73
- soku skill install --global # all detected agents
74
- soku skill install --agent claude # one agent, into the project
75
- ```
76
-
77
- The CLI writes `.soku-skills.json` only while Soku-managed skills are installed
78
- in a skills directory. It is a local install manifest, not a credential or user
79
- config file, and it is removed automatically when the last Soku-managed skill is
80
- removed.
81
-
82
- ## Updates
83
-
84
- `soku update status` queries the npm registry for `@soku-ai/cli@latest` and
85
- compares installed Soku-managed skills against the public skill catalog.
86
- `soku update skills` refreshes the bundled `soku` meta-skill plus already
87
- installed business skills. `soku update cli` runs `npm i -g @soku-ai/cli`.
88
-
89
- The CLI also performs an advisory check on every command invocation, writing
90
- update notices to stderr only. There is no update-check cache; set
91
- `SOKU_NO_UPDATE_CHECK=1` to disable the background notice. The legacy
92
- `soku update-check` command still exists as a hidden compatibility alias.
93
-
94
- ## Release
95
-
96
- Release publishing is handled by `.github/workflows/publish-soku-cli.yml`.
97
-
98
- 1. Bump both `apps/cli/package.json` and `apps/cli/src/version.ts`.
99
- 2. Run `pnpm --filter @soku-ai/cli test` and `pnpm --filter @soku-ai/cli build`.
100
- 3. Use workflow dispatch with `dry_run=true` to verify packaging.
101
- 4. After the PR is merged, push a tag named `soku-ai-cli-v<version>`.
102
-
103
- The workflow verifies that the tag matches the package version, checks that the
104
- version is not already on npm, runs `npm pack --dry-run`, then publishes with
105
- `npm publish --access public --tag latest` via npm Trusted Publishing.
106
- The publish workflow upgrades npm to the Trusted Publishing compatible runtime
107
- before calling `npm publish`.
108
-
109
- ## Environment variables
110
-
111
- Production is the default: API calls go to `https://api.soku.ai`, and skills are
112
- downloaded from `https://api.soku.ai/api/cli/skills`. Local and staging
113
- endpoints are environment-only overrides so a dev session cannot poison
114
- `~/.soku/config.json`.
115
-
116
- ```bash
117
- SOKU_API_BASE=http://localhost:15386 soku auth status
118
- SOKU_SKILLS_URL=http://127.0.0.1:18080 soku skill list
119
- ```
120
-
121
- | Variable | Purpose |
122
- |----------|---------|
123
- | `SOKU_TOKEN` | Pre-issued session token (overrides stored credentials) |
124
- | `SOKU_API_BASE` | Per-command API base URL override; default is `https://api.soku.ai` |
125
- | `SOKU_ORG_ID` / `SOKU_BRAND_ID` | One-off workspace override |
126
- | `SOKU_NO_KEYCHAIN` | Skip the OS keychain; use the 0600 file |
127
- | `SOKU_NO_UPDATE_CHECK` | Disable the background update notice |
128
- | `SOKU_SKILLS_URL` | Per-command skill catalog override |
129
- | `ALL_PROXY` | Proxy for outbound HTTPS |