@heyramzi/social 1.3.1 → 1.4.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 CHANGED
@@ -9,7 +9,7 @@ changes in one place.
9
9
  | `./story` | Checks with no model: `openerFault` (greeting, hidden point, scene first), `hedgeScan`, `flatRun`, `HOOK_MAX_WORDS` | CutKit's offline lint, `./shorts` |
10
10
  | `./questions` | `storyQuestions({ field, piece, reader })`: the story questions a judge model answers, in the surface's own words | CutKit's check, Jev's `opening`, `linkedin`, `x` and `reddit` surfaces |
11
11
  | `./hooks` | One regex per hook-library shape, and the banned shape | `./shorts` |
12
- | `./shorts` | `matchHook` and `auditShorts`, the skeleton of a Short | `heyramzi-slop --register=shorts` in `@heyramzi/lint` |
12
+ | `./shorts` | `matchHook`, `hookStake` and `auditShorts`: a hedged or comforting hook, the tax office's words and put-on slang fail; the template boxes (`hook-shape`, `hook-length`, `uncounted-steps`, `cta-reply`) and a hook with no stake word print under `review` | `heyramzi-slop --register=shorts` in `@heyramzi/lint` |
13
13
  | `./jev` | The wire shape of a question (`questionBody`), the `Answer` type, and `askJev`: one call that takes the endpoint URL, key, model, state and questions, and returns the answers | CutKit's check, UpSys's `tools/social` client |
14
14
  | `./grade` | A trained model plus Jev's answers to a grade: `gradeAnswers` (grade 0 to 10, confidence, the three weakest answers with their fixes, the nearest winners, the pass gate), `encode`, `predict`, `rankOn`, `letterGrade`, `PASS_GRADE` | UpSys's loop, training and draft grading, CutKit's letter |
15
15
 
package/hooks.js CHANGED
@@ -106,6 +106,11 @@ export const hookShapes = [
106
106
  test: /^[\w.$'’ -]{2,40} just (?:turned down|said no to|walked away from|rejected)\b/i,
107
107
  },
108
108
  { n: 39, family: "Diagnosis", test: /^the difference between an? [\w -]{1,30} and an? \w+/i },
109
+ {
110
+ n: 40,
111
+ family: "Warning",
112
+ test: /^(?:[\w ]{2,30}, )?i (?:really )?(?:hate to (?:be the one to )?say (?:this|it)|didn't want to be the one to tell you)\b/i,
113
+ },
109
114
  // Shape 16 qualifies the audience and opens no gap, so it only counts beside another shape.
110
115
  { n: 16, family: "Tribe", alone: false, test: /^if you\b/i },
111
116
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyramzi/social",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "Content evaluation CutKit and UpSys share: hook shapes, the Shorts audit, story checks with no model, the story question bank, and the Jev call and trained-model grade",
5
5
  "license": "MIT",
6
6
  "repository": {
package/shorts.d.ts CHANGED
@@ -3,7 +3,15 @@ export type HookMatch =
3
3
  | { vague: true }
4
4
  | { shape: number; family: string; alone: boolean };
5
5
  export declare function matchHook(first: string, second?: string): HookMatch | null;
6
+ /** Whether the first two sentences name money, a loss, a risk or a feeling, and the comfort line when they reassure first. */
7
+ export declare function hookStake(
8
+ first: string,
9
+ second?: string,
10
+ ): { stake: boolean; reassures?: string };
6
11
  export declare function auditShorts(text: string): {
7
12
  hook: HookMatch | null;
13
+ /** Hits: a non-empty list fails the gate. */
8
14
  findings: { kind: "shorts"; id: string; detail: string }[];
15
+ /** Template checks (`hook-shape`, `hook-length`, `uncounted-steps`, `cta-reply`) and a hook with no stake word, printed and never counted. */
16
+ review: { kind: "review-shorts"; id: string; detail: string }[];
9
17
  };
package/shorts.js CHANGED
@@ -1,11 +1,76 @@
1
1
  import { bannedHook, hookShapes } from "#social/hooks.js";
2
- import { HOOK_MAX_WORDS, openerFault } from "#social/story.js";
2
+ import { HEDGES, HOOK_MAX_WORDS, openerFault } from "#social/story.js";
3
3
 
4
4
  const SENTENCE = /[^.!?]+(?:[.!?]+["'”’)]*|$)/g;
5
5
  const COUNT =
6
6
  /\b(?:no\.? ?\d|number (?:one|two|three|four|five|\d)|step (?:one|two|three|four|\d)|(?:the )?first|second|third|fourth)\b/gi;
7
7
  const REPLY_CTA = /\b(?:comment|dm me|type|reply)\b/i;
8
8
 
9
+ /** Whole words in French and English: `\b` is ASCII-only, so it cuts "impôt" after the ô. */
10
+ const lexicon = (src) => new RegExp(`(?<![\\p{L}\\p{N}])(?:${src})(?![\\p{L}])`, "giu");
11
+
12
+ // "Peut" and bare "could" stay: « un impôt qui peut te coûter très cher » is the hook Ramzi wrote himself (30 Nov 2026).
13
+ const HEDGE = lexicon(
14
+ [
15
+ ...HEDGES.filter((h) => h !== "could"),
16
+ "could be",
17
+ "peut-être",
18
+ "sans doute",
19
+ "probablement",
20
+ "il se peut",
21
+ ]
22
+ .map((h) => h.replaceAll(" ", "\\s+"))
23
+ .join("|"),
24
+ );
25
+ const MONEY =
26
+ /\d[\d\s .,]*\s?(?:€|k€|euros?|%|\$|dollars?)|[$€£]\s?\d|(?:milliers|centaines|millions?) d['’]euros|(?:thousands|hundreds|millions) of dollars/iu;
27
+ const LOSS = lexicon(
28
+ [
29
+ "risqu\\p{L}*|perd\\p{L}*|pertes?|payer|paye[sr]?|payent|paie[sn]?t?|payé\\p{L}*|co[uû]t\\p{L}*|cher|chère|amendes?",
30
+ "imp[oô]ts?|taxes?|redress\\p{L}*|pénalit\\p{L}*|sanction\\p{L}*|réclam\\p{L}*|dettes?|faillite|tribunal|procès",
31
+ "arnaqu\\p{L}*|escroqu\\p{L}*|pièges?|argent|fric|ruin\\p{L}*|erreurs?|volé\\p{L}*",
32
+ "risk\\p{L}*|lose|loses|losing|lost|loss(?:es)?|cost\\p{L}*|fined|a fine|broke|fired|pay|pays|paying|paid",
33
+ "tax(?:es)?|debts?|sued|scam\\p{L}*|penalt\\p{L}*|owe[sd]?|money|bankrupt\\p{L}*|wast\\p{L}*|mistakes?|expensive|cash",
34
+ ].join("|"),
35
+ );
36
+ const EMOTION = lexicon(
37
+ [
38
+ "peur|honte|colère|furieu\\p{L}*|énerv\\p{L}*|triste\\p{L}*|heureu\\p{L}*|fier|fière|choqu\\p{L}*|panique\\p{L}*",
39
+ "stress\\p{L}*|angoiss\\p{L}*|cauchemar\\p{L}*|détest\\p{L}*|scandal\\p{L}*|injust\\p{L}*|marre|regrett\\p{L}*",
40
+ "afraid|scared|scary|fear\\p{L}*|angry|furious|hate[sd]?|ashamed|embarrass\\p{L}*|proud|happy|sad|panic\\p{L}*",
41
+ "nightmare|terrif\\p{L}*|shock\\p{L}*|regret\\p{L}*|frustrat\\p{L}*|unfair",
42
+ ].join("|"),
43
+ );
44
+ // The rejected CFE hook said "c'est normal" before it named any risk: comfort first is no stake.
45
+ const REASSURE = lexicon(
46
+ "c['’]est normal|pas de panique|pas d['’]inquiétude|rassure-toi|ne t['’]inquiète pas|don['’]t worry|no need to worry",
47
+ );
48
+
49
+ /** The tax office's words, and what an investor at a bar says instead (Ramzi, 30 Nov 2026). */
50
+ const INSTITUTION = [
51
+ [lexicon("contribuables?"), "un investisseur, un propriétaire"],
52
+ [
53
+ lexicon(
54
+ "(?:(?<!à )(?:ton|votre|son|leur) )?avis (?:d['’]imposition|de (?:CFE|taxe\\p{L}*|paiement))|(?<!à )(?:ton|votre|son|leur) avis",
55
+ ),
56
+ "un courrier",
57
+ ],
58
+ [lexicon("relances?"), "un courrier, un rappel"],
59
+ [lexicon("majoration\\p{L}*|majoré\\p{L}*"), '"X % en plus"'],
60
+ [lexicon("assujetti\\p{L}*|redevables?"), '"tu dois le payer"'],
61
+ [lexicon("exonér\\p{L}*"), '"tu ne paies rien"'],
62
+ ];
63
+
64
+ // An adult imitating teenagers. One dropped "ne" is how people talk; the costume is the stack, so 2 marks fail.
65
+ const COSTUME = lexicon(
66
+ [
67
+ "t['’](?:as|es|étais)|eh bien non|eh ben|ben non|wesh|frérot|du coup",
68
+ "c['’]est pas|(?:tu|je|il|elle|on) (?:l['’])?\\p{L}+ pas",
69
+ "bro|bruh|lowkey|no cap|fr fr|ngl|deadass|it['’]s giving|bussin",
70
+ ].join("|"),
71
+ );
72
+ const COSTUME_MAX = 1;
73
+
9
74
  /** The spoken part of a note: header lines and everything under a `---` divider are notes to self. */
10
75
  function spoken(text) {
11
76
  const body = text.split(/^-{3,}\s*$/m)[0];
@@ -75,22 +140,61 @@ export function matchHook(first, second = "") {
75
140
  return null;
76
141
  }
77
142
 
143
+ const hits = (re, s) => [...s.matchAll(re)].map((m) => m[0]);
144
+
145
+ /** The hook's first two sentences name no money, loss, risk or feeling, or they comfort first. */
146
+ export function hookStake(first, second = "") {
147
+ const open = `${first} ${second}`;
148
+ const reassures = hits(REASSURE, open)[0];
149
+ if (reassures) return { stake: false, reassures };
150
+ const stake = MONEY.test(open) || hits(LOSS, open).length > 0 || hits(EMOTION, open).length > 0;
151
+ return { stake };
152
+ }
153
+
78
154
  /** The hook and the skeleton of a Short, per the shorts-script skill. */
79
155
  export function auditShorts(text) {
80
156
  const findings = [];
157
+ // Template boxes are printed, never counted: they flagged Ramzi's own best hook (30 Nov 2026).
158
+ const review = [];
81
159
  const sentences = (spoken(text).match(SENTENCE) ?? []).map((s) => s.trim()).filter(Boolean);
82
- if (sentences.length === 0) return { hook: null, findings };
160
+ if (sentences.length === 0) return { hook: null, findings, review };
83
161
  const [first, second] = sentences;
84
162
  const push = (id, detail) => findings.push({ kind: "shorts", id, detail });
163
+ const note = (id, detail) => review.push({ kind: "review-shorts", id, detail });
85
164
 
86
165
  const hook = matchHook(first, second);
87
- if (!hook) push("hook-shape", `"${first}" matches no shape in the hook library`);
166
+ if (!hook) note("hook-shape", `"${first}" matches no shape in the hook library`);
88
167
  else if (hook.vague) push("hook-vague", `"${first}" hides the plot or opens on a time and place`);
89
168
  else if (hook.banned) push("hook-banned", `"${first}" is shape 30, banned`);
90
169
  else if (hook.alone)
91
170
  push("hook-alone", `"${first}" is shape 16, which qualifies the audience and opens no gap`);
92
171
  if (words(first) > HOOK_MAX_WORDS)
93
- push("hook-length", `the hook is ${words(first)} words, the window takes ${HOOK_MAX_WORDS}`);
172
+ note("hook-length", `the hook is ${words(first)} words, the window takes ${HOOK_MAX_WORDS}`);
173
+
174
+ const hedges = hits(HEDGE, first);
175
+ if (hedges.length)
176
+ push(
177
+ "hook-hedge",
178
+ `"${hedges[0]}" in the hook is a guess; say the risk flat ("tu risques de")`,
179
+ );
180
+ const stake = hookStake(first, second);
181
+ if (stake.reassures)
182
+ push("hook-no-stake", `the opening comforts ("${stake.reassures}") before it names any risk`);
183
+ // Review only: over CutKit's 8,066 transcribed Shorts it fired on 77% of winners and 80% of flops.
184
+ else if (!stake.stake)
185
+ note(
186
+ "hook-no-stake",
187
+ "the first 2 sentences name no money, loss, risk or feeling; which emotion does the hook make you feel?",
188
+ );
189
+
190
+ const body = sentences.join(" ");
191
+ const jargon = INSTITUTION.flatMap(([re, plain]) =>
192
+ hits(re, body).map((w) => `"${w}" (say ${plain})`),
193
+ );
194
+ if (jargon.length) push("institution-words", `the tax office's words: ${jargon.join(", ")}`);
195
+ const costume = hits(COSTUME, body);
196
+ if (costume.length > COSTUME_MAX)
197
+ push("costume", `${costume.length} put-on marks: ${costume.map((w) => `"${w}"`).join(", ")}`);
94
198
 
95
199
  const clefts = sentences.filter(
96
200
  (s) => /^What [^?]{3,60}?\b(?:is|are|was|were)\s/.test(s) && !s.endsWith("?"),
@@ -102,10 +206,10 @@ export function auditShorts(text) {
102
206
 
103
207
  const counted = (sentences.slice(1).join(" ").match(COUNT) ?? []).length;
104
208
  if (counted < 2)
105
- push("uncounted-steps", `${counted} count markers in the body; name the steps out loud`);
209
+ note("uncounted-steps", `${counted} count markers in the body; name the steps out loud`);
106
210
 
107
211
  const close = sentences.slice(-2).join(" ");
108
- if (!REPLY_CTA.test(close)) push("cta-reply", "the close carries no reply-trigger CTA");
212
+ if (!REPLY_CTA.test(close)) note("cta-reply", "the close carries no reply-trigger CTA");
109
213
 
110
- return { hook, findings };
214
+ return { hook, findings, review };
111
215
  }