@coppica/persuasion-mcp 1.0.1
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/LICENSE +21 -0
- package/README.md +108 -0
- package/data/LICENSE.md +8 -0
- package/data/catalog.json +1 -0
- package/data/categories.json +1 -0
- package/data/trait-evidence.json +187 -0
- package/dist/data.d.ts +81 -0
- package/dist/data.js +207 -0
- package/dist/format.d.ts +28 -0
- package/dist/format.js +50 -0
- package/dist/hookcheck/index.d.ts +98 -0
- package/dist/hookcheck/index.js +294 -0
- package/dist/http.d.ts +12 -0
- package/dist/http.js +62 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/roles.d.ts +68 -0
- package/dist/roles.js +188 -0
- package/dist/schemas.d.ts +7 -0
- package/dist/schemas.js +13 -0
- package/dist/scorers/claim-framework.d.ts +52 -0
- package/dist/scorers/claim-framework.js +363 -0
- package/dist/scorers/flow-framework.d.ts +69 -0
- package/dist/scorers/flow-framework.js +708 -0
- package/dist/scorers/hook-framework.d.ts +58 -0
- package/dist/scorers/hook-framework.js +447 -0
- package/dist/scorers/string-utils.d.ts +1 -0
- package/dist/scorers/string-utils.js +10 -0
- package/dist/server.d.ts +7 -0
- package/dist/server.js +71 -0
- package/dist/stats.d.ts +22 -0
- package/dist/stats.js +112 -0
- package/dist/tools/catalog.d.ts +2 -0
- package/dist/tools/catalog.js +84 -0
- package/dist/tools/craft.d.ts +2 -0
- package/dist/tools/craft.js +129 -0
- package/dist/tools/diagnose.d.ts +5 -0
- package/dist/tools/diagnose.js +269 -0
- package/dist/tools/plan.d.ts +4 -0
- package/dist/tools/plan.js +99 -0
- package/dist/tools/testing.d.ts +2 -0
- package/dist/tools/testing.js +145 -0
- package/dist/tools/why.d.ts +2 -0
- package/dist/tools/why.js +63 -0
- package/dist/voice.d.ts +33 -0
- package/dist/voice.js +139 -0
- package/package.json +73 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FLOW & CADENCE FRAMEWORK — Phase 1 of the writing-tools strategy.
|
|
3
|
+
*
|
|
4
|
+
* The hook framework scores individual openers. The flow framework scores
|
|
5
|
+
* everything else: paragraphs, body sections, ad scripts, email bodies. It
|
|
6
|
+
* is the post-generation statistical detector that catches the "AI smell"
|
|
7
|
+
* patterns no prompt instruction can reliably suppress, in particular the
|
|
8
|
+
* "Five bots. Ten principles. That's not X, it's Y." rhythm tic.
|
|
9
|
+
*
|
|
10
|
+
* Three layers, called in order. Each layer cheaper than the next.
|
|
11
|
+
*
|
|
12
|
+
* Layer 1 — SURFACE: regex/lexicon. Banned words, em-dash density,
|
|
13
|
+
* negative-parallelism cap, triad ratio. Always fires.
|
|
14
|
+
* Layer 2 — CADENCE: statistical. Sentence-length burstiness, paragraph
|
|
15
|
+
* variance, rhythmic contrast, opening uniformity. Skipped on
|
|
16
|
+
* non-prose contexts (bullets, headers, ad copy, subject lines)
|
|
17
|
+
* where uniformity is by design.
|
|
18
|
+
* Layer 3 — FLOW: discourse-aware approximations (no POS tagger). Bucket-
|
|
19
|
+
* brigade density, threading ratio, closing-recap detection.
|
|
20
|
+
* Same context gating as Layer 2.
|
|
21
|
+
*
|
|
22
|
+
* Pure module — no I/O, no DB. The evaluate_flow tool wraps this and
|
|
23
|
+
* persists the result. Reuses AI-smell lexicon from hook-framework.ts so
|
|
24
|
+
* the banned-word list has a single source of truth.
|
|
25
|
+
*/
|
|
26
|
+
export type FlowContext = 'hero' | 'body' | 'long_form' | 'email' | 'ad' | 'bullets' | 'header' | 'subject' | 'tldr';
|
|
27
|
+
interface FlowGateResult {
|
|
28
|
+
name: string;
|
|
29
|
+
layer: 'surface' | 'cadence' | 'flow';
|
|
30
|
+
status: 'pass' | 'warn' | 'fail';
|
|
31
|
+
detail?: string;
|
|
32
|
+
}
|
|
33
|
+
interface FlowViolation {
|
|
34
|
+
pattern: string;
|
|
35
|
+
span: string;
|
|
36
|
+
reason: string;
|
|
37
|
+
}
|
|
38
|
+
export interface FlowScore {
|
|
39
|
+
score: number;
|
|
40
|
+
scoreLabel: 'fail' | 'weak' | 'passable' | 'strong' | 'excellent';
|
|
41
|
+
gates: FlowGateResult[];
|
|
42
|
+
violations: FlowViolation[];
|
|
43
|
+
suggestions: string[];
|
|
44
|
+
metadata: {
|
|
45
|
+
/** Counts for the ORIGINAL input. Always reflect what the bot passed in,
|
|
46
|
+
* not what was actually scored. When `sampled` is true, the scoring
|
|
47
|
+
* numbers came from the windows below — these stats describe the whole. */
|
|
48
|
+
wordCount: number;
|
|
49
|
+
sentenceCount: number;
|
|
50
|
+
paragraphCount: number;
|
|
51
|
+
/** True when input exceeded MAX_FULL_WORDS and was sampled. */
|
|
52
|
+
sampled: boolean;
|
|
53
|
+
/** When sampled: number of paragraphs/windows that were actually scored. */
|
|
54
|
+
sampledWindowCount?: number;
|
|
55
|
+
/** When sampled: word count of the scored subset (so the user can see
|
|
56
|
+
* how representative the sample is). */
|
|
57
|
+
sampledWordCount?: number;
|
|
58
|
+
contextGated: ('cadence' | 'flow')[];
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface ScoreFlowOptions {
|
|
62
|
+
context?: FlowContext;
|
|
63
|
+
/** Bot opts in to deliberate negative parallelism (Copy Autopsy diagnosing,
|
|
64
|
+
* The Closer / Modern Masters teaching, White Stag character voice). */
|
|
65
|
+
allowAntithesis?: boolean;
|
|
66
|
+
}
|
|
67
|
+
export declare function splitSentences(text: string): string[];
|
|
68
|
+
export declare function scoreFlow(rawText: string, options?: ScoreFlowOptions): FlowScore;
|
|
69
|
+
export {};
|