@refrakt-md/ai 0.21.0 → 0.23.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.
@@ -1,5 +1,14 @@
1
1
  export interface WritePromptOptions {
2
2
  multiFile?: boolean;
3
3
  }
4
+ /**
5
+ * Few-shot exemplars drawn from the standardised fixture corpus (SPEC-102 /
6
+ * WORK-413). Only fixtures whose frontmatter explicitly tags a `canonical` /
7
+ * `rich` role are included — an explicit role is the author's opt-in that a
8
+ * fixture is a good example to learn from. Each block carries the fixture's
9
+ * `notes` (authoring guidance) when present. Replaces the old hardcoded example
10
+ * snippet; grows automatically as the corpus is annotated.
11
+ */
12
+ export declare function exemplarSection(): string;
4
13
  export declare function writePrompt(options?: WritePromptOptions): string;
5
14
  //# sourceMappingURL=write.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/modes/write.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAYD,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,MAAM,CA+ChE"}
1
+ {"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/modes/write.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAeD;;;;;;;GAOG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAqBxC;AAED,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,MAAM,CA2ChE"}
@@ -1,3 +1,4 @@
1
+ import { RUNE_EXAMPLES, RUNE_FIXTURE_META } from '@refrakt-md/runes';
1
2
  const FRONTMATTER_INSTRUCTION = `
2
3
 
3
4
  ## File format
@@ -7,9 +8,40 @@ Every page should begin with YAML frontmatter:
7
8
  title: Page Title
8
9
  description: A brief description
9
10
  ---`;
11
+ /** Fixture roles that opt a rune into the few-shot exemplar set. */
12
+ const EXEMPLAR_ROLES = new Set(['canonical', 'rich']);
13
+ /**
14
+ * Few-shot exemplars drawn from the standardised fixture corpus (SPEC-102 /
15
+ * WORK-413). Only fixtures whose frontmatter explicitly tags a `canonical` /
16
+ * `rich` role are included — an explicit role is the author's opt-in that a
17
+ * fixture is a good example to learn from. Each block carries the fixture's
18
+ * `notes` (authoring guidance) when present. Replaces the old hardcoded example
19
+ * snippet; grows automatically as the corpus is annotated.
20
+ */
21
+ export function exemplarSection() {
22
+ const exemplars = Object.entries(RUNE_FIXTURE_META)
23
+ .filter(([name, meta]) => meta.role && EXEMPLAR_ROLES.has(meta.role) && RUNE_EXAMPLES[name])
24
+ .sort(([a], [b]) => a.localeCompare(b));
25
+ if (exemplars.length === 0)
26
+ return '';
27
+ const blocks = exemplars.map(([name, meta]) => {
28
+ const notes = meta.notes ? `\n${meta.notes}\n` : '';
29
+ return `### ${name}${notes}\n\`\`\`md\n${RUNE_EXAMPLES[name]}\n\`\`\``;
30
+ });
31
+ return `
32
+
33
+ ## Example patterns
34
+
35
+ These are canonical, validated examples of well-formed runes. Study their
36
+ structure and match this quality — emulate the shape, don't copy the literal
37
+ content.
38
+
39
+ ${blocks.join('\n\n')}`;
40
+ }
10
41
  export function writePrompt(options) {
42
+ const exemplars = exemplarSection();
11
43
  if (!options?.multiFile) {
12
- return FRONTMATTER_INSTRUCTION;
44
+ return FRONTMATTER_INSTRUCTION + exemplars;
13
45
  }
14
46
  return FRONTMATTER_INSTRUCTION + `
15
47
 
@@ -27,7 +59,8 @@ Rules:
27
59
  - Use directory nesting for logical sections (e.g. \`docs/\`, \`blog/\`).
28
60
  - Do NOT use \`../\` in file paths.
29
61
 
30
- Example structure:
62
+ The marker structure looks like this (compose the page bodies from the rune
63
+ patterns shown below):
31
64
 
32
65
  --- FILE: _layout.md ---
33
66
  ---
@@ -41,17 +74,10 @@ title: Home
41
74
  description: Welcome to the site
42
75
  ---
43
76
 
44
- {% hero %}
45
- # Welcome
46
- ...
47
- {% /hero %}
48
-
49
77
  --- FILE: docs/getting-started.md ---
50
78
  ---
51
79
  title: Getting Started
52
80
  description: Learn the basics
53
- ---
54
-
55
- Content here...`;
81
+ ---` + exemplars;
56
82
  }
57
83
  //# sourceMappingURL=write.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/modes/write.ts"],"names":[],"mappings":"AAIA,MAAM,uBAAuB,GAAG;;;;;;;;IAQ5B,CAAC;AAEL,MAAM,UAAU,WAAW,CAAC,OAA4B;IACvD,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC;QACzB,OAAO,uBAAuB,CAAC;IAChC,CAAC;IAED,OAAO,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAyClB,CAAC;AACjB,CAAC"}
1
+ {"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/modes/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAMrE,MAAM,uBAAuB,GAAG;;;;;;;;IAQ5B,CAAC;AAEL,oEAAoE;AACpE,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;AAEtD;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe;IAC9B,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC;SACjD,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC;SAC3F,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEtC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE;QAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QACpD,OAAO,OAAO,IAAI,GAAG,KAAK,eAAe,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,OAAO;;;;;;;;EAQN,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAA4B;IACvD,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC;IAEpC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC;QACzB,OAAO,uBAAuB,GAAG,SAAS,CAAC;IAC5C,CAAC;IAED,OAAO,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAmC9B,GAAG,SAAS,CAAC;AACjB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@refrakt-md/ai",
3
3
  "description": "AI content generation for refrakt.md",
4
- "version": "0.21.0",
4
+ "version": "0.23.0",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -29,6 +29,6 @@
29
29
  "build": "tsc"
30
30
  },
31
31
  "devDependencies": {
32
- "@refrakt-md/runes": "0.21.0"
32
+ "@refrakt-md/runes": "0.23.0"
33
33
  }
34
34
  }