@appeeky/spec 0.6.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/files.js CHANGED
@@ -98,6 +98,15 @@ export function stringifySpec(spec) {
98
98
  if (v === undefined || (Array.isArray(v) ? v.length === 0 : Object.keys(v).length === 0))
99
99
  delete clean[k];
100
100
  }
101
+ // Alert thresholds: only the ones that differ from the defaults are written.
102
+ if (clean.alerts && typeof clean.alerts === "object") {
103
+ const defaults = specFileSchema.shape.alerts.parse(undefined);
104
+ const own = Object.fromEntries(Object.entries(clean.alerts).filter(([k, v]) => v !== undefined && JSON.stringify(v) !== JSON.stringify(defaults[k])));
105
+ if (Object.keys(own).length)
106
+ clean.alerts = own;
107
+ else
108
+ delete clean.alerts;
109
+ }
101
110
  const doc = new YAML.Document(clean);
102
111
  doc.commentBefore =
103
112
  " Appeeky Spec: your app's store presence as a spec.\n Docs: https://docs.appeeky.com/docs/spec";
package/dist/reviews.d.ts CHANGED
@@ -102,15 +102,15 @@ export declare const replySchema: z.ZodObject<{
102
102
  store: "app-store" | "google-play";
103
103
  id: string;
104
104
  text: string;
105
- sentAt?: string | undefined;
106
105
  review?: string | undefined;
106
+ sentAt?: string | undefined;
107
107
  }, {
108
108
  store: "app-store" | "google-play";
109
109
  id: string;
110
110
  text: string;
111
111
  status?: "draft" | "sent" | undefined;
112
- sentAt?: string | undefined;
113
112
  review?: string | undefined;
113
+ sentAt?: string | undefined;
114
114
  }>;
115
115
  export type Reply = z.infer<typeof replySchema>;
116
116
  export declare const repliesDir: (root: string) => string;
package/dist/schema.d.ts CHANGED
@@ -8,6 +8,9 @@ export type TransportMode = z.infer<typeof transportMode>;
8
8
  /** Store charts a category rank is read from. */
9
9
  export declare const CHARTS: readonly ["top-free", "top-paid", "top-grossing"];
10
10
  export type Chart = (typeof CHARTS)[number];
11
+ /** What `alerts` looks for in the files the daily run writes. */
12
+ export declare const ALERT_KINDS: readonly ["rank-drop", "release-lost", "category-drop", "low-ratings", "competitor-change", "visibility-drop", "search-drop", "late-check"];
13
+ export type AlertKind = (typeof ALERT_KINDS)[number];
11
14
  /** `appeeky.spec.yaml`: who the app is, where it ships, and what it should be found for. */
12
15
  export declare const specFileSchema: z.ZodObject<{
13
16
  version: z.ZodLiteral<1>;
@@ -356,6 +359,155 @@ export declare const specFileSchema: z.ZodObject<{
356
359
  countries?: string[] | undefined;
357
360
  chart?: "top-free" | "top-paid" | "top-grossing" | undefined;
358
361
  }>>;
362
+ /**
363
+ * When `alerts` speaks up. It reads only the files the daily run already wrote; each
364
+ * kind has its thresholds here, and `off` turns kinds off. Every field has a default.
365
+ */
366
+ alerts: z.ZodDefault<z.ZodObject<{
367
+ /** Kinds to leave out, e.g. [competitor-change]. */
368
+ off: z.ZodDefault<z.ZodArray<z.ZodEnum<["rank-drop", "release-lost", "category-drop", "low-ratings", "competitor-change", "visibility-drop", "search-drop", "late-check"]>, "many">>;
369
+ /** A target fell this many places between its last two recorded checks (critical: twice that, or a top-10 target out of the top 20). */
370
+ "rank-drop": z.ZodDefault<z.ZodObject<{
371
+ places: z.ZodDefault<z.ZodNumber>;
372
+ }, "strict", z.ZodTypeAny, {
373
+ places: number;
374
+ }, {
375
+ places?: number | undefined;
376
+ }>>;
377
+ /** A release's day-7 or day-14 verdict was lost: open for this many days after the check. */
378
+ "release-lost": z.ZodDefault<z.ZodObject<{
379
+ days: z.ZodDefault<z.ZodNumber>;
380
+ }, "strict", z.ZodTypeAny, {
381
+ days: number;
382
+ }, {
383
+ days?: number | undefined;
384
+ }>>;
385
+ /** The category rank on the latest day against the average of the `days` before (critical: twice the places, or out of the chart). */
386
+ "category-drop": z.ZodDefault<z.ZodObject<{
387
+ places: z.ZodDefault<z.ZodNumber>;
388
+ days: z.ZodDefault<z.ZodNumber>;
389
+ }, "strict", z.ZodTypeAny, {
390
+ places: number;
391
+ days: number;
392
+ }, {
393
+ places?: number | undefined;
394
+ days?: number | undefined;
395
+ }>>;
396
+ /** 1–2 star reviews in the last `days` against the `days` before: at least `min` of them and `ratio` times as many (critical: twice both). */
397
+ "low-ratings": z.ZodDefault<z.ZodObject<{
398
+ days: z.ZodDefault<z.ZodNumber>;
399
+ min: z.ZodDefault<z.ZodNumber>;
400
+ ratio: z.ZodDefault<z.ZodNumber>;
401
+ }, "strict", z.ZodTypeAny, {
402
+ min: number;
403
+ days: number;
404
+ ratio: number;
405
+ }, {
406
+ min?: number | undefined;
407
+ days?: number | undefined;
408
+ ratio?: number | undefined;
409
+ }>>;
410
+ /** A competitor climbed into the top 10 for a target, or put a target in its title, in the last `days`. */
411
+ "competitor-change": z.ZodDefault<z.ZodObject<{
412
+ days: z.ZodDefault<z.ZodNumber>;
413
+ }, "strict", z.ZodTypeAny, {
414
+ days: number;
415
+ }, {
416
+ days?: number | undefined;
417
+ }>>;
418
+ /** The assistants stopped naming the app for an intent, or stopped citing its site, in the last `days`. */
419
+ "visibility-drop": z.ZodDefault<z.ZodObject<{
420
+ days: z.ZodDefault<z.ZodNumber>;
421
+ }, "strict", z.ZodTypeAny, {
422
+ days: number;
423
+ }, {
424
+ days?: number | undefined;
425
+ }>>;
426
+ /** Search Console clicks over the last `days` fell by `drop` (0.3 = 30%) against the `days` before, with at least `min` clicks before (critical: twice the drop). */
427
+ "search-drop": z.ZodDefault<z.ZodObject<{
428
+ days: z.ZodDefault<z.ZodNumber>;
429
+ drop: z.ZodDefault<z.ZodNumber>;
430
+ min: z.ZodDefault<z.ZodNumber>;
431
+ }, "strict", z.ZodTypeAny, {
432
+ min: number;
433
+ days: number;
434
+ drop: number;
435
+ }, {
436
+ min?: number | undefined;
437
+ days?: number | undefined;
438
+ drop?: number | undefined;
439
+ }>>;
440
+ /** A release or experiment check this many days late or more (critical: 7 days). */
441
+ "late-check": z.ZodDefault<z.ZodObject<{
442
+ days: z.ZodDefault<z.ZodNumber>;
443
+ }, "strict", z.ZodTypeAny, {
444
+ days: number;
445
+ }, {
446
+ days?: number | undefined;
447
+ }>>;
448
+ }, "strict", z.ZodTypeAny, {
449
+ "rank-drop": {
450
+ places: number;
451
+ };
452
+ "release-lost": {
453
+ days: number;
454
+ };
455
+ "category-drop": {
456
+ places: number;
457
+ days: number;
458
+ };
459
+ "low-ratings": {
460
+ min: number;
461
+ days: number;
462
+ ratio: number;
463
+ };
464
+ "competitor-change": {
465
+ days: number;
466
+ };
467
+ "visibility-drop": {
468
+ days: number;
469
+ };
470
+ "search-drop": {
471
+ min: number;
472
+ days: number;
473
+ drop: number;
474
+ };
475
+ "late-check": {
476
+ days: number;
477
+ };
478
+ off: ("rank-drop" | "release-lost" | "category-drop" | "low-ratings" | "competitor-change" | "visibility-drop" | "search-drop" | "late-check")[];
479
+ }, {
480
+ "rank-drop"?: {
481
+ places?: number | undefined;
482
+ } | undefined;
483
+ "release-lost"?: {
484
+ days?: number | undefined;
485
+ } | undefined;
486
+ "category-drop"?: {
487
+ places?: number | undefined;
488
+ days?: number | undefined;
489
+ } | undefined;
490
+ "low-ratings"?: {
491
+ min?: number | undefined;
492
+ days?: number | undefined;
493
+ ratio?: number | undefined;
494
+ } | undefined;
495
+ "competitor-change"?: {
496
+ days?: number | undefined;
497
+ } | undefined;
498
+ "visibility-drop"?: {
499
+ days?: number | undefined;
500
+ } | undefined;
501
+ "search-drop"?: {
502
+ min?: number | undefined;
503
+ days?: number | undefined;
504
+ drop?: number | undefined;
505
+ } | undefined;
506
+ "late-check"?: {
507
+ days?: number | undefined;
508
+ } | undefined;
509
+ off?: ("rank-drop" | "release-lost" | "category-drop" | "low-ratings" | "competitor-change" | "visibility-drop" | "search-drop" | "late-check")[] | undefined;
510
+ }>>;
359
511
  /** Who the app is for. Experiments, screenshots and UGC refer to these by id. */
360
512
  personas: z.ZodDefault<z.ZodArray<z.ZodObject<{
361
513
  id: z.ZodString;
@@ -418,6 +570,38 @@ export declare const specFileSchema: z.ZodObject<{
418
570
  data: {
419
571
  commit: boolean;
420
572
  };
573
+ alerts: {
574
+ "rank-drop": {
575
+ places: number;
576
+ };
577
+ "release-lost": {
578
+ days: number;
579
+ };
580
+ "category-drop": {
581
+ places: number;
582
+ days: number;
583
+ };
584
+ "low-ratings": {
585
+ min: number;
586
+ days: number;
587
+ ratio: number;
588
+ };
589
+ "competitor-change": {
590
+ days: number;
591
+ };
592
+ "visibility-drop": {
593
+ days: number;
594
+ };
595
+ "search-drop": {
596
+ min: number;
597
+ days: number;
598
+ drop: number;
599
+ };
600
+ "late-check": {
601
+ days: number;
602
+ };
603
+ off: ("rank-drop" | "release-lost" | "category-drop" | "low-ratings" | "competitor-change" | "visibility-drop" | "search-drop" | "late-check")[];
604
+ };
421
605
  personas: {
422
606
  name: string;
423
607
  id: string;
@@ -532,6 +716,38 @@ export declare const specFileSchema: z.ZodObject<{
532
716
  countries?: string[] | undefined;
533
717
  chart?: "top-free" | "top-paid" | "top-grossing" | undefined;
534
718
  } | undefined;
719
+ alerts?: {
720
+ "rank-drop"?: {
721
+ places?: number | undefined;
722
+ } | undefined;
723
+ "release-lost"?: {
724
+ days?: number | undefined;
725
+ } | undefined;
726
+ "category-drop"?: {
727
+ places?: number | undefined;
728
+ days?: number | undefined;
729
+ } | undefined;
730
+ "low-ratings"?: {
731
+ min?: number | undefined;
732
+ days?: number | undefined;
733
+ ratio?: number | undefined;
734
+ } | undefined;
735
+ "competitor-change"?: {
736
+ days?: number | undefined;
737
+ } | undefined;
738
+ "visibility-drop"?: {
739
+ days?: number | undefined;
740
+ } | undefined;
741
+ "search-drop"?: {
742
+ min?: number | undefined;
743
+ days?: number | undefined;
744
+ drop?: number | undefined;
745
+ } | undefined;
746
+ "late-check"?: {
747
+ days?: number | undefined;
748
+ } | undefined;
749
+ off?: ("rank-drop" | "release-lost" | "category-drop" | "low-ratings" | "competitor-change" | "visibility-drop" | "search-drop" | "late-check")[] | undefined;
750
+ } | undefined;
535
751
  personas?: {
536
752
  name: string;
537
753
  id: string;
package/dist/schema.js CHANGED
@@ -66,6 +66,8 @@ const aiIntent = z
66
66
  .strict();
67
67
  /** Store charts a category rank is read from. */
68
68
  export const CHARTS = ["top-free", "top-paid", "top-grossing"];
69
+ /** What `alerts` looks for in the files the daily run writes. */
70
+ export const ALERT_KINDS = ["rank-drop", "release-lost", "category-drop", "low-ratings", "competitor-change", "visibility-drop", "search-drop", "late-check"];
69
71
  /** `appeeky.spec.yaml`: who the app is, where it ships, and what it should be found for. */
70
72
  export const specFileSchema = z
71
73
  .object({
@@ -192,6 +194,39 @@ export const specFileSchema = z
192
194
  })
193
195
  .strict()
194
196
  .optional(),
197
+ /**
198
+ * When `alerts` speaks up. It reads only the files the daily run already wrote; each
199
+ * kind has its thresholds here, and `off` turns kinds off. Every field has a default.
200
+ */
201
+ alerts: z
202
+ .object({
203
+ /** Kinds to leave out, e.g. [competitor-change]. */
204
+ off: z.array(z.enum(ALERT_KINDS)).default([]),
205
+ /** A target fell this many places between its last two recorded checks (critical: twice that, or a top-10 target out of the top 20). */
206
+ "rank-drop": z.object({ places: z.number().int().min(1).default(10) }).strict().default({}),
207
+ /** A release's day-7 or day-14 verdict was lost: open for this many days after the check. */
208
+ "release-lost": z.object({ days: z.number().int().min(1).default(14) }).strict().default({}),
209
+ /** The category rank on the latest day against the average of the `days` before (critical: twice the places, or out of the chart). */
210
+ "category-drop": z.object({ places: z.number().int().min(1).default(10), days: z.number().int().min(1).default(7) }).strict().default({}),
211
+ /** 1–2 star reviews in the last `days` against the `days` before: at least `min` of them and `ratio` times as many (critical: twice both). */
212
+ "low-ratings": z
213
+ .object({ days: z.number().int().min(1).default(7), min: z.number().int().min(1).default(3), ratio: z.number().min(1).default(2) })
214
+ .strict()
215
+ .default({}),
216
+ /** A competitor climbed into the top 10 for a target, or put a target in its title, in the last `days`. */
217
+ "competitor-change": z.object({ days: z.number().int().min(1).default(3) }).strict().default({}),
218
+ /** The assistants stopped naming the app for an intent, or stopped citing its site, in the last `days`. */
219
+ "visibility-drop": z.object({ days: z.number().int().min(1).default(3) }).strict().default({}),
220
+ /** Search Console clicks over the last `days` fell by `drop` (0.3 = 30%) against the `days` before, with at least `min` clicks before (critical: twice the drop). */
221
+ "search-drop": z
222
+ .object({ days: z.number().int().min(1).default(7), drop: z.number().gt(0).max(1).default(0.3), min: z.number().int().min(0).default(20) })
223
+ .strict()
224
+ .default({}),
225
+ /** A release or experiment check this many days late or more (critical: 7 days). */
226
+ "late-check": z.object({ days: z.number().int().min(1).default(2) }).strict().default({}),
227
+ })
228
+ .strict()
229
+ .default({}),
195
230
  /** Who the app is for. Experiments, screenshots and UGC refer to these by id. */
196
231
  personas: z
197
232
  .array(z
package/dist/setup.js CHANGED
@@ -130,12 +130,14 @@ jobs:
130
130
  git config user.email "spec@users.noreply.github.com"
131
131
  git add appeeky && git commit -m "Record release, replies, posts and clips" && git push || true
132
132
  `,
133
- "listing-daily.yml": `# Appeeky Spec: record the category rank, AI visibility and Google search, measure releases on day 7 and 14, refresh reviews and competitors.
133
+ "listing-daily.yml": `# Appeeky Spec: record the category rank, AI visibility and Google search, measure releases on day 7 and 14, refresh reviews and competitors,
134
+ # and keep one issue open with what needs attention.
134
135
  on:
135
136
  schedule: [{ cron: "0 6 * * *" }] # 06:00 UTC
136
137
  workflow_dispatch:
137
138
  permissions:
138
139
  contents: write
140
+ issues: write # one issue with what needs attention (alerts)
139
141
  jobs:
140
142
  refresh:
141
143
  runs-on: ubuntu-latest
@@ -171,10 +173,34 @@ jobs:
171
173
  ANTHROPIC_API_KEY: \${{ secrets.ANTHROPIC_API_KEY }}
172
174
  GEMINI_API_KEY: \${{ secrets.GEMINI_API_KEY }}
173
175
  PERPLEXITY_API_KEY: \${{ secrets.PERPLEXITY_API_KEY }}
176
+ # What needs attention, from the files above: the new ones first, then all of them
177
+ # (--record remembers them in appeeky/alerts.json, so each is reported once).
178
+ - if: always()
179
+ run: |
180
+ npx @appeeky/spec alerts --new -o .appeeky/alerts-new.md
181
+ npx @appeeky/spec alerts --record -o .appeeky/alerts.md
174
182
  - run: |
175
183
  git config user.name "appeeky-spec"
176
184
  git config user.email "spec@users.noreply.github.com"
177
185
  git add appeeky && git commit -m "Daily: category, AI visibility, search, Search Ads, verify, reviews, competitors, social, UGC" && git push || true
186
+ # One open issue labelled appeeky-spec-alert: opened or updated while something needs
187
+ # attention (a comment lists the new alerts), closed when nothing is left.
188
+ - if: always() && hashFiles('.appeeky/alerts.md') != ''
189
+ run: |
190
+ issue="$(gh issue list --label appeeky-spec-alert --state open --limit 1 --json number --jq '.[0].number // empty')"
191
+ if [ -s .appeeky/alerts.md ]; then
192
+ if [ -n "$issue" ]; then
193
+ gh issue edit "$issue" --body-file .appeeky/alerts.md
194
+ if [ -s .appeeky/alerts-new.md ]; then gh issue comment "$issue" --body-file .appeeky/alerts-new.md; fi
195
+ else
196
+ gh label create appeeky-spec-alert --color d93f0b --description "Appeeky Spec: something needs attention" 2>/dev/null || true
197
+ gh issue create --title "Appeeky Spec alerts" --label appeeky-spec-alert --body-file .appeeky/alerts.md
198
+ fi
199
+ elif [ -n "$issue" ]; then
200
+ gh issue close "$issue" --comment "Nothing needs attention any more. Closed by appeeky-spec alerts; it opens again when something does."
201
+ fi
202
+ env:
203
+ GH_TOKEN: \${{ github.token }}
178
204
  `,
179
205
  };
180
206
  const ok = (area, detail) => ({ area, status: "ok", detail });
@@ -259,6 +285,21 @@ export function diagnose(root, project, env = process.env, nodeVersion = process
259
285
  out.push(fail("GitHub Actions", `${old.join(", ")} use${old.length === 1 ? "s" : ""} appeeky/appeeky-spec@v0, which no longer runs`, "Replace `uses: appeeky/appeeky-spec@v0` with `uses: appeeky/spec@v0`."));
260
286
  else
261
287
  out.push(found.length ? ok("GitHub Actions", found.join(", ")) : warn("GitHub Actions", "No workflow runs the spec", "Optional: `npx @appeeky/spec init --ci` writes the pull request check, push on merge and daily verify."));
288
+ // Alerts: someone hears about a drop without reading the files.
289
+ const daily = files.filter(({ text }) => /@appeeky\/spec verify/.test(text)).map(({ f }) => f);
290
+ const alerting = files.filter(({ text }) => /@appeeky\/spec alerts/.test(text));
291
+ const webhook = env.ALERT_WEBHOOK_URL ? " and ALERT_WEBHOOK_URL is set" : "";
292
+ const off = project.spec.alerts.off.length ? ` (off: ${project.spec.alerts.off.join(", ")})` : "";
293
+ if (alerting.some(({ text }) => !/issues:\s*write/.test(text)))
294
+ out.push(warn("alerts", `${alerting.filter(({ text }) => !/issues:\s*write/.test(text)).map(({ f }) => f).join(", ")} runs alerts without issues: write`, "Add `issues: write` under `permissions:`, so it can open the alert issue."));
295
+ else if (alerting.length)
296
+ out.push(ok("alerts", `${alerting.map(({ f }) => f).join(", ")} keeps an issue open while something needs attention${webhook}${off}`));
297
+ else if (daily.length)
298
+ out.push(warn("alerts", `${daily.join(", ")} runs daily but no workflow runs alerts: nobody hears about a drop`, "Delete .github/workflows/listing-daily.yml and run `npx @appeeky/spec init --ci` again (it adds the alert issue), or set ALERT_WEBHOOK_URL on a Docker routine."));
299
+ else if (env.ALERT_WEBHOOK_URL)
300
+ out.push(ok("alerts", `ALERT_WEBHOOK_URL is set: the daily routine posts new alerts${off}`));
301
+ else
302
+ out.push(warn("alerts", "Nothing reports a drop: rank, rating or category changes wait for someone to read the files", "Optional: `npx @appeeky/spec init --ci` (an issue on GitHub) or ALERT_WEBHOOK_URL on the Docker routine; `alerts` shows them now."));
262
303
  const skills = [".claude/skills/appeeky-spec", ".agents/skills/appeeky-spec", ".cursor/skills/appeeky-spec"].some((p) => existsSync(join(root, p)));
263
304
  out.push(skills ? ok("agent skills", "installed") : warn("agent skills", "Not installed in this repo", "Optional: `npx skills add appeeky/skills`."));
264
305
  const specialists = installedTargets(root);
package/dist/social.d.ts CHANGED
@@ -388,8 +388,8 @@ export declare const draftSchema: z.ZodObject<{
388
388
  sentAt: z.ZodOptional<z.ZodString>;
389
389
  }, "strict", z.ZodTypeAny, {
390
390
  status: "draft" | "sent";
391
- accounts: string[];
392
391
  text: string;
392
+ accounts: string[];
393
393
  tiktok?: {
394
394
  title?: string | undefined;
395
395
  comments?: boolean | undefined;
@@ -401,6 +401,7 @@ export declare const draftSchema: z.ZodObject<{
401
401
  cover_time_ms?: number | undefined;
402
402
  cover_image_url?: string | undefined;
403
403
  } | undefined;
404
+ sentAt?: string | undefined;
404
405
  when?: string | undefined;
405
406
  media?: string[] | undefined;
406
407
  youtube?: {
@@ -417,10 +418,9 @@ export declare const draftSchema: z.ZodObject<{
417
418
  } | undefined;
418
419
  why?: string | undefined;
419
420
  postId?: string | undefined;
420
- sentAt?: string | undefined;
421
421
  }, {
422
- accounts: string[];
423
422
  text: string;
423
+ accounts: string[];
424
424
  status?: "draft" | "sent" | undefined;
425
425
  tiktok?: {
426
426
  title?: string | undefined;
@@ -433,6 +433,7 @@ export declare const draftSchema: z.ZodObject<{
433
433
  cover_time_ms?: number | undefined;
434
434
  cover_image_url?: string | undefined;
435
435
  } | undefined;
436
+ sentAt?: string | undefined;
436
437
  when?: string | undefined;
437
438
  media?: string[] | undefined;
438
439
  youtube?: {
@@ -449,7 +450,6 @@ export declare const draftSchema: z.ZodObject<{
449
450
  } | undefined;
450
451
  why?: string | undefined;
451
452
  postId?: string | undefined;
452
- sentAt?: string | undefined;
453
453
  }>;
454
454
  export type Draft = z.infer<typeof draftSchema>;
455
455
  /** Character limits per platform, for `check`-style warnings before sending. */