Skip to content

Universal SEO skill for Claude Code. 26 sub-skills + 19 sub-agents covering technical SEO, E-E-A-T, schema, GEO/AEO, agent readiness (Lighthouse Agentic Browsing, WebMCP, llms.txt), backlinks, local SEO, e-commerce, international SEO, Google APIs, and PDF/Excel reporting. 9 optional extensions for live SEO data.

feat(seo-cockpit): /seo-cockpit <site> opens and remembers that site

Agrici Danielaeecfd4fe961
diff --git a/plugins/seo-cockpit/README.md b/plugins/seo-cockpit/README.md
index d38afbb..d6d7252 100644
--- a/plugins/seo-cockpit/README.md
+++ b/plugins/seo-cockpit/README.md
@@ -71,7 +71,7 @@ Charts are drawn with block characters in the terminal and as SVG on the desktop
- `/seo-spend`: DataForSEO spend today, over 7 and 30 days, by endpoint, with a 30-day spark row.
- `/seo-doctor`: claude-seo runtime readiness, install location, and guard state.
-- `/seo-cockpit [export]`: the visual cockpit, or with `export` the HTML dashboard.
+- `/seo-cockpit [site | export]`: the visual cockpit (for a given site, remembered), or with `export` the HTML dashboard.
## Install
diff --git a/plugins/seo-cockpit/hooks/register.ts b/plugins/seo-cockpit/hooks/register.ts
index c5636f5..8fb1521 100644
--- a/plugins/seo-cockpit/hooks/register.ts
+++ b/plugins/seo-cockpit/hooks/register.ts
@@ -511,15 +511,21 @@ async function loadAll($: EngineInterface, ctx: Ctx): Promise<void> {
$.ui.status(statusLine(ctx.pane.host, rows))
}
-/** The person typed the site in the pane: remember it for this folder and load again. */
+/** Remembers a site the person gave: for this folder, and as the last one used anywhere. */
+async function rememberTarget($: EngineInterface, ctx: Ctx, value: string): Promise<void> {
+ ctx.typed = value.trim()
+ ctx.pane.models = {}
+ await $.store.set(`target:${await $.session.cwd()}`, ctx.typed).catch(() => undefined)
+ await $.store.set('target:last', hostOf(ctx.typed)).catch(() => undefined)
+}
+
+/** The person typed the site in the pane: remember it and load again. */
async function setTarget($: EngineInterface, ctx: Ctx, value: string): Promise<void> {
if (hostOf(value) === null) {
return
}
- ctx.typed = value.trim()
- ctx.pane.models = {}
- await $.store.set(`target:${await $.session.cwd()}`, ctx.typed).catch(() => undefined)
+ await rememberTarget($, ctx, value)
await loadAll($, ctx)
}
@@ -551,12 +557,27 @@ async function exportHtml($: EngineInterface, ctx: Ctx, loadAllFirst: boolean):
async function cockpitCommand($: EngineInterface, ctx: Ctx, args: string): Promise<{ text: string }> {
// The engine already names the plugin above a command's answer; the text is the outcome only.
try {
- if (args.trim().toLowerCase() === 'export') {
+ const arg = args.trim()
+
+ if (arg.toLowerCase() === 'export') {
return { text: `Dashboard written to ${await exportHtml($, ctx, true)}` }
}
- // A second /seo-cockpit closes it, as the official modernization pane does.
- if (ctx.pane.isOpen) {
+ // `/seo-cockpit claude-seo.md`: that site, remembered for this folder and as the last one used.
+ if (arg !== '') {
+ if (hostOf(arg) === null) {
+ return { text: `"${arg}" is not a site. Try /seo-cockpit example.com, or /seo-cockpit export.` }
+ }
+
+ await rememberTarget($, ctx, arg)
+
+ if (ctx.pane.isOpen) {
+ void loadAll($, ctx).catch(() => undefined)
+
+ return { text: `Cockpit switched to ${hostOf(arg)}.` }
+ }
+ } else if (ctx.pane.isOpen) {
+ // A second /seo-cockpit closes it, as the official modernization pane does.
await $.ui.close({ id: PANE_ID }).catch(() => undefined)
ctx.pane.isOpen = false
@@ -588,7 +609,7 @@ async function registerCommands($: EngineInterface): Promise<void> {
await Promise.all([
$.command.register({ name: 'seo-spend', description: 'claude-seo DataForSEO spend: today, 7 and 30 days, by endpoint', immediate: true }).catch(() => undefined),
$.command.register({ name: 'seo-doctor', description: 'claude-seo runtime readiness and where it is installed', immediate: true }).catch(() => undefined),
- $.command.register({ name: 'seo-cockpit', description: 'Charts for Search Console, rankings, Core Web Vitals, the audit, Maps and spend', argumentHint: '[export]', immediate: true }).catch(() => undefined),
+ $.command.register({ name: 'seo-cockpit', description: 'Charts for Search Console, rankings, Core Web Vitals, the audit, Maps and spend', argumentHint: '[site | export]', immediate: true }).catch(() => undefined),
])
}
diff --git a/plugins/seo-cockpit/tests/cockpit.test.ts b/plugins/seo-cockpit/tests/cockpit.test.ts
index 08a643b..58664b5 100644
--- a/plugins/seo-cockpit/tests/cockpit.test.ts
+++ b/plugins/seo-cockpit/tests/cockpit.test.ts
@@ -96,6 +96,30 @@ describe('cockpit', () => {
expect(await ui.find({ key: 'target' })).toBeDefined()
})
+ test('/seo-cockpit <site> opens that site and remembers it here and as the last one', async ($, on) => {
+ worldOf(on)
+
+ const saved: Record<string, unknown> = {}
+
+ on('session.cwd', () => ({ value: '/elsewhere' }))
+ on('store.get', ($, e) => ({ value: saved[e.key] }))
+ on('store.set', ($, e) => {
+ saved[e.key] = e.value
+
+ return { value: undefined }
+ })
+ on('ui.status', () => ({ value: undefined }))
+ on('ui.open', () => ({ value: { isPlaced: true } }) as never)
+ on('ui.render', () => ({ type: 'Text', props: {}, children: ['engine'] }) as never)
+ mock.clock(on)
+
+ expect((await $.command.run(command('seo-cockpit', 'claude-seo.md'))).text).toBe('Cockpit open for claude-seo.md.')
+ expect(saved['target:/elsewhere']).toBe('claude-seo.md')
+ expect(saved['target:last']).toBe('claude-seo.md')
+ expect((await $.command.run(command('seo-cockpit', 'claude-ads.md'))).text).toBe('Cockpit switched to claude-ads.md.')
+ expect((await $.command.run(command('seo-cockpit', 'not a site'))).text).toContain('is not a site')
+ })
+
test('with no pane on screen, it writes the HTML dashboard instead', async ($, on) => {
worldOf(on)