seomd-cli 1.4.0 → 2.0.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.
Files changed (39) hide show
  1. package/PROVIDER_SPEC.md +125 -0
  2. package/README.md +54 -190
  3. package/SKILL.md +44 -0
  4. package/bin/seomd.js +79 -31
  5. package/package.json +11 -7
  6. package/src/commands/analyze.js +90 -90
  7. package/src/commands/check.js +301 -0
  8. package/src/commands/doctor.js +109 -0
  9. package/src/commands/generate.js +215 -0
  10. package/src/commands/init.js +170 -66
  11. package/src/commands/status.js +92 -76
  12. package/src/commands/sync.js +84 -70
  13. package/src/commands/validate.js +52 -25
  14. package/src/generators/directory.js +46 -114
  15. package/src/generators/reverse.js +46 -56
  16. package/src/generators/seomd.js +226 -44
  17. package/src/providers/http.js +67 -0
  18. package/src/providers/index.js +194 -0
  19. package/src/utils/agent-wiring.js +97 -0
  20. package/src/utils/api-client.js +14 -56
  21. package/src/utils/constants.js +110 -12
  22. package/src/utils/migrate.js +99 -0
  23. package/src/utils/parser.js +114 -25
  24. package/src/utils/placeholders.js +31 -0
  25. package/src/utils/repo-scanner.js +207 -0
  26. package/src/utils/writeback.js +171 -82
  27. package/src/validators/seomd.js +263 -93
  28. package/scripts/release-contributors.js +0 -196
  29. package/scripts/release-notes.js +0 -194
  30. package/src/templates/blog/SEO.REVERSE.md +0 -176
  31. package/src/templates/blog/SEO.md +0 -233
  32. package/src/templates/ecommerce/SEO.REVERSE.md +0 -199
  33. package/src/templates/ecommerce/SEO.md +0 -239
  34. package/src/templates/local/SEO.REVERSE.md +0 -222
  35. package/src/templates/local/SEO.md +0 -245
  36. package/src/templates/marketplace/SEO.REVERSE.md +0 -222
  37. package/src/templates/marketplace/SEO.md +0 -245
  38. package/src/templates/saas/SEO.REVERSE.md +0 -268
  39. package/src/templates/saas/SEO.md +0 -257
@@ -0,0 +1,125 @@
1
+ # SEO.md Provider Protocol (v2.0.0)
2
+
3
+ `SEO.md` is a vendor-agnostic open standard. Local workflows (`init`, `validate`, `check`, `generate`, `doctor`) work offline with zero API keys.
4
+
5
+ Any SEO/AEO intelligence platform — **Foxcite** (reference implementation), **SEMrush**, **Ahrefs**, **Profound**, **Peec AI**, or a custom internal service — can plug into `seomd analyze` and `seomd sync` by exposing the HTTP contract below.
6
+
7
+ ---
8
+
9
+ ## Configuration
10
+
11
+ Users select a provider in `SEO.md` frontmatter or via environment variables:
12
+
13
+ ```yaml
14
+ provider:
15
+ name: custom # foxcite | semrush | ahrefs | profound | peec | custom
16
+ endpoint: https://api.your-provider.com
17
+ ```
18
+
19
+ Environment variables (override `SEO.md`):
20
+
21
+ ```bash
22
+ SEOMD_PROVIDER=custom
23
+ SEOMD_API_URL=https://api.your-provider.com
24
+ SEOMD_API_KEY=your_api_key
25
+ SEOMD_PAYMENT_TOKEN= # optional x402 pay-per-scan token
26
+ SEOMD_DOMAIN= # optional domain header override
27
+ ```
28
+
29
+ Authentication headers sent by `seomd-cli`:
30
+ - `Authorization: Bearer <SEOMD_API_KEY>` (when `SEOMD_API_KEY` is set)
31
+ - `x-payment-token: <SEOMD_PAYMENT_TOKEN>` (when `SEOMD_PAYMENT_TOKEN` is set)
32
+ - `x-seomd-domain: <SEOMD_DOMAIN>` (when `SEOMD_DOMAIN` is set)
33
+
34
+ ---
35
+
36
+ ## Endpoints
37
+
38
+ ### 1. `POST /cli/analyze`
39
+
40
+ Runs a live AI citation & gap analysis and returns structured metrics + optional per-page playbooks.
41
+
42
+ **Request Body:**
43
+ ```json
44
+ {
45
+ "domain": "acme.com",
46
+ "niche": "saas",
47
+ "brand": "Acme",
48
+ "queries": {
49
+ "category": ["best billing automation"],
50
+ "comparison": ["chargebee vs acme"]
51
+ },
52
+ "engines": ["ChatGPT", "Perplexity", "Claude"],
53
+ "pages": [
54
+ {
55
+ "id": "pricing",
56
+ "url": "/pricing",
57
+ "primary_keyword": "acme pricing",
58
+ "status": "live"
59
+ }
60
+ ]
61
+ }
62
+ ```
63
+
64
+ **Response Body:**
65
+ ```json
66
+ {
67
+ "provider": "your-provider",
68
+ "domain": "acme.com",
69
+ "brand_name": "Acme",
70
+ "credits_remaining": 42,
71
+ "aeo_analysis": {
72
+ "overall_citation_rate": 0.35,
73
+ "overall_gap_score": 48,
74
+ "engines_tracked": ["ChatGPT", "Perplexity", "Claude"],
75
+ "last_analyzed": "2026-11-22T00:00:00Z",
76
+ "next_analysis": "2026-11-29T00:00:00Z"
77
+ },
78
+ "intent_analysis": {
79
+ "category": {
80
+ "citation_rate": 0.2,
81
+ "gap_score": 65,
82
+ "top_cited_competitor": "chargebee.com",
83
+ "trend": "up"
84
+ }
85
+ },
86
+ "page_analysis": [
87
+ {
88
+ "id": "pricing",
89
+ "url": "/pricing",
90
+ "status": "live",
91
+ "citation_rate": 0.4,
92
+ "gap_score": 38,
93
+ "top_cited_competitor": "chargebee.com",
94
+ "why_page_won": ["Transparent tier comparison table"],
95
+ "citation_hooks": ["FAQPage JSON-LD with pricing Q&As"],
96
+ "gaps_for_brand": ["Missing enterprise SLA summary"],
97
+ "remediation_playbook": [],
98
+ "fastest_win": {
99
+ "action": "Add 50-word pricing summary above the fold",
100
+ "estimated_gap_score_improvement": 12,
101
+ "effort": "low"
102
+ },
103
+ "suggested_content_outline": [],
104
+ "markdown_content": "# pricing\n\n..."
105
+ }
106
+ ]
107
+ }
108
+ ```
109
+
110
+ ### 2. `POST /cli/sync` (or `GET /cli/sync`)
111
+
112
+ Returns the latest cached analysis payload in the exact same response shape as `POST /cli/analyze` without triggering a new paid scan.
113
+
114
+ - Standard v2 providers should accept `POST /cli/sync` with `{ "domain": "...", "pages": [...] }`.
115
+ - `seomd-cli` automatically falls back to `GET /cli/sync?domain=...&pages=...` for compatibility with providers that only implement `GET`.
116
+
117
+ ---
118
+
119
+ ## Error Codes
120
+
121
+ | Status | Meaning |
122
+ |---|---|
123
+ | `401` | Invalid or missing `SEOMD_API_KEY` |
124
+ | `402` | Insufficient credits (supports `x402` payment retry via `SEOMD_PAYMENT_TOKEN`) |
125
+ | `4xx` / `5xx` | JSON body with `detail` or `message` string |
package/README.md CHANGED
@@ -1,34 +1,25 @@
1
1
  # SEO.md CLI
2
2
 
3
- <p align="left" style="padding: 100px 0;">
3
+ <p align="left" style="padding: 40px 0;">
4
4
  <img alt="SEO.md CLI logo" src="./assets/logo.svg" />
5
5
  </p>
6
6
 
7
- The official CLI for the [SEO.md](https://seomd.dev) open standard — AEO (AI Engine Optimization) infrastructure for technical founders.
7
+ The official CLI for the [SEO.md](https://seomd.dev) open standard (spec **v2.0.0**) — the `AGENTS.md` / `CLAUDE.md` / `DESIGN.md` equivalent for search and AI Engine Optimization (AEO).
8
8
 
9
- Use it to scaffold, validate, analyze, and sync `SEO.md` files directly from your repo.
9
+ Use it to scaffold a Markdown + YAML frontmatter `SEO.md`, wire coding agents automatically via `AGENTS.md` / `CLAUDE.md`, audit local pages offline, generate `robots.txt` / `llms.txt` / JSON-LD, and optionally connect any compatible AI citation intelligence provider.
10
10
 
11
- ## Table of Contents
11
+ ---
12
12
 
13
- - [Why SEO.md](#why-seomd)
14
- - [Install](#install)
15
- - [Quick Start](#quick-start)
16
- - [Configuration](#configuration)
17
- - [Commands](#commands)
18
- - [Local Development](#local-development)
19
- - [Testing](#testing)
20
- - [Release Notes (Contributor Tagging)](#release-notes-contributor-tagging)
21
- - [Security](#security)
22
- - [Specification Reference](#specification-reference)
23
- - [License](#license)
13
+ ## Why SEO.md?
24
14
 
25
- ## Why SEO.md
15
+ Coding agents are great at shipping pages fast, but terrible at SEO/AEO without ground truth. `SEO.md` gives both humans and coding agents one repo-native source of truth:
26
16
 
27
- SEO.md is a structured, version-controlled specification for describing your site, intent queries, and pages so AI engines can cite you more often.
17
+ - **Markdown-first (`---` frontmatter + prose):** Agents read Canonical Product Facts, Page & AEO Rules, Target Buyer Prompts, and Do Not Claim guardrails directly — while the CLI parses the structured frontmatter safely.
18
+ - **Zero-friction agent discovery:** `seomd init` automatically wires a concise pointer block into `AGENTS.md` / `CLAUDE.md` so coding agents pick up `SEO.md` on day one.
19
+ - **Useful offline with zero API keys:** `validate`, `check`, `generate`, and `doctor` all work locally.
20
+ - **Vendor-agnostic provider protocol:** Connect **Foxcite** (native reference implementation) or any provider/bridge implementing [`PROVIDER_SPEC.md`](./PROVIDER_SPEC.md) (SEMrush, Ahrefs, Profound, Peec AI, or custom).
28
21
 
29
- - Declare what matters (site, identity, keywords, intent, pages)
30
- - Run audits via your connected platform
31
- - Write back `_analysis` blocks and per-page playbooks into your repo
22
+ ---
32
23
 
33
24
  ## Install
34
25
 
@@ -36,216 +27,89 @@ SEO.md is a structured, version-controlled specification for describing your sit
36
27
  npm install -g seomd-cli
37
28
  ```
38
29
 
39
- Or run without installing (zero-install):
30
+ Or run zero-install:
40
31
 
41
32
  ```bash
42
33
  npx seomd-cli init
43
34
  ```
44
35
 
45
- Verify:
46
-
47
- ```bash
48
- seomd --help
49
- ```
36
+ ---
50
37
 
51
38
  ## Quick Start
52
39
 
53
- ### 1) Initialize
54
-
55
- Run in the root of your project:
40
+ ### 1) Initialize (Repo-Aware + Agent Wiring)
56
41
 
57
42
  ```bash
58
- seomd init
43
+ npx seomd-cli init
59
44
  ```
60
45
 
61
- Or non-interactively with flags:
46
+ `init` inspects your repo (Next.js, Astro, SvelteKit, etc.) to discover live routes, generates `SEO.md` (v2.0.0) and `.seo/`, and wires `AGENTS.md` / `CLAUDE.md` so coding agents read `SEO.md` automatically.
62
47
 
63
- ```bash
64
- seomd init -y --type local
65
- # or
66
- seomd init --brand "Acme" --domain acme.com --primary-keyword "local seo"
67
- ```
68
-
69
- ### 2) Validate
48
+ Non-interactive mode:
70
49
 
71
50
  ```bash
72
- seomd validate
51
+ npx seomd-cli init -y --type saas --brand "Acme" --domain acme.com --primary-keyword "billing automation"
73
52
  ```
74
53
 
75
- ### 3) Run an Audit (Analyze) and Sync
54
+ ### 2) Validate & Audit Locally (Zero API Key)
76
55
 
77
56
  ```bash
78
- seomd analyze
79
- seomd sync
57
+ npx seomd-cli validate --strict
58
+ npx seomd-cli check ./out # audit static HTML output
59
+ npx seomd-cli check http://localhost:3000 # audit running dev server
60
+ npx seomd-cli doctor # check SEO.md, agent wiring, crawl files, provider
80
61
  ```
81
62
 
82
- ### 4) View Status
63
+ ### 3) Generate Crawl & AI Discovery Artifacts
83
64
 
84
65
  ```bash
85
- seomd status
86
- seomd status --json
66
+ npx seomd-cli generate robots --out public/robots.txt
67
+ npx seomd-cli generate llms --out public/llms.txt
68
+ npx seomd-cli generate schema
87
69
  ```
88
70
 
89
- ## Configuration
90
-
91
- Copy `.env.example` from your platform provider docs, or create one with the vars you need:
71
+ ### 4) Connect a Live Intelligence Provider (Optional)
92
72
 
93
- Required for live audits:
73
+ Live citation scans (`analyze` / `sync`) write results into `.seo/STATUS.yml`, `.seo/REVERSE.md`, and `.seo/pages/*.md` (merge-safe on partial `--page` runs):
94
74
 
95
75
  ```bash
96
- SEOMD_API_URL=
97
- SEOMD_API_KEY=your_key_here
98
- ```
99
-
100
- Optional:
76
+ # Example using Foxcite (native reference implementation)
77
+ export SEOMD_PROVIDER=foxcite
78
+ export SEOMD_API_KEY="your_api_key_here"
101
79
 
102
- ```bash
103
- SEOMD_PAYMENT_TOKEN= # x402 pay-per-scan token
104
- SEOMD_DOMAIN= # override domain header
80
+ npx seomd-cli analyze
81
+ npx seomd-cli analyze --page /pricing --intent transactional
82
+ npx seomd-cli sync --dry-run
83
+ npx seomd-cli status --json
105
84
  ```
106
85
 
107
- > If you don't have a platform key yet, `seomd init` still works without `.env`.
108
-
109
- ## Commands
110
-
111
- ### `seomd init`
112
-
113
- Scaffolds `SEO.md`, `SEO.REVERSE.md`, and the `.seo/` intelligence directory.
114
-
115
- **Usage:**
116
-
117
- ```bash
118
- seomd init # interactive 5-question flow
119
- seomd init -y --type local # skip prompts, use defaults
120
- seomd init --brand "Acme" --domain acme.com # non-interactive with partial flags
121
- seomd init --type saas --brand "MyApp" --domain myapp.com --primary-keyword "billing automation" --output ./new-project
122
- ```
123
-
124
- **Options:**
125
-
126
- | Flag | Description |
127
- |------|-------------|
128
- | `-y, --yes` | skip prompts, use defaults |
129
- | `--type <type>` | site type: saas, ecommerce, local, blog, marketplace |
130
- | `--brand <name>` | brand name |
131
- | `--domain <domain>` | primary domain |
132
- | `--primary-keyword <keyword>` | primary keyword |
133
- | `--competitors <list>` | comma-separated competitor list |
134
- | `--output <dir>` | scaffold into a new (empty) directory instead of cwd |
135
-
136
- **Behavior:**
137
-
138
- - Interactive flow by default (5 questions)
139
- - Non-interactive when `-y` is set **OR** any config flag (`--brand`, `--domain`, `--primary-keyword`, `--competitors`) is provided
140
- - `--type` alone pre-selects site type in the interactive flow
141
- - `--output` writes all files to the target directory (must be empty or non-existent)
142
-
143
- ### `seomd validate`
144
-
145
- Validates your `SEO.md` against the spec requirements.
146
-
147
- ### `seomd status`
148
-
149
- Shows current citation rates and gap scores from `_analysis`.
150
-
151
- - `--json` outputs machine-readable JSON for scripts/CI
152
-
153
- ### `seomd analyze`
154
-
155
- Runs an AI search audit via your connected platform and writes results back into:
156
-
157
- - `SEO.md` (`_analysis` blocks)
158
- - `SEO.REVERSE.md` (generated reverse view)
159
- - `.seo/pages/*.md` (per-page playbooks when available)
160
-
161
- ### `seomd sync`
162
-
163
- Pulls cached/latest platform intelligence and writes it back to the same files as `analyze`.
164
-
165
- - `--dry-run` prints a preview and does not modify files
86
+ See [`PROVIDER_SPEC.md`](./PROVIDER_SPEC.md) to connect custom endpoints or third-party platforms (`semrush`, `ahrefs`, `profound`, `peec`, `custom`).
166
87
 
167
- ## Built-in Templates
88
+ ---
168
89
 
169
- `seomd-cli` ships with type-specific templates under `src/templates/`. `seomd init --type <type>` uses the matching template automatically.
170
-
171
- | Type | Template dir | Best for |
172
- |------|-------------|----------|
173
- | `saas` | `src/templates/saas/` | Software products, B2B tools, web apps |
174
- | `blog` | `src/templates/blog/` | Content sites, newsletters, personal brands |
175
- | `ecommerce` | `src/templates/ecommerce/` | Online stores, DTC brands, product catalogs |
176
- | `local` | `src/templates/local/` | Service-area businesses, locations pages |
177
- | `marketplace` | `src/templates/marketplace/` | Two-sided platforms, directories |
178
-
179
- Each template contains:
180
-
181
- - `SEO.md` — pre-filled with type-specific intent queries, page structures, and negative keywords
182
- - `SEO.REVERSE.md` — reverse-engineer output scaffold with placeholders for competitor analysis
183
-
184
- Want to customize a template? Copy the relevant folder, edit the placeholders (`{{brand}}`, `{{domain}}`, etc.), and use `--type` with your custom scaffold.
185
-
186
- ## Local Development
90
+ ## Commands
187
91
 
188
- Prefer the local entrypoint while developing:
92
+ | Command | Offline? | Description |
93
+ |---|---|---|
94
+ | `seomd init` | Yes | Repo-aware scaffold for `SEO.md` (v2.0.0), `.seo/`, and `AGENTS.md` / `CLAUDE.md` wiring |
95
+ | `seomd validate` | Yes | Validate `SEO.md` (supports v2 frontmatter + legacy v1 YAML); `--strict`, `--json` |
96
+ | `seomd check [target]` | Yes | Audit local HTML/build dir or URL against `SEO.md` (title, meta, H1, canonical, JSON-LD, AI bots, negative terms) |
97
+ | `seomd generate <target>` | Yes | Generate `robots`, `llms`, or `schema` from `SEO.md` |
98
+ | `seomd doctor` | Yes | Inspect `SEO.md`, agent wiring, crawl files, and provider readiness |
99
+ | `seomd analyze` | Provider | Run live AI citation audit (`--page`, `--intent`, `--engines`) and merge into `.seo/` |
100
+ | `seomd sync` | Provider | Pull cached provider intelligence (`--dry-run` shows deltas) |
101
+ | `seomd status` | Yes | Display citation rates and gap scores from `.seo/STATUS.yml` (`--json`) |
189
102
 
190
- ```bash
191
- node ./bin/seomd.js --help
192
- node ./bin/seomd.js init
193
- node ./bin/seomd.js validate
194
- node ./bin/seomd.js status --json
195
- ```
103
+ ---
196
104
 
197
- ## Testing
105
+ ## Development & Testing
198
106
 
199
107
  ```bash
108
+ npm run lint
200
109
  npm test
110
+ node ./bin/seomd.js --help
201
111
  ```
202
112
 
203
- ## Release Notes (Contributor Tagging)
204
-
205
- To generate a contributor section for a release (commit-based attribution), maintain mappings in `.github/contributors.yml` and generate markdown from a tag range:
206
-
207
- ```bash
208
- npm run release:contributors -- --from v1.0.2 --to v1.0.3
209
- ```
210
-
211
- To write output to a file:
212
-
213
- ```bash
214
- npm run release:contributors -- --from v1.0.2 --to v1.0.3 --out notes/v1.0.3-contributors.md
215
- ```
216
-
217
- To generate a full release note (changes + contributors) for a tag:
218
-
219
- ```bash
220
- npm run release:notes -- --tag v1.0.3
221
- ```
222
-
223
- Automation: the repository includes a GitHub Actions workflow that runs on tag push (`v*`) and creates/updates the GitHub Release using `scripts/release-notes.js`.
224
-
225
- ## Platform Connections & API Keys
226
-
227
- To enable live intelligence writebacks (using automated platforms like [Foxcite](https://foxcite.com)):
228
-
229
- 1. Obtain a developer API key from your platform provider.
230
- 2. Export the key as an environment variable:
231
-
232
- ```bash
233
- export SEOMD_API_KEY="your_api_key_here"
234
- ```
235
-
236
- 3. Run `seomd sync` or `seomd analyze`.
237
-
238
- _Note: Never commit your API keys or `.env` files containing keys to version control._
239
-
240
- ## Security
241
-
242
- - Never commit `.env` files or API keys
243
- - Use `.env.example` as the template for required variables
244
-
245
- ## Specification Reference
246
-
247
- Read the complete specification and guidelines at [seomd.dev/spec](https://seomd.dev/spec).
248
-
249
113
  ## License
250
114
 
251
- MIT License. Developed and maintained by the community.
115
+ MIT License.
package/SKILL.md ADDED
@@ -0,0 +1,44 @@
1
+ # SEO.md CLI Skill
2
+
3
+ **What this does:** Scaffolds, validates, and audits `SEO.md` (spec v2.0.0) — the `AGENTS.md` / `CLAUDE.md` / `DESIGN.md` equivalent for search and AI-citation strategy — and wires coding-agent instructions directly into `AGENTS.md` / `CLAUDE.md`.
4
+
5
+ ## Workflow for Coding Agents
6
+
7
+ 1. **Initialize in a repo** (auto-detects routes and wires `AGENTS.md` / `CLAUDE.md`):
8
+ ```bash
9
+ npx seomd-cli init
10
+ # or non-interactively:
11
+ npx seomd-cli init -y --type saas --brand "Acme" --domain acme.com --primary-keyword "billing automation"
12
+ ```
13
+ 2. **Read `SEO.md` before creating or editing public pages** — follow the Canonical Product Facts, Page & AEO Rules, Target Buyer Prompts, and Do Not Claim sections.
14
+ 3. **Check page playbooks** in `.seo/pages/<page-id>.md` and `.seo/REVERSE.md` (when populated by a provider) to fix citation gaps.
15
+ 4. **Verify locally (zero API key required):**
16
+ ```bash
17
+ npx seomd-cli validate --strict
18
+ npx seomd-cli check ./out # or http://localhost:3000
19
+ npx seomd-cli generate robots --out public/robots.txt
20
+ npx seomd-cli generate llms --out public/llms.txt
21
+ npx seomd-cli doctor
22
+ ```
23
+ 5. **Run live AI citation scans (optional, any compatible provider):**
24
+ ```bash
25
+ npx seomd-cli analyze # full audit -> updates .seo/
26
+ npx seomd-cli analyze --page /pricing # single page (merge-safe)
27
+ npx seomd-cli sync --dry-run # preview cached deltas
28
+ npx seomd-cli status --json # machine-readable metrics
29
+ ```
30
+
31
+ ## `init` Flags
32
+
33
+ | Flag | Description |
34
+ |------|-------------|
35
+ | `-y, --yes` | skip prompts, use inferred defaults |
36
+ | `-f, --force` | overwrite existing `SEO.md` without prompting |
37
+ | `--type <type>` | `saas`, `ecommerce`, `local`, `blog`, `marketplace` |
38
+ | `--brand <name>` | brand name |
39
+ | `--domain <domain>` | primary domain |
40
+ | `--primary-keyword <keyword>` | primary keyword |
41
+ | `--competitors <list>` | comma-separated competitor domains |
42
+ | `--provider <name>` | optional provider (`foxcite`, `semrush`, `ahrefs`, `profound`, `peec`, `custom`) |
43
+ | `--no-wire-agents` | skip wiring `AGENTS.md` / `CLAUDE.md` |
44
+ | `--output <dir>` | scaffold into a new (empty) directory |
package/bin/seomd.js CHANGED
@@ -10,83 +10,131 @@ const pkg = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf8'))
10
10
 
11
11
  // Commands
12
12
  import { initCommand } from '../src/commands/init.js';
13
+ import { validateCommand } from '../src/commands/validate.js';
14
+ import { checkCommand } from '../src/commands/check.js';
15
+ import { generateCommand } from '../src/commands/generate.js';
16
+ import { doctorCommand } from '../src/commands/doctor.js';
13
17
  import { analyzeCommand } from '../src/commands/analyze.js';
14
18
  import { syncCommand } from '../src/commands/sync.js';
15
19
  import { statusCommand } from '../src/commands/status.js';
16
- import { validateCommand } from '../src/commands/validate.js';
17
20
 
18
21
  program
19
22
  .name('seomd')
20
- .description('AEO infrastructure for technical founders — seomd.dev')
23
+ .description('Open-standard SEO.md CLI — AEO infrastructure for technical founders & coding agents (seomd.dev)')
21
24
  .version(pkg.version);
22
25
 
23
26
  program
24
27
  .command('init')
25
- .description('Scaffold SEO.md for your project')
26
- .option('-y, --yes', 'skip prompts and use defaults')
28
+ .description('Scaffold SEO.md (v2.0.0), .seo/ workspace, and AGENTS.md/CLAUDE.md wiring')
29
+ .option('-y, --yes', 'skip prompts and use smart defaults')
30
+ .option('-f, --force', 'overwrite existing SEO.md without prompting')
27
31
  .option('--type <type>', 'site type: saas, ecommerce, local, blog, marketplace')
28
32
  .option('--brand <brand>', 'brand name')
29
33
  .option('--domain <domain>', 'primary domain')
30
34
  .option('--primary-keyword <keyword>', 'primary keyword')
31
35
  .option('--competitors <list>', 'comma-separated competitor list')
36
+ .option('--provider <name>', 'optional provider: foxcite, semrush, ahrefs, profound, peec, custom')
37
+ .option('--no-wire-agents', 'skip wiring SEO.md instructions into AGENTS.md / CLAUDE.md')
32
38
  .option('--output <dir>', 'scaffold into a new directory instead of cwd')
33
39
  .addHelpText('after', `
34
40
 
35
41
  Examples:
36
- seomd init # interactive 5-question flow
37
- seomd init -y --type local # skip prompts, use defaults
38
- seomd init --brand "Acme" --domain acme.com --primary-keyword "local seo"
39
- seomd init --type saas --brand "MyApp" --domain myapp.com --output ./new-project
42
+ seomd init # interactive flow with repo route detection
43
+ seomd init -y --type saas # skip prompts, auto-detect routes + wire AGENTS.md
44
+ seomd init --brand "Acme" --domain acme.com --primary-keyword "billing automation"
45
+ seomd init --type local --no-wire-agents --output ./new-project
40
46
  `)
41
47
  .action(initCommand);
42
48
 
49
+ program
50
+ .command('validate')
51
+ .description('Validate SEO.md against spec v2.0.0 (or legacy v1.0)')
52
+ .option('--strict', 'treat warnings as errors (useful in CI)')
53
+ .option('--json', 'output machine-readable JSON')
54
+ .addHelpText('after', `
55
+
56
+ Examples:
57
+ seomd validate
58
+ seomd validate --strict --json
59
+ `)
60
+ .action(validateCommand);
61
+
62
+ program
63
+ .command('check [target]')
64
+ .description('Audit local HTML/build output or a URL against SEO.md (offline, zero API key)')
65
+ .option('--strict', 'treat warnings as errors')
66
+ .option('--json', 'output machine-readable JSON')
67
+ .addHelpText('after', `
68
+
69
+ Examples:
70
+ seomd check ./out # audit static build output
71
+ seomd check http://localhost:3000 # audit running dev server
72
+ seomd check ./public --json # machine-readable check for CI / agents
73
+ `)
74
+ .action(checkCommand);
75
+
76
+ program
77
+ .command('generate <target>')
78
+ .description('Generate robots.txt, llms.txt, or JSON-LD schema from SEO.md (offline)')
79
+ .option('--out <file>', 'write output to file instead of stdout')
80
+ .option('--strict', 'fail instead of warning when SEO.md still has template text')
81
+ .addHelpText('after', `
82
+
83
+ Targets:
84
+ robots AI-crawler-friendly robots.txt
85
+ llms llms.txt directory for AI agents
86
+ schema JSON-LD starter graph
87
+
88
+ Examples:
89
+ seomd generate robots --out public/robots.txt
90
+ seomd generate llms --out public/llms.txt
91
+ seomd generate schema
92
+ `)
93
+ .action(generateCommand);
94
+
95
+ program
96
+ .command('doctor')
97
+ .description('Check SEO.md validity, agent wiring, crawl files, and provider readiness')
98
+ .option('--json', 'output as JSON')
99
+ .action(doctorCommand);
100
+
43
101
  program
44
102
  .command('analyze')
45
- .description('Run citation analysis and write back _analysis blocks')
46
- .option('--page <url>', 'analyze a specific page only')
103
+ .description('Run live AI citation analysis via your configured provider and update .seo/')
104
+ .option('--page <url>', 'analyze a specific page only (merges into .seo/)')
47
105
  .option('--intent <category>', 'analyze a specific intent category only')
48
- .option('--engines <list>', 'comma-separated list of engines to scan (e.g. chatgpt,claude)')
106
+ .option('--engines <list>', 'comma-separated list of engines to scan (e.g. ChatGPT,Claude)')
49
107
  .addHelpText('after', `
50
108
 
51
109
  Examples:
52
- seomd analyze # full audit
53
- seomd analyze --page /pricing # single page audit
54
- seomd analyze --intent transactional --engines chatgpt,claude
110
+ seomd analyze # full audit
111
+ seomd analyze --page /pricing # single page audit (merge-safe)
112
+ seomd analyze --intent transactional --engines ChatGPT,Claude
55
113
  `)
56
114
  .action(analyzeCommand);
57
115
 
58
116
  program
59
117
  .command('sync')
60
- .description('Sync latest platform intelligence to your SEO.md files')
61
- .option('--dry-run', 'preview changes without writing')
118
+ .description('Pull latest cached intelligence from your configured provider into .seo/')
119
+ .option('--dry-run', 'preview metric deltas without modifying files')
62
120
  .addHelpText('after', `
63
121
 
64
122
  Examples:
65
- seomd sync # sync latest data
66
- seomd sync --dry-run # preview changes only
123
+ seomd sync
124
+ seomd sync --dry-run
67
125
  `)
68
126
  .action(syncCommand);
69
127
 
70
128
  program
71
129
  .command('status')
72
- .description('Show current citation rates and gap scores')
130
+ .description('Show current citation rates and gap scores from .seo/STATUS.yml')
73
131
  .option('--json', 'output as JSON')
74
132
  .addHelpText('after', `
75
133
 
76
134
  Examples:
77
- seomd status # human-readable summary
78
- seomd status --json # machine-readable JSON
135
+ seomd status
136
+ seomd status --json
79
137
  `)
80
138
  .action(statusCommand);
81
139
 
82
- program
83
- .command('validate')
84
- .description('Validate your SEO.md against the spec')
85
- .addHelpText('after', `
86
-
87
- Example:
88
- seomd validate
89
- `)
90
- .action(validateCommand);
91
-
92
140
  program.parse();