@hanna84/mcp-writing 2.12.6 → 2.12.8

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.
@@ -1,125 +1 @@
1
- export const PROSE_STYLEGUIDE_SKILL_DIRNAME = "skills";
2
- export const PROSE_STYLEGUIDE_SKILL_BASENAME = "prose-styleguide.md";
3
-
4
- const LANGUAGE_LABELS = {
5
- english_us: "English (US)",
6
- english_uk: "English (UK)",
7
- english_au: "English (AU)",
8
- english_ca: "English (CA)",
9
- swedish: "Swedish",
10
- norwegian: "Norwegian",
11
- danish: "Danish",
12
- finnish: "Finnish",
13
- french: "French",
14
- italian: "Italian",
15
- russian: "Russian",
16
- portuguese_pt: "Portuguese (PT)",
17
- portuguese_br: "Portuguese (BR)",
18
- german: "German",
19
- dutch: "Dutch",
20
- polish: "Polish",
21
- czech: "Czech",
22
- hungarian: "Hungarian",
23
- spanish: "Spanish",
24
- irish: "Irish",
25
- japanese: "Japanese",
26
- korean: "Korean",
27
- chinese_traditional: "Chinese (Traditional)",
28
- chinese_simplified: "Chinese (Simplified)",
29
- };
30
-
31
- const CONFIG_RULE_RENDERERS = {
32
- language: (value) => `Primary writing language: ${LANGUAGE_LABELS[value] ?? value}.`,
33
- spelling: (value) => `Spelling variant: ${value.toUpperCase()}.`,
34
- quotation_style: (value) => {
35
- const labels = {
36
- double: "double quotes",
37
- single: "single quotes",
38
- guillemets: "guillemets (« »)",
39
- low9: "low-9 quotation marks",
40
- dialogue_dash_en: "Scandinavian en-dash dialogue",
41
- dialogue_dash_em: "Spanish/Irish em-dash dialogue",
42
- corner_brackets: "corner brackets (「 」)",
43
- };
44
- return `Dialogue quotation style: ${labels[value] ?? value}.`;
45
- },
46
- quotation_style_nested: (value) => `Nested quotation style: ${value}.`,
47
- em_dash_spacing: (value) => `Em dash spacing: ${value}.`,
48
- ellipsis_style: (value) => `Ellipsis style: ${value}.`,
49
- abbreviation_periods: (value) => `Abbreviation periods: ${value}.`,
50
- oxford_comma: (value) => `Oxford comma: ${value}.`,
51
- numbers: (value) => `Number formatting rule: ${value}.`,
52
- date_format: (value) => `Date format: ${value}.`,
53
- time_format: (value) => `Time format: ${value}.`,
54
- tense: (value) => `Default narrative tense: ${value}. Flag deviations as questions, not hard errors.`,
55
- pov: (value) => `Default POV: ${value}. Flag shifts as intentional-or-drift questions.`,
56
- dialogue_tags: (value) => `Dialogue tag policy: ${value}.`,
57
- sentence_fragments: (value) => `Sentence fragments policy: ${value}.`,
58
- };
59
-
60
- export function buildProseStyleguideSkill({ resolvedConfig, sources = [], projectId = null }) {
61
- if (!resolvedConfig || typeof resolvedConfig !== "object") {
62
- return {
63
- ok: false,
64
- error: {
65
- code: "INVALID_STYLEGUIDE_CONFIG",
66
- message: "Cannot generate prose-styleguide.md without a resolved config object.",
67
- },
68
- };
69
- }
70
-
71
- const injectedRules = [];
72
- for (const [field, renderRule] of Object.entries(CONFIG_RULE_RENDERERS)) {
73
- if (resolvedConfig[field] === undefined) continue;
74
- injectedRules.push(renderRule(resolvedConfig[field]));
75
- }
76
-
77
- const sourceLines = sources.length
78
- ? sources.map((source) => `- ${source.scope}: ${source.file_path}`)
79
- : ["- none"];
80
-
81
- const voiceNotes = typeof resolvedConfig.voice_notes === "string" && resolvedConfig.voice_notes.trim()
82
- ? resolvedConfig.voice_notes.trim().split("\n").map((line) => `> ${line}`).join("\n")
83
- : "> None provided.";
84
-
85
- const markdown = [
86
- "# Prose Styleguide",
87
- "",
88
- "## Standing Order",
89
- "Apply this styleguide by default for prose critique and edits. Preserve author voice over mechanical cleanup.",
90
- "",
91
- "## Resolved Scope",
92
- `- Project scope: ${projectId ?? "sync-root default"}`,
93
- ...sourceLines,
94
- "",
95
- "## Mechanical Conventions",
96
- "These are injected from prose-styleguide.config.yaml and should be applied consistently:",
97
- ...injectedRules.map((rule) => `- ${rule}`),
98
- "",
99
- "## Universal Craft Rules",
100
- "- Identify scene purpose before proposing changes.",
101
- "- Require transformation (emotional, relational, narrative, or thematic).",
102
- "- Prefer critique before rewrite.",
103
- "- Preserve cadence and specificity; avoid flattening voice.",
104
- "- Ask before normalizing intentional instability (flashbacks, POV drift, syntax breaks).",
105
- "",
106
- "## Review Posture",
107
- "- Prioritize structural issues, then convention drift, then line-level polish.",
108
- "- Treat convention drift as a question when intent may be deliberate.",
109
- "",
110
- "## Edit Posture",
111
- "- Do not shorten unless requested.",
112
- "- Apply conventions consistently while preserving tone.",
113
- "- Justify significant rewrites.",
114
- "",
115
- "## Voice Notes",
116
- voiceNotes,
117
- "",
118
- ].join("\n");
119
-
120
- return {
121
- ok: true,
122
- markdown,
123
- injected_rules: injectedRules,
124
- };
125
- }
1
+ export * from "./src/styleguide/prose-styleguide-skill.js";