@appeeky/spec 0.8.0 → 0.10.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 +7 -4
- package/dist/alerts.d.ts +10 -0
- package/dist/alerts.js +25 -0
- 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 +168 -38
- 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 +45 -6
- package/dist/schema.js +13 -1
- package/dist/search-ads.js +2 -2
- package/dist/setup.d.ts +15 -0
- package/dist/setup.js +95 -10
- package/dist/social.d.ts +67 -6
- package/dist/social.js +140 -7
- 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-automation/SKILL.md +2 -2
- package/skills/appeeky-spec-server/SKILL.md +16 -7
- package/skills/appeeky-spec-server/files/env.example +6 -0
- package/skills/appeeky-spec-social/SKILL.md +14 -5
package/dist/social.js
CHANGED
|
@@ -25,7 +25,15 @@ export const socialDir = (root) => join(root, SPEC_DIR, "social");
|
|
|
25
25
|
export const draftsDir = (root) => join(socialDir(root), "drafts");
|
|
26
26
|
const compact = (o) => Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined && v !== null && v !== ""));
|
|
27
27
|
export function toAccount(r) {
|
|
28
|
-
|
|
28
|
+
const problem = r.needsReconnect ? "needs reconnecting" : r.isActive === false ? "turned off" : undefined;
|
|
29
|
+
return {
|
|
30
|
+
id: r.id,
|
|
31
|
+
platform: r.platform,
|
|
32
|
+
name: r.displayName || r.platformUserId || r.platform,
|
|
33
|
+
active: !problem,
|
|
34
|
+
...(problem ? { problem } : {}),
|
|
35
|
+
...(r.lastError?.trim() ? { lastError: r.lastError.trim() } : {}),
|
|
36
|
+
};
|
|
29
37
|
}
|
|
30
38
|
export function toPost(r, analytics = []) {
|
|
31
39
|
return compact({
|
|
@@ -122,9 +130,26 @@ async function perAccount(accounts, what, warnings, fetchOne, map, skip = []) {
|
|
|
122
130
|
* Connected accounts and the latest posts made through Appeeky, with analytics for the ones that
|
|
123
131
|
* went out; then, per account, the posts made in the platform's app, recent comments and followers.
|
|
124
132
|
*/
|
|
133
|
+
/** Whether an account is one of `only` (ids, handles, names or platform:handle, as in `social.accounts`). */
|
|
134
|
+
export function accountMatches(a, only) {
|
|
135
|
+
const handles = accountHandles(a);
|
|
136
|
+
return only.some((ref) => {
|
|
137
|
+
const r = ref.trim().toLowerCase();
|
|
138
|
+
if (r === a.id.toLowerCase())
|
|
139
|
+
return true;
|
|
140
|
+
const m = /^([a-z]+):(.+)$/.exec(r);
|
|
141
|
+
if (m)
|
|
142
|
+
return platformKey(m[1]) === platformKey(a.platform) && handles.includes(m[2]);
|
|
143
|
+
return handles.includes(r);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
125
146
|
export async function fetchSocial(api, options = {}) {
|
|
126
|
-
const
|
|
127
|
-
const
|
|
147
|
+
const all = ((await api.get("/connect/social/accounts")) ?? []).map(toAccount);
|
|
148
|
+
const accounts = options.only?.length ? all.filter((a) => accountMatches(a, options.only)) : all;
|
|
149
|
+
const allRows = (await api.get("/social/posts", { limit: String(options.limit ?? 100) })) ?? [];
|
|
150
|
+
// Posts made through Appeeky name platforms, not accounts: with social.accounts, keep those on this app's platforms.
|
|
151
|
+
const platforms = new Set(accounts.map((a) => platformKey(a.platform)));
|
|
152
|
+
const rows = options.only?.length ? allRows.filter((r) => (r.social_media_platform_posts ?? []).some((p) => platforms.has(platformKey(p.platform)))) : allRows;
|
|
128
153
|
const posts = [];
|
|
129
154
|
for (const row of rows) {
|
|
130
155
|
const published = (row.social_media_platform_posts ?? []).some((p) => p.published_at);
|
|
@@ -143,8 +168,11 @@ const total = (p, k) => p.metrics?.[k] ?? 0;
|
|
|
143
168
|
/** The reach of a post on one platform: views when the platform reports them, else impressions or reach. */
|
|
144
169
|
const seen = (p) => total(p, "views") || total(p, "impressions") || total(p, "reach");
|
|
145
170
|
const score = (p) => seen(p) + total(p, "likes") * 10;
|
|
171
|
+
/** Text without a caption (an emoji-only or image comment, a video posted without one) arrives without `text`. */
|
|
146
172
|
const oneLine = (text, max) => {
|
|
147
|
-
const t = text.replace(/\s+/g, " ").trim();
|
|
173
|
+
const t = (text ?? "").replace(/\s+/g, " ").trim();
|
|
174
|
+
if (!t)
|
|
175
|
+
return "(no text)";
|
|
148
176
|
return `${t.slice(0, max)}${t.length > max ? "…" : ""}`;
|
|
149
177
|
};
|
|
150
178
|
const signed = (n) => (n > 0 ? `+${n}` : String(n));
|
|
@@ -222,7 +250,7 @@ const jsonl = (rows) => rows.map((r) => JSON.stringify(r)).join("\n") + (rows.le
|
|
|
222
250
|
export async function saveSocial(root, data, now = new Date()) {
|
|
223
251
|
const dir = socialDir(root);
|
|
224
252
|
await mkdir(dir, { recursive: true });
|
|
225
|
-
await writeFile(join(dir, "accounts.yaml"), YAML.stringify({ accounts: data.accounts }, { lineWidth: 0 }));
|
|
253
|
+
await writeFile(join(dir, "accounts.yaml"), YAML.stringify({ checkedAt: now.toISOString(), accounts: data.accounts }, { lineWidth: 0 }));
|
|
226
254
|
await writeFile(join(dir, "posts.jsonl"), jsonl(data.posts));
|
|
227
255
|
if (data.nativePosts)
|
|
228
256
|
await writeFile(join(dir, "native-posts.jsonl"), jsonl(data.nativePosts));
|
|
@@ -240,12 +268,106 @@ export async function saveSocial(root, data, now = new Date()) {
|
|
|
240
268
|
const more = { nativePosts: await kept("native-posts.jsonl", data.nativePosts), comments: await kept("comments.jsonl", data.comments), insights };
|
|
241
269
|
await writeFile(join(dir, "summary.md"), summaryMarkdown(data.accounts, data.posts, now, more));
|
|
242
270
|
}
|
|
271
|
+
/** accounts.yaml with the time of the social pull that wrote it (absent in files from before 0.10). */
|
|
272
|
+
export async function readAccountsFile(root) {
|
|
273
|
+
const file = join(socialDir(root), "accounts.yaml");
|
|
274
|
+
if (!existsSync(file))
|
|
275
|
+
return { accounts: [] };
|
|
276
|
+
const parsed = YAML.parse(await readFile(file, "utf8"));
|
|
277
|
+
return { accounts: parsed?.accounts ?? [], ...(parsed?.checkedAt ? { checkedAt: parsed.checkedAt } : {}) };
|
|
278
|
+
}
|
|
243
279
|
export async function readAccounts(root) {
|
|
244
280
|
const file = join(socialDir(root), "accounts.yaml");
|
|
245
281
|
if (!existsSync(file))
|
|
246
282
|
return [];
|
|
247
283
|
return (YAML.parse(await readFile(file, "utf8"))?.accounts ?? []);
|
|
248
284
|
}
|
|
285
|
+
// ── Account health ──────────────────────────────────────────────────────────
|
|
286
|
+
/**
|
|
287
|
+
* The platforms keep a connection only so long: a revoked permission, a changed password or a
|
|
288
|
+
* token the platform will not refresh, and Appeeky marks the account `needsReconnect`. Nothing
|
|
289
|
+
* posts or reads on it until someone signs in again, so Spec says so wherever it looks (social
|
|
290
|
+
* pull, doctor, the daily alerts) and `social connect` gives the sign-in link, without the dashboard.
|
|
291
|
+
*/
|
|
292
|
+
export const reconnectCommand = (platform) => `appeeky-spec social connect ${platformKey(platform)}`;
|
|
293
|
+
/** Accounts that cannot post or be read, and entries under social.accounts that no connected account matches. */
|
|
294
|
+
export function accountProblems(accounts, only = []) {
|
|
295
|
+
const out = [];
|
|
296
|
+
for (const a of accounts) {
|
|
297
|
+
if (a.active)
|
|
298
|
+
continue;
|
|
299
|
+
out.push({
|
|
300
|
+
platform: platformKey(a.platform),
|
|
301
|
+
account: a,
|
|
302
|
+
message: `${a.platform} ${accountLabel(a)} ${a.problem ?? "stopped working"}${a.lastError ? ` (${a.lastError})` : ""}`,
|
|
303
|
+
fix: `Run \`${reconnectCommand(a.platform)}\` and sign in with the link it gives, or reconnect it at appeeky.com/dashboard.`,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
for (const ref of only) {
|
|
307
|
+
if (accounts.some((a) => accountMatches(a, [ref])))
|
|
308
|
+
continue;
|
|
309
|
+
const platform = platformKey(/^([a-z]+):/i.exec(ref.trim())?.[1] ?? ref.trim());
|
|
310
|
+
out.push({
|
|
311
|
+
platform,
|
|
312
|
+
ref,
|
|
313
|
+
message: `${ref} is under social.accounts but not connected in Appeeky`,
|
|
314
|
+
fix: `Run \`${reconnectCommand(platform)}\`, connect it at appeeky.com/dashboard, or take it out of social.accounts.`,
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
return out;
|
|
318
|
+
}
|
|
319
|
+
export const listAccountRows = async (api) => (await api.get("/connect/social/accounts")) ?? [];
|
|
320
|
+
/** The Appeeky API route that starts a sign-in for a platform: GET, `account_id` to reconnect one account. */
|
|
321
|
+
export const connectPath = (platform) => `/connect/social/accounts/connect/${encodeURIComponent(platformKey(platform))}`;
|
|
322
|
+
export class ConnectUnavailableError extends Error {
|
|
323
|
+
constructor(platform) {
|
|
324
|
+
super(`The Appeeky API does not hand out sign-in links yet (${connectPath(platform)} is not there). Reconnect ${platform} at appeeky.com/dashboard for now; \`social connect\` works as soon as the API has the route.`);
|
|
325
|
+
this.name = "ConnectUnavailableError";
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
/** A sign-in link for a platform, from the Appeeky API (which keeps the platform tokens and refreshes them). */
|
|
329
|
+
export async function connectLink(api, platform, accountId) {
|
|
330
|
+
let data;
|
|
331
|
+
try {
|
|
332
|
+
data = await api.get(connectPath(platform), accountId ? { account_id: accountId } : {});
|
|
333
|
+
}
|
|
334
|
+
catch (e) {
|
|
335
|
+
if (e instanceof AppeekyApiError && e.status === 404)
|
|
336
|
+
throw new ConnectUnavailableError(platform);
|
|
337
|
+
throw e;
|
|
338
|
+
}
|
|
339
|
+
const url = data?.authUrl ?? data?.url;
|
|
340
|
+
if (!url)
|
|
341
|
+
throw new Error(`The Appeeky API gave no sign-in link for ${platform}.`);
|
|
342
|
+
return { url, ...(data?.handoff?.url ? { phoneUrl: data.handoff.url } : {}), ...((data?.handoff?.expiresAt ?? data?.expiresAt) ? { expiresAt: data?.handoff?.expiresAt ?? data?.expiresAt } : {}) };
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Waits until the sign-in lands: an account on the platform that works and is new, was broken
|
|
346
|
+
* before, or changed since (a fresh sign-in on an account that already worked). Null on timeout.
|
|
347
|
+
*/
|
|
348
|
+
export async function waitForConnection(api, platform, before, options = {}) {
|
|
349
|
+
const { timeoutMs = 600_000, intervalMs = 5_000 } = options;
|
|
350
|
+
const sleep = options.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
351
|
+
const now = options.now ?? Date.now;
|
|
352
|
+
const key = platformKey(platform);
|
|
353
|
+
const end = now() + timeoutMs;
|
|
354
|
+
for (;;) {
|
|
355
|
+
const rows = await listAccountRows(api).catch(() => null);
|
|
356
|
+
for (const row of rows ?? []) {
|
|
357
|
+
if (platformKey(row.platform) !== key || (options.accountId && row.id !== options.accountId))
|
|
358
|
+
continue;
|
|
359
|
+
const account = toAccount(row);
|
|
360
|
+
if (!account.active)
|
|
361
|
+
continue;
|
|
362
|
+
const prev = before.find((b) => b.id === row.id);
|
|
363
|
+
if (!prev || !toAccount(prev).active || prev.updatedAt !== row.updatedAt)
|
|
364
|
+
return account;
|
|
365
|
+
}
|
|
366
|
+
if (now() >= end)
|
|
367
|
+
return null;
|
|
368
|
+
await sleep(intervalMs);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
249
371
|
// ── Drafts ──────────────────────────────────────────────────────────────────
|
|
250
372
|
/** TikTok's posting options, in the words a draft uses; each maps to a key of `extra.tiktok` in the API. */
|
|
251
373
|
export const PRIVACY = { public: "PUBLIC_TO_EVERYONE", friends: "MUTUAL_FOLLOW_FRIENDS", followers: "FOLLOWER_OF_CREATOR", only_me: "SELF_ONLY" };
|
|
@@ -487,8 +609,19 @@ function tiktokIssues(draft, toTikTok) {
|
|
|
487
609
|
export function draftIssues(draft, accounts, now = new Date()) {
|
|
488
610
|
const issues = [];
|
|
489
611
|
const { accounts: to, missing, ambiguous } = resolveAccounts(draft, accounts);
|
|
490
|
-
|
|
491
|
-
|
|
612
|
+
// A ref that only matches accounts that stopped working: say how to bring them back.
|
|
613
|
+
const everyone = accounts.map((a) => ({ ...a, active: true }));
|
|
614
|
+
const unknown = [];
|
|
615
|
+
for (const ref of missing) {
|
|
616
|
+
const broken = resolveAccounts({ accounts: [ref] }, everyone).accounts.filter((a) => !accounts.find((x) => x.id === a.id)?.active);
|
|
617
|
+
if (broken.length)
|
|
618
|
+
for (const a of broken)
|
|
619
|
+
issues.push(`${a.platform} ${accountLabel(a)} ${a.problem ?? "stopped working"}: run \`${reconnectCommand(a.platform)}\``);
|
|
620
|
+
else
|
|
621
|
+
unknown.push(ref);
|
|
622
|
+
}
|
|
623
|
+
if (unknown.length)
|
|
624
|
+
issues.push(`no connected account for ${unknown.join(", ")}`);
|
|
492
625
|
for (const a of ambiguous) {
|
|
493
626
|
issues.push(a.platform
|
|
494
627
|
? `${a.ref} matches ${a.choices.length} ${a.platform} accounts (${a.choices.join(", ")}): name the ones to post on, e.g. ${a.platform}:${a.choices[0]}, or write ${a.platform}:all to post on all ${a.choices.length}`
|
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.10.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
|
|
|
@@ -52,11 +52,11 @@ The push workflow reads `APPEEKY_API_KEY`, or your own store keys from secrets o
|
|
|
52
52
|
|
|
53
53
|
## 3. Alerts
|
|
54
54
|
|
|
55
|
-
`alerts` turns the files the daily run wrote into what needs a person: `rank-drop` (from the ranks in `appeeky/releases/`), `release-lost`, `category-drop`, `low-ratings`, `competitor-change` (on targets only), `visibility-drop`, `search-drop` (`appeeky/seo/daily.csv`)
|
|
55
|
+
`alerts` turns the files the daily run wrote into what needs a person: `rank-drop` (from the ranks in `appeeky/releases/`), `release-lost`, `category-drop`, `low-ratings`, `competitor-change` (on targets only), `visibility-drop`, `search-drop` (`appeeky/seo/daily.csv`), `late-check` and `social-account` (`appeeky/social/accounts.yaml`: an account that needs reconnecting, critical, or a `social.accounts` entry not connected). Each has `severity` (`warn`/`critical`), `numbers`, `window`, `source` and `next`. It makes no network call except the delivery flags.
|
|
56
56
|
|
|
57
57
|
- Read them: `alerts --json` (`--new` for the ones not reported yet). `--markdown -o <file>` writes an issue body; the file is empty when nothing is open.
|
|
58
58
|
- Dedupe: `--record` writes `appeeky/alerts.json`; the daily run commits it, so an alert is new once, again when it turns critical, and again only after it cleared and came back. Never hand-edit it; delete it to report everything again.
|
|
59
|
-
- Thresholds: `alerts:` in `appeeky.spec.yaml` (`rank-drop.places`, `category-drop.places`/`days`, `low-ratings.days`/`min`/`ratio`, `search-drop.days`/`drop`/`min`, `competitor-change.days`, `visibility-drop.days`, `release-lost.days`, `late-check.days`), `off: [<kind>]` to turn kinds off. Too noisy: raise a threshold or turn the kind off in a pull request, not by deleting the state file.
|
|
59
|
+
- Thresholds: `alerts:` in `appeeky.spec.yaml` (`rank-drop.places`, `category-drop.places`/`days`, `low-ratings.days`/`min`/`ratio`, `search-drop.days`/`drop`/`min`, `competitor-change.days`, `visibility-drop.days`, `release-lost.days`, `late-check.days`, `social-account.days`), `off: [<kind>]` to turn kinds off. Too noisy: raise a threshold or turn the kind off in a pull request, not by deleting the state file.
|
|
60
60
|
- GitHub: `listing-daily.yml` runs `alerts --new -o .appeeky/alerts-new.md` and `alerts --record -o .appeeky/alerts.md`, then with `gh` keeps one open issue labelled `appeeky-spec-alert` (body: every open alert; a comment with the new ones; closed when the file is empty). A `listing-daily.yml` from an older version has neither the steps nor `issues: write`: delete it and run `init --ci` again (doctor's `alerts` line says so).
|
|
61
61
|
- Docker `daily`: `alerts --record`, plus `--webhook` when `ALERT_WEBHOOK_URL` is set (Slack-compatible `{"text"}`, new alerts only) and `--issue` when `GITHUB_TOKEN` is set (same issue through the GitHub API; needs Issues: Read and write; `ALERT_ISSUE=0` skips it). A failed post is not recorded and is retried the next day. `! GitHub answered 403 … Issues: Read and write` in the log: add that permission to the token or set `ALERT_ISSUE=0`.
|
|
62
62
|
- Other CI or cron: `alerts --record --webhook` (and `--issue` with `GITHUB_TOKEN`) after the daily commands, then commit `appeeky/alerts.json`.
|
|
@@ -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.2.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,9 +112,11 @@ 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.
|
|
119
|
+
- **A social account stopped working** (the `social-account` alert, or a `social` warning in the preflight): the person signs in again. `docker compose exec spec appeeky-spec social connect tiktok` prints the sign-in link (and one for the phone) and waits until the account works; give them the link, the sign-in is theirs. Until the Appeeky API hands out links, it says so and they reconnect at appeeky.com/dashboard.
|
|
111
120
|
- **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
121
|
|
|
113
122
|
```yaml
|
|
@@ -136,7 +145,7 @@ services:
|
|
|
136
145
|
- 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
146
|
- `Fix these first, or pass --force.`: `check` found errors in the merged listing. Fix in a pull request; never add `--force`.
|
|
138
147
|
- `<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
|
|
148
|
+
- 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
149
|
- Daily red at `verify --playbook`: the one daily step that fails the run; run `npx @appeeky/spec verify --playbook --json` in the repo.
|
|
141
150
|
- 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
151
|
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 +163,6 @@ services:
|
|
|
154
163
|
- Turning off `PUSH_DRY_RUN` before the person has seen the dry runs and agreed.
|
|
155
164
|
- Running the same repo from two hosts (or the server and a second copy) at once: double commits and pushes.
|
|
156
165
|
- Using `:latest` with `WEEKLY_AT` set: `weekly` needs `:latest-agent`.
|
|
157
|
-
- Setting `via: local`
|
|
166
|
+
- Setting `via: local` in a container without store keys in its environment (it has no saved accounts).
|
|
158
167
|
- Adding paid keys (DataForSEO, `VISIBILITY_EVERY`, `FAL_KEY`) the person did not ask for.
|
|
159
168
|
- 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
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
name: appeeky-spec-social
|
|
3
3
|
description: Draft, check and measure organic social posts, and handle comments, in an Appeeky Spec repo (appeeky/social/). Use when asked what to post this week, to announce a release or feature on X, Instagram, TikTok, LinkedIn, Pinterest, Reddit, YouTube, Threads, Facebook or Bluesky, to write or fix a post draft, why `social check` fails, how past posts did, which hooks work, to schedule posts, or to answer, hide, like or delete comments. Posts go out only after a person merges them. For making a creator video see appeeky-spec-ugc; for the store listing see appeeky-spec.
|
|
4
4
|
metadata:
|
|
5
|
-
version: 1.
|
|
5
|
+
version: 1.1.0
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Organic social with Appeeky Spec
|
|
9
9
|
|
|
10
|
-
Posts are files. You draft them in `appeeky/social/drafts/`, a person reviews them in a pull request, and they go out after the merge through the accounts connected in Appeeky. Needs `APPEEKY_API_KEY` and the Startup plan or above in Appeeky; accounts are connected in Appeeky, not in the repo.
|
|
10
|
+
Posts are files. You draft them in `appeeky/social/drafts/`, a person reviews them in a pull request, and they go out after the merge through the accounts connected in Appeeky. Needs `APPEEKY_API_KEY` and the Startup plan or above in Appeeky; accounts are connected in Appeeky (which keeps their tokens and refreshes them), not in the repo; `social connect <platform>` gives the sign-in link to connect or reconnect one without the dashboard.
|
|
11
11
|
|
|
12
12
|
Run commands as `npx @appeeky/spec <command> --json`.
|
|
13
13
|
|
|
@@ -17,17 +17,25 @@ Run commands as `npx @appeeky/spec <command> --json`.
|
|
|
17
17
|
|
|
18
18
|
| File | Holds |
|
|
19
19
|
| --- | --- |
|
|
20
|
-
| `accounts.yaml` | connected accounts: `id`, `platform`, `name`, `active`. Draft only for
|
|
20
|
+
| `accounts.yaml` | `checkedAt` and the connected accounts: `id`, `platform`, `name`, `active`, and for one that does not work `problem` (`needs reconnecting`, `turned off`) and `lastError`. Draft only for active ones |
|
|
21
21
|
| `posts.jsonl` | posts made through Appeeky: `status`, `text`, `scheduledFor`, per platform `url`, `publishedAt`, `error`, `draft` (in the TikTok inbox) and `metrics` (views, impressions, reach, likes, comments, shares, reposts, saves, clicks) |
|
|
22
22
|
| `native-posts.jsonl` | posts made in each platform's own app, same metrics. Often most of an account's history |
|
|
23
23
|
| `comments.jsonl` | recent comments (`own: true` is the account itself, `repliedAt` means answered) |
|
|
24
24
|
| `insights.yaml` | followers and growth per account |
|
|
25
25
|
| `summary.md` | last 30 days per platform and account, the posts that did best, what sits in the TikTok inbox, what is waiting to go out |
|
|
26
26
|
|
|
27
|
-
The JSON output has counts and `
|
|
27
|
+
The JSON output has counts, `warnings` and `problems` (accounts that stopped working, and `social.accounts` entries no connected account matches, each with its `fix`). A file the API could not fill this time is kept from the last pull. If `appeeky/social/` is missing, the key or the connected accounts are missing: say so, do not guess handles.
|
|
28
28
|
|
|
29
29
|
Also read before drafting: existing drafts (do not repeat one), `whatsNew` in `appeeky/store/**`, `status --json` and `log --json` (what shipped and won), `appeeky/reviews/summary.md` (what users love, in their words), `.appeeky/data/README.md` and the attribution files it lists (which channels and smart links bring installs that pay), and UGC experiments in `appeeky/experiments/` so posts and creator videos do not repeat each other.
|
|
30
30
|
|
|
31
|
+
### Accounts that stop working
|
|
32
|
+
|
|
33
|
+
A platform drops the connection when someone revokes the permission, changes the password, or the token can no longer be refreshed; Appeeky then marks the account `needsReconnect`. Nothing posts or reads on it until a person signs in again. Spec reports it everywhere it looks: `social pull` (a `fix` line), `doctor` (a `social` warning to look at, also in the server's preflight), the daily `alerts` (`social-account`, critical) and `social check` (`… needs reconnecting: run \`appeeky-spec social connect <platform>\``).
|
|
34
|
+
|
|
35
|
+
`social connect <platform>` asks the Appeeky API for a sign-in link (and one for the phone, where the TikTok or Instagram app is signed in), prints it and waits until the account works (`--no-wait` to only print it, `--timeout <seconds>`, `--account @handle` when the platform has several). With one broken account on the platform it reconnects that one. It needs no spec, so on a Docker host: `docker compose exec spec appeeky-spec social connect tiktok`. The sign-in is the person's to do: give them the link, never sign in for them. If the API answers that it does not hand out links yet, the person reconnects at appeeky.com/dashboard.
|
|
36
|
+
|
|
37
|
+
`social.accounts` in `appeeky.spec.yaml` (`["instagram:@app", "tiktok:@app"]`) limits pull, doctor and the alerts to this app's accounts when the Appeeky account has others connected.
|
|
38
|
+
|
|
31
39
|
## 2. Decide what to post
|
|
32
40
|
|
|
33
41
|
- One reason per post: a new version or feature, a result worth saying plainly (a rank won, a rating that rose), something users praise that posts never mention, a question commenters keep asking.
|
|
@@ -82,7 +90,7 @@ Put a smart link in the text when `attribution:` is set up, one per post or chan
|
|
|
82
90
|
|
|
83
91
|
`social check --json` checks every draft still marked `draft` against `accounts.yaml` and exits 1 on any issue (`{ drafts: [{ file, issues }] }`). Fix and run again until `issues` is empty everywhere. The reasons it refuses:
|
|
84
92
|
|
|
85
|
-
- `no connected account for …`; `… matches N … accounts (…): name the ones to post on … or write <platform>:all`
|
|
93
|
+
- `<platform> <handle> needs reconnecting: run \`appeeky-spec social connect <platform>\`` (tell the person, do not draft around it); `no connected account for …`; `… matches N … accounts (…): name the ones to post on … or write <platform>:all`
|
|
86
94
|
- `<platform>: <n>/<limit> characters`
|
|
87
95
|
- `<platform> needs an image or video (media:)`, `youtube needs a video`, `youtube: needs exactly one video (media:), and no images`
|
|
88
96
|
- `a post is either images or one video, not both`, `<n> images, at most <m>`, `<n> videos, at most <m>`
|
|
@@ -116,6 +124,7 @@ After the next `social pull` (daily in `listing-daily.yml`), find the sent post
|
|
|
116
124
|
|
|
117
125
|
## Mistakes to avoid
|
|
118
126
|
|
|
127
|
+
- Treating a `needs reconnecting` account as gone, or moving its post to another platform without asking: give the person the `social connect` link.
|
|
119
128
|
- Drafting for a handle that is not in `accounts.yaml`, or a bare platform name when it has several accounts.
|
|
120
129
|
- One text pasted to every platform: an X post over 280, a Reddit post with no subreddit, Instagram/TikTok/YouTube without media.
|
|
121
130
|
- Promoting the app on TikTok without `disclosure: own_brand`, or posting an AI clip without `inbox_draft: true` / `synthetic_media: true`.
|