read-style-guide.mjs
42 lines 1.3 KB
Raw
sha256:8915fe406161f95c1681f9469375e7bae5b28c884f00bedbdef65e4b0cd0738d docs(flow): commit FLOW-V0-SPEC.md hygiene for 7A-INT merge Human 12 hours ago
1 /**
2 * Skill: read-style-guide
3 *
4 * Returns the canonical voice + boundaries note for one of the three projects.
5 * Every conveyor-belt agent calls this FIRST, before generating any content,
6 * so the output stays grounded in the project's documented voice.
7 *
8 * Vault path convention:
9 * vault/projects/<project>/style-guide/voice-and-boundaries.md
10 *
11 * @param {ReturnType<import('./hub-client.mjs').createHubClient>} hub
12 * @param {{ project: 'born-free' | 'store-free' | 'knowtation' }} args
13 * @returns {Promise<{ path: string, frontmatter: object, body: string }>}
14 */
15 import { assertProject } from './hub-client.mjs';
16
17 export async function readStyleGuide(hub, args) {
18 const project = assertProject(args.project);
19 const path = `projects/${project}/style-guide/voice-and-boundaries.md`;
20
21 let note;
22 try {
23 note = await hub.getNote(path);
24 } catch (e) {
25 if (e.status === 404) {
26 throw Object.assign(
27 new Error(
28 `style_guide_missing: vault/${path} does not exist on the Hub. ` +
29 `Create it with the project's voice rules before running agents for ${project}.`
30 ),
31 { code: 'STYLE_GUIDE_MISSING', project, path, cause: e }
32 );
33 }
34 throw e;
35 }
36
37 return {
38 path: note.path ?? path,
39 frontmatter: note.frontmatter ?? {},
40 body: typeof note.body === 'string' ? note.body : '',
41 };
42 }
File History 1 commit
sha256:8915fe406161f95c1681f9469375e7bae5b28c884f00bedbdef65e4b0cd0738d docs(flow): commit FLOW-V0-SPEC.md hygiene for 7A-INT merge Human 12 hours ago