@appeeky/spec 0.8.0 → 0.9.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 +3 -2
- package/dist/appeeky-api.js +2 -1
- package/dist/category.d.ts +3 -1
- package/dist/category.js +16 -4
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +115 -34
- package/dist/data.d.ts +3 -1
- package/dist/data.js +3 -1
- package/dist/lint.d.ts +1 -0
- package/dist/lint.js +27 -6
- package/dist/schema.d.ts +19 -0
- package/dist/schema.js +10 -0
- package/dist/search-ads.js +2 -2
- package/dist/setup.d.ts +7 -0
- package/dist/setup.js +57 -10
- package/dist/social.d.ts +11 -5
- package/dist/social.js +23 -3
- package/dist/transport.d.ts +23 -3
- package/dist/transport.js +39 -7
- package/package.json +1 -1
- package/skills/appeeky-spec/SKILL.md +3 -2
- package/skills/appeeky-spec-server/SKILL.md +15 -7
- package/skills/appeeky-spec-server/files/env.example +6 -0
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ npx @appeeky/spec verify # day 7 and day 14: did it work?
|
|
|
30
30
|
|
|
31
31
|
`pnpm dlx`, `yarn dlx` and `bunx` work the same way. Node 20 or later.
|
|
32
32
|
|
|
33
|
-
`init` with no options asks for the app's name, finds it on the App Store, checks the Google Play package, pulls every store it can reach, suggests five targets from what the app already ranks for, offers the GitHub workflows (`--ci`) and the agent skills, and ends on the first coverage table. With options (`--name`, `--app-store`, `--google-play`, `--pull`) it does the same without questions, for scripts. It also adds `.appeeky/` to `.gitignore`.
|
|
33
|
+
`init` with no options asks for the app's name, finds it on the App Store, checks the Google Play package, pulls every store it can reach, suggests five targets from what the app already ranks for, offers the GitHub workflows (`--ci`) and the agent skills, and ends on the first coverage table. With options (`--name`, `--app-store`, `--google-play`, `--pull`) it does the same without questions, for scripts: it writes the five suggested targets (or the ones in `--targets "a,b,c"`; `--no-targets` leaves them empty) and the Google Play category, and a store it cannot reach does not stop the other. It also adds `.appeeky/` to `.gitignore`.
|
|
34
34
|
|
|
35
35
|
## What it does
|
|
36
36
|
|
|
@@ -119,7 +119,8 @@ A field you leave out of a listing file is not managed by the spec: it is never
|
|
|
119
119
|
|
|
120
120
|
| Command | What it does |
|
|
121
121
|
| --- | --- |
|
|
122
|
-
| `init` | Create `appeeky.spec.yaml` and `appeeky/`. `--pull` fetches the live listings right away. |
|
|
122
|
+
| `init` | Create `appeeky.spec.yaml` and `appeeky/`. `--pull` fetches the live listings right away, `--targets` sets the first targets. |
|
|
123
|
+
| `doctor` | What is set up and what is missing, with the fix for each. It calls the hosted gateways once to check that the key reaches the stores (`--offline` skips that). |
|
|
123
124
|
| `pull` | Write the live listings into `appeeky/store/` (overwrites local files). |
|
|
124
125
|
| `check` | Store limits, ASO rules and screenshot sizes. Exits 1 on errors (`--strict`: on warnings too). |
|
|
125
126
|
| `coverage` | Which target keywords each storefront indexes, plus tips for storefronts that read a second locale (the US also reads Spanish (Mexico)). |
|
package/dist/appeeky-api.js
CHANGED
|
@@ -2,6 +2,7 @@ import { existsSync } from "node:fs";
|
|
|
2
2
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { combineSources, summarizeMeta, summarizeMetrics, summarizeTikTok, } from "./metrics.js";
|
|
5
|
+
import { explainAppeekyError } from "./transport.js";
|
|
5
6
|
import { normalize } from "./text.js";
|
|
6
7
|
export const APPEEKY_API_URL = "https://api.appeeky.com/v1";
|
|
7
8
|
/** An error answer from the Appeeky API, with its HTTP status and error code, so callers can tell "not there" from "failed". */
|
|
@@ -9,7 +10,7 @@ export class AppeekyApiError extends Error {
|
|
|
9
10
|
status;
|
|
10
11
|
code;
|
|
11
12
|
constructor(message, status, code) {
|
|
12
|
-
super(message);
|
|
13
|
+
super(explainAppeekyError(message, status));
|
|
13
14
|
this.status = status;
|
|
14
15
|
this.code = code;
|
|
15
16
|
this.name = "AppeekyApiError";
|
package/dist/category.d.ts
CHANGED
|
@@ -49,7 +49,9 @@ export interface CategoryPlan {
|
|
|
49
49
|
/** Category name for people, e.g. "Health & Fitness". */
|
|
50
50
|
name?: string;
|
|
51
51
|
}
|
|
52
|
-
/**
|
|
52
|
+
/** The Google Play category id (e.g. VIDEO_PLAYERS) from the app's public Play page, as the App Store genre comes from Apple's lookup. */
|
|
53
|
+
export declare function playCategory(packageName: string, fetcher?: typeof fetch): Promise<string | undefined>;
|
|
54
|
+
/** Which charts to read: the configured category, or the app's own category on each store. */
|
|
53
55
|
export declare function categoryPlans(project: Project, fetcher?: typeof fetch): Promise<{
|
|
54
56
|
plans: CategoryPlan[];
|
|
55
57
|
notes: string[];
|
package/dist/category.js
CHANGED
|
@@ -80,7 +80,15 @@ export async function appleAppInfo(appId, country, fetcher = fetch) {
|
|
|
80
80
|
return null;
|
|
81
81
|
return { genreId: String(app.primaryGenreId), genre: app.primaryGenreName ?? String(app.primaryGenreId), paid: (app.price ?? 0) > 0 };
|
|
82
82
|
}
|
|
83
|
-
/**
|
|
83
|
+
/** The Google Play category id (e.g. VIDEO_PLAYERS) from the app's public Play page, as the App Store genre comes from Apple's lookup. */
|
|
84
|
+
export async function playCategory(packageName, fetcher = fetch) {
|
|
85
|
+
const res = await fetcher(`https://play.google.com/store/apps/details?id=${encodeURIComponent(packageName)}&hl=en`, { headers: { "User-Agent": "Mozilla/5.0 appeeky-spec" } });
|
|
86
|
+
if (!res.ok)
|
|
87
|
+
return undefined;
|
|
88
|
+
const html = await res.text();
|
|
89
|
+
return /"applicationCategory"\s*:\s*"([A-Z_]+)"/.exec(html)?.[1];
|
|
90
|
+
}
|
|
91
|
+
/** Which charts to read: the configured category, or the app's own category on each store. */
|
|
84
92
|
export async function categoryPlans(project, fetcher = fetch) {
|
|
85
93
|
const cfg = project.spec.category ?? {};
|
|
86
94
|
const ids = rankAppIds(project);
|
|
@@ -103,10 +111,14 @@ export async function categoryPlans(project, fetcher = fetch) {
|
|
|
103
111
|
notes.push("App Store: category charts need the numeric appId in stores.appStore.");
|
|
104
112
|
}
|
|
105
113
|
if (ids["google-play"]) {
|
|
106
|
-
|
|
107
|
-
|
|
114
|
+
const detected = cfg.googlePlay ? undefined : await playCategory(ids["google-play"], fetcher).catch(() => undefined);
|
|
115
|
+
const category = cfg.googlePlay ?? detected;
|
|
116
|
+
if (category)
|
|
117
|
+
plans.push({ store: "google-play", appId: ids["google-play"], category, chart: cfg.chart ?? "top-free", countries, name: category.toLowerCase().replace(/_/g, " ") });
|
|
108
118
|
else
|
|
109
|
-
notes.push("Google Play:
|
|
119
|
+
notes.push("Google Play: could not read the app's category. Set category.googlePlay in appeeky.spec.yaml (e.g. HEALTH_AND_FITNESS) to record its chart.");
|
|
120
|
+
if (detected)
|
|
121
|
+
notes.push(`Google Play: category ${detected}, read from the Play page. Set category.googlePlay: ${detected} in appeeky.spec.yaml to pin it.`);
|
|
110
122
|
}
|
|
111
123
|
return { plans, notes };
|
|
112
124
|
}
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
+
/** This package's version, from package.json next to src/ and dist/ (never typed by hand). */
|
|
3
|
+
export declare const VERSION: string;
|
|
2
4
|
export declare function buildProgram(): Command;
|
|
3
5
|
export declare function run(argv?: string[]): Promise<void>;
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
4
4
|
import { dirname, join, resolve } from "node:path";
|
|
5
5
|
import { createInterface } from "node:readline/promises";
|
|
@@ -13,7 +13,7 @@ import { pullCompetitors, similarApps } from "./competitors.js";
|
|
|
13
13
|
import { commentPlatform, deleteComment, draftIssues, fetchSocial, hideComment, likeComment, listComments, readAccounts, readDrafts, replyToComment, resolveAccounts, saveSocial, sendDraft } from "./social.js";
|
|
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
|
-
import { categoryFile, categoryMetricSource, categoryPlans, chartSources, previousRank, readCategoryHistory, readCategoryRanks, saveCategoryRanks } from "./category.js";
|
|
16
|
+
import { categoryFile, categoryMetricSource, categoryPlans, playCategory, chartSources, previousRank, readCategoryHistory, readCategoryRanks, saveCategoryRanks } from "./category.js";
|
|
17
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";
|
|
@@ -36,7 +36,7 @@ import { invertChanges } from "./diff.js";
|
|
|
36
36
|
import { loadProject, recordPull, SPEC_DIR, SPEC_FILE, writeListing, writeSpec } from "./files.js";
|
|
37
37
|
import { readReleases, releaseId, releaseMarkdown, writeRelease } from "./history.js";
|
|
38
38
|
import { freeStores, writeLoops } from "./loops.js";
|
|
39
|
-
import { diagnose, findApps, playPackageExists, suggestTargets, targetCandidates, WORKFLOWS } from "./setup.js";
|
|
39
|
+
import { diagnose, findApps, probeConnections, playPackageExists, suggestTargets, targetCandidates, WORKFLOWS } from "./setup.js";
|
|
40
40
|
import { hasErrors, lintProject } from "./lint.js";
|
|
41
41
|
import { c, formatChanges, formatCoverage, formatIssues, printJson, storeLabel } from "./output.js";
|
|
42
42
|
import { CODING_AGENTS, onPath, runQuiet, setupPrompt } from "./coding-agents.js";
|
|
@@ -48,7 +48,7 @@ function experimentPlaybookLine(e) {
|
|
|
48
48
|
const value = e.result?.value !== undefined ? ` (${e.metric} ${round(e.baseline)} → ${round(e.result.value)})` : "";
|
|
49
49
|
return `- ${e.startedAt.slice(0, 10)}, ${e.type}${e.persona ? `, ${e.persona}` : ""}: ${e.hypothesis} → ${e.status}${value}${e.result?.note ? `. ${e.result.note}` : ""}`;
|
|
50
50
|
}
|
|
51
|
-
import { STORE_CLIS } from "./transport.js";
|
|
51
|
+
import { npxPackage, STORE_CLIS } from "./transport.js";
|
|
52
52
|
const PLAYBOOK = `# Playbook
|
|
53
53
|
|
|
54
54
|
What worked and what did not for this app. Appeeky Spec and your agent read this
|
|
@@ -127,11 +127,22 @@ async function confirm(question) {
|
|
|
127
127
|
function storeOption() {
|
|
128
128
|
return new Option("-s, --store <store>", "Only this store").choices([...STORES]);
|
|
129
129
|
}
|
|
130
|
+
/** This package's version, from package.json next to src/ and dist/ (never typed by hand). */
|
|
131
|
+
export const VERSION = (() => {
|
|
132
|
+
try {
|
|
133
|
+
return JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
return "unknown";
|
|
137
|
+
}
|
|
138
|
+
})();
|
|
139
|
+
/** Errors the CLI throws on purpose carry a message meant for the user; anything else is a bug worth reporting. */
|
|
140
|
+
const EXPECTED_ERRORS = new Set(["Error", "SpecError", "TransportError", "AppeekyApiError", "CommanderError"]);
|
|
130
141
|
export function buildProgram() {
|
|
131
142
|
const program = new Command()
|
|
132
143
|
.name("appeeky-spec")
|
|
133
144
|
.description("Your app's store listing as a spec: check it, measure keyword coverage, diff it with the live store and push it.")
|
|
134
|
-
.version(
|
|
145
|
+
.version(VERSION)
|
|
135
146
|
.option("-C, --cwd <dir>", "Run as if started in this folder", process.cwd())
|
|
136
147
|
.option("--json", "Machine-readable output", false)
|
|
137
148
|
.addOption(new Option("--via <mode>", "How to reach the stores (overrides the spec)").choices(["auto", "local", "hosted"]));
|
|
@@ -139,6 +150,34 @@ export function buildProgram() {
|
|
|
139
150
|
const transportOverrides = () => (g().via ? { via: g().via } : {});
|
|
140
151
|
const load = () => loadProject(g().cwd);
|
|
141
152
|
const api = () => (process.env.APPEEKY_API_KEY ? new AppeekyApi(process.env.APPEEKY_API_KEY, { baseUrl: process.env.APPEEKY_API_URL }) : undefined);
|
|
153
|
+
/** Pull each store on its own: one that cannot be reached does not stop the other. */
|
|
154
|
+
const pullListings = async (project, only, locales) => {
|
|
155
|
+
const written = [];
|
|
156
|
+
const errors = [];
|
|
157
|
+
const stores = configuredStores(project, only);
|
|
158
|
+
for (const store of stores) {
|
|
159
|
+
try {
|
|
160
|
+
const handle = storeHandle(project, store, transportOverrides());
|
|
161
|
+
if (!g().json)
|
|
162
|
+
console.log(c.dim(`${storeLabel(store)}: pulling via ${handle.transport.label}…`));
|
|
163
|
+
const state = await handle.adapter.pull();
|
|
164
|
+
for (const [locale, listing] of Object.entries(state.listings)) {
|
|
165
|
+
if (locales && !locales.includes(locale))
|
|
166
|
+
continue;
|
|
167
|
+
written.push({ store, locale, file: await writeListing(project.root, store, locale, listing) });
|
|
168
|
+
}
|
|
169
|
+
await recordPull(project.root, store, state.target);
|
|
170
|
+
if (!g().json)
|
|
171
|
+
console.log(`${storeLabel(store)}: ${Object.keys(state.listings).length} locales from ${state.target}`);
|
|
172
|
+
}
|
|
173
|
+
catch (e) {
|
|
174
|
+
errors.push({ store, message: e.message });
|
|
175
|
+
if (!g().json)
|
|
176
|
+
console.error(c.red(`${storeLabel(store)}: ${e.message}`));
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return { written, errors, stores };
|
|
180
|
+
};
|
|
142
181
|
/** Appeeky API ranks when a key is set (both stores), Apple's public search otherwise (App Store only). */
|
|
143
182
|
const rankSource = () => {
|
|
144
183
|
const a = api();
|
|
@@ -153,6 +192,8 @@ export function buildProgram() {
|
|
|
153
192
|
.option("--locale <locale>", "Primary locale", "en-US")
|
|
154
193
|
.option("--country <cc>", "First storefront to add targets for", "us")
|
|
155
194
|
.option("--pull", "Pull the live listings right away", false)
|
|
195
|
+
.option("--targets <searches>", "Comma-separated searches to win in --country (default: five suggested from the app's name and where it already ranks)")
|
|
196
|
+
.option("--no-targets", "Leave targets empty")
|
|
156
197
|
.option("--ci", "Write the GitHub workflows (pull request check, push on merge, daily verify); works on an existing spec too", false)
|
|
157
198
|
.action(async (opts) => {
|
|
158
199
|
const root = resolve(g().cwd);
|
|
@@ -192,10 +233,45 @@ export function buildProgram() {
|
|
|
192
233
|
if (!opts.appStore && !opts.googlePlay)
|
|
193
234
|
console.log(c.dim("Add stores.appStore.appId or stores.googlePlay.packageName, then run `appeeky-spec pull`."));
|
|
194
235
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
236
|
+
// Pull failures are reported and do not stop init: the spec is there, `pull` can run again later.
|
|
237
|
+
const pulled = opts.pull && (opts.appStore || opts.googlePlay) ? await pullListings(await load()) : undefined;
|
|
238
|
+
if (pulled?.errors.length)
|
|
239
|
+
process.exitCode = 1;
|
|
240
|
+
// The Google Play category, so `category pull` records its chart from the first day.
|
|
241
|
+
if (opts.googlePlay) {
|
|
242
|
+
const detected = await playCategory(opts.googlePlay).catch(() => undefined);
|
|
243
|
+
if (detected) {
|
|
244
|
+
// Into the spec as written above, so the file keeps only what init chose (no schema defaults).
|
|
245
|
+
spec.category = { ...spec.category, googlePlay: detected };
|
|
246
|
+
await writeSpec(root, spec);
|
|
247
|
+
if (!g().json)
|
|
248
|
+
console.log(`${c.green("Category")} Google Play ${detected}`);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
// Targets, as the guided setup does: the ones given, or five suggested from the listing (or the
|
|
252
|
+
// name) and where the app already ranks on the App Store. --no-targets leaves them empty.
|
|
253
|
+
const country = opts.country.toLowerCase();
|
|
254
|
+
let targets = [];
|
|
255
|
+
let suggested = false;
|
|
256
|
+
if (typeof opts.targets === "string")
|
|
257
|
+
targets = [...new Set(opts.targets.split(",").map((x) => x.trim().toLowerCase()).filter(Boolean))];
|
|
258
|
+
else if (opts.targets !== false && (opts.appStore || opts.googlePlay)) {
|
|
259
|
+
const project = await load();
|
|
260
|
+
const appStoreId = opts.appStore && /^\d+$/.test(opts.appStore) ? opts.appStore : undefined;
|
|
261
|
+
const ranked = await suggestTargets(targetCandidates(project, 14, opts.name), appStoreId, country, itunesRankSource()).catch(() => []);
|
|
262
|
+
targets = ranked.map((r) => r.keyword);
|
|
263
|
+
suggested = true;
|
|
264
|
+
}
|
|
265
|
+
if (targets.length) {
|
|
266
|
+
spec.targets = { ...spec.targets, [country]: targets };
|
|
267
|
+
await writeSpec(root, spec);
|
|
268
|
+
if (!g().json)
|
|
269
|
+
console.log(`${c.green(suggested ? "Suggested" : "Added")} ${targets.length} targets for ${country.toUpperCase()}: ${targets.join(", ")}${suggested ? c.dim("\n A first guess from the name and listing: check them, and re-rank with `appeeky-spec suggest` once APPEEKY_API_KEY is set.") : ""}`);
|
|
270
|
+
}
|
|
271
|
+
else if (!g().json && opts.targets !== false)
|
|
272
|
+
console.log(c.dim(`No targets yet: add the searches to win under targets.${country} in ${SPEC_FILE}, or run \`appeeky-spec suggest\`.`));
|
|
273
|
+
if (g().json)
|
|
274
|
+
printJson({ root, created: [SPEC_FILE, `${SPEC_DIR}/`, ...workflows], targets: { [country]: targets }, ...(pulled ? { pulled: { written: pulled.written, errors: pulled.errors } } : {}) });
|
|
199
275
|
});
|
|
200
276
|
/**
|
|
201
277
|
* The guided setup: find the app, make its folder and write the spec, check that the stores
|
|
@@ -413,7 +489,7 @@ export function buildProgram() {
|
|
|
413
489
|
}
|
|
414
490
|
const s = p.spinner();
|
|
415
491
|
s.start(`Saving the key with the ${cli.bin} CLI`);
|
|
416
|
-
const result = await runQuiet("npx", ["-y", "-p",
|
|
492
|
+
const result = await runQuiet("npx", ["-y", "-p", npxPackage(store), cli.bin, ...args], process.cwd());
|
|
417
493
|
if (result.code === 0) {
|
|
418
494
|
s.stop(`Saved as "${account}" in the ${cli.bin} CLI's config (not in this repo)`);
|
|
419
495
|
return true;
|
|
@@ -465,10 +541,13 @@ export function buildProgram() {
|
|
|
465
541
|
program
|
|
466
542
|
.command("doctor")
|
|
467
543
|
.description("What is set up for this repo, what is missing, and how to fix it")
|
|
468
|
-
.
|
|
544
|
+
.option("--offline", "Only look at what is set up; do not call the hosted gateways to check the connection", false)
|
|
545
|
+
.action(async (opts) => {
|
|
469
546
|
const root = resolve(g().cwd);
|
|
470
547
|
const project = await load().catch(() => null);
|
|
471
|
-
|
|
548
|
+
let checks = diagnose(project?.root ?? root, project);
|
|
549
|
+
if (project && !opts.offline)
|
|
550
|
+
checks = await probeConnections(project, checks);
|
|
472
551
|
if (g().json)
|
|
473
552
|
printJson({ checks });
|
|
474
553
|
else {
|
|
@@ -486,24 +565,13 @@ export function buildProgram() {
|
|
|
486
565
|
.addOption(storeOption())
|
|
487
566
|
.option("--locale <locales...>", "Only these locales")
|
|
488
567
|
.action(async (opts) => {
|
|
489
|
-
const
|
|
490
|
-
const written = [];
|
|
491
|
-
for (const store of configuredStores(project, opts.store)) {
|
|
492
|
-
const handle = storeHandle(project, store, transportOverrides());
|
|
493
|
-
if (!g().json)
|
|
494
|
-
console.log(c.dim(`${storeLabel(store)}: pulling via ${handle.transport.label}…`));
|
|
495
|
-
const state = await handle.adapter.pull();
|
|
496
|
-
for (const [locale, listing] of Object.entries(state.listings)) {
|
|
497
|
-
if (opts.locale && !opts.locale.includes(locale))
|
|
498
|
-
continue;
|
|
499
|
-
written.push({ store, locale, file: await writeListing(project.root, store, locale, listing) });
|
|
500
|
-
}
|
|
501
|
-
await recordPull(project.root, store, state.target);
|
|
502
|
-
if (!g().json)
|
|
503
|
-
console.log(`${storeLabel(store)}: ${Object.keys(state.listings).length} locales from ${state.target}`);
|
|
504
|
-
}
|
|
568
|
+
const { written, errors, stores } = await pullListings(await load(), opts.store, opts.locale);
|
|
505
569
|
if (g().json)
|
|
506
|
-
printJson({ written });
|
|
570
|
+
printJson({ written, errors });
|
|
571
|
+
else if (errors.length && errors.length < stores.length)
|
|
572
|
+
console.error(c.dim(`Pulled ${stores.length - errors.length} of ${stores.length} stores; fix the one above and run \`appeeky-spec pull --store ${errors[0].store}\`.`));
|
|
573
|
+
if (errors.length)
|
|
574
|
+
process.exitCode = 1;
|
|
507
575
|
});
|
|
508
576
|
program
|
|
509
577
|
.command("check")
|
|
@@ -956,7 +1024,10 @@ export function buildProgram() {
|
|
|
956
1024
|
const a = api();
|
|
957
1025
|
if (!a)
|
|
958
1026
|
throw new Error("Set APPEEKY_API_KEY: posts come from the social accounts connected in Appeeky.");
|
|
959
|
-
const
|
|
1027
|
+
const only = project.spec.social?.accounts;
|
|
1028
|
+
const data = await fetchSocial(a, { limit: Number(opts.limit) || 100, only });
|
|
1029
|
+
if (only?.length && !g().json)
|
|
1030
|
+
console.log(c.dim(`Only the accounts under social.accounts in ${SPEC_FILE}: ${only.join(", ")}`));
|
|
960
1031
|
await saveSocial(project.root, data);
|
|
961
1032
|
if (g().json) {
|
|
962
1033
|
printJson({ accounts: data.accounts.length, posts: data.posts.length, nativePosts: data.nativePosts?.length ?? null, comments: data.comments?.length ?? null, insights: data.insights?.length ?? null, warnings: data.warnings ?? [] });
|
|
@@ -2222,11 +2293,21 @@ export async function run(argv = process.argv) {
|
|
|
2222
2293
|
await program.parseAsync(argv);
|
|
2223
2294
|
}
|
|
2224
2295
|
catch (err) {
|
|
2225
|
-
const
|
|
2296
|
+
const e = err;
|
|
2297
|
+
const debug = Boolean(process.env.APPEEKY_SPEC_DEBUG);
|
|
2298
|
+
// A TypeError and the like is a bug, not a message for the user: say so, with where it happened.
|
|
2299
|
+
const bug = !EXPECTED_ERRORS.has(e?.name ?? "Error");
|
|
2300
|
+
const frames = (e?.stack ?? "").split("\n").slice(1).map((l) => l.trim());
|
|
2301
|
+
const where = frames.find((l) => /appeeky-spec|@appeeky\/spec|\/src\/|\/dist\//.test(l)) ?? frames[0];
|
|
2226
2302
|
if (program.opts().json)
|
|
2227
|
-
printJson({ error: message });
|
|
2228
|
-
else
|
|
2229
|
-
console.error(c.red(message));
|
|
2303
|
+
printJson({ error: e?.message ?? String(err), ...(bug ? { bug: true, version: VERSION, where, ...(debug ? { stack: e?.stack } : {}) } : {}) });
|
|
2304
|
+
else {
|
|
2305
|
+
console.error(c.red(e?.message ?? String(err)));
|
|
2306
|
+
if (bug) {
|
|
2307
|
+
console.error(c.dim(`${e.name} in appeeky-spec ${VERSION}${where ? `, ${where}` : ""}.`));
|
|
2308
|
+
console.error(c.dim(debug ? (e.stack ?? "") : "This is a bug: run again with APPEEKY_SPEC_DEBUG=1 for the full stack, and report it with the command you ran."));
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2230
2311
|
process.exitCode = 1;
|
|
2231
2312
|
}
|
|
2232
2313
|
}
|
package/dist/data.d.ts
CHANGED
|
@@ -8,7 +8,9 @@ import type { Project } from "./schema.js";
|
|
|
8
8
|
*
|
|
9
9
|
* They are private business data, so they go to .appeeky/data/ (gitignored) unless the
|
|
10
10
|
* spec says `data: { commit: true }`, which writes them to appeeky/data/ instead.
|
|
11
|
-
* Pulling again merges by date, so
|
|
11
|
+
* Pulling again merges by date, so pulls in the same folder keep one growing file per source.
|
|
12
|
+
* The Docker routines start from a fresh clone, where .appeeky/ is empty: there a file grows
|
|
13
|
+
* only with `data: { commit: true }`, otherwise each run holds the last `--days`.
|
|
12
14
|
*/
|
|
13
15
|
export declare function dataDir(project: Project): string;
|
|
14
16
|
type Row = Record<string, string | number | null | undefined>;
|
package/dist/data.js
CHANGED
|
@@ -10,7 +10,9 @@ import { rankAppIds } from "./verify.js";
|
|
|
10
10
|
*
|
|
11
11
|
* They are private business data, so they go to .appeeky/data/ (gitignored) unless the
|
|
12
12
|
* spec says `data: { commit: true }`, which writes them to appeeky/data/ instead.
|
|
13
|
-
* Pulling again merges by date, so
|
|
13
|
+
* Pulling again merges by date, so pulls in the same folder keep one growing file per source.
|
|
14
|
+
* The Docker routines start from a fresh clone, where .appeeky/ is empty: there a file grows
|
|
15
|
+
* only with `data: { commit: true }`, otherwise each run holds the last `--days`.
|
|
14
16
|
*/
|
|
15
17
|
export function dataDir(project) {
|
|
16
18
|
return project.spec.data.commit ? join(project.root, SPEC_DIR, "data") : join(project.root, ".appeeky", "data");
|
package/dist/lint.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface Issue {
|
|
|
9
9
|
field?: string;
|
|
10
10
|
message: string;
|
|
11
11
|
}
|
|
12
|
+
export declare function functionWords(locale: string): Set<string>;
|
|
12
13
|
export declare function lintLength(store: StoreId, locale: string, field: string, value: string | undefined): Issue[];
|
|
13
14
|
export declare function lintAppStore(locale: string, listing: AppStoreListing): Issue[];
|
|
14
15
|
export declare function lintGooglePlay(locale: string, listing: GooglePlayListing): Issue[];
|
package/dist/lint.js
CHANGED
|
@@ -2,6 +2,25 @@ import { LIMITS } from "./limits.js";
|
|
|
2
2
|
import { charLength, isEnglish, keywordEntries, singular, unique, words } from "./text.js";
|
|
3
3
|
/** Words Apple already ignores or that buy nothing in the keyword field. */
|
|
4
4
|
const APPLE_FILLER = new Set(["app", "apps", "the", "a", "an", "and", "or", "for", "with", "of", "iphone", "ipad"]);
|
|
5
|
+
/**
|
|
6
|
+
* Articles, prepositions and conjunctions per language. They carry no search on their own, so a
|
|
7
|
+
* name and subtitle that both need "de" or "and" to read naturally are not wasting index space.
|
|
8
|
+
*/
|
|
9
|
+
const FUNCTION_WORDS = {
|
|
10
|
+
en: "a an the and or of for with to in on by at from",
|
|
11
|
+
es: "de del la el los las y o en con para por un una al a",
|
|
12
|
+
pt: "de do da dos das e o a os as em com para por um uma no na",
|
|
13
|
+
fr: "de du des la le les et ou en avec pour par un une au aux à l d",
|
|
14
|
+
it: "di del della dei delle e o il lo la i gli le in con per un una al a da",
|
|
15
|
+
de: "der die das und oder mit für von zu im in am an auf ein eine den dem des",
|
|
16
|
+
nl: "de het een en of met voor van in op",
|
|
17
|
+
tr: "ve ile için bir da de",
|
|
18
|
+
pl: "i w z na do dla o",
|
|
19
|
+
sv: "och med för av i på en ett",
|
|
20
|
+
};
|
|
21
|
+
export function functionWords(locale) {
|
|
22
|
+
return new Set((FUNCTION_WORDS[locale.split("-")[0].toLowerCase()] ?? "").split(" ").filter(Boolean));
|
|
23
|
+
}
|
|
5
24
|
/** Google Play's metadata policy rejects these in the title. */
|
|
6
25
|
const PLAY_TITLE_BANNED = [/\bbest\b/i, /#\s?1\b/, /\btop\b/i, /\bfree\b/i, /\bno\.?\s?1\b/i, /\bsale\b/i, /\bdiscount\b/i];
|
|
7
26
|
export function lintLength(store, locale, field, value) {
|
|
@@ -30,7 +49,8 @@ export function lintAppStore(locale, listing) {
|
|
|
30
49
|
}
|
|
31
50
|
const nameWords = new Set(words(listing.name));
|
|
32
51
|
const subtitleWords = words(listing.subtitle);
|
|
33
|
-
const
|
|
52
|
+
const stop = functionWords(locale);
|
|
53
|
+
const repeatedInSubtitle = unique(subtitleWords.filter((w) => nameWords.has(w) && !stop.has(w)));
|
|
34
54
|
if (repeatedInSubtitle.length > 0) {
|
|
35
55
|
at("warning", "subtitle/repeats-name", "subtitle", `Subtitle repeats ${quoteList(repeatedInSubtitle)} from the name. Each word is indexed once, so use the space for a new word.`);
|
|
36
56
|
}
|
|
@@ -52,7 +72,7 @@ export function lintAppStore(locale, listing) {
|
|
|
52
72
|
}
|
|
53
73
|
const keywordWords = entries.flatMap((e) => words(e));
|
|
54
74
|
const titled = new Set([...nameWords, ...subtitleWords]);
|
|
55
|
-
const alreadyIndexed = unique(keywordWords.filter((w) => titled.has(w)));
|
|
75
|
+
const alreadyIndexed = unique(keywordWords.filter((w) => titled.has(w) && !stop.has(w)));
|
|
56
76
|
if (alreadyIndexed.length > 0) {
|
|
57
77
|
at("warning", "keywords/duplicate-of-name", "keywords", `${quoteList(alreadyIndexed)} already ${alreadyIndexed.length === 1 ? "appears" : "appear"} in the name or subtitle, so the keyword field does not need ${alreadyIndexed.length === 1 ? "it" : "them"}.`);
|
|
58
78
|
}
|
|
@@ -60,11 +80,12 @@ export function lintAppStore(locale, listing) {
|
|
|
60
80
|
if (repeatedWords.length > 0) {
|
|
61
81
|
at("info", "keywords/repeated-word", "keywords", `${quoteList(repeatedWords)} ${repeatedWords.length === 1 ? "is" : "are"} written more than once. Single words combine with each other, so phrases rarely need repeating.`);
|
|
62
82
|
}
|
|
83
|
+
// Filler in any language: the function words above, plus Apple's English ones.
|
|
84
|
+
const filler = unique(keywordWords.filter((w) => stop.has(w) || (isEnglish(locale) && APPLE_FILLER.has(w))));
|
|
85
|
+
if (filler.length > 0) {
|
|
86
|
+
at("info", "keywords/filler", "keywords", `${quoteList(filler)} add little in the keyword field.`);
|
|
87
|
+
}
|
|
63
88
|
if (isEnglish(locale)) {
|
|
64
|
-
const filler = unique(keywordWords.filter((w) => APPLE_FILLER.has(w)));
|
|
65
|
-
if (filler.length > 0) {
|
|
66
|
-
at("info", "keywords/filler", "keywords", `${quoteList(filler)} add little in the keyword field.`);
|
|
67
|
-
}
|
|
68
89
|
const all = unique([...titled, ...keywordWords]);
|
|
69
90
|
const plurals = all.filter((w) => singular(w) !== w && all.includes(singular(w)));
|
|
70
91
|
if (plurals.length > 0) {
|
package/dist/schema.d.ts
CHANGED
|
@@ -338,6 +338,19 @@ export declare const specFileSchema: z.ZodObject<{
|
|
|
338
338
|
keywords?: Record<string, string[]> | undefined;
|
|
339
339
|
device?: "mobile" | "desktop" | undefined;
|
|
340
340
|
}>>;
|
|
341
|
+
/**
|
|
342
|
+
* Which of the social accounts connected in Appeeky belong to this app. Appeeky lists every
|
|
343
|
+
* account on the key's account, so with several apps (or a company account next to the app's)
|
|
344
|
+
* name this app's here: an id from accounts.yaml, a handle (`@saiko`, `u/name`) or
|
|
345
|
+
* `platform:@handle`. `social pull` keeps only these, so drafts can only go to them.
|
|
346
|
+
*/
|
|
347
|
+
social: z.ZodOptional<z.ZodObject<{
|
|
348
|
+
accounts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
349
|
+
}, "strict", z.ZodTypeAny, {
|
|
350
|
+
accounts?: string[] | undefined;
|
|
351
|
+
}, {
|
|
352
|
+
accounts?: string[] | undefined;
|
|
353
|
+
}>>;
|
|
341
354
|
/** Rank in the app's category chart (top 100), recorded daily by `category pull`. */
|
|
342
355
|
category: z.ZodOptional<z.ZodObject<{
|
|
343
356
|
/** App Store genre id, e.g. "6013" for Health & Fitness; read from the app when left out. */
|
|
@@ -634,6 +647,9 @@ export declare const specFileSchema: z.ZodObject<{
|
|
|
634
647
|
keywords?: Record<string, string[]> | undefined;
|
|
635
648
|
device?: "mobile" | "desktop" | undefined;
|
|
636
649
|
} | undefined;
|
|
650
|
+
social?: {
|
|
651
|
+
accounts?: string[] | undefined;
|
|
652
|
+
} | undefined;
|
|
637
653
|
category?: {
|
|
638
654
|
appStore?: string | undefined;
|
|
639
655
|
googlePlay?: string | undefined;
|
|
@@ -710,6 +726,9 @@ export declare const specFileSchema: z.ZodObject<{
|
|
|
710
726
|
keywords?: Record<string, string[]> | undefined;
|
|
711
727
|
device?: "mobile" | "desktop" | undefined;
|
|
712
728
|
} | undefined;
|
|
729
|
+
social?: {
|
|
730
|
+
accounts?: string[] | undefined;
|
|
731
|
+
} | undefined;
|
|
713
732
|
category?: {
|
|
714
733
|
appStore?: string | undefined;
|
|
715
734
|
googlePlay?: string | undefined;
|
package/dist/schema.js
CHANGED
|
@@ -180,6 +180,16 @@ export const specFileSchema = z
|
|
|
180
180
|
})
|
|
181
181
|
.strict()
|
|
182
182
|
.optional(),
|
|
183
|
+
/**
|
|
184
|
+
* Which of the social accounts connected in Appeeky belong to this app. Appeeky lists every
|
|
185
|
+
* account on the key's account, so with several apps (or a company account next to the app's)
|
|
186
|
+
* name this app's here: an id from accounts.yaml, a handle (`@saiko`, `u/name`) or
|
|
187
|
+
* `platform:@handle`. `social pull` keeps only these, so drafts can only go to them.
|
|
188
|
+
*/
|
|
189
|
+
social: z
|
|
190
|
+
.object({ accounts: z.array(z.string().min(1)).min(1).optional() })
|
|
191
|
+
.strict()
|
|
192
|
+
.optional(),
|
|
183
193
|
/** Rank in the app's category chart (top 100), recorded daily by `category pull`. */
|
|
184
194
|
category: z
|
|
185
195
|
.object({
|
package/dist/search-ads.js
CHANGED
|
@@ -3,7 +3,7 @@ import { existsSync } from "node:fs";
|
|
|
3
3
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { SPEC_DIR } from "./files.js";
|
|
6
|
-
import { defaultRunner, onPath, STORE_CLIS } from "./transport.js";
|
|
6
|
+
import { defaultRunner, npxPackage, onPath, STORE_CLIS } from "./transport.js";
|
|
7
7
|
/**
|
|
8
8
|
* Apple Search Ads on your own API key, no Appeeky account: the app's campaigns, spend and installs
|
|
9
9
|
* per day, and the keywords and search terms that brought installs, in appeeky/search-ads/.
|
|
@@ -113,7 +113,7 @@ export function cliRequest(options = {}) {
|
|
|
113
113
|
const run = async (args) => {
|
|
114
114
|
const argv = ["--json", ...(options.account ? ["--account", options.account] : []), "search-ads", ...args];
|
|
115
115
|
const useNpx = options.useNpx ?? !onPath(cli.bin);
|
|
116
|
-
const [command, full] = useNpx ? ["npx", ["-y", "-p",
|
|
116
|
+
const [command, full] = useNpx ? ["npx", ["-y", "-p", npxPackage("app-store"), cli.bin, ...argv]] : [cli.bin, argv];
|
|
117
117
|
let r;
|
|
118
118
|
try {
|
|
119
119
|
r = await (options.runner ?? defaultRunner)(command, full);
|
package/dist/setup.d.ts
CHANGED
|
@@ -40,6 +40,13 @@ export interface DoctorCheck {
|
|
|
40
40
|
export declare function savedAccountsFile(store: StoreId, env?: NodeJS.ProcessEnv): string;
|
|
41
41
|
/** Names of the accounts saved with the store CLI, if any. */
|
|
42
42
|
export declare function savedAccounts(store: StoreId, env?: NodeJS.ProcessEnv): string[];
|
|
43
|
+
/**
|
|
44
|
+
* `diagnose` only sees which keys are set. This asks each store reached through the hosted
|
|
45
|
+
* gateway for one read, so a key that is valid but has no store connected (or the wrong
|
|
46
|
+
* account's key) shows up as a failure instead of "Ready". Local CLIs are not called: that
|
|
47
|
+
* can take a minute through npx; `pull` shows their errors.
|
|
48
|
+
*/
|
|
49
|
+
export declare function probeConnections(project: Project, checks: DoctorCheck[], env?: NodeJS.ProcessEnv, fetcher?: typeof fetch, timeoutMs?: number): Promise<DoctorCheck[]>;
|
|
43
50
|
/** What is set up for this repo, and what is missing. Works without a spec (it says so). */
|
|
44
51
|
export declare function diagnose(root: string, project: Project | null, env?: NodeJS.ProcessEnv, nodeVersion?: string): DoctorCheck[];
|
|
45
52
|
export {};
|
package/dist/setup.js
CHANGED
|
@@ -2,8 +2,8 @@ import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { installedTargets } from "./agents.js";
|
|
4
4
|
import { SPEC_DIR, SPEC_FILE } from "./files.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { words } from "./text.js";
|
|
6
|
+
import { createTransport, hasLocalKeys, npxPackage, onPath, STORE_CLIS } from "./transport.js";
|
|
7
7
|
/** App Store apps matching a name, from Apple's public search. */
|
|
8
8
|
export async function findApps(term, country = "us", fetcher = fetch) {
|
|
9
9
|
const url = `https://itunes.apple.com/search?media=software&entity=software&limit=6&country=${encodeURIComponent(country)}&term=${encodeURIComponent(term)}`;
|
|
@@ -45,7 +45,8 @@ export function targetCandidates(project, limit = 14, storeName) {
|
|
|
45
45
|
const play = project.listings["google-play"][locale] ?? Object.values(project.listings["google-play"])[0];
|
|
46
46
|
const name = asc?.name ?? play?.title ?? storeName ?? project.spec.app.name;
|
|
47
47
|
const subtitle = asc?.subtitle ?? play?.shortDescription ?? "";
|
|
48
|
-
|
|
48
|
+
// The brand is the name's first part ("Saiko AI" in "Saiko AI: Dance Video Maker"), not the whole name.
|
|
49
|
+
const brand = words(project.spec.app.name.split(/[:\-–—|]/)[0]).join(" ");
|
|
49
50
|
const out = [];
|
|
50
51
|
const add = (phrase) => {
|
|
51
52
|
const ws = words(phrase);
|
|
@@ -206,9 +207,6 @@ jobs:
|
|
|
206
207
|
const ok = (area, detail) => ({ area, status: "ok", detail });
|
|
207
208
|
const warn = (area, detail, fix) => ({ area, status: "warn", detail, fix });
|
|
208
209
|
const fail = (area, detail, fix) => ({ area, status: "fail", detail, fix });
|
|
209
|
-
const hasLocalKeys = (store, env) => store === "app-store"
|
|
210
|
-
? Boolean(env.ASC_KEY_ID && (env.ASC_PRIVATE_KEY || env.ASC_PRIVATE_KEY_PATH))
|
|
211
|
-
: Boolean(env.GPS_CREDENTIALS || env.GOOGLE_PLAY_CREDENTIALS || env.GOOGLE_APPLICATION_CREDENTIALS);
|
|
212
210
|
/** Where each store CLI keeps its saved accounts (`appstore accounts add`, `gps accounts add`). */
|
|
213
211
|
export function savedAccountsFile(store, env = process.env) {
|
|
214
212
|
const base = env.XDG_CONFIG_HOME ?? join(env.HOME ?? env.USERPROFILE ?? "", ".config");
|
|
@@ -225,6 +223,54 @@ export function savedAccounts(store, env = process.env) {
|
|
|
225
223
|
return [];
|
|
226
224
|
}
|
|
227
225
|
}
|
|
226
|
+
const HOSTED_DETAIL = "hosted through your Appeeky connection (APPEEKY_API_KEY)";
|
|
227
|
+
/** One read per store, the cheapest the adapters make, to prove the connection works and not only that a key is set. */
|
|
228
|
+
const PROBES = {
|
|
229
|
+
"app-store": (project) => {
|
|
230
|
+
const cfg = project.spec.stores.appStore;
|
|
231
|
+
return cfg ? ["appstore_list_versions", { appId: cfg.appId, platform: cfg.platform ?? "IOS" }] : null;
|
|
232
|
+
},
|
|
233
|
+
"google-play": (project) => {
|
|
234
|
+
const cfg = project.spec.stores.googlePlay;
|
|
235
|
+
return cfg ? ["gps_list_listings", { packageName: cfg.packageName }] : null;
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* `diagnose` only sees which keys are set. This asks each store reached through the hosted
|
|
240
|
+
* gateway for one read, so a key that is valid but has no store connected (or the wrong
|
|
241
|
+
* account's key) shows up as a failure instead of "Ready". Local CLIs are not called: that
|
|
242
|
+
* can take a minute through npx; `pull` shows their errors.
|
|
243
|
+
*/
|
|
244
|
+
export async function probeConnections(project, checks, env = process.env, fetcher, timeoutMs = 15_000) {
|
|
245
|
+
const out = [...checks];
|
|
246
|
+
for (const store of ["app-store", "google-play"]) {
|
|
247
|
+
const label = store === "app-store" ? "App Store" : "Google Play";
|
|
248
|
+
const i = out.findIndex((c) => c.area === label && c.status === "ok" && c.detail === HOSTED_DETAIL);
|
|
249
|
+
const probe = PROBES[store](project);
|
|
250
|
+
if (i < 0 || !probe)
|
|
251
|
+
continue;
|
|
252
|
+
const cfg = store === "app-store" ? project.spec.stores.appStore : project.spec.stores.googlePlay;
|
|
253
|
+
let timer;
|
|
254
|
+
try {
|
|
255
|
+
const transport = createTransport(store, { via: cfg?.via ?? "auto", env, fetcher });
|
|
256
|
+
if (transport.kind !== "hosted")
|
|
257
|
+
continue;
|
|
258
|
+
const timeout = new Promise((_, reject) => {
|
|
259
|
+
timer = setTimeout(() => reject(new Error(`no answer in ${timeoutMs / 1000}s`)), timeoutMs);
|
|
260
|
+
});
|
|
261
|
+
await Promise.race([transport.call(probe[0], probe[1]), timeout]);
|
|
262
|
+
out[i] = ok(label, `${HOSTED_DETAIL}, connected`);
|
|
263
|
+
}
|
|
264
|
+
catch (e) {
|
|
265
|
+
out[i] = fail(label, `APPEEKY_API_KEY is set, but the hosted gateway refused: ${e.message}`, `Connect ${label} in Appeeky for the account this key belongs to (appeeky.com/dashboard), or use your own store key with \`via: local\`.`);
|
|
266
|
+
}
|
|
267
|
+
finally {
|
|
268
|
+
if (timer)
|
|
269
|
+
clearTimeout(timer);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return out;
|
|
273
|
+
}
|
|
228
274
|
/** What is set up for this repo, and what is missing. Works without a spec (it says so). */
|
|
229
275
|
export function diagnose(root, project, env = process.env, nodeVersion = process.versions.node) {
|
|
230
276
|
const out = [];
|
|
@@ -247,13 +293,14 @@ export function diagnose(root, project, env = process.env, nodeVersion = process
|
|
|
247
293
|
// The CLI runs from PATH or through npx; either way it reads keys from the environment or its saved accounts.
|
|
248
294
|
const accounts = savedAccounts(store, env);
|
|
249
295
|
const keys = hasLocalKeys(store, env) ? "keys in the environment" : accounts.length ? `saved account${accounts.length > 1 ? "s" : ""} ${accounts.join(", ")}` : "";
|
|
250
|
-
const runner = local ? `${cli.bin} CLI` : `npx ${
|
|
296
|
+
const runner = local ? `${cli.bin} CLI` : `npx ${npxPackage(store)}`;
|
|
251
297
|
if (via === "hosted")
|
|
252
|
-
out.push(key ? ok(label,
|
|
253
|
-
|
|
298
|
+
out.push(key ? ok(label, HOSTED_DETAIL) : fail(label, "via: hosted, but APPEEKY_API_KEY is not set", "Set APPEEKY_API_KEY (appeeky.com/dashboard/settings)."));
|
|
299
|
+
// Same order as createTransport: an installed CLI or keys in the environment win over the hosted gateway.
|
|
300
|
+
else if (keys && (via === "local" || local || hasLocalKeys(store, env) || !key))
|
|
254
301
|
out.push(ok(label, `your own key: ${runner}, ${keys}`));
|
|
255
302
|
else if (via !== "local" && key)
|
|
256
|
-
out.push(ok(label,
|
|
303
|
+
out.push(ok(label, HOSTED_DETAIL));
|
|
257
304
|
else if (local)
|
|
258
305
|
out.push(fail(label, `${cli.bin} CLI is installed but has no saved account and no keys in the environment`, cli.setupHint));
|
|
259
306
|
else
|
package/dist/social.d.ts
CHANGED
|
@@ -38,7 +38,8 @@ export interface NativePost {
|
|
|
38
38
|
account: string;
|
|
39
39
|
platform: string;
|
|
40
40
|
url?: string;
|
|
41
|
-
text:
|
|
41
|
+
/** Missing when the post or comment has no text (emoji-only, an image, no caption): empty strings are not stored. */
|
|
42
|
+
text?: string;
|
|
42
43
|
mediaType?: string;
|
|
43
44
|
publishedAt?: string;
|
|
44
45
|
metrics?: Partial<Record<SocialMetric | "engagementRate", number>>;
|
|
@@ -50,7 +51,8 @@ export interface SocialComment {
|
|
|
50
51
|
postUrl?: string;
|
|
51
52
|
postId?: string;
|
|
52
53
|
platformPostId?: string;
|
|
53
|
-
text:
|
|
54
|
+
/** Missing when the post or comment has no text (emoji-only, an image, no caption): empty strings are not stored. */
|
|
55
|
+
text?: string;
|
|
54
56
|
author?: string;
|
|
55
57
|
own?: boolean;
|
|
56
58
|
reply?: boolean;
|
|
@@ -87,7 +89,8 @@ export interface SocialData {
|
|
|
87
89
|
export interface SocialPost {
|
|
88
90
|
id: string;
|
|
89
91
|
status: string;
|
|
90
|
-
text:
|
|
92
|
+
/** Missing when the post or comment has no text (emoji-only, an image, no caption): empty strings are not stored. */
|
|
93
|
+
text?: string;
|
|
91
94
|
createdAt: string;
|
|
92
95
|
scheduledFor?: string;
|
|
93
96
|
platforms: SocialPlatformResult[];
|
|
@@ -180,8 +183,11 @@ export declare function toInsights(r: InsightsRow, account: SocialAccount): Acco
|
|
|
180
183
|
* Connected accounts and the latest posts made through Appeeky, with analytics for the ones that
|
|
181
184
|
* went out; then, per account, the posts made in the platform's app, recent comments and followers.
|
|
182
185
|
*/
|
|
186
|
+
/** Whether an account is one of `only` (ids, handles, names or platform:handle, as in `social.accounts`). */
|
|
187
|
+
export declare function accountMatches(a: SocialAccount, only: string[]): boolean;
|
|
183
188
|
export declare function fetchSocial(api: AppeekyApi, options?: {
|
|
184
189
|
limit?: number;
|
|
190
|
+
only?: string[];
|
|
185
191
|
}): Promise<SocialData>;
|
|
186
192
|
export declare function summaryMarkdown(accounts: SocialAccount[], posts: SocialPost[], now?: Date, more?: Pick<SocialData, "nativePosts" | "comments" | "insights">): string;
|
|
187
193
|
export declare function saveSocial(root: string, data: SocialData, now?: Date): Promise<void>;
|
|
@@ -388,8 +394,8 @@ export declare const draftSchema: z.ZodObject<{
|
|
|
388
394
|
sentAt: z.ZodOptional<z.ZodString>;
|
|
389
395
|
}, "strict", z.ZodTypeAny, {
|
|
390
396
|
status: "draft" | "sent";
|
|
391
|
-
text: string;
|
|
392
397
|
accounts: string[];
|
|
398
|
+
text: string;
|
|
393
399
|
tiktok?: {
|
|
394
400
|
title?: string | undefined;
|
|
395
401
|
comments?: boolean | undefined;
|
|
@@ -419,8 +425,8 @@ export declare const draftSchema: z.ZodObject<{
|
|
|
419
425
|
why?: string | undefined;
|
|
420
426
|
postId?: string | undefined;
|
|
421
427
|
}, {
|
|
422
|
-
text: string;
|
|
423
428
|
accounts: string[];
|
|
429
|
+
text: string;
|
|
424
430
|
status?: "draft" | "sent" | undefined;
|
|
425
431
|
tiktok?: {
|
|
426
432
|
title?: string | undefined;
|
package/dist/social.js
CHANGED
|
@@ -122,9 +122,26 @@ async function perAccount(accounts, what, warnings, fetchOne, map, skip = []) {
|
|
|
122
122
|
* Connected accounts and the latest posts made through Appeeky, with analytics for the ones that
|
|
123
123
|
* went out; then, per account, the posts made in the platform's app, recent comments and followers.
|
|
124
124
|
*/
|
|
125
|
+
/** Whether an account is one of `only` (ids, handles, names or platform:handle, as in `social.accounts`). */
|
|
126
|
+
export function accountMatches(a, only) {
|
|
127
|
+
const handles = accountHandles(a);
|
|
128
|
+
return only.some((ref) => {
|
|
129
|
+
const r = ref.trim().toLowerCase();
|
|
130
|
+
if (r === a.id.toLowerCase())
|
|
131
|
+
return true;
|
|
132
|
+
const m = /^([a-z]+):(.+)$/.exec(r);
|
|
133
|
+
if (m)
|
|
134
|
+
return platformKey(m[1]) === platformKey(a.platform) && handles.includes(m[2]);
|
|
135
|
+
return handles.includes(r);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
125
138
|
export async function fetchSocial(api, options = {}) {
|
|
126
|
-
const
|
|
127
|
-
const
|
|
139
|
+
const all = ((await api.get("/connect/social/accounts")) ?? []).map(toAccount);
|
|
140
|
+
const accounts = options.only?.length ? all.filter((a) => accountMatches(a, options.only)) : all;
|
|
141
|
+
const allRows = (await api.get("/social/posts", { limit: String(options.limit ?? 100) })) ?? [];
|
|
142
|
+
// Posts made through Appeeky name platforms, not accounts: with social.accounts, keep those on this app's platforms.
|
|
143
|
+
const platforms = new Set(accounts.map((a) => platformKey(a.platform)));
|
|
144
|
+
const rows = options.only?.length ? allRows.filter((r) => (r.social_media_platform_posts ?? []).some((p) => platforms.has(platformKey(p.platform)))) : allRows;
|
|
128
145
|
const posts = [];
|
|
129
146
|
for (const row of rows) {
|
|
130
147
|
const published = (row.social_media_platform_posts ?? []).some((p) => p.published_at);
|
|
@@ -143,8 +160,11 @@ const total = (p, k) => p.metrics?.[k] ?? 0;
|
|
|
143
160
|
/** The reach of a post on one platform: views when the platform reports them, else impressions or reach. */
|
|
144
161
|
const seen = (p) => total(p, "views") || total(p, "impressions") || total(p, "reach");
|
|
145
162
|
const score = (p) => seen(p) + total(p, "likes") * 10;
|
|
163
|
+
/** Text without a caption (an emoji-only or image comment, a video posted without one) arrives without `text`. */
|
|
146
164
|
const oneLine = (text, max) => {
|
|
147
|
-
const t = text.replace(/\s+/g, " ").trim();
|
|
165
|
+
const t = (text ?? "").replace(/\s+/g, " ").trim();
|
|
166
|
+
if (!t)
|
|
167
|
+
return "(no text)";
|
|
148
168
|
return `${t.slice(0, max)}${t.length > max ? "…" : ""}`;
|
|
149
169
|
};
|
|
150
170
|
const signed = (n) => (n > 0 ? `+${n}` : String(n));
|
package/dist/transport.d.ts
CHANGED
|
@@ -18,6 +18,11 @@ export declare class TransportError extends Error {
|
|
|
18
18
|
interface StoreCli {
|
|
19
19
|
bin: string;
|
|
20
20
|
npmPackage: string;
|
|
21
|
+
/**
|
|
22
|
+
* The CLI version `npx` runs when it is not installed. Pinned so a scheduled run with the
|
|
23
|
+
* user's store keys never picks up whatever was published last; bump it deliberately.
|
|
24
|
+
*/
|
|
25
|
+
npmVersion: string;
|
|
21
26
|
/** argv before the op name, e.g. `ops call` vs `call`. */
|
|
22
27
|
callArgs: string[];
|
|
23
28
|
/** Flag that picks a named account or profile. */
|
|
@@ -27,6 +32,20 @@ interface StoreCli {
|
|
|
27
32
|
setupHint: string;
|
|
28
33
|
}
|
|
29
34
|
export declare const STORE_CLIS: Record<StoreId, StoreCli>;
|
|
35
|
+
/** `@appeeky/…-cli@<version>`: what `npx -p` installs. */
|
|
36
|
+
export declare const npxPackage: (store: StoreId) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Store keys in the environment that the store CLI reads (the user's own key, no saved account
|
|
39
|
+
* needed). A path counts only when the file exists, so a variable left over in an env file, or
|
|
40
|
+
* a key folder that is not mounted, does not take the store away from the hosted gateway.
|
|
41
|
+
*/
|
|
42
|
+
export declare const hasLocalKeys: (store: StoreId, env?: NodeJS.ProcessEnv) => boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The gateways and the Appeeky API answer "No appeeky-web account found for the API key owner"
|
|
45
|
+
* when the key is valid but belongs to no Appeeky account with stores connected (an internal or
|
|
46
|
+
* service key, or a key made before the account existed). Say what to do instead.
|
|
47
|
+
*/
|
|
48
|
+
export declare function explainAppeekyError(message: string, status?: number): string;
|
|
30
49
|
export declare function onPath(bin: string, env?: NodeJS.ProcessEnv): boolean;
|
|
31
50
|
export type Runner = (command: string, args: string[], env?: Record<string, string>) => Promise<{
|
|
32
51
|
code: number;
|
|
@@ -91,9 +110,10 @@ export interface TransportOptions {
|
|
|
91
110
|
fetcher?: Fetcher;
|
|
92
111
|
}
|
|
93
112
|
/**
|
|
94
|
-
* `auto` prefers the local CLI when it is installed
|
|
95
|
-
*
|
|
96
|
-
*
|
|
113
|
+
* `auto` prefers your own key: the local CLI when it is installed, or through npx when
|
|
114
|
+
* the store keys are in the environment (ASC_KEY_ID…, GPS_CREDENTIALS, GOOGLE_APPLICATION_CREDENTIALS),
|
|
115
|
+
* as in a container. Then the hosted gateway when an Appeeky API key is set, and finally
|
|
116
|
+
* the CLI through npx with its saved accounts.
|
|
97
117
|
*/
|
|
98
118
|
export declare function createTransport(store: StoreId, options: TransportOptions): OpsTransport;
|
|
99
119
|
export {};
|
package/dist/transport.js
CHANGED
|
@@ -13,6 +13,7 @@ export const STORE_CLIS = {
|
|
|
13
13
|
"app-store": {
|
|
14
14
|
bin: "appstore",
|
|
15
15
|
npmPackage: "@appeeky/app-store-connect-cli",
|
|
16
|
+
npmVersion: "0.2.0",
|
|
16
17
|
callArgs: ["ops", "call"],
|
|
17
18
|
accountFlag: "--account",
|
|
18
19
|
hostedUrl: "https://asc-api.appeeky.com",
|
|
@@ -22,6 +23,7 @@ export const STORE_CLIS = {
|
|
|
22
23
|
"google-play": {
|
|
23
24
|
bin: "gps",
|
|
24
25
|
npmPackage: "@appeeky/google-play-store-cli",
|
|
26
|
+
npmVersion: "0.1.2",
|
|
25
27
|
callArgs: ["call"],
|
|
26
28
|
accountFlag: "--account",
|
|
27
29
|
hostedUrl: "https://gps-api.appeeky.com",
|
|
@@ -29,6 +31,31 @@ export const STORE_CLIS = {
|
|
|
29
31
|
setupHint: "Save your Google Play service account once with the Google Play CLI: `npx -p @appeeky/google-play-store-cli gps accounts add my-co --credentials service-account.json --default` (github.com/appeeky/google-play-console-cli). Or set APPEEKY_API_KEY to use your connection in Appeeky.",
|
|
30
32
|
},
|
|
31
33
|
};
|
|
34
|
+
/** `@appeeky/…-cli@<version>`: what `npx -p` installs. */
|
|
35
|
+
export const npxPackage = (store) => `${STORE_CLIS[store].npmPackage}@${STORE_CLIS[store].npmVersion}`;
|
|
36
|
+
/** A key given inline (JSON or PEM), or a path to a file that is there: a path to nothing is not a key. */
|
|
37
|
+
const keyThere = (value, inline) => Boolean(value && (inline.test(value.trim()) || existsSync(value)));
|
|
38
|
+
/**
|
|
39
|
+
* Store keys in the environment that the store CLI reads (the user's own key, no saved account
|
|
40
|
+
* needed). A path counts only when the file exists, so a variable left over in an env file, or
|
|
41
|
+
* a key folder that is not mounted, does not take the store away from the hosted gateway.
|
|
42
|
+
*/
|
|
43
|
+
export const hasLocalKeys = (store, env = process.env) => store === "app-store"
|
|
44
|
+
? Boolean(env.ASC_KEY_ID && (env.ASC_PRIVATE_KEY || keyThere(env.ASC_PRIVATE_KEY_PATH, /^-----BEGIN/)))
|
|
45
|
+
: [env.GPS_CREDENTIALS, env.GOOGLE_PLAY_CREDENTIALS, env.GOOGLE_APPLICATION_CREDENTIALS].some((v) => keyThere(v, /^\{/));
|
|
46
|
+
/**
|
|
47
|
+
* The gateways and the Appeeky API answer "No appeeky-web account found for the API key owner"
|
|
48
|
+
* when the key is valid but belongs to no Appeeky account with stores connected (an internal or
|
|
49
|
+
* service key, or a key made before the account existed). Say what to do instead.
|
|
50
|
+
*/
|
|
51
|
+
export function explainAppeekyError(message, status) {
|
|
52
|
+
const said = message.replace(/[.\s]+$/, "");
|
|
53
|
+
if (/no appeeky-web account/i.test(message))
|
|
54
|
+
return `${said}. This APPEEKY_API_KEY is valid but belongs to no Appeeky account with the stores connected: create the key at appeeky.com/dashboard/settings while signed in to the account where this app's App Store Connect and Google Play are connected (and its social accounts), or use your own store keys with \`via: local\`.`;
|
|
55
|
+
if (status === 401)
|
|
56
|
+
return `${said}. Check APPEEKY_API_KEY: it is missing, revoked or mistyped (appeeky.com/dashboard/settings).`;
|
|
57
|
+
return message;
|
|
58
|
+
}
|
|
32
59
|
export function onPath(bin, env = process.env) {
|
|
33
60
|
const exts = process.platform === "win32" ? (env.PATHEXT ?? ".EXE;.CMD").split(";") : [""];
|
|
34
61
|
for (const dir of (env.PATH ?? "").split(delimiter)) {
|
|
@@ -63,7 +90,7 @@ export class LocalCliTransport {
|
|
|
63
90
|
this.store = store;
|
|
64
91
|
this.options = options;
|
|
65
92
|
const cli = STORE_CLIS[store];
|
|
66
|
-
this.label = options.label ?? (options.useNpx ? `npx ${
|
|
93
|
+
this.label = options.label ?? (options.useNpx ? `npx ${npxPackage(store)}` : `local ${cli.bin} CLI`);
|
|
67
94
|
}
|
|
68
95
|
async call(op, args, options = {}) {
|
|
69
96
|
const cli = STORE_CLIS[this.store];
|
|
@@ -76,7 +103,7 @@ export class LocalCliTransport {
|
|
|
76
103
|
const [command, full] = this.options.command
|
|
77
104
|
? [this.options.command.file, [...this.options.command.args, ...argv]]
|
|
78
105
|
: this.options.useNpx
|
|
79
|
-
? ["npx", ["-y", "-p",
|
|
106
|
+
? ["npx", ["-y", "-p", npxPackage(this.store), cli.bin, ...argv]]
|
|
80
107
|
: [cli.bin, argv];
|
|
81
108
|
const run = this.options.runner ?? defaultRunner;
|
|
82
109
|
let result;
|
|
@@ -88,7 +115,9 @@ export class LocalCliTransport {
|
|
|
88
115
|
}
|
|
89
116
|
if (result.code !== 0) {
|
|
90
117
|
const detail = (result.stderr || result.stdout).trim().split("\n").slice(-3).join(" ");
|
|
91
|
-
|
|
118
|
+
// No key at all: say both ways in (save your own key, or use the stores connected in Appeeky).
|
|
119
|
+
const noKey = /no .*(api key|credentials)|accounts add|service account/i.test(detail);
|
|
120
|
+
throw new TransportError(`${cli.bin} ${op} failed: ${detail || `exit ${result.code}`}${noKey ? ` ${cli.setupHint}` : ""}`, op);
|
|
92
121
|
}
|
|
93
122
|
const text = result.stdout.trim();
|
|
94
123
|
if (!text)
|
|
@@ -135,15 +164,16 @@ export class HostedTransport {
|
|
|
135
164
|
const body = (await res.json().catch(() => null));
|
|
136
165
|
if (!res.ok) {
|
|
137
166
|
const message = body?.error?.message ?? `HTTP ${res.status}`;
|
|
138
|
-
throw new TransportError(`${op} failed on ${new URL(base).host}: ${message}`, op);
|
|
167
|
+
throw new TransportError(explainAppeekyError(`${op} failed on ${new URL(base).host}: ${message}`, res.status), op);
|
|
139
168
|
}
|
|
140
169
|
return body?.data;
|
|
141
170
|
}
|
|
142
171
|
}
|
|
143
172
|
/**
|
|
144
|
-
* `auto` prefers the local CLI when it is installed
|
|
145
|
-
*
|
|
146
|
-
*
|
|
173
|
+
* `auto` prefers your own key: the local CLI when it is installed, or through npx when
|
|
174
|
+
* the store keys are in the environment (ASC_KEY_ID…, GPS_CREDENTIALS, GOOGLE_APPLICATION_CREDENTIALS),
|
|
175
|
+
* as in a container. Then the hosted gateway when an Appeeky API key is set, and finally
|
|
176
|
+
* the CLI through npx with its saved accounts.
|
|
147
177
|
*/
|
|
148
178
|
export function createTransport(store, options) {
|
|
149
179
|
const env = options.env ?? process.env;
|
|
@@ -162,6 +192,8 @@ export function createTransport(store, options) {
|
|
|
162
192
|
case "auto":
|
|
163
193
|
if (onPath(cli.bin, env))
|
|
164
194
|
return local(false);
|
|
195
|
+
if (hasLocalKeys(store, env))
|
|
196
|
+
return local(true);
|
|
165
197
|
if (apiKey)
|
|
166
198
|
return hosted(apiKey);
|
|
167
199
|
return local(true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appeeky/spec",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.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",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: appeeky-spec
|
|
3
3
|
description: Improve and ship an app's App Store / Google Play listing with Appeeky Spec (appeeky.spec.yaml + appeeky/store). Use when asked to set up Appeeky Spec or listing-as-code in a repo, do ASO, change an app's name, subtitle, keywords, promotional text or descriptions, check keyword coverage, or push listing changes to App Store Connect or Google Play. The other appeeky-spec-* skills cover one area each - targets (keywords), localize, review (past releases), cofounder (the weekly review), reviews, competitors, social, ugc, ads, attribution, screenshots, seo (the website), visibility (AI assistants and the category chart), experiments (pricing and other tests), automation (GitHub Actions and CI) and server (a VM or container host).
|
|
4
4
|
metadata:
|
|
5
|
-
version: 1.
|
|
5
|
+
version: 1.5.0
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Appeeky Spec
|
|
@@ -36,7 +36,8 @@ In a terminal the user runs, `init` with no options is a guided setup. It finds
|
|
|
36
36
|
2. Store access: `appstore` / `gps` CLIs with the user's keys (local), or `APPEEKY_API_KEY` with a store connected in Appeeky (hosted). Do not ask for or handle key files yourself.
|
|
37
37
|
- Local App Store: `appstore accounts add`, or `ASC_KEY_ID`, `ASC_ISSUER_ID`, `ASC_PRIVATE_KEY`.
|
|
38
38
|
- Local Google Play: `gps accounts add`, or `GPS_CREDENTIALS`.
|
|
39
|
-
- `--via auto` (default) uses
|
|
39
|
+
- `--via auto` (default) uses your own key first (an installed CLI, or store keys in the environment through npx), then hosted when `APPEEKY_API_KEY` is set. `APPEEKY_API_KEY` also adds keyword popularity and ideas.
|
|
40
|
+
- Hosted needs the stores connected in Appeeky for the account the key belongs to; `doctor` calls the gateway to check (`--offline` to skip).
|
|
40
41
|
3. `init --name "<App>" --app-store <id> --google-play <package> --pull`, then fill `targets` (see appeeky-spec-targets).
|
|
41
42
|
4. `doctor --json` lists everything still missing (store access, targets, the key, attribution, workflows, skills, `.gitignore`), each with its fix. Exit code 1 means something must be fixed.
|
|
42
43
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: appeeky-spec-server
|
|
3
3
|
description: Set up and operate Appeeky Spec on a machine or container host the user owns, end to end over SSH, with the published ghcr.io/appeeky/appeeky-spec image. Covers choosing a host (a VM with Docker on Hetzner, DigitalOcean, AWS, Google Cloud or an office machine, or a platform scheduler such as Railway cron, Fly, Render or Cloud Run Jobs), installing Docker, docker-compose.yml and a chmod 600 .env, the first dry run, reading the logs, the healthcheck ping, updating the image, several apps on one host, moving hosts and fixing a failed routine. Use when asked to "run Spec on my server", "set it up on a VPS / Hetzner / EC2", "deploy the Docker image", "docker compose for Appeeky Spec", "it stopped pushing on the server", "update the container", or "move it to another server". For GitHub Actions and workflow files use appeeky-spec-automation; for the weekly review content use appeeky-spec-cofounder.
|
|
4
4
|
metadata:
|
|
5
|
-
version: 1.
|
|
5
|
+
version: 1.1.0
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Run Appeeky Spec on your own server
|
|
@@ -16,7 +16,7 @@ The image runs the same routines as the GitHub workflows. Each run clones the re
|
|
|
16
16
|
| `weekly` | the co-founder review, opened as a pull request `listing/weekly-<date>` (needs the `-agent` image) |
|
|
17
17
|
| `schedule` | stays up and runs the three on cron (supercronic). The compose file uses this |
|
|
18
18
|
|
|
19
|
-
Images (linux/amd64 and arm64): `ghcr.io/appeeky/appeeky-spec:latest`, and `:latest-agent` with Claude Code and `gh` for `weekly`. Versioned tags exist too:
|
|
19
|
+
Images (linux/amd64 and arm64): `ghcr.io/appeeky/appeeky-spec:latest`, and `:latest-agent` with Claude Code and `gh` for `weekly`. Versioned tags exist too, one per release: `:<x.y.z>`, `:<x.y>`, `:<x.y.z>-agent`, `:<x.y>-agent` (the version on npm, `npm view @appeeky/spec version`).
|
|
20
20
|
|
|
21
21
|
## 1. Choose where (the person decides)
|
|
22
22
|
|
|
@@ -32,7 +32,10 @@ docker run --rm --env-file app.env ghcr.io/appeeky/appeeky-spec push # ever
|
|
|
32
32
|
docker run --rm --env-file app.env ghcr.io/appeeky/appeeky-spec:latest-agent weekly
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Before choosing, make sure the repo is ready: `appeeky.spec.yaml` committed,
|
|
35
|
+
Before choosing, make sure the repo is ready: `appeeky.spec.yaml` committed, store access, and for `weekly` the files `npx @appeeky/spec agents install` writes, committed. Store access is one of:
|
|
36
|
+
|
|
37
|
+
- **Hosted** (`via: auto` or `hosted`): the stores are connected in Appeeky for the account `APPEEKY_API_KEY` belongs to. A valid key from another account (an internal or service key) fails with "No appeeky-web account found"; `doctor` now calls the gateway and says so.
|
|
38
|
+
- **The person's own store keys** (`via: auto` or `local`): the image has no store CLIs installed, so Spec runs them through npx (a pinned version) with the keys from the environment: `ASC_KEY_ID`, `ASC_ISSUER_ID` and `ASC_PRIVATE_KEY` (the .p8 contents) or `ASC_PRIVATE_KEY_PATH`; `GPS_CREDENTIALS` (the service account JSON) or `GOOGLE_APPLICATION_CREDENTIALS` (a path). Mount key files read-only (`./keys:/keys:ro`) and point the variables at `/keys/…`. With these set, `auto` uses them before the hosted gateway.
|
|
36
39
|
|
|
37
40
|
## 2. Install on the VM (over SSH)
|
|
38
41
|
|
|
@@ -61,7 +64,7 @@ ssh <host> 'chmod 600 ~/appeeky-spec/.env'
|
|
|
61
64
|
grep -oE '^[A-Z_]+=.' .env | cut -d= -f1 # names that have a value
|
|
62
65
|
```
|
|
63
66
|
|
|
64
|
-
`.env` variables
|
|
67
|
+
`.env` variables:
|
|
65
68
|
|
|
66
69
|
| Variable | What to put |
|
|
67
70
|
| --- | --- |
|
|
@@ -69,6 +72,8 @@ grep -oE '^[A-Z_]+=.' .env | cut -d= -f1 # names that have a value
|
|
|
69
72
|
| `GITHUB_TOKEN` | fine-grained token, "Only select repositories" → this repo, Contents: Read and write; Pull requests: Read and write too for `weekly`. Passed to git through a credential helper, never in a URL or log |
|
|
70
73
|
| `APPEEKY_API_KEY` | appeeky.com/dashboard/settings: store access, analytics, AI visibility |
|
|
71
74
|
| `BRANCH` (`main`), `SPEC_DIR` (`.`) | the branch merges land on; the folder with `appeeky.spec.yaml` |
|
|
75
|
+
| `COMMIT_TO=pr` | `daily` commits to one pull request (`appeeky-spec/daily`, updated every day until merged) instead of straight to `BRANCH`, for a protected main. `push` still commits to `BRANCH`: it records there what it sent, so nothing goes out twice; let the token bypass the protection |
|
|
76
|
+
| `ASC_KEY_ID`, `ASC_ISSUER_ID`, `ASC_PRIVATE_KEY` / `ASC_PRIVATE_KEY_PATH`; `GPS_CREDENTIALS` / `GOOGLE_APPLICATION_CREDENTIALS` | the person's own store keys instead of the hosted gateway (see above) |
|
|
72
77
|
| `DAILY_AT` (`0 6 * * *`), `PUSH_EVERY` (`*/15 * * * *`, `off` to push by hand), `WEEKLY_AT` (off, e.g. `0 7 * * 1`) | cron times, UTC |
|
|
73
78
|
| `PUSH_DRY_RUN=1` | `push` only shows what it would change, sends nothing |
|
|
74
79
|
| `HEALTHCHECK_URL` | e.g. a healthchecks.io ping URL; `daily` pings it on success, `<url>/fail` on failure |
|
|
@@ -87,6 +92,8 @@ The paid keys (`DATAFORSEO_*`, `VISIBILITY_EVERY`, `FAL_KEY`) start spending on
|
|
|
87
92
|
|
|
88
93
|
## 3. First run
|
|
89
94
|
|
|
95
|
+
`docker compose run --rm appeeky-spec preflight` checks now what the routines need: the spec in the repo, the weekly prompt, image and Claude token when `WEEKLY_AT` is set, and `doctor`, which calls the hosted gateways. `schedule` runs it on start too, so a missing piece shows in the first log lines, not on Monday.
|
|
96
|
+
|
|
90
97
|
1. Start with `PUSH_DRY_RUN=1` in `.env`, then `docker compose up -d` and `docker compose logs -f`. Healthy output:
|
|
91
98
|
|
|
92
99
|
```
|
|
@@ -105,8 +112,9 @@ supercronic adds its own lines around each job. `Dry run: started following main
|
|
|
105
112
|
|
|
106
113
|
## 4. Operate it
|
|
107
114
|
|
|
108
|
-
- **Update:** `docker compose pull && docker compose up -d`. To pin, set `APPEEKY_SPEC_IMAGE=ghcr.io/appeeky/appeeky-spec
|
|
115
|
+
- **Update:** `docker compose pull && docker compose up -d`. To pin, set `APPEEKY_SPEC_IMAGE=ghcr.io/appeeky/appeeky-spec:<x.y>-agent` (or without `-agent`) and change it deliberately: 0.x releases can change commands and files.
|
|
109
116
|
- **Reboots:** `restart: unless-stopped` plus Docker enabled at boot brings it back. A container stopped with `docker compose stop` stays stopped; `docker compose up -d` again.
|
|
117
|
+
- **Analytics CSVs:** `data pull` runs in `weekly`. `.appeeky/data/` is gitignored and every run starts from a fresh clone, so on a server they do not pile up: each weekly run reads the last 90 days. To keep a growing history, set `data: { commit: true }` in the spec (it commits revenue and other business data to the repo).
|
|
110
118
|
- **Status:** `docker compose ps`, `docker compose logs --since 24h`. Logs rotate at 3 × 10 MB.
|
|
111
119
|
- **Several apps:** one service and one env file each (`chmod 600` every one). Never point two services or two hosts at the same repo.
|
|
112
120
|
|
|
@@ -136,7 +144,7 @@ services:
|
|
|
136
144
|
- Nothing ever pushed: merges land on another branch than `BRANCH`, or the listing change is outside `appeeky.spec.yaml` / `appeeky/store` (under `SPEC_DIR`).
|
|
137
145
|
- `Fix these first, or pass --force.`: `check` found errors in the merged listing. Fix in a pull request; never add `--force`.
|
|
138
146
|
- `<n> change(s) wait for the store`: name, subtitle or keywords need a new App Store version; a person runs `push --create-version <x.y.z>`. The tag stays, so it retries.
|
|
139
|
-
- Store errors: the store is not connected in Appeeky, `APPEEKY_API_KEY` missing, or
|
|
147
|
+
- Store errors: the store is not connected in Appeeky for the key's account (`No appeeky-web account found`), `APPEEKY_API_KEY` missing, or `via: local` without store keys in the environment.
|
|
140
148
|
- Daily red at `verify --playbook`: the one daily step that fails the run; run `npx @appeeky/spec verify --playbook --json` in the repo.
|
|
141
149
|
- Weekly: `This image has no agent` (use `:latest-agent`), `Set CLAUDE_CODE_OAUTH_TOKEN …`, `No review prompt …` (commit `agents install` output), `Nothing proposed.` (often no store is free to change).
|
|
142
150
|
3. Run `npx @appeeky/spec doctor --json` locally in the repo with the same keys for anything else. Propose fixes to the repo as a pull request.
|
|
@@ -154,6 +162,6 @@ services:
|
|
|
154
162
|
- Turning off `PUSH_DRY_RUN` before the person has seen the dry runs and agreed.
|
|
155
163
|
- Running the same repo from two hosts (or the server and a second copy) at once: double commits and pushes.
|
|
156
164
|
- Using `:latest` with `WEEKLY_AT` set: `weekly` needs `:latest-agent`.
|
|
157
|
-
- Setting `via: local`
|
|
165
|
+
- Setting `via: local` in a container without store keys in its environment (it has no saved accounts).
|
|
158
166
|
- Adding paid keys (DataForSEO, `VISIBILITY_EVERY`, `FAL_KEY`) the person did not ask for.
|
|
159
167
|
- Forcing a push (`--force`) or running `push --yes` by hand to "unstick" the routine: fix the cause and let the next run push.
|
|
@@ -9,6 +9,7 @@ APPEEKY_API_KEY=
|
|
|
9
9
|
# Optional
|
|
10
10
|
# BRANCH=main
|
|
11
11
|
# SPEC_DIR=. # the folder with appeeky.spec.yaml
|
|
12
|
+
# COMMIT_TO=pr # daily: one pull request (appeeky-spec/daily) instead of commits to BRANCH, for a protected main
|
|
12
13
|
# DAILY_AT=0 6 * * * # UTC
|
|
13
14
|
# PUSH_EVERY=*/15 * * * * # "off" to push by hand
|
|
14
15
|
# The weekly agent: use the latest-agent image and one of these.
|
|
@@ -33,3 +34,8 @@ APPEEKY_API_KEY=
|
|
|
33
34
|
# OPENAI_API_KEY= # ChatGPT
|
|
34
35
|
# GEMINI_API_KEY= # Gemini
|
|
35
36
|
# PERPLEXITY_API_KEY= # Perplexity (ANTHROPIC_API_KEY above adds Claude)
|
|
37
|
+
# Your own store keys instead of the hosted gateway (mount key files read-only, e.g. ./keys:/keys:ro):
|
|
38
|
+
# ASC_KEY_ID=
|
|
39
|
+
# ASC_ISSUER_ID=
|
|
40
|
+
# ASC_PRIVATE_KEY_PATH=/keys/AuthKey.p8
|
|
41
|
+
# GOOGLE_APPLICATION_CREDENTIALS=/keys/google-play.json # or GPS_CREDENTIALS with the JSON itself
|