@chieflab/cli 0.2.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.
Files changed (3) hide show
  1. package/README.md +163 -0
  2. package/package.json +44 -0
  3. package/src/index.js +1465 -0
package/README.md ADDED
@@ -0,0 +1,163 @@
1
+ # @chieflab/cli
2
+
3
+ Hosted MCP from your terminal. ChiefLab's repo-aware launch flow plus approval-gated execution.
4
+
5
+ > Package status: this CLI is packaged in the repo but not published to npm yet. Use hosted MCP directly today at `https://api.chieflab.io/api/mcp`; the commands below describe the CLI contract once published.
6
+
7
+ ```bash
8
+ curl -X POST https://api.chieflab.io/api/mcp \
9
+ -H "Content-Type: application/json" \
10
+ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
11
+ ```
12
+
13
+ ## Why a CLI when the MCP is an HTTP endpoint?
14
+
15
+ Because `curl` is great until you need the second call. Once you've got a `runId` to look up, an `actionId` to publish, a reviewUrl to open, an `accountId` to pass — you want a real shell tool, not a fistful of JSON-RPC envelopes.
16
+
17
+ This CLI:
18
+ - Saves your API key once (`~/.chieflab/config.json`, `chmod 600`)
19
+ - Wraps every operator + the closed-loop launch flow with sane flags
20
+ - Has zero npm dependencies (node 20+ built-ins only — install in <5s)
21
+ - Is honest about JSON output (`--json` on any command)
22
+
23
+ ## Current install status
24
+
25
+ The npm package is not public yet. Do not tell users to run `npx @chieflab/cli`
26
+ until `npm view @chieflab/cli` resolves. Use the hosted MCP endpoint and hosted
27
+ agent-hook installer today:
28
+
29
+ ```bash
30
+ curl -X POST https://api.chieflab.io/api/mcp \
31
+ -H "Authorization: Bearer $CHIEFLAB_API_KEY" \
32
+ -H "Content-Type: application/json" \
33
+ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
34
+
35
+ curl -fsSL https://chieflab.io/install-agent-hook.mjs | node -
36
+ ```
37
+
38
+ After npm publish:
39
+
40
+ ```bash
41
+ npm install -g @chieflab/cli
42
+ npx @chieflab/cli init
43
+ npx @chieflab/cli launch-here https://yoursite.com
44
+ ```
45
+
46
+ Both `chieflab` and `chiefmo` work as the bin name.
47
+
48
+ ## Auth
49
+
50
+ ```bash
51
+ chieflab login # interactive prompt
52
+ chieflab login --key clp_... # non-interactive
53
+ chieflab whoami # confirm workspace
54
+ chieflab logout # forget the key
55
+ ```
56
+
57
+ Or skip the file and pass via env (good for CI):
58
+
59
+ ```bash
60
+ export CHIEFLAB_API_KEY=clp_live_...
61
+ chieflab whoami
62
+ ```
63
+
64
+ Get a key at <https://chieflab.io/get-key>.
65
+
66
+ ## The closed loop
67
+
68
+ ```bash
69
+ # 0. Install repo instructions so agents call ChiefLab after build
70
+ chieflab init
71
+
72
+ # 1. Plan + draft from the current repo
73
+ chieflab launch-here https://yoursite.com --channels linkedin,x,email
74
+ # → returns launchId + publishActions + reviewUrl
75
+
76
+ # 2. Approve on the reviewUrl (open it in a browser)
77
+
78
+ # 3. Fire the approved actions
79
+ chieflab publish launch-action-run_xxx-linkedin \
80
+ --content "..." --platform linkedin --account zer_acc_xxx
81
+
82
+ chieflab send-email launch-action-run_xxx-email \
83
+ --from "Brand <hi@yourdomain.com>" --to user@example.com \
84
+ --subject "Launch day" --html "<h1>...</h1>"
85
+
86
+ # 4. Wait 24h, then read results + get the next-move recommendation
87
+ chieflab review run_xxx
88
+ ```
89
+
90
+ Full launch wedge in 4 commands.
91
+
92
+ `init` writes `AGENTS.md`, a Cursor rule, Claude command, Codex note, and an MCP config stub. It tells agents to call `chieflab_get_users_after_build`, surface `agentGuide.userMessage`, wait for the `reviewUrl`, execute only approved actions, resume with `chiefmo_continue_launch_loop`, and measure after 24h.
93
+
94
+ Compatibility: `chieflab install-agent-hook` still works after npm publish. Public docs should prefer the hosted installer until `npm view @chieflab/cli` resolves.
95
+
96
+ ```bash
97
+ chieflab init --dry-run
98
+ chieflab init --runtime cursor
99
+ chieflab init --runtime all --force
100
+ ```
101
+
102
+ ## Launch Commands
103
+
104
+ ```bash
105
+ chieflab launch-here https://yoursite.com # preferred: gathers repo context
106
+ chieflab launch https://yoursite.com # URL-only fallback
107
+ chieflab marketing "Diagnose our current funnel"
108
+ ```
109
+
110
+ Each accepts `--url <product-url>` (auto-extract brand context), `--tenant-id <id>` (use stored tenant), `--idempotency-key <key>` (cached re-runs).
111
+
112
+ ## Trigger phrases
113
+
114
+ When an agent calls the CLI on a user's behalf, these phrases map to `launch-here`:
115
+
116
+ - "launch this"
117
+ - "get users"
118
+ - "market this"
119
+ - "announce this"
120
+ - "post this"
121
+
122
+ For an existing program ("why is X not working"), use `chieflab marketing "<goal>"` (calls `chiefmo_diagnose_marketing`).
123
+
124
+ ## Connections
125
+
126
+ ```bash
127
+ chieflab connections # show what's connected
128
+ chieflab connect ga4 # OAuth start (also: search_console, hubspot)
129
+ chieflab set-key zernio sk_... # for set-key flows (also: resend)
130
+ ```
131
+
132
+ ## Inbox
133
+
134
+ ```bash
135
+ chieflab runs # list workspace runs
136
+ chieflab runs --limit 50
137
+ chieflab open run_xxx # print the signed reviewUrl
138
+ ```
139
+
140
+ ## Tools introspection
141
+
142
+ ```bash
143
+ chieflab tools # list the live MCP tools available on this key
144
+ chieflab tools --json # for piping into jq
145
+ ```
146
+
147
+ ## Flags
148
+
149
+ | Flag | What |
150
+ |------|------|
151
+ | `--json` | Emit raw JSON (suppresses pretty terminal output) |
152
+ | `--key <key>` | Override saved key for this call only |
153
+ | `--endpoint <url>` | Override endpoint (default `https://api.chieflab.io/api/mcp`) |
154
+
155
+ | Env | What |
156
+ |-----|------|
157
+ | `CHIEFLAB_API_KEY` | Wins over saved config (CI-friendly) |
158
+ | `CHIEFLAB_ENDPOINT` | Wins over saved endpoint |
159
+ | `NO_COLOR` | Disable ANSI colors |
160
+
161
+ ## License
162
+
163
+ Apache 2.0. Source at <https://github.com/bdentech/chieflab>.
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@chieflab/cli",
3
+ "version": "0.2.0",
4
+ "mcpName": "io.github.bdentech/chieflab",
5
+ "description": "ChiefLab CLI — after-build GTM for agents. Run `chieflab launch-here` from a repo to collect context, create a launch room, approval-gate publish/send actions, and measure the next move.",
6
+ "type": "module",
7
+ "bin": {
8
+ "chieflab": "src/index.js",
9
+ "chiefmo": "src/index.js"
10
+ },
11
+ "files": [
12
+ "src/",
13
+ "README.md"
14
+ ],
15
+ "engines": {
16
+ "node": ">=20"
17
+ },
18
+ "keywords": [
19
+ "chieflab",
20
+ "chiefmo",
21
+ "mcp",
22
+ "ai-agent",
23
+ "agent-built",
24
+ "get-users",
25
+ "product-launch",
26
+ "marketing-ops",
27
+ "launch",
28
+ "gtm",
29
+ "startup",
30
+ "cursor",
31
+ "claude",
32
+ "codex"
33
+ ],
34
+ "homepage": "https://chieflab.io",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/bdentech/chieflab.git",
38
+ "directory": "apps/cli"
39
+ },
40
+ "license": "Apache-2.0",
41
+ "publishConfig": {
42
+ "access": "public"
43
+ }
44
+ }