outrank-cli 0.1.0 → 0.1.1

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 CHANGED
@@ -2,6 +2,33 @@
2
2
 
3
3
  Agent-first CLI for the Outrank agent API.
4
4
 
5
+ ## Install
6
+
7
+ Requires Node.js 18+.
8
+
9
+ ```powershell
10
+ npm install -g outrank-cli
11
+ outrank-cli --help
12
+ ```
13
+
14
+ Or run it from a clone without installing globally:
15
+
16
+ ```powershell
17
+ git clone https://github.com/Outrank-SAS/outrank-cli.git
18
+ cd outrank-cli
19
+ npm install
20
+ node .\src\index.js --help
21
+ ```
22
+
23
+ ## Get an API key
24
+
25
+ 1. Sign in to your Outrank account at <https://www.outrank.so>.
26
+ 2. Open **Settings → API keys**: <https://www.outrank.so/dashboard/settings/api-keys>.
27
+ 3. Click **Create key**, give it a name, and copy the `outr_live_...` value. The key is shown only once — store it somewhere safe.
28
+ 4. Revoke a key from the same page if it ever leaks. Generate a fresh one and re-run `auth login`.
29
+
30
+ You can also rotate keys at any time; each key is independent and can be revoked without affecting the others.
31
+
5
32
  ## Current scope
6
33
 
7
34
  This repo currently targets the agent endpoints that already exist in `outrank`:
@@ -23,14 +50,33 @@ The broader roadmap from the internal implementation plan is larger than the liv
23
50
 
24
51
  ## Auth
25
52
 
26
- The CLI can read credentials from either:
53
+ The CLI reads credentials in this order of precedence:
54
+
55
+ 1. `--api-key <key>` on the command line (highest priority, per-call)
56
+ 2. `OUTRANK_API_KEY` environment variable
57
+ 3. `~/.outrank/config.json`, populated by `outrank-cli auth login <api-key>` (lowest priority, persistent)
58
+
59
+ Pick one. For interactive use on your own machine, `auth login` is simplest. For CI / ephemeral environments, prefer the env var.
60
+
61
+ ```powershell
62
+ # One-time persistent setup
63
+ outrank-cli auth login outr_live_xxx
64
+ outrank-cli auth status # confirms the key is stored
65
+ outrank-cli auth whoami # round-trips it against the server
66
+
67
+ # OR per-shell env var (no config file written)
68
+ $env:OUTRANK_API_KEY = "outr_live_xxx"
69
+ outrank-cli auth whoami
27
70
 
28
- - `OUTRANK_API_KEY`
29
- - `~/.outrank/config.json` after `outrank-cli auth login <api-key>`
71
+ # OR per-call (useful in scripts)
72
+ outrank-cli auth whoami --api-key outr_live_xxx
73
+ ```
30
74
 
31
- Optional config storage override:
75
+ Sign out / rotate:
32
76
 
33
- - `OUTRANK_CONFIG_DIR`
77
+ ```powershell
78
+ outrank-cli auth logout # clears apiKey from ~/.outrank/config.json
79
+ ```
34
80
 
35
81
  ## Examples
36
82
 
@@ -119,7 +165,7 @@ outrank-cli billing purchase-products quote --additional-products 2
119
165
 
120
166
  ## Custom API target (advanced)
121
167
 
122
- The CLI talks to `https://outrank.so` by default and you should not need to change that. The override below exists only for Outrank staff debugging against a staging deployment.
168
+ The CLI talks to `https://www.outrank.so` by default and you should not need to change that. The override below exists only for Outrank staff debugging against a staging deployment.
123
169
 
124
170
  ```powershell
125
171
  $env:OUTRANK_BASE_URL="https://staging.example"
@@ -150,3 +196,30 @@ Every command writes a single JSON object to stdout.
150
196
 
151
197
  This makes the CLI easier for AI agents to drive reliably.
152
198
 
199
+ ## Using the agent skill (`SKILL.md`)
200
+
201
+ `SKILL.md` ships alongside this CLI as a Claude Code skill. It tells an AI agent how to drive `outrank-cli` end-to-end — when to inspect before writing, how to interpret `agent_guidance`, the new-product preflight, the GSC flow, keyword/article rules, and how to handle 401/402/403/409 errors.
202
+
203
+ You do not need it if you are using the CLI by hand from a terminal. You want it when you are letting an AI assistant operate the CLI for you.
204
+
205
+ ### Claude Code
206
+
207
+ 1. Install `outrank-cli` globally so the agent can call it: `npm install -g outrank-cli`.
208
+ 2. Make `SKILL.md` available to Claude Code as a skill. Either:
209
+ - **Project-scoped** — copy `SKILL.md` into `.claude/skills/outrank/SKILL.md` inside the project you want the agent to work in, or
210
+ - **User-scoped** — copy it into `~/.claude/skills/outrank/SKILL.md` (Windows: `C:\Users\<you>\.claude\skills\outrank\SKILL.md`) so it is available in every Claude Code session.
211
+ 3. Provide the API key once via env var or `outrank-cli auth login` (see [Auth](#auth)).
212
+ 4. In Claude Code, ask the agent to do something Outrank-shaped (e.g. "list my products", "create a new product for example.com", "regenerate next week's keyword plan"). The skill's `description` triggers it automatically; Claude will run `outrank-cli` commands and follow the rules in `SKILL.md`.
213
+
214
+ ### Other agents (Cursor, custom Anthropic SDK apps, etc.)
215
+
216
+ `SKILL.md` is plain Markdown — feed it as a system prompt, a tool description, or load it into the model's context however your runtime expects. The key contract is:
217
+
218
+ - Every command returns JSON with `ok`, `data`, and `agent_guidance`.
219
+ - The agent should always read `agent_guidance` before deciding the next step.
220
+ - Mutations should be preceded by an inspect call (`products get`, `keywords list`, `articles get`, etc.).
221
+
222
+ ### Updating the skill
223
+
224
+ The CLI and `SKILL.md` are versioned together. When you upgrade `outrank-cli`, also refresh the copy of `SKILL.md` in your `.claude/skills/...` directory from the installed package (`<global node_modules>/outrank-cli/SKILL.md`) or from this repo.
225
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "outrank-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Agent-first CLI for the Outrank agent API",
5
5
  "type": "module",
6
6
  "files": [
@@ -4,7 +4,7 @@ import fs from 'node:fs/promises';
4
4
 
5
5
  import { ensureDirectory, fileExists } from './io.js';
6
6
 
7
- const DEFAULT_BASE_URL = 'https://outrank.so';
7
+ const DEFAULT_BASE_URL = 'https://www.outrank.so';
8
8
 
9
9
  const getConfigDir = () => process.env.OUTRANK_CONFIG_DIR || path.join(os.homedir(), '.outrank');
10
10
  export const getConfigPath = () => path.join(getConfigDir(), 'config.json');