@appeeky/spec 0.7.0 → 0.8.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.
- package/README.md +2 -2
- package/agents/appeeky-aso.md +1 -1
- package/dist/cli.js +10 -3
- package/dist/visibility-core.js +26 -26
- package/dist/visibility-local.d.ts +20 -0
- package/dist/visibility-local.js +25 -3
- package/dist/visibility.d.ts +43 -1
- package/dist/visibility.js +59 -3
- package/package.json +1 -1
- package/skills/appeeky-spec-visibility/SKILL.md +12 -4
package/README.md
CHANGED
|
@@ -413,7 +413,7 @@ aiVisibility:
|
|
|
413
413
|
|
|
414
414
|
- `visibility init` writes the intents Appeeky already tracks into the spec. With none yet, Appeeky writes them from your listing; run `init` again a few minutes later.
|
|
415
415
|
- `visibility sync` sends the spec's intents and prompts to Appeeky. Ones only in Appeeky are listed, and archived only with `--prune`. `--dry-run` shows the plan.
|
|
416
|
-
- `visibility pull` writes `appeeky/visibility/us.yaml`. It shows each intent as `winning`, `weak` or `missing`, the share of answers that name you per assistant, who they name instead, the pages they cite (`yours: true` for your own site), and the fixes Appeeky suggests. What moved since the last pull goes to `appeeky/visibility/changes.md`.
|
|
416
|
+
- `visibility pull` writes `appeeky/visibility/us.yaml`. It shows each intent as `winning`, `weak` or `missing`, the share of answers that name you per assistant, who they name instead, the pages they cite (`yours: true` for your own site, `gap: true` for a site cited for other apps and never for yours), and the fixes Appeeky suggests. `overall` has your share of voice and how often you come first across every answer, `apps` the apps named most, and `searches` what the assistants searched the web for. What moved since the last pull goes to `appeeky/visibility/changes.md`.
|
|
417
417
|
- `visibility scan` asks the assistants now instead of waiting for the schedule. It uses AI Visibility credits.
|
|
418
418
|
|
|
419
419
|
`verify` reads the daily series as `ai_visibility`, the share of answers that name the app, before and after a push. A description that says what the app is for in the words people use can move it, and so can the pages the assistants cite.
|
|
@@ -429,7 +429,7 @@ npx @appeeky/spec visibility scan --local --dry-run
|
|
|
429
429
|
npx @appeeky/spec visibility scan --local
|
|
430
430
|
```
|
|
431
431
|
|
|
432
|
-
Each prompt goes to each assistant with web search on, the way the apps answer people, and a second cheap call lists the apps each answer names. The result is the same `appeeky/visibility/<country>.yaml`, plus `history.csv` (one row per scan, intent and assistant, read by `verify`) and `answers/<country>.jsonl` with every answer. Add `aliases:` under `aiVisibility` for other names the assistants use for the app.
|
|
432
|
+
Each prompt goes to each assistant with web search on, the way the apps answer people, and a second cheap call lists the apps each answer names. The result is the same `appeeky/visibility/<country>.yaml`, plus `history.csv` (one row per scan, intent and assistant, read by `verify`) and `answers/<country>.jsonl` with every answer and the searches behind it. Add `aliases:` under `aiVisibility` for other names the assistants use for the app.
|
|
433
433
|
|
|
434
434
|
On a schedule: set `VISIBILITY_EVERY` (days, e.g. `7`) as a repository variable or in the docker `.env`, with the keys as secrets, and the daily routine scans when it is due.
|
|
435
435
|
|
package/agents/appeeky-aso.md
CHANGED
|
@@ -26,7 +26,7 @@ Run the CLI the way the co-founder tells you (`appeeky-spec <command> --json` or
|
|
|
26
26
|
- Spare keyword space, including secondary locales a storefront reads (`crossLocalization` in coverage)
|
|
27
27
|
- Words repeated across name, subtitle and keyword field, and wasted characters
|
|
28
28
|
- Competitors that climbed on your targets or changed their listing recently
|
|
29
|
-
- Questions where AI assistants name competitors instead of this app, and the words they use
|
|
29
|
+
- Questions where AI assistants name competitors instead of this app, and the words they use: `namedInstead`, the `gap` sites under `sources` and the `searches` in the visibility files
|
|
30
30
|
- Google queries that bring people to the website and are not targets yet
|
|
31
31
|
- The category rank trend over the last weeks
|
|
32
32
|
|
package/dist/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ import { commentPlatform, deleteComment, draftIssues, fetchSocial, hideComment,
|
|
|
14
14
|
import { fetchUgc, findPersona, generateBrief, quoteBrief, readBriefs, readPersonas, saveUgc } from "./ugc.js";
|
|
15
15
|
import { generateLocal, loadCore, planLocalClip, readAppeekyPersona, readLocalPersona } from "./ugc-local.js";
|
|
16
16
|
import { categoryFile, categoryMetricSource, categoryPlans, chartSources, previousRank, readCategoryHistory, readCategoryRanks, saveCategoryRanks } from "./category.js";
|
|
17
|
-
import { applySync, bootstrapIntents, languageFor, planSync, pullVisibility, readRemoteIntents, scanVisibility, visibilityMetricSource, visibilityTarget } from "./visibility.js";
|
|
17
|
+
import { applySync, bootstrapIntents, languageFor, overallLine, planSync, pullVisibility, readRemoteIntents, scanVisibility, visibilityMetricSource, visibilityTarget } from "./visibility.js";
|
|
18
18
|
import { appContext, daysSinceLocalScan, KEY_NAMES, loadVisibilityCore, localVisibilityMetricSource, planLocalScan, scanLocal } from "./visibility-local.js";
|
|
19
19
|
import { pullSearchAds, SearchAdsClient, searchAdsMetricSource, searchAdsSource } from "./search-ads.js";
|
|
20
20
|
import { daysSinceRanks, pullDomain, pullKeywords, pullRanks, quoteSeo, readDataForSeo, webKeywords, webRankMetricSource } from "./dataforseo.js";
|
|
@@ -1443,7 +1443,7 @@ export function buildProgram() {
|
|
|
1443
1443
|
const a = needKey();
|
|
1444
1444
|
const results = await pullVisibility(a, project, opts.country ? [opts.country.toLowerCase()] : undefined);
|
|
1445
1445
|
if (g().json) {
|
|
1446
|
-
printJson(results.map(({ data, ...r }) => ({ ...r, summary: data?.summary })));
|
|
1446
|
+
printJson(results.map(({ data, ...r }) => ({ ...r, summary: data?.summary, overall: data?.overall })));
|
|
1447
1447
|
return;
|
|
1448
1448
|
}
|
|
1449
1449
|
for (const r of results) {
|
|
@@ -1459,8 +1459,13 @@ export function buildProgram() {
|
|
|
1459
1459
|
}
|
|
1460
1460
|
const s = d.summary;
|
|
1461
1461
|
console.log(`${c.green("✓")} ${r.file.replace(project.root + "/", "")} ${c.green(`${s.winning} named`)} · ${c.yellow(`${s.weak} weak`)} · ${c.red(`${s.missing} missing`)}${s.noData ? c.dim(` · ${s.noData} not scanned yet`) : ""}`);
|
|
1462
|
+
if (d.overall)
|
|
1463
|
+
console.log(c.dim(` ${overallLine(d.overall)}`));
|
|
1462
1464
|
for (const i of d.intents.filter((x) => x.status === "missing").slice(0, 3))
|
|
1463
1465
|
console.log(` ${c.red("missing")} "${i.label}"${i.namedInstead ? c.dim(`: they name ${i.namedInstead.slice(0, 3).join(", ")}`) : ""}`);
|
|
1466
|
+
const gaps = d.sources.filter((s) => s.gap);
|
|
1467
|
+
if (gaps.length)
|
|
1468
|
+
console.log(` ${c.yellow("gaps")} ${c.dim(`cited for other apps, not for yours: ${gaps.slice(0, 4).map((s) => s.domain).join(", ")}`)}`);
|
|
1464
1469
|
for (const ch of r.changes)
|
|
1465
1470
|
console.log(` ${c.yellow("changed")} ${ch}`);
|
|
1466
1471
|
if (d.fixes.length)
|
|
@@ -1575,12 +1580,14 @@ export function buildProgram() {
|
|
|
1575
1580
|
results.push(r);
|
|
1576
1581
|
}
|
|
1577
1582
|
if (g().json) {
|
|
1578
|
-
printJson(results.map(({ data, ...r }) => ({ ...r, summary: data.summary })));
|
|
1583
|
+
printJson(results.map(({ data, ...r }) => ({ ...r, summary: data.summary, overall: data.overall })));
|
|
1579
1584
|
return;
|
|
1580
1585
|
}
|
|
1581
1586
|
for (const r of results) {
|
|
1582
1587
|
const s = r.data.summary;
|
|
1583
1588
|
console.log(`${c.green("✓")} ${r.file.replace(project.root + "/", "")} ${c.green(`${s.winning} named`)} · ${c.yellow(`${s.weak} weak`)} · ${c.red(`${s.missing} missing`)} ${c.dim(`$${r.costUsd.toFixed(2)}`)}`);
|
|
1589
|
+
if (r.data.overall)
|
|
1590
|
+
console.log(c.dim(` ${overallLine(r.data.overall)}`));
|
|
1584
1591
|
for (const i of r.data.intents.filter((x) => x.status === "missing").slice(0, 3))
|
|
1585
1592
|
console.log(` ${c.red("missing")} "${i.label}"${i.namedInstead ? c.dim(`: they name ${i.namedInstead.slice(0, 3).join(", ")}`) : ""}`);
|
|
1586
1593
|
for (const ch of r.changes)
|
package/dist/visibility-core.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
function
|
|
1
|
+
var W=20,G=300;function M(e){let n=[],t=new Set;for(let o of e){if(typeof o!="string")continue;let s=o.trim().replace(/\s+/g," ").slice(0,G);if(!s)continue;let i=s.toLowerCase();if(!t.has(i)&&(t.add(i),n.push(s),n.length>=W))break}return n}function h(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function w(e){return Array.isArray(e)?e:[]}function y(e){return typeof e=="string"&&e.length>0?e:void 0}function _(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function F(e){try{let n=new URL(e);n.hash="",n.searchParams.delete("utm_source");let t=n.toString();return t.endsWith("/")&&(t=t.slice(0,-1)),t.toLowerCase()}catch{return e.trim().toLowerCase()}}var C=class{list=[];index=new Map;add(n,t){if(!n)return null;let o=F(n),s=this.index.get(o);if(s!==void 0){let i=this.list[s];return!i.title&&t&&(i.title=t),s+1}return this.list.push(t?{url:n,title:t}:{url:n}),this.index.set(o,this.list.length-1),this.list.length}get citations(){return this.list}};function v(e){return Array.from(new Set(e)).sort((t,o)=>t-o).map(t=>` [${t}]`).join("")}function O(e){let n=h(e)?e:{},t=new C,o=[],s=[],i=0;for(let m of w(n.output))if(h(m)){if(m.type==="web_search_call"){i+=1;let l=h(m.action)?m.action:{};s.push(l.query,...w(l.queries));continue}if(m.type==="message")for(let l of w(m.content)){if(!h(l)||l.type!=="output_text")continue;let u=typeof l.text=="string"?l.text:"",a=[];for(let p of w(l.annotations)){if(!h(p)||p.type!=="url_citation")continue;let g=y(p.url),d=t.add(g,y(p.title));if(d===null||!g)continue;let f=J(u,p,g);f!==null&&a.push({at:f,n:d})}o.push(B(u,a))}}let r=o.join(`
|
|
2
2
|
|
|
3
|
-
`).trim();!
|
|
4
|
-
The user is in ${
|
|
3
|
+
`).trim();!r&&typeof n.output_text=="string"&&(r=n.output_text.trim());let c=h(n.usage)?n.usage:{};return{text:r,citations:t.citations,inputTokens:_(c.input_tokens),outputTokens:_(c.output_tokens),searchCalls:i,searchQueries:M(s)}}function J(e,n,t){let o=typeof n.start_index=="number"?n.start_index:null,s=typeof n.end_index=="number"?n.end_index:null,i="";try{i=new URL(t).hostname.replace(/^www\./,"")}catch{}if(o!==null&&s!==null&&s<=e.length&&o<s){let m=e.slice(o,s);if(m.includes(t)||i&&m.includes(i))return s}let r=e.indexOf(t);if(r===-1)return null;let c=r+t.length;for(;c<e.length&&e[c]===")";)c+=1;return c}function B(e,n){if(n.length===0)return e;let t=new Map;for(let{at:s,n:i}of n)t.set(s,[...t.get(s)??[],i]);let o=e;for(let s of Array.from(t.keys()).sort((i,r)=>r-i))o=o.slice(0,s)+v(t.get(s))+o.slice(s);return o}function T(e){let n=h(e)?e:{},t=new C,o=w(n.content).filter(h),s="",i=0,r=[];for(let u of o){if(u.type==="server_tool_use"&&u.name==="web_search"&&(i+=1,h(u.input)&&r.push(u.input.query)),u.type!=="text")continue;let a=typeof u.text=="string"?u.text:"",p=[];for(let g of w(u.citations)){if(!h(g)||g.type!==void 0&&g.type!=="web_search_result_location")continue;let d=t.add(y(g.url),y(g.title));d!==null&&p.push(d)}s+=p.length>0?Q(a,v(p)):a}for(let u of o)if(u.type==="web_search_tool_result")for(let a of w(u.content))h(a)&&(a.type!==void 0&&a.type!=="web_search_result"||t.add(y(a.url),y(a.title)));let c=h(n.usage)?n.usage:{},m=h(c.server_tool_use)?c.server_tool_use:{},l=_(m.web_search_requests);return{text:s.trim(),citations:t.citations,inputTokens:_(c.input_tokens),outputTokens:_(c.output_tokens),searchCalls:l>0?l:i,searchQueries:M(r)}}function Q(e,n){let t=/\s*$/.exec(e),o=t?t.index:e.length;return e.slice(0,o)+n+e.slice(o)}function N(e){let n=new C,t=h(e.groundingMetadata)?e.groundingMetadata:{},o=[];for(let r of w(t.groundingChunks)){let c=h(r)&&h(r.web)?r.web:h(r)&&h(r.retrievedContext)?r.retrievedContext:null;o.push(c?n.add(y(c.uri),y(c.title)):null)}for(let r of e.sources??[])n.add(y(r?.url),y(r?.title));let s=e.text;for(let r of w(t.groundingSupports)){if(!h(r))continue;let c=h(r.segment)?r.segment:{},m=y(c.text)??y(r.segment_text);if(!m)continue;let l=w(r.groundingChunkIndices).map(p=>typeof p=="number"?o[p]:null).filter(p=>typeof p=="number");if(l.length===0)continue;let u=s.indexOf(m);if(u===-1)continue;let a=u+m.length;s=s.slice(0,a)+v(l)+s.slice(a)}let i=M(w(t.webSearchQueries));return{text:s,citations:n.citations,searchCalls:i.length>0||n.citations.length>0?1:0,searchQueries:i}}var j=["chatgpt","claude","gemini","perplexity"],R={chatgpt:{model:"chatgpt",env:["OPENAI_API_KEY"],modelId:"gpt-4.1",estimateUsd:.035},claude:{model:"claude",env:["ANTHROPIC_API_KEY"],modelId:"claude-haiku-5-5",estimateUsd:.015},gemini:{model:"gemini",env:["GEMINI_API_KEY","GOOGLE_API_KEY","GOOGLE_GENERATIVE_AI_API_KEY"],modelId:"gemini-2.5-flash",estimateUsd:.04},perplexity:{model:"perplexity",env:["PERPLEXITY_API_KEY"],modelId:"sonar",estimateUsd:.008}},Y=[{model:"chatgpt",modelId:"gpt-4.1-mini",estimateUsd:.001},{model:"gemini",modelId:"gemini-2.5-flash",estimateUsd:.001},{model:"claude",modelId:"claude-haiku-5-5",estimateUsd:.002}];function L(e,n){for(let t of R[e].env)if(n[t]?.trim())return n[t].trim()}function re(e,n=j){return n.filter(t=>L(t,e))}function D(e){for(let n of Y){let t=L(n.model,e);if(t)return{...n,key:t}}return null}function ie(e,n,t){let o=D(t),s=n.reduce((i,r)=>i+R[r].estimateUsd+(o?.estimateUsd??0),0);return Math.round(e*s*100)/100}var H=e=>new Promise(n=>setTimeout(n,e));async function b(e,n,t,o,s=12e4){let i="";for(let r=0;r<4;r++){let c=await e(n,{method:"POST",headers:{"content-type":"application/json",...t},body:JSON.stringify(o),signal:AbortSignal.timeout(s)}),m=await c.text();if(c.ok)return JSON.parse(m);if(i=`${c.status} ${K(m)}`,c.status!==429&&c.status<500)break;let l=Number(c.headers.get("retry-after"));await H(Number.isFinite(l)&&l>0?Math.min(l*1e3,3e4):2e3*2**r)}throw new Error(i)}function K(e){try{let n=JSON.parse(e),t=Array.isArray(n)?n[0]?.error:n.error;return(typeof t=="string"?t:t?.message)??e.slice(0,200)}catch{return e.slice(0,200)}}var V={"gpt-4.1":{in:2,out:8},"gpt-4.1-mini":{in:.4,out:1.6},"claude-haiku-5-5":{in:.1,out:.5},"gemini-2.5-flash":{in:.3,out:2.5},sonar:{in:1,out:1}},S={chatgpt:.025,claude:.01,gemini:.035,perplexity:.005},x=(e,n,t)=>{let o=V[e];return o?(n*o.in+t*o.out)/1e6:0};function z(e,n){return`You are a helpful assistant recommending mobile apps.
|
|
4
|
+
The user is in ${e.toUpperCase()} and writes in ${n.toUpperCase()}.
|
|
5
5
|
When the user asks for an app, return a short ranked list (1\u20135) of real,
|
|
6
6
|
currently-available apps. For each app: state its name first, then a
|
|
7
7
|
one-sentence reason. Prefer iOS App Store apps. Be specific \u2014 name the
|
|
8
8
|
exact app, not a category. If you genuinely cannot recommend any app,
|
|
9
|
-
say so plainly.`}function
|
|
9
|
+
say so plainly.`}function X(e){let n=e.toLowerCase();return["i can't recommend","i cannot recommend","i'm unable to recommend","i am unable to recommend"].some(t=>n.includes(t))||n.startsWith("i'm sorry")||n.startsWith("sorry, i")}var q=e=>/claude-[a-z]+-5/.test(e)?{max_tokens:16e3}:{max_tokens:1500,temperature:.4};async function ae(e,n,t,o=fetch){let s=R[e].modelId,i=z(t.country,t.language);try{let r="",c=[],m=[],l=0;if(e==="chatgpt"){let u=await b(o,"https://api.openai.com/v1/responses",{authorization:`Bearer ${n}`},{model:s,instructions:i,input:t.prompt,temperature:.4,tools:[{type:"web_search_preview",search_context_size:"low"}]}),a=O(u);({text:r,citations:c}=a),m=a.searchQueries??[],l=x(s,a.inputTokens,a.outputTokens)+S.chatgpt*Math.max(1,a.searchCalls)}else if(e==="claude"){let u=await b(o,"https://api.anthropic.com/v1/messages",{"x-api-key":n,"anthropic-version":"2023-06-01"},{model:s,...q(s),system:i,messages:[{role:"user",content:t.prompt}],tools:[{type:"web_search_20250305",name:"web_search",max_uses:3}]}),a=T(u);({text:r,citations:c}=a),m=a.searchQueries??[],l=x(s,a.inputTokens,a.outputTokens)+S.claude*Math.max(1,a.searchCalls)}else if(e==="gemini"){let u=await b(o,`https://generativelanguage.googleapis.com/v1beta/models/${s}:generateContent`,{"x-goog-api-key":n},{systemInstruction:{parts:[{text:i}]},contents:[{role:"user",parts:[{text:t.prompt}]}],tools:[{google_search:{}}],generationConfig:{temperature:.4}}),a=u?.candidates?.[0],p=(a?.content?.parts??[]).map(f=>f.text??"").join(""),g=N({text:p,groundingMetadata:a?.groundingMetadata});({text:r,citations:c}=g),m=g.searchQueries??[];let d=u?.usageMetadata??{};l=x(s,d.promptTokenCount??0,(d.candidatesTokenCount??0)+(d.thoughtsTokenCount??0))+(g.searchCalls>0?S.gemini:0)}else{let u=await b(o,"https://api.perplexity.ai/chat/completions",{authorization:`Bearer ${n}`},{model:s,temperature:.4,messages:[{role:"system",content:i},{role:"user",content:t.prompt}]});r=u?.choices?.[0]?.message?.content??"",c=(Array.isArray(u?.search_results)&&u.search_results.length?u.search_results:Array.isArray(u?.citations)?u.citations:[]).map(p=>typeof p=="string"?{url:p}:p&&typeof p.url=="string"?{url:p.url,title:p.title}:null).filter(p=>p!==null),l=x(s,u?.usage?.prompt_tokens??0,u?.usage?.completion_tokens??0)+S.perplexity}return{model:e,modelId:s,status:X(r)?"refusal":"ok",text:r,citations:c,searches:m,costUsd:l}}catch(r){return{model:e,modelId:s,status:"error",text:"",citations:[],searches:[],costUsd:0,error:r.message}}}function E(e){let n=e.indexOf("{"),t=e.lastIndexOf("}");if(n===-1||t<=n)throw new Error("no JSON in the answer");return JSON.parse(e.slice(n,t+1))}async function P(e,n,t,o=fetch){if(e.model==="chatgpt"){let r=await b(o,"https://api.openai.com/v1/chat/completions",{authorization:`Bearer ${e.key}`},{model:e.modelId,temperature:t,response_format:{type:"json_object"},messages:[{role:"user",content:n}]});return{json:E(r?.choices?.[0]?.message?.content??""),costUsd:x(e.modelId,r?.usage?.prompt_tokens??0,r?.usage?.completion_tokens??0)}}if(e.model==="gemini"){let r=await b(o,`https://generativelanguage.googleapis.com/v1beta/models/${e.modelId}:generateContent`,{"x-goog-api-key":e.key},{contents:[{role:"user",parts:[{text:n}]}],generationConfig:{temperature:t,responseMimeType:"application/json"}}),c=(r?.candidates?.[0]?.content?.parts??[]).map(l=>l.text??"").join(""),m=r?.usageMetadata??{};return{json:E(c),costUsd:x(e.modelId,m.promptTokenCount??0,(m.candidatesTokenCount??0)+(m.thoughtsTokenCount??0))}}let s=await b(o,"https://api.anthropic.com/v1/messages",{"x-api-key":e.key,"anthropic-version":"2023-06-01"},{model:e.modelId,...q(e.modelId),messages:[{role:"user",content:`${n}
|
|
10
10
|
|
|
11
|
-
Answer with the JSON object only.`}]}),i=(
|
|
12
|
-
Known competitor apps: ${
|
|
11
|
+
Answer with the JSON object only.`}]}),i=(s?.content??[]).filter(r=>r.type==="text").map(r=>r.text).join("");return{json:E(i),costUsd:x(e.modelId,s?.usage?.input_tokens??0,s?.usage?.output_tokens??0)}}function Z(e){let n=e.competitors.length?`
|
|
12
|
+
Known competitor apps: ${e.competitors.slice(0,10).join(", ")}`:"",t=e.citations.length?`
|
|
13
13
|
|
|
14
14
|
Citations available (0-indexed):
|
|
15
|
-
${
|
|
15
|
+
${e.citations.slice(0,10).map((o,s)=>` [${s}] ${o.title??o.url}`).join(`
|
|
16
16
|
`)}`:"";return`You parse a recommendation answer from an AI assistant and extract
|
|
17
17
|
which mobile apps were mentioned, and in which position.
|
|
18
18
|
|
|
19
19
|
Original user prompt:
|
|
20
|
-
"""${
|
|
20
|
+
"""${e.prompt}"""
|
|
21
21
|
|
|
22
22
|
The user owns this app (recognise it even with minor spelling variants):
|
|
23
|
-
"${
|
|
23
|
+
"${e.owner}"${n}
|
|
24
24
|
|
|
25
25
|
Assistant's answer:
|
|
26
|
-
"""${
|
|
26
|
+
"""${e.answer.slice(0,8e3)}"""${t}
|
|
27
27
|
|
|
28
28
|
Return JSON: {"refusal": boolean, "apps": [{"appName": string, "position": number|null, "citationIndex": number|null}]}
|
|
29
29
|
|
|
@@ -40,21 +40,21 @@ Rules:
|
|
|
40
40
|
generic phrases like "an app for X" \u2014 only specific named apps.
|
|
41
41
|
- Strip explanatory parentheses from appName (return "Calm" not
|
|
42
42
|
"Calm (popular meditation app)").
|
|
43
|
-
- App names should be the brand the assistant used.`}async function
|
|
43
|
+
- App names should be the brand the assistant used.`}async function ce(e,n,t=fetch){let{json:o,costUsd:s}=await P(e,Z(n),0,t),r=(Array.isArray(o?.apps)?o.apps:[]).map(c=>c).filter(c=>typeof c.appName=="string"&&c.appName.trim()).map(c=>({name:c.appName.trim(),position:typeof c.position=="number"&&c.position>=1?Math.round(c.position):null,citation:typeof c.citationIndex=="number"&&c.citationIndex>=0?Math.round(c.citationIndex):null}));return{refusal:!!o?.refusal,mentions:r,costUsd:s}}var A=e=>e.toLowerCase().replace(/[^\p{L}\p{N}]/gu,"");function $(e,n){let t=A(e);return t?n.some(o=>[o,o.split(/\s[:\-–—|]\s|:\s/)[0]??o].map(A).filter(i=>i.length>=3).some(i=>t===i||i.length>=4&&(t.includes(i)||i.includes(t)&&t.length>=i.length*.7))):!1}var ee=25,k=e=>Math.round(e*10)/10;function ue(e,n,t){return n.map(o=>{let s=e.filter(a=>a.intent===o&&(a.status==="ok"||a.status==="refusal")),i={};for(let a of j){let p=s.filter(f=>f.model===a);if(!p.length)continue;let g=p.map(f=>f.mentions.find(I=>$(I.name,t))).filter(f=>!!f),d=g.map(f=>f.position).filter(f=>f!==null);i[a]={pct:k(g.length/p.length*100),position:d.length?k(d.reduce((f,I)=>f+I,0)/d.length):null,prompts:p.length}}let r=Object.values(i),c=r.length?k(r.reduce((a,p)=>a+p.pct,0)/r.length):void 0,m=new Map;for(let a of s)for(let p of a.mentions){if($(p.name,t))continue;let g=A(p.name),d=m.get(g)??{name:p.name,count:0,models:new Set};d.count++,d.models.add(a.model),m.set(g,d)}let l=[...m.values()].sort((a,p)=>p.count-a.count||a.name.localeCompare(p.name)).slice(0,5).map(a=>({name:a.name,pct:s.length?Math.min(100,k(a.count/s.length*100)):0,models:[...a.models]})),u=c===void 0?"no_data":c>=ee?"winning":c>0?"weak":"missing";return{label:o,status:u,you:c,byModel:i,namedInstead:l}})}function le(e,n){let t=e.filter(l=>l.status==="ok"||l.status==="refusal"),o=new Map,s=0;for(let l of t){let u=new Set;for(let a of l.mentions){let p=$(a.name,n),g=p?"\0you":A(a.name);if(!g||u.has(g))continue;u.add(g);let d=o.get(g)??{name:p?n[0]:a.name,you:p,hits:0,firsts:0,positions:[]};d.hits++,s++,a.position===1&&d.firsts++,a.position!==null&&d.positions.push(a.position),o.set(g,d)}}let i=(l,u)=>u?k(l/u*100):0,r=l=>({name:l.name,...l.you?{you:!0}:{},visibility:i(l.hits,t.length),shareOfVoice:i(l.hits,s),winRate:i(l.firsts,t.length),position:l.positions.length?k(l.positions.reduce((u,a)=>u+a,0)/l.positions.length):null}),c=[...o.values()].sort((l,u)=>u.hits-l.hits||l.name.localeCompare(u.name)).map(r),m=c.find(l=>l.you)??{name:n[0]??"",you:!0,visibility:0,shareOfVoice:0,winRate:0,position:null};return{answers:t.length,you:m,apps:c}}function pe(e){let n=new Map;for(let t of e)for(let o of t.searches??[]){let s=o.toLowerCase().replace(/\s+/g," ").trim();if(!s)continue;let i=n.get(s)??{query:o.trim(),count:0,models:new Set};i.count++,i.models.add(t.model),n.set(s,i)}return[...n.values()].sort((t,o)=>o.count-t.count||t.query.localeCompare(o.query)).map(t=>({query:t.query,count:t.count,models:[...t.models]}))}function me(e,n){let t=n.map(s=>s.toLowerCase().replace(/^www\./,"")),o=new Map;for(let s of e)for(let i of s.citations){let r;try{r=new URL(i.url).hostname.toLowerCase().replace(/^www\./,"")}catch{continue}r.endsWith("vertexaisearch.cloud.google.com")&&i.title&&/^[\w.-]+\.[a-z]{2,}$/i.test(i.title)&&(r=i.title.toLowerCase().replace(/^www\./,""));let c=o.get(r)??{domain:r,count:0,url:i.url};c.count++,t.some(m=>r===m||r.endsWith(`.${m}`))&&(c.yours=!0),o.set(r,c)}return[...o.values()].sort((s,i)=>i.count-s.count||s.domain.localeCompare(i.domain))}function te(e,n,t){return`You map a mobile app to the *user intents* it serves \u2014 the goals
|
|
44
44
|
real users would ask an AI assistant (like ChatGPT, Gemini, or
|
|
45
45
|
Perplexity) about. Each intent is a short user-meaningful goal,
|
|
46
46
|
NOT an app feature.
|
|
47
47
|
|
|
48
|
-
App: ${
|
|
49
|
-
Subtitle: ${
|
|
50
|
-
Description (first 700 chars): ${
|
|
51
|
-
Target keywords: ${
|
|
48
|
+
App: ${e.title}${e.subtitle?`
|
|
49
|
+
Subtitle: ${e.subtitle}`:""}${e.description?`
|
|
50
|
+
Description (first 700 chars): ${e.description.slice(0,700)}`:""}${e.keywords?.length?`
|
|
51
|
+
Target keywords: ${e.keywords.slice(0,20).join(", ")}`:""}
|
|
52
52
|
|
|
53
|
-
Country: ${
|
|
54
|
-
Language: ${
|
|
53
|
+
Country: ${e.country.toUpperCase()}
|
|
54
|
+
Language: ${e.language.toUpperCase()}${t.length?`
|
|
55
55
|
|
|
56
56
|
ALREADY DEFINED (do NOT propose duplicates or near-duplicates):
|
|
57
|
-
- ${
|
|
57
|
+
- ${t.slice(0,30).join(`
|
|
58
58
|
- `)}`:""}
|
|
59
59
|
|
|
60
60
|
Return JSON: {"intents": [{"label": string, "description": string}]}
|
|
@@ -69,7 +69,7 @@ Rules:
|
|
|
69
69
|
problem-driven goals, and at least one comparison/alternative angle when applicable.
|
|
70
70
|
- Write labels in the storefront's language.
|
|
71
71
|
- Description (1 sentence, max 200 chars): what kind of user has this
|
|
72
|
-
intent and what they want the assistant to recommend.`}function
|
|
72
|
+
intent and what they want the assistant to recommend.`}function ne(e,n,t){return`You write realistic prompts that everyday users would type into an
|
|
73
73
|
AI assistant (ChatGPT, Gemini, Perplexity) when looking for a mobile app.
|
|
74
74
|
|
|
75
75
|
Intent to cover:
|
|
@@ -77,20 +77,20 @@ Intent to cover:
|
|
|
77
77
|
${n.description}`:""}
|
|
78
78
|
|
|
79
79
|
App context (the app whose visibility we're measuring):
|
|
80
|
-
Title: ${
|
|
81
|
-
Subtitle: ${
|
|
82
|
-
Known competitor apps (use in comparison prompts where natural): ${
|
|
80
|
+
Title: ${e.title}${e.subtitle?`
|
|
81
|
+
Subtitle: ${e.subtitle}`:""}${e.competitors?.length?`
|
|
82
|
+
Known competitor apps (use in comparison prompts where natural): ${e.competitors.slice(0,6).join(", ")}`:""}
|
|
83
83
|
|
|
84
|
-
Country: ${
|
|
85
|
-
Language: ${
|
|
84
|
+
Country: ${e.country.toUpperCase()}
|
|
85
|
+
Language: ${e.language.toUpperCase()}
|
|
86
86
|
|
|
87
87
|
Return JSON: {"prompts": [string]}
|
|
88
88
|
|
|
89
89
|
Rules:
|
|
90
|
-
- Produce ${
|
|
90
|
+
- Produce ${t} prompts that cover the intent from different angles:
|
|
91
91
|
a pure category query, a problem-first one ("I struggle with\u2026"),
|
|
92
92
|
a scenario ("an app for my morning routine"), and where natural an
|
|
93
93
|
"alternative to X" comparison. Never name the app being measured.
|
|
94
94
|
- Write the way a casual user types, in the storefront's language:
|
|
95
95
|
conversational, lower-case is fine. Length 8\u201335 words.
|
|
96
|
-
- Do NOT mention that you're an AI or test prompts. No emojis.`}var U=
|
|
96
|
+
- Do NOT mention that you're an AI or test prompts. No emojis.`}var U=e=>e.toLowerCase().replace(/[^\p{L}\p{N}\s]/gu," ").split(/\s+/).filter(Boolean).sort().join(" ");async function de(e,n,t={},o=fetch){let s=t.maxIntents??6,i=await P(e,te(n,s,t.exclude??[]),.7,o),r=i.costUsd,c=new Set((t.exclude??[]).map(U)),m=[];for(let u of Array.isArray(i.json?.intents)?i.json.intents:[]){if(typeof u?.label!="string"||u.label.trim().length<4)continue;let a=U(u.label);if(!c.has(a)&&(c.add(a),m.push({label:u.label.trim(),description:typeof u.description=="string"?u.description.trim():void 0}),m.length>=s))break}let l=[];for(let u of m){let a=await P(e,ne(n,u,t.promptsPerIntent??4),.8,o);r+=a.costUsd;let p=A(n.title.split(/[:\-–—|]/)[0]??n.title),g=[...new Set((Array.isArray(a.json?.prompts)?a.json.prompts:[]).filter(d=>typeof d=="string"&&d.trim().length>=15).map(d=>d.trim()))].filter(d=>p.length<4||!A(d).includes(p)).slice(0,t.promptsPerIntent??4);g.length&&l.push({...u,prompts:g})}return{intents:l,costUsd:r}}export{j as MODELS,R as PROVIDERS,ee as WINNING_PCT,ae as ask,re as availableModels,me as citedDomains,ce as extract,de as generateIntents,D as helperFor,P as helperJson,$ as isOwner,L as keyFor,le as overall,ie as quoteScan,ue as score,pe as searchQueries};
|
|
@@ -19,6 +19,7 @@ interface Answer {
|
|
|
19
19
|
status: "ok" | "refusal" | "error";
|
|
20
20
|
text: string;
|
|
21
21
|
citations: Citation[];
|
|
22
|
+
searches?: string[];
|
|
22
23
|
costUsd: number;
|
|
23
24
|
error?: string;
|
|
24
25
|
}
|
|
@@ -40,6 +41,15 @@ interface ScoredAnswer {
|
|
|
40
41
|
status: Answer["status"];
|
|
41
42
|
mentions: Mention[];
|
|
42
43
|
citations: Citation[];
|
|
44
|
+
searches?: string[];
|
|
45
|
+
}
|
|
46
|
+
interface AppShare {
|
|
47
|
+
name: string;
|
|
48
|
+
you?: true;
|
|
49
|
+
visibility: number;
|
|
50
|
+
shareOfVoice: number;
|
|
51
|
+
winRate: number;
|
|
52
|
+
position: number | null;
|
|
43
53
|
}
|
|
44
54
|
interface IntentScore {
|
|
45
55
|
label: string;
|
|
@@ -94,6 +104,16 @@ export interface VisibilityCore {
|
|
|
94
104
|
}>;
|
|
95
105
|
isOwner(name: string, titles: string[]): boolean;
|
|
96
106
|
score(answers: ScoredAnswer[], intents: string[], owner: string[]): IntentScore[];
|
|
107
|
+
overall(answers: ScoredAnswer[], owner: string[]): {
|
|
108
|
+
answers: number;
|
|
109
|
+
you: AppShare;
|
|
110
|
+
apps: AppShare[];
|
|
111
|
+
};
|
|
112
|
+
searchQueries(answers: ScoredAnswer[]): Array<{
|
|
113
|
+
query: string;
|
|
114
|
+
count: number;
|
|
115
|
+
models: Model[];
|
|
116
|
+
}>;
|
|
97
117
|
citedDomains(answers: ScoredAnswer[], ownDomains: string[]): Array<{
|
|
98
118
|
domain: string;
|
|
99
119
|
count: number;
|
package/dist/visibility-local.js
CHANGED
|
@@ -3,7 +3,7 @@ import { appendFile, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import YAML from "yaml";
|
|
5
5
|
import { indexedLocales, playLanguageFor } from "./storefronts.js";
|
|
6
|
-
import { languageFor, readVisibility, recordChanges, visibilityChanges, visibilityDir, visibilityPath, visibilityTarget } from "./visibility.js";
|
|
6
|
+
import { MAX_APPS, MAX_SEARCHES, MAX_SOURCES, languageFor, readVisibility, recordChanges, visibilityChanges, visibilityDir, visibilityPath, visibilityTarget } from "./visibility.js";
|
|
7
7
|
export const VISIBILITY_CORE_FILE = "./visibility-core.js";
|
|
8
8
|
export async function loadVisibilityCore(load = (s) => import(s)) {
|
|
9
9
|
try {
|
|
@@ -112,7 +112,7 @@ export async function scanLocal(core, project, plan, env, options = {}) {
|
|
|
112
112
|
}
|
|
113
113
|
if (status === "error")
|
|
114
114
|
failed.push({ model: job.model, error: answer.error ?? "no answer" });
|
|
115
|
-
const row = { ...job, status, mentions, citations: answer.citations };
|
|
115
|
+
const row = { ...job, status, mentions, citations: answer.citations, ...(answer.searches?.length ? { searches: answer.searches } : {}) };
|
|
116
116
|
scored.push(row);
|
|
117
117
|
raw.push({ ...row, text: answer.text, ...(answer.error ? { error: answer.error } : {}) });
|
|
118
118
|
done++;
|
|
@@ -122,6 +122,8 @@ export async function scanLocal(core, project, plan, env, options = {}) {
|
|
|
122
122
|
const labels = plan.intents.map((i) => i.label);
|
|
123
123
|
const scores = core.score(scored, labels, owner);
|
|
124
124
|
const sources = core.citedDomains(scored, ownDomains(project));
|
|
125
|
+
const all = core.overall(scored, owner);
|
|
126
|
+
const searches = core.searchQueries(scored);
|
|
125
127
|
const summary = { winning: 0, weak: 0, missing: 0, noData: 0 };
|
|
126
128
|
for (const s of scores) {
|
|
127
129
|
if (s.status === "no_data")
|
|
@@ -138,6 +140,25 @@ export async function scanLocal(core, project, plan, env, options = {}) {
|
|
|
138
140
|
store: target?.store ?? "app-store",
|
|
139
141
|
appId: target?.appId ?? project.spec.app.name,
|
|
140
142
|
summary,
|
|
143
|
+
...(all.answers
|
|
144
|
+
? {
|
|
145
|
+
overall: {
|
|
146
|
+
answers: all.answers,
|
|
147
|
+
visibility: Math.round(all.you.visibility),
|
|
148
|
+
shareOfVoice: Math.round(all.you.shareOfVoice),
|
|
149
|
+
winRate: Math.round(all.you.winRate),
|
|
150
|
+
...(all.you.position !== null ? { position: all.you.position } : {}),
|
|
151
|
+
...(all.apps.some((a) => a.you) ? { rank: all.apps.findIndex((a) => a.you) + 1 } : {}),
|
|
152
|
+
},
|
|
153
|
+
apps: all.apps.slice(0, MAX_APPS).map((a) => ({
|
|
154
|
+
name: a.name,
|
|
155
|
+
...(a.you ? { you: true } : {}),
|
|
156
|
+
visibility: Math.round(a.visibility),
|
|
157
|
+
shareOfVoice: Math.round(a.shareOfVoice),
|
|
158
|
+
...(a.position !== null ? { position: a.position } : {}),
|
|
159
|
+
})),
|
|
160
|
+
}
|
|
161
|
+
: {}),
|
|
141
162
|
intents: [...scores]
|
|
142
163
|
.sort((a, b) => order[a.status] - order[b.status] || (a.you ?? 0) - (b.you ?? 0))
|
|
143
164
|
.map((s) => {
|
|
@@ -150,7 +171,8 @@ export async function scanLocal(core, project, plan, env, options = {}) {
|
|
|
150
171
|
...(s.namedInstead.length ? { namedInstead: s.namedInstead.map((w) => `${w.name} (${Math.round(w.pct)}%)`) } : {}),
|
|
151
172
|
};
|
|
152
173
|
}),
|
|
153
|
-
sources: sources.slice(0,
|
|
174
|
+
sources: sources.slice(0, MAX_SOURCES).map((s) => ({ domain: s.domain, count: s.count, ...(s.yours ? { yours: true } : {}), url: s.url })),
|
|
175
|
+
...(searches.length ? { searches: searches.slice(0, MAX_SEARCHES).map((q) => ({ query: q.query, count: q.count })) } : {}),
|
|
154
176
|
fixes: [],
|
|
155
177
|
};
|
|
156
178
|
await mkdir(join(visibilityDir(project.root), "answers"), { recursive: true });
|
package/dist/visibility.d.ts
CHANGED
|
@@ -69,6 +69,32 @@ export interface VisibilityFile {
|
|
|
69
69
|
missing: number;
|
|
70
70
|
noData: number;
|
|
71
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* Across every answer of the last 30 days (of this scan with --local), 0–100: `visibility` is the share
|
|
74
|
+
* of answers that name the app, `shareOfVoice` its share of every app the answers name, `winRate` the
|
|
75
|
+
* share that put it first. `position` is its mean rank, `rank` its place among the apps named.
|
|
76
|
+
*/
|
|
77
|
+
overall?: {
|
|
78
|
+
answers: number;
|
|
79
|
+
visibility: number;
|
|
80
|
+
shareOfVoice: number;
|
|
81
|
+
winRate: number;
|
|
82
|
+
position?: number;
|
|
83
|
+
rank?: number;
|
|
84
|
+
previous?: {
|
|
85
|
+
visibility: number;
|
|
86
|
+
shareOfVoice: number;
|
|
87
|
+
winRate: number;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
/** The apps the assistants name most across every intent, the app itself included (`you: true`). */
|
|
91
|
+
apps?: Array<{
|
|
92
|
+
name: string;
|
|
93
|
+
you?: true;
|
|
94
|
+
visibility: number;
|
|
95
|
+
shareOfVoice: number;
|
|
96
|
+
position?: number;
|
|
97
|
+
}>;
|
|
72
98
|
intents: Array<{
|
|
73
99
|
label: string;
|
|
74
100
|
status: Opportunity["status"];
|
|
@@ -78,12 +104,23 @@ export interface VisibilityFile {
|
|
|
78
104
|
/** Who the assistants name instead. */
|
|
79
105
|
namedInstead?: string[];
|
|
80
106
|
}>;
|
|
81
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* Pages the assistants cite, most cited first. From Appeeky: `type` is the kind of site, `names` the apps
|
|
109
|
+
* the answers citing it name, and `gap: true` a site they cite for other apps and never for this one.
|
|
110
|
+
*/
|
|
82
111
|
sources: Array<{
|
|
83
112
|
domain: string;
|
|
84
113
|
count: number;
|
|
85
114
|
yours?: true;
|
|
86
115
|
url: string;
|
|
116
|
+
type?: string;
|
|
117
|
+
gap?: true;
|
|
118
|
+
names?: string[];
|
|
119
|
+
}>;
|
|
120
|
+
/** What the assistants searched the web for before answering, most repeated first. */
|
|
121
|
+
searches?: Array<{
|
|
122
|
+
query: string;
|
|
123
|
+
count: number;
|
|
87
124
|
}>;
|
|
88
125
|
/** What Appeeky suggests changing, still open. */
|
|
89
126
|
fixes: Array<{
|
|
@@ -93,7 +130,12 @@ export interface VisibilityFile {
|
|
|
93
130
|
page?: string;
|
|
94
131
|
}>;
|
|
95
132
|
}
|
|
133
|
+
export declare const MAX_APPS = 8;
|
|
134
|
+
export declare const MAX_SOURCES = 15;
|
|
135
|
+
export declare const MAX_SEARCHES = 15;
|
|
96
136
|
export declare function fetchVisibility(api: AppeekyApi, target: VisibilityTarget, country: string, now?: Date): Promise<VisibilityFile>;
|
|
137
|
+
/** One line for the terminal: "named in 31% of 120 answers · 12% share of voice · first in 8%". */
|
|
138
|
+
export declare function overallLine(o: NonNullable<VisibilityFile["overall"]>): string;
|
|
97
139
|
export declare const visibilityPath: (root: string, country: string) => string;
|
|
98
140
|
export declare function readVisibility(root: string, country: string): Promise<VisibilityFile | null>;
|
|
99
141
|
/** What moved since the last pull: an intent the assistants started or stopped naming the app for. */
|
package/dist/visibility.js
CHANGED
|
@@ -40,16 +40,59 @@ export async function remotePrompts(api, appId, country, intentId) {
|
|
|
40
40
|
return (detail?.prompts ?? []).filter((p) => p.status !== "archived");
|
|
41
41
|
}
|
|
42
42
|
const pct = (n) => (n === null || n === undefined ? undefined : Math.round(n));
|
|
43
|
+
const round1 = (n) => (n === null || n === undefined ? undefined : Math.round(n * 10) / 10);
|
|
44
|
+
export const MAX_APPS = 8;
|
|
45
|
+
export const MAX_SOURCES = 15;
|
|
46
|
+
export const MAX_SEARCHES = 15;
|
|
43
47
|
export async function fetchVisibility(api, target, country, now = new Date()) {
|
|
44
48
|
const opp = await api.get(path(target.appId, "/opportunities"), { country, days: "30" });
|
|
45
49
|
const fixes = await api.get(path(target.appId, "/fixes"), { country }).catch(() => null);
|
|
50
|
+
const window = { country, days: "30" };
|
|
51
|
+
const [analytics, cited, searched] = await Promise.all([
|
|
52
|
+
api.get(path(target.appId, "/analytics"), window).catch(() => null),
|
|
53
|
+
api.get(path(target.appId, "/sources"), window).catch(() => null),
|
|
54
|
+
api.get(path(target.appId, "/searches"), window).catch(() => null),
|
|
55
|
+
]);
|
|
56
|
+
const overall = analytics?.totals?.answers
|
|
57
|
+
? strip({
|
|
58
|
+
answers: analytics.totals.answers,
|
|
59
|
+
visibility: pct(analytics.owner.visibilityPct),
|
|
60
|
+
shareOfVoice: pct(analytics.owner.sovPct),
|
|
61
|
+
winRate: pct(analytics.owner.winRatePct),
|
|
62
|
+
position: round1(analytics.owner.positionAvg),
|
|
63
|
+
rank: analytics.owner.rank ?? undefined,
|
|
64
|
+
previous: analytics.owner.previous
|
|
65
|
+
? { visibility: pct(analytics.owner.previous.visibilityPct), shareOfVoice: pct(analytics.owner.previous.sovPct), winRate: pct(analytics.owner.previous.winRatePct) }
|
|
66
|
+
: undefined,
|
|
67
|
+
})
|
|
68
|
+
: undefined;
|
|
69
|
+
const apps = overall
|
|
70
|
+
? (analytics.brands ?? []).slice(0, MAX_APPS).map((b) => strip({ name: b.name, you: b.isOwnerApp ? true : undefined, visibility: pct(b.visibilityPct), shareOfVoice: pct(b.sovPct), position: round1(b.positionAvg) }))
|
|
71
|
+
: undefined;
|
|
72
|
+
const domains = cited?.domains?.length
|
|
73
|
+
? [...cited.domains]
|
|
74
|
+
.sort((a, b) => b.citations - a.citations)
|
|
75
|
+
.slice(0, MAX_SOURCES)
|
|
76
|
+
.map((d) => strip({
|
|
77
|
+
domain: d.domain,
|
|
78
|
+
count: d.citations,
|
|
79
|
+
yours: d.type === "owner" ? true : undefined,
|
|
80
|
+
url: d.topUrls?.[0]?.url ?? `https://${d.domain}`,
|
|
81
|
+
type: d.type,
|
|
82
|
+
gap: d.isGap ? true : undefined,
|
|
83
|
+
names: d.apps?.length ? d.apps.slice(0, 5) : undefined,
|
|
84
|
+
}))
|
|
85
|
+
: undefined;
|
|
86
|
+
const searches = searched?.queries?.length ? searched.queries.slice(0, MAX_SEARCHES).map((q) => ({ query: q.query, count: q.occurrences })) : undefined;
|
|
46
87
|
const labels = new Map((opp?.intents ?? []).map((i) => [i.intentId, i.label]));
|
|
47
|
-
return {
|
|
88
|
+
return strip({
|
|
48
89
|
pulledAt: now.toISOString().slice(0, 10),
|
|
49
90
|
country,
|
|
50
91
|
store: target.store,
|
|
51
92
|
appId: target.appId,
|
|
52
93
|
summary: opp?.summary ?? { winning: 0, weak: 0, missing: 0, noData: 0 },
|
|
94
|
+
overall,
|
|
95
|
+
apps,
|
|
53
96
|
intents: (opp?.intents ?? []).map((i) => {
|
|
54
97
|
const byModel = Object.fromEntries(Object.entries(i.byModel).map(([m, s]) => [m, pct(s?.visibilityPct)]));
|
|
55
98
|
return strip({
|
|
@@ -60,11 +103,17 @@ export async function fetchVisibility(api, target, country, now = new Date()) {
|
|
|
60
103
|
namedInstead: i.winners.length ? i.winners.slice(0, 5).map((w) => `${w.name} (${Math.round(w.sharePct)}%)`) : undefined,
|
|
61
104
|
});
|
|
62
105
|
}),
|
|
63
|
-
sources: (opp?.sources.sources ?? []).slice(0,
|
|
106
|
+
sources: domains ?? (opp?.sources.sources ?? []).slice(0, MAX_SOURCES).map((s) => strip({ domain: s.domain, count: s.count, yours: s.citesOwner ? true : undefined, url: s.url })),
|
|
107
|
+
searches,
|
|
64
108
|
fixes: (fixes?.fixes ?? [])
|
|
65
109
|
.filter((f) => f.status === "open")
|
|
66
110
|
.map((f) => strip({ intent: labels.get(f.intentId) ?? f.intentId, title: f.title, why: f.rationale, page: f.targetUrl ?? undefined })),
|
|
67
|
-
};
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/** One line for the terminal: "named in 31% of 120 answers · 12% share of voice · first in 8%". */
|
|
114
|
+
export function overallLine(o) {
|
|
115
|
+
const was = o.previous ? ` (was ${o.previous.visibility}%)` : "";
|
|
116
|
+
return `named in ${o.visibility}% of ${o.answers} answers${was} · ${o.shareOfVoice}% share of voice · first in ${o.winRate}%${o.rank ? ` · #${o.rank} among the apps named` : ""}`;
|
|
68
117
|
}
|
|
69
118
|
const strip = (o) => Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined));
|
|
70
119
|
export const visibilityPath = (root, country) => join(visibilityDir(root), `${country}.yaml`);
|
|
@@ -89,6 +138,13 @@ export function visibilityChanges(prev, next) {
|
|
|
89
138
|
out.push("the assistants now cite your own site");
|
|
90
139
|
if (cited(prev) && !cited(next))
|
|
91
140
|
out.push("the assistants stopped citing your own site");
|
|
141
|
+
// A site only counts as a new gap when the last pull already knew about gaps.
|
|
142
|
+
if (prev.sources.some((s) => s.type)) {
|
|
143
|
+
const had = new Set(prev.sources.filter((s) => s.gap).map((s) => s.domain));
|
|
144
|
+
const gaps = next.sources.filter((s) => s.gap && !had.has(s.domain)).map((s) => s.domain);
|
|
145
|
+
if (gaps.length)
|
|
146
|
+
out.push(`cited for other apps and not for yours: ${gaps.slice(0, 5).join(", ")}`);
|
|
147
|
+
}
|
|
92
148
|
return out;
|
|
93
149
|
}
|
|
94
150
|
export async function recordChanges(root, date, country, changes) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appeeky/spec",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Your app's store listing as a spec: lint it, check keyword coverage, diff it against the live store and push it to App Store Connect and Google Play.",
|
|
5
5
|
"license": "FSL-1.1-MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -46,13 +46,20 @@ Good prompts:
|
|
|
46
46
|
| Field | Meaning |
|
|
47
47
|
| --- | --- |
|
|
48
48
|
| `summary` | intents by status: `winning` (named in 25%+ of answers), `weak`, `missing`, `noData` (not scanned yet) |
|
|
49
|
+
| `overall` | across every answer of the last 30 days (of the scan with `--local`), 0–100: `visibility` is the share of answers that name the app, `shareOfVoice` its share of every app the answers name, `winRate` the share that put it first; `position` is its mean rank where the answer gave an order, `rank` its place among the apps named, `previous` the 30 days before |
|
|
50
|
+
| `apps` | the apps the assistants name most across every intent, with the same numbers; `you: true` is this app |
|
|
49
51
|
| `intents[].you` | share of answers that name the app, averaged over the assistants, 0–100 |
|
|
50
52
|
| `intents[].byModel` | the same per assistant: one assistant can name you while another never does |
|
|
51
53
|
| `intents[].namedInstead` | who the assistants name instead, with their share |
|
|
52
|
-
| `sources` |
|
|
54
|
+
| `sources` | sites the assistants cite, most cited first; `yours: true` is the app's own site. From Appeeky also `type` (`owner`, `app_store`, `ugc`, `review`, `editorial`, `reference`, `other`), `names` (the apps named in the answers that cite it) and `gap: true`: cited for other apps and never for this one |
|
|
55
|
+
| `searches` | what the assistants searched the web for before answering, most repeated first (ChatGPT, Claude and Gemini report it) |
|
|
53
56
|
| `fixes` | open suggestions from Appeeky for an intent |
|
|
54
57
|
|
|
55
|
-
`
|
|
58
|
+
`overall`, `apps` and `searches` are missing when there is nothing to report yet; `type`, `names` and `gap` come only from Appeeky.
|
|
59
|
+
|
|
60
|
+
High `visibility` with a low `shareOfVoice` means the app is named, in long lists next to many others. A low `winRate` with a good `visibility` means it is named and rarely first.
|
|
61
|
+
|
|
62
|
+
`appeeky/visibility/changes.md` keeps what moved between pulls: an intent that went from `missing` to `winning`, the app's site starting to be cited, or a new site cited for other apps only.
|
|
56
63
|
|
|
57
64
|
### Improve it
|
|
58
65
|
|
|
@@ -60,8 +67,9 @@ Assistants repeat what the web says about an app. In order of what you can chang
|
|
|
60
67
|
|
|
61
68
|
1. **The listing.** The first lines of the description and the subtitle should say what the app does in the intent's words ("rain sounds for sleep", not "an immersive audio experience"). This is a normal listing change: propose it in a pull request and measure it like any release (see appeeky-spec).
|
|
62
69
|
2. **The app's own website.** A page per main use case, in plain words, with the app's name and store links. When `sources` shows the assistants cite pages like it from competitors, the same kind of page is the gap.
|
|
63
|
-
3. **Cited third-party pages.** `sources` lists them: review sites, Reddit threads, "best apps for…" articles.
|
|
64
|
-
4. **`
|
|
70
|
+
3. **Cited third-party pages.** `sources` lists them: review sites, Reddit threads, "best apps for…" articles. Start with `gap: true`: the assistants cite those for the apps in `names` and never for this one. Without `gap` (a local scan), tell the user which ones name the competitors in `namedInstead` but not the app. Getting listed there is the user's outreach, not something to fake.
|
|
71
|
+
4. **`searches`.** These are the words the assistants type into a search engine for the user's question. A page that ranks for them is a page they can cite. Use them as wording for the website's pages and the description, and as candidates for `web.keywords`.
|
|
72
|
+
5. **`fixes`.** Read each one. Propose the ones that are listing or website edits; summarize the rest for the user.
|
|
65
73
|
|
|
66
74
|
Never write fake reviews, posts or comments, and never make claims the app does not live up to. Assistants also read those.
|
|
67
75
|
|