@riotprompt/riotdoc 1.0.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/LICENSE +190 -0
- package/README.md +42 -0
- package/dist/__vite-browser-external-l0sNRNKZ.js +2 -0
- package/dist/__vite-browser-external-l0sNRNKZ.js.map +1 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +5 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.js +353 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +361 -0
- package/dist/index.js +231 -0
- package/dist/index.js.map +1 -0
- package/dist/loader-B7ZeTPQg.js +6358 -0
- package/dist/loader-B7ZeTPQg.js.map +1 -0
- package/package.json +87 -0
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sources":["../src/cli/commands/create.ts","../src/outline/generator.ts","../src/workspace/loader.ts","../src/objectives/loader.ts","../src/cli/commands/outline.ts","../src/cli/commands/draft.ts","../src/cli/commands/revise.ts","../src/cli/commands/cleanup.ts","../src/cli/commands/spellcheck.ts","../src/cli/commands/export.ts","../src/cli/commands/status.ts","../src/cli/cli.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport inquirer from \"inquirer\";\nimport { join, resolve } from \"node:path\";\nimport { stat } from \"node:fs/promises\";\nimport { createWorkspace } from \"../../workspace/creator.js\";\nimport type { DocumentConfig } from \"../../types.js\";\n\nexport interface CreateOptions {\n type?: DocumentConfig[\"type\"];\n title?: string;\n path?: string;\n}\n\nconst DOCUMENT_TYPES = [\n { name: \"Blog Post\", value: \"blog-post\" },\n { name: \"Podcast Script\", value: \"podcast-script\" },\n { name: \"Technical Documentation\", value: \"technical-doc\" },\n { name: \"Newsletter\", value: \"newsletter\" },\n { name: \"Custom\", value: \"custom\" },\n];\n\n/**\n * Prompt for document type\n */\nasync function promptForType(): Promise<DocumentConfig[\"type\"]> {\n const { type } = await inquirer.prompt([{\n type: \"list\",\n name: \"type\",\n message: \"Document type:\",\n choices: DOCUMENT_TYPES,\n }]);\n return type;\n}\n\n/**\n * Prompt for document title\n */\nasync function promptForTitle(name: string): Promise<string> {\n const defaultTitle = name\n .split(\"-\")\n .map(w => w.charAt(0).toUpperCase() + w.slice(1))\n .join(\" \");\n \n const { title } = await inquirer.prompt([{\n type: \"input\",\n name: \"title\",\n message: \"Document title:\",\n default: defaultTitle,\n }]);\n return title;\n}\n\n/**\n * Prompt for primary goal\n */\nasync function promptForGoal(): Promise<string> {\n const { goal } = await inquirer.prompt([{\n type: \"input\",\n name: \"goal\",\n message: \"What is the primary goal of this document?\",\n }]);\n return goal;\n}\n\n/**\n * Prompt for target audience\n */\nasync function promptForAudience(): Promise<string> {\n const { audience } = await inquirer.prompt([{\n type: \"input\",\n name: \"audience\",\n message: \"Who is the target audience?\",\n }]);\n return audience;\n}\n\n/**\n * Check if path already exists\n */\nasync function pathExists(path: string): Promise<boolean> {\n try {\n await stat(path);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Register the create command\n */\nexport function registerCreateCommand(program: Command): void {\n program\n .command(\"create <name>\")\n .description(\"Create a new document workspace\")\n .option(\"-t, --type <type>\", \"Document type (blog-post, podcast-script, technical-doc, newsletter, custom)\")\n .option(\"-T, --title <title>\", \"Document title\")\n .option(\"-p, --path <path>\", \"Base path (default: current directory)\")\n .action(async (name: string, options: CreateOptions) => {\n try {\n const basePath = options.path || process.cwd();\n const workspacePath = resolve(join(basePath, name));\n \n // Check if already exists\n if (await pathExists(workspacePath)) {\n console.error(chalk.red(`Directory already exists: ${workspacePath}`));\n process.exit(1);\n }\n \n console.log(chalk.cyan(\"\\nš Creating new document workspace\\n\"));\n \n // Get document type\n const type = options.type as DocumentConfig[\"type\"] || await promptForType();\n \n // Get title\n const title = options.title || await promptForTitle(name);\n \n // Get initial objectives\n const goal = await promptForGoal();\n const audience = await promptForAudience();\n \n // Create workspace\n console.log(chalk.gray(\"\\nCreating workspace...\"));\n \n await createWorkspace({\n path: workspacePath,\n id: name,\n title,\n type,\n objectives: {\n primaryGoal: goal,\n secondaryGoals: [],\n keyTakeaways: [],\n },\n });\n \n // Note: audience is collected but not yet stored in config\n // This will be added when we implement config management\n if (audience) {\n // Future: store audience in config\n }\n \n console.log(chalk.green(`\\nā
Document workspace created: ${workspacePath}`));\n \n // Show next steps\n console.log(chalk.cyan(\"\\nš Next steps:\\n\"));\n console.log(chalk.gray(` 1. Edit voice/tone.md to define your writing voice`));\n console.log(chalk.gray(` 2. Edit OBJECTIVES.md to refine your goals`));\n console.log(chalk.gray(` 3. Run: riotdoc outline ${name}`));\n console.log(chalk.gray(` 4. Run: riotdoc draft ${name}`));\n \n console.log(chalk.cyan(`\\nš Workspace structure:`));\n console.log(chalk.gray(` ${name}/`));\n console.log(chalk.gray(` āāā riotdoc.yaml # Configuration`));\n console.log(chalk.gray(` āāā OBJECTIVES.md # Goals and objectives`));\n console.log(chalk.gray(` āāā OUTLINE.md # Document outline`));\n console.log(chalk.gray(` āāā voice/ # Voice and style`));\n console.log(chalk.gray(` āāā evidence/ # Research and references`));\n console.log(chalk.gray(` āāā drafts/ # Draft iterations`));\n console.log(chalk.gray(` āāā export/ # Final output`));\n \n } catch (error) {\n console.error(chalk.red(\"Failed to create workspace:\"), error);\n process.exit(1);\n }\n });\n}\n","import { readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { RIOTDOC_STRUCTURE } from \"../constants.js\";\nimport type { DocumentObjectives, VoiceConfig } from \"../types.js\";\n\nexport interface OutlineSection {\n title: string;\n points: string[];\n subsections?: OutlineSection[];\n}\n\nexport interface Outline {\n title: string;\n hook: string;\n sections: OutlineSection[];\n conclusion: string;\n}\n\n/**\n * Load outline from workspace\n */\nexport async function loadOutline(workspacePath: string): Promise<string> {\n const outlinePath = join(workspacePath, RIOTDOC_STRUCTURE.outlineFile);\n return await readFile(outlinePath, \"utf-8\");\n}\n\n/**\n * Save outline to workspace\n */\nexport async function saveOutline(workspacePath: string, content: string): Promise<void> {\n const outlinePath = join(workspacePath, RIOTDOC_STRUCTURE.outlineFile);\n await writeFile(outlinePath, content, \"utf-8\");\n}\n\n/**\n * Build prompt for outline generation\n */\nexport function buildOutlinePrompt(\n objectives: DocumentObjectives,\n voice: VoiceConfig,\n documentType: string\n): string {\n return `Generate an outline for a ${documentType}.\n\n## Objectives\n\nPrimary Goal: ${objectives.primaryGoal}\n\nSecondary Goals:\n${objectives.secondaryGoals.map(g => `- ${g}`).join(\"\\n\")}\n\nKey Takeaways:\n${objectives.keyTakeaways.map(t => `- ${t}`).join(\"\\n\")}\n\n${objectives.emotionalArc ? `Emotional Arc: ${objectives.emotionalArc}` : \"\"}\n\n## Voice & Tone\n\nTone: ${voice.tone}\nPoint of View: ${voice.pointOfView}\n\n## Output Format\n\nCreate a markdown outline with:\n1. A compelling hook/introduction\n2. 3-5 main sections with bullet points\n3. A conclusion with call to action\n\nUse ## for main sections, ### for subsections, and - for bullet points.\n`;\n}\n\n/**\n * Parse outline markdown into structure\n */\nexport function parseOutline(content: string): Outline {\n const lines = content.split(\"\\n\");\n const outline: Outline = {\n title: \"\",\n hook: \"\",\n sections: [],\n conclusion: \"\",\n };\n \n let currentSection: OutlineSection | null = null;\n let inIntro = false;\n let inConclusion = false;\n \n for (const line of lines) {\n // Title\n if (line.startsWith(\"# \")) {\n outline.title = line.slice(2).trim();\n continue;\n }\n \n // Main section\n if (line.startsWith(\"## \")) {\n const title = line.slice(3).trim().toLowerCase();\n if (title.includes(\"intro\") || title.includes(\"hook\")) {\n inIntro = true;\n inConclusion = false;\n currentSection = null;\n } else if (title.includes(\"conclusion\")) {\n inIntro = false;\n inConclusion = true;\n currentSection = null;\n } else {\n inIntro = false;\n inConclusion = false;\n currentSection = { title: line.slice(3).trim(), points: [] };\n outline.sections.push(currentSection);\n }\n continue;\n }\n \n // Bullet point\n if (line.match(/^[-*]\\s+/)) {\n const point = line.replace(/^[-*]\\s+/, \"\").trim();\n if (inIntro) {\n outline.hook += (outline.hook ? \"\\n\" : \"\") + point;\n } else if (inConclusion) {\n outline.conclusion += (outline.conclusion ? \"\\n\" : \"\") + point;\n } else if (currentSection) {\n currentSection.points.push(point);\n }\n }\n }\n \n return outline;\n}\n\n/**\n * Format outline structure as markdown\n */\nexport function formatOutline(outline: Outline): string {\n const parts: string[] = [];\n \n parts.push(`# ${outline.title}\\n`);\n \n if (outline.hook) {\n parts.push(`## Introduction\\n`);\n parts.push(outline.hook.split(\"\\n\").map(p => `- ${p}`).join(\"\\n\"));\n parts.push(\"\");\n }\n \n for (const section of outline.sections) {\n parts.push(`## ${section.title}\\n`);\n parts.push(section.points.map(p => `- ${p}`).join(\"\\n\"));\n parts.push(\"\");\n }\n \n if (outline.conclusion) {\n parts.push(`## Conclusion\\n`);\n parts.push(outline.conclusion.split(\"\\n\").map(p => `- ${p}`).join(\"\\n\"));\n }\n \n return parts.join(\"\\n\");\n}\n","import { readFile, stat } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { parse } from \"yaml\";\nimport { RIOTDOC_STRUCTURE } from \"../constants.js\";\nimport type { RiotDoc, DocumentConfig } from \"../types.js\";\n\n/**\n * Load document from workspace\n */\nexport async function loadDocument(workspacePath: string): Promise<RiotDoc | null> {\n try {\n const configPath = join(workspacePath, RIOTDOC_STRUCTURE.configFile);\n const content = await readFile(configPath, \"utf-8\");\n const config = parse(content) as DocumentConfig;\n \n // Convert date strings to Date objects\n config.createdAt = new Date(config.createdAt);\n config.updatedAt = new Date(config.updatedAt);\n \n return {\n config,\n voice: { tone: \"\", pointOfView: \"first\", styleNotes: [], avoid: [] },\n objectives: { primaryGoal: \"\", secondaryGoals: [], keyTakeaways: [] },\n evidence: [],\n drafts: [],\n revisions: [],\n workspacePath,\n };\n } catch {\n return null;\n }\n}\n\n/**\n * Check if path is a RiotDoc workspace\n */\nexport async function isRiotDocWorkspace(path: string): Promise<boolean> {\n try {\n const configPath = join(path, RIOTDOC_STRUCTURE.configFile);\n await stat(configPath);\n return true;\n } catch {\n return false;\n }\n}\n","import { readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { RIOTDOC_STRUCTURE } from \"../constants.js\";\nimport type { DocumentObjectives } from \"../types.js\";\n\n/**\n * Load objectives from workspace\n */\nexport async function loadObjectives(workspacePath: string): Promise<DocumentObjectives> {\n const objectivesPath = join(workspacePath, RIOTDOC_STRUCTURE.objectivesFile);\n \n try {\n const content = await readFile(objectivesPath, \"utf-8\");\n return parseObjectivesMarkdown(content);\n } catch {\n return {\n primaryGoal: \"\",\n secondaryGoals: [],\n keyTakeaways: [],\n };\n }\n}\n\n/**\n * Parse objectives markdown\n */\nfunction parseObjectivesMarkdown(content: string): DocumentObjectives {\n const objectives: DocumentObjectives = {\n primaryGoal: \"\",\n secondaryGoals: [],\n keyTakeaways: [],\n };\n \n // Extract primary goal\n const goalMatch = content.match(/##\\s*Primary\\s+Goal\\s*\\n+([^\\n#]+)/i);\n if (goalMatch) {\n objectives.primaryGoal = goalMatch[1].trim().replace(/^_|_$/g, \"\");\n }\n \n // Extract secondary goals\n const secondaryMatch = content.match(/##\\s*Secondary\\s+Goals\\s*\\n([\\s\\S]*?)(?=\\n##|$)/i);\n if (secondaryMatch) {\n const goals = secondaryMatch[1].matchAll(/^[-*]\\s+(.+)$/gm);\n for (const goal of goals) {\n const text = goal[1].trim().replace(/^_|_$/g, \"\");\n if (text && !text.startsWith(\"Add\")) {\n objectives.secondaryGoals.push(text);\n }\n }\n }\n \n // Extract key takeaways\n const takeawaysMatch = content.match(/##\\s*Key\\s+Takeaways\\s*\\n([\\s\\S]*?)(?=\\n##|$)/i);\n if (takeawaysMatch) {\n const takeaways = takeawaysMatch[1].matchAll(/^\\d+\\.\\s+(.+)$/gm);\n for (const takeaway of takeaways) {\n const text = takeaway[1].trim().replace(/^_|_$/g, \"\");\n if (text && !text.startsWith(\"Define\")) {\n objectives.keyTakeaways.push(text);\n }\n }\n }\n \n // Extract call to action\n const ctaMatch = content.match(/##\\s*Call\\s+to\\s+Action\\s*\\n+([^\\n#]+)/i);\n if (ctaMatch) {\n const cta = ctaMatch[1].trim().replace(/^_|_$/g, \"\");\n if (cta && !cta.startsWith(\"What\")) {\n objectives.callToAction = cta;\n }\n }\n \n // Extract emotional arc\n const arcMatch = content.match(/##\\s*Emotional\\s+Arc\\s*\\n+([^\\n#]+)/i);\n if (arcMatch) {\n const arc = arcMatch[1].trim().replace(/^_|_$/g, \"\");\n if (arc && !arc.startsWith(\"Describe\")) {\n objectives.emotionalArc = arc;\n }\n }\n \n return objectives;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { resolve } from \"node:path\";\nimport { loadOutline, buildOutlinePrompt } from \"../../outline/generator.js\";\nimport { loadDocument } from \"../../workspace/loader.js\";\nimport { loadVoice } from \"../../voice/loader.js\";\nimport { loadObjectives } from \"../../objectives/loader.js\";\n\nexport interface OutlineOptions {\n generate?: boolean;\n edit?: boolean;\n}\n\nexport function registerOutlineCommand(program: Command): void {\n program\n .command(\"outline [path]\")\n .description(\"Generate or edit document outline\")\n .option(\"-g, --generate\", \"Generate outline with AI\")\n .option(\"-e, --edit\", \"Open outline for editing\")\n .action(async (pathArg: string | undefined, options: OutlineOptions) => {\n try {\n const workspacePath = resolve(pathArg || process.cwd());\n \n // Load document state\n const doc = await loadDocument(workspacePath);\n if (!doc) {\n console.error(chalk.red(\"Not a RiotDoc workspace\"));\n process.exit(1);\n }\n \n if (options.generate) {\n // Generate outline with AI\n console.log(chalk.cyan(\"Generating outline...\"));\n \n const voice = await loadVoice(workspacePath);\n const objectives = await loadObjectives(workspacePath);\n \n const prompt = buildOutlinePrompt(objectives, voice, doc.config.type);\n \n // TODO: Call AI provider\n console.log(chalk.yellow(\"\\nOutline generation prompt:\"));\n console.log(chalk.gray(prompt));\n console.log(chalk.yellow(\"\\n(AI integration pending - edit OUTLINE.md manually)\"));\n \n } else if (options.edit) {\n // Open in editor\n const { spawn } = await import(\"node:child_process\");\n const editor = process.env.EDITOR || \"vim\";\n const outlinePath = `${workspacePath}/OUTLINE.md`;\n \n spawn(editor, [outlinePath], { stdio: \"inherit\" });\n \n } else {\n // Show current outline\n const outline = await loadOutline(workspacePath);\n console.log(chalk.cyan(\"\\nš Current Outline:\\n\"));\n console.log(outline);\n \n console.log(chalk.gray(\"\\nOptions:\"));\n console.log(chalk.gray(\" --generate Generate outline with AI\"));\n console.log(chalk.gray(\" --edit Open outline in editor\"));\n }\n \n } catch (error) {\n console.error(chalk.red(\"Failed:\"), error);\n process.exit(1);\n }\n });\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\n\nexport interface DraftOptions {\n level?: string;\n from?: string;\n}\n\nexport function registerDraftCommand(program: Command): void {\n program\n .command(\"draft [path]\")\n .description(\"Create a new draft\")\n .option(\"-l, --level <level>\", \"AI assistance level (generate, expand, revise)\", \"expand\")\n .option(\"-f, --from <draft>\", \"Base on existing draft\")\n .action(async (_path: string | undefined, _options: DraftOptions) => {\n console.log(chalk.yellow(\"Draft command - AI integration pending\"));\n console.log(chalk.gray(\"\\nThis command will:\"));\n console.log(chalk.gray(\" 1. Load outline and objectives\"));\n console.log(chalk.gray(\" 2. Apply voice and style rules\"));\n console.log(chalk.gray(\" 3. Generate draft with specified assistance level\"));\n console.log(chalk.gray(\" 4. Save to drafts/ directory\"));\n });\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\n\nexport interface ReviseOptions {\n draft?: string;\n message?: string;\n}\n\nexport function registerReviseCommand(program: Command): void {\n program\n .command(\"revise [path]\")\n .description(\"Add revision feedback\")\n .option(\"-d, --draft <number>\", \"Target draft number\")\n .option(\"-m, --message <message>\", \"Revision feedback\")\n .action(async (_path: string | undefined, _options: ReviseOptions) => {\n console.log(chalk.yellow(\"Revise command - implementation pending\"));\n console.log(chalk.gray(\"\\nThis command will:\"));\n console.log(chalk.gray(\" 1. Load specified draft\"));\n console.log(chalk.gray(\" 2. Collect revision feedback\"));\n console.log(chalk.gray(\" 3. Save to revisions/ directory\"));\n });\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\n\nexport interface CleanupOptions {\n draft?: string;\n}\n\nexport function registerCleanupCommand(program: Command): void {\n program\n .command(\"cleanup [path]\")\n .description(\"Light editing pass (grammar, clarity)\")\n .option(\"-d, --draft <number>\", \"Target draft\")\n .action(async (_path: string | undefined, _options: CleanupOptions) => {\n console.log(chalk.yellow(\"Cleanup command - AI integration pending\"));\n console.log(chalk.gray(\"\\nThis command will:\"));\n console.log(chalk.gray(\" 1. Load draft\"));\n console.log(chalk.gray(\" 2. Apply light editing for grammar and clarity\"));\n console.log(chalk.gray(\" 3. Save cleaned version\"));\n });\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\n\nexport interface SpellcheckOptions {\n draft?: string;\n}\n\nexport function registerSpellcheckCommand(program: Command): void {\n program\n .command(\"spellcheck [path]\")\n .description(\"Fix spelling and grammar only\")\n .option(\"-d, --draft <number>\", \"Target draft\")\n .action(async (_path: string | undefined, _options: SpellcheckOptions) => {\n console.log(chalk.yellow(\"Spellcheck command - implementation pending\"));\n console.log(chalk.gray(\"\\nThis command will:\"));\n console.log(chalk.gray(\" 1. Load draft\"));\n console.log(chalk.gray(\" 2. Check spelling and basic grammar\"));\n console.log(chalk.gray(\" 3. Report or fix issues\"));\n });\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\n\nexport interface ExportOptions {\n draft?: string;\n output?: string;\n}\n\nexport function registerExportCommand(program: Command): void {\n program\n .command(\"export [path]\")\n .description(\"Export publication-ready document\")\n .option(\"-d, --draft <number>\", \"Source draft\")\n .option(\"-o, --output <file>\", \"Output file name\")\n .action(async (_path: string | undefined, _options: ExportOptions) => {\n console.log(chalk.yellow(\"Export command - implementation pending\"));\n console.log(chalk.gray(\"\\nThis command will:\"));\n console.log(chalk.gray(\" 1. Load specified draft\"));\n console.log(chalk.gray(\" 2. Apply final formatting\"));\n console.log(chalk.gray(\" 3. Export to export/ directory\"));\n });\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { resolve } from \"node:path\";\nimport { loadDocument } from \"../../workspace/loader.js\";\n\nexport function registerStatusCommand(program: Command): void {\n program\n .command(\"status [path]\")\n .description(\"Show document status\")\n .action(async (pathArg: string | undefined) => {\n try {\n const workspacePath = resolve(pathArg || process.cwd());\n \n const doc = await loadDocument(workspacePath);\n if (!doc) {\n console.error(chalk.red(\"Not a RiotDoc workspace\"));\n process.exit(1);\n }\n \n console.log(chalk.cyan(\"\\nš Document Status\\n\"));\n console.log(chalk.gray(`Title: ${doc.config.title}`));\n console.log(chalk.gray(`Type: ${doc.config.type}`));\n console.log(chalk.gray(`Status: ${doc.config.status}`));\n console.log(chalk.gray(`Created: ${doc.config.createdAt.toLocaleDateString()}`));\n console.log(chalk.gray(`Updated: ${doc.config.updatedAt.toLocaleDateString()}`));\n \n if (doc.config.targetWordCount) {\n console.log(chalk.gray(`Target: ${doc.config.targetWordCount} words`));\n }\n \n console.log(chalk.cyan(\"\\nš Workspace: \") + chalk.gray(workspacePath));\n \n } catch (error) {\n console.error(chalk.red(\"Failed:\"), error);\n process.exit(1);\n }\n });\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { registerCreateCommand } from \"./commands/create.js\";\nimport { registerOutlineCommand } from \"./commands/outline.js\";\nimport { registerDraftCommand } from \"./commands/draft.js\";\nimport { registerReviseCommand } from \"./commands/revise.js\";\nimport { registerCleanupCommand } from \"./commands/cleanup.js\";\nimport { registerSpellcheckCommand } from \"./commands/spellcheck.js\";\nimport { registerExportCommand } from \"./commands/export.js\";\nimport { registerStatusCommand } from \"./commands/status.js\";\n\nconst VERSION = \"1.0.0-dev.0\";\n\n/**\n * Create the CLI program\n */\nexport function createProgram(): Command {\n const program = new Command();\n \n program\n .name(\"riotdoc\")\n .description(\"Structured document creation with AI assistance\")\n .version(VERSION)\n .configureHelp({\n sortSubcommands: true,\n });\n \n // Register commands (implemented in subsequent steps)\n registerCreateCommand(program);\n registerOutlineCommand(program);\n registerDraftCommand(program);\n registerReviseCommand(program);\n registerCleanupCommand(program);\n registerSpellcheckCommand(program);\n registerExportCommand(program);\n registerStatusCommand(program);\n \n // Global options\n program\n .option(\"-v, --verbose\", \"Verbose output\")\n .option(\"--json\", \"Output as JSON\")\n .option(\"--no-color\", \"Disable colored output\");\n \n // Handle unknown commands\n program.on(\"command:*\", () => {\n console.error(chalk.red(`Unknown command: ${program.args.join(\" \")}`));\n console.log(`Run ${chalk.cyan(\"riotdoc --help\")} for usage.`);\n process.exit(1);\n });\n \n return program;\n}\n\n// All commands are now imported from separate files\n"],"names":[],"mappings":";;;;;;AAcA,MAAM,iBAAiB;AAAA,EACnB,EAAE,MAAM,aAAa,OAAO,YAAA;AAAA,EAC5B,EAAE,MAAM,kBAAkB,OAAO,iBAAA;AAAA,EACjC,EAAE,MAAM,2BAA2B,OAAO,gBAAA;AAAA,EAC1C,EAAE,MAAM,cAAc,OAAO,aAAA;AAAA,EAC7B,EAAE,MAAM,UAAU,OAAO,SAAA;AAC7B;AAKA,eAAe,gBAAiD;AAC5D,QAAM,EAAE,KAAA,IAAS,MAAM,SAAS,OAAO,CAAC;AAAA,IACpC,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,EAAA,CACZ,CAAC;AACF,SAAO;AACX;AAKA,eAAe,eAAe,MAA+B;AACzD,QAAM,eAAe,KAChB,MAAM,GAAG,EACT,IAAI,OAAK,EAAE,OAAO,CAAC,EAAE,YAAA,IAAgB,EAAE,MAAM,CAAC,CAAC,EAC/C,KAAK,GAAG;AAEb,QAAM,EAAE,MAAA,IAAU,MAAM,SAAS,OAAO,CAAC;AAAA,IACrC,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,EAAA,CACZ,CAAC;AACF,SAAO;AACX;AAKA,eAAe,gBAAiC;AAC5C,QAAM,EAAE,KAAA,IAAS,MAAM,SAA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C,OAAO,cAAc,wBAAwB;AAGlD,UAAQ,GAAG,aAAa,MAAM;AAC1B,YAAQ,MAAM,MAAM,IAAI,oBAAoB,QAAQ,KAAK,KAAK,GAAG,CAAC,EAAE,CAAC;AACrE,YAAQ,IAAI,OAAO,MAAM,KAAK,gBAAgB,CAAC,aAAa;AAC5D,YAAQ,KAAK,CAAC;AAAA,EAClB,CAAC;AAED,SAAO;AACX;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AI assistance level for operations
|
|
5
|
+
*/
|
|
6
|
+
export declare type AssistanceLevel = "generate" | "expand" | "revise" | "cleanup" | "spellcheck";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Build a prompt section describing the voice/tone
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildVoicePrompt(voice: VoiceConfig): string;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Create a new RiotDoc workspace
|
|
15
|
+
*/
|
|
16
|
+
export declare function createWorkspace(options: CreateWorkspaceOptions): Promise<string>;
|
|
17
|
+
|
|
18
|
+
export declare interface CreateWorkspaceOptions {
|
|
19
|
+
/** Workspace path */
|
|
20
|
+
path: string;
|
|
21
|
+
/** Document ID (derived from path if not provided) */
|
|
22
|
+
id?: string;
|
|
23
|
+
/** Document title */
|
|
24
|
+
title: string;
|
|
25
|
+
/** Document type */
|
|
26
|
+
type: DocumentConfig["type"];
|
|
27
|
+
/** Initial voice config (uses defaults if not provided) */
|
|
28
|
+
voice?: Partial<VoiceConfig>;
|
|
29
|
+
/** Initial objectives */
|
|
30
|
+
objectives?: Partial<DocumentObjectives>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Default objectives template
|
|
35
|
+
*/
|
|
36
|
+
export declare const DEFAULT_OBJECTIVES: {
|
|
37
|
+
primaryGoal: string;
|
|
38
|
+
secondaryGoals: never[];
|
|
39
|
+
keyTakeaways: never[];
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Default voice configuration
|
|
44
|
+
*/
|
|
45
|
+
export declare const DEFAULT_VOICE: {
|
|
46
|
+
tone: string;
|
|
47
|
+
pointOfView: "first";
|
|
48
|
+
styleNotes: string[];
|
|
49
|
+
avoid: string[];
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Core document configuration
|
|
54
|
+
*/
|
|
55
|
+
export declare interface DocumentConfig {
|
|
56
|
+
/** Document identifier */
|
|
57
|
+
id: string;
|
|
58
|
+
/** Human-readable title */
|
|
59
|
+
title: string;
|
|
60
|
+
/** Document type */
|
|
61
|
+
type: DocumentType;
|
|
62
|
+
/** Current status */
|
|
63
|
+
status: DocumentStatus;
|
|
64
|
+
/** Creation timestamp */
|
|
65
|
+
createdAt: Date;
|
|
66
|
+
/** Last modified timestamp */
|
|
67
|
+
updatedAt: Date;
|
|
68
|
+
/** Target word count (optional) */
|
|
69
|
+
targetWordCount?: number;
|
|
70
|
+
/** Target audience description */
|
|
71
|
+
audience?: string;
|
|
72
|
+
/** Custom metadata */
|
|
73
|
+
metadata?: Record<string, unknown>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export declare const DocumentConfigSchema: z.ZodObject<{
|
|
77
|
+
id: z.ZodString;
|
|
78
|
+
title: z.ZodString;
|
|
79
|
+
type: z.ZodEnum<["blog-post", "podcast-script", "technical-doc", "newsletter", "custom"]>;
|
|
80
|
+
status: z.ZodEnum<["idea", "outlined", "drafting", "revising", "final", "exported"]>;
|
|
81
|
+
createdAt: z.ZodDate;
|
|
82
|
+
updatedAt: z.ZodDate;
|
|
83
|
+
targetWordCount: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
audience: z.ZodOptional<z.ZodString>;
|
|
85
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
id: string;
|
|
88
|
+
title: string;
|
|
89
|
+
type: "blog-post" | "podcast-script" | "technical-doc" | "newsletter" | "custom";
|
|
90
|
+
status: "idea" | "outlined" | "drafting" | "revising" | "final" | "exported";
|
|
91
|
+
createdAt: Date;
|
|
92
|
+
updatedAt: Date;
|
|
93
|
+
targetWordCount?: number | undefined;
|
|
94
|
+
audience?: string | undefined;
|
|
95
|
+
metadata?: Record<string, unknown> | undefined;
|
|
96
|
+
}, {
|
|
97
|
+
id: string;
|
|
98
|
+
title: string;
|
|
99
|
+
type: "blog-post" | "podcast-script" | "technical-doc" | "newsletter" | "custom";
|
|
100
|
+
status: "idea" | "outlined" | "drafting" | "revising" | "final" | "exported";
|
|
101
|
+
createdAt: Date;
|
|
102
|
+
updatedAt: Date;
|
|
103
|
+
targetWordCount?: number | undefined;
|
|
104
|
+
audience?: string | undefined;
|
|
105
|
+
metadata?: Record<string, unknown> | undefined;
|
|
106
|
+
}>;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Document objectives
|
|
110
|
+
*/
|
|
111
|
+
export declare interface DocumentObjectives {
|
|
112
|
+
/** Primary goal of the document */
|
|
113
|
+
primaryGoal: string;
|
|
114
|
+
/** Secondary objectives */
|
|
115
|
+
secondaryGoals: string[];
|
|
116
|
+
/** Call to action (if any) */
|
|
117
|
+
callToAction?: string;
|
|
118
|
+
/** Key takeaways for reader */
|
|
119
|
+
keyTakeaways: string[];
|
|
120
|
+
/** Emotional arc description */
|
|
121
|
+
emotionalArc?: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export declare const DocumentObjectivesSchema: z.ZodObject<{
|
|
125
|
+
primaryGoal: z.ZodString;
|
|
126
|
+
secondaryGoals: z.ZodArray<z.ZodString, "many">;
|
|
127
|
+
callToAction: z.ZodOptional<z.ZodString>;
|
|
128
|
+
keyTakeaways: z.ZodArray<z.ZodString, "many">;
|
|
129
|
+
emotionalArc: z.ZodOptional<z.ZodString>;
|
|
130
|
+
}, "strip", z.ZodTypeAny, {
|
|
131
|
+
primaryGoal: string;
|
|
132
|
+
secondaryGoals: string[];
|
|
133
|
+
keyTakeaways: string[];
|
|
134
|
+
callToAction?: string | undefined;
|
|
135
|
+
emotionalArc?: string | undefined;
|
|
136
|
+
}, {
|
|
137
|
+
primaryGoal: string;
|
|
138
|
+
secondaryGoals: string[];
|
|
139
|
+
keyTakeaways: string[];
|
|
140
|
+
callToAction?: string | undefined;
|
|
141
|
+
emotionalArc?: string | undefined;
|
|
142
|
+
}>;
|
|
143
|
+
|
|
144
|
+
export declare interface DocumentStats {
|
|
145
|
+
wordCount: number;
|
|
146
|
+
sentenceCount: number;
|
|
147
|
+
paragraphCount: number;
|
|
148
|
+
avgWordsPerSentence: number;
|
|
149
|
+
avgSentencesPerParagraph: number;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Document lifecycle status
|
|
154
|
+
*/
|
|
155
|
+
export declare type DocumentStatus = "idea" | "outlined" | "drafting" | "revising" | "final" | "exported";
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Document type classification
|
|
159
|
+
*/
|
|
160
|
+
export declare type DocumentType = "blog-post" | "podcast-script" | "technical-doc" | "newsletter" | "custom";
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Draft metadata
|
|
164
|
+
*/
|
|
165
|
+
export declare interface Draft {
|
|
166
|
+
/** Draft number (01, 02, etc.) */
|
|
167
|
+
number: number;
|
|
168
|
+
/** File path relative to drafts/ */
|
|
169
|
+
path: string;
|
|
170
|
+
/** Creation timestamp */
|
|
171
|
+
createdAt: Date;
|
|
172
|
+
/** Word count */
|
|
173
|
+
wordCount: number;
|
|
174
|
+
/** Assistance level used */
|
|
175
|
+
assistanceLevel: AssistanceLevel;
|
|
176
|
+
/** Notes about this draft */
|
|
177
|
+
notes?: string;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Evidence/reference item
|
|
182
|
+
*/
|
|
183
|
+
export declare interface EvidenceItem {
|
|
184
|
+
/** Unique identifier */
|
|
185
|
+
id: string;
|
|
186
|
+
/** File path relative to evidence/ */
|
|
187
|
+
path: string;
|
|
188
|
+
/** Description of the evidence */
|
|
189
|
+
description: string;
|
|
190
|
+
/** Type of evidence */
|
|
191
|
+
type: "research" | "quote" | "data" | "image" | "link" | "other";
|
|
192
|
+
/** Whether it's been incorporated */
|
|
193
|
+
incorporated: boolean;
|
|
194
|
+
/** Which draft incorporated it */
|
|
195
|
+
incorporatedIn?: string;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Format style validation result for terminal
|
|
200
|
+
*/
|
|
201
|
+
export declare function formatStyleReport(result: StyleValidationResult): string;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Check if voice configuration exists
|
|
205
|
+
*/
|
|
206
|
+
export declare function hasVoiceConfig(workspacePath: string): Promise<boolean>;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Load glossary from workspace
|
|
210
|
+
*/
|
|
211
|
+
export declare function loadGlossary(workspacePath: string): Promise<Map<string, string>>;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Load voice configuration from a document workspace
|
|
215
|
+
*/
|
|
216
|
+
export declare function loadVoice(workspacePath: string): Promise<VoiceConfig>;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Parse style rules markdown
|
|
220
|
+
*/
|
|
221
|
+
export declare function parseStyleRulesMarkdown(content: string): {
|
|
222
|
+
do: string[];
|
|
223
|
+
dont: string[];
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Parse tone markdown content
|
|
228
|
+
*/
|
|
229
|
+
export declare function parseToneMarkdown(content: string): {
|
|
230
|
+
tone: string;
|
|
231
|
+
pointOfView: "first" | "second" | "third";
|
|
232
|
+
examplePhrases?: string[];
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Revision feedback
|
|
237
|
+
*/
|
|
238
|
+
export declare interface Revision {
|
|
239
|
+
/** Revision number */
|
|
240
|
+
number: number;
|
|
241
|
+
/** File path */
|
|
242
|
+
path: string;
|
|
243
|
+
/** Timestamp */
|
|
244
|
+
createdAt: Date;
|
|
245
|
+
/** Which draft this revises */
|
|
246
|
+
targetDraft: number;
|
|
247
|
+
/** Summary of feedback */
|
|
248
|
+
summary: string;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Complete document state
|
|
253
|
+
*/
|
|
254
|
+
export declare interface RiotDoc {
|
|
255
|
+
/** Configuration */
|
|
256
|
+
config: DocumentConfig;
|
|
257
|
+
/** Voice settings */
|
|
258
|
+
voice: VoiceConfig;
|
|
259
|
+
/** Objectives */
|
|
260
|
+
objectives: DocumentObjectives;
|
|
261
|
+
/** Evidence items */
|
|
262
|
+
evidence: EvidenceItem[];
|
|
263
|
+
/** Draft history */
|
|
264
|
+
drafts: Draft[];
|
|
265
|
+
/** Revision history */
|
|
266
|
+
revisions: Revision[];
|
|
267
|
+
/** Path to document workspace */
|
|
268
|
+
workspacePath: string;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Standard directory structure for a RiotDoc workspace
|
|
273
|
+
*/
|
|
274
|
+
export declare const RIOTDOC_STRUCTURE: {
|
|
275
|
+
/** Main configuration file */
|
|
276
|
+
readonly configFile: "riotdoc.yaml";
|
|
277
|
+
/** Objectives document */
|
|
278
|
+
readonly objectivesFile: "OBJECTIVES.md";
|
|
279
|
+
/** Outline document */
|
|
280
|
+
readonly outlineFile: "OUTLINE.md";
|
|
281
|
+
/** Voice configuration directory */
|
|
282
|
+
readonly voiceDir: "voice";
|
|
283
|
+
/** Voice files */
|
|
284
|
+
readonly voiceFiles: {
|
|
285
|
+
readonly tone: "tone.md";
|
|
286
|
+
readonly styleRules: "style-rules.md";
|
|
287
|
+
readonly glossary: "glossary.md";
|
|
288
|
+
};
|
|
289
|
+
/** Evidence directory */
|
|
290
|
+
readonly evidenceDir: "evidence";
|
|
291
|
+
/** Drafts directory */
|
|
292
|
+
readonly draftsDir: "drafts";
|
|
293
|
+
/** Revisions directory */
|
|
294
|
+
readonly revisionsDir: "revisions";
|
|
295
|
+
/** Export directory */
|
|
296
|
+
readonly exportDir: "export";
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
export declare interface StyleRules {
|
|
300
|
+
maxWordCount?: number;
|
|
301
|
+
minWordCount?: number;
|
|
302
|
+
maxSentenceLength?: number;
|
|
303
|
+
checkPassiveVoice?: boolean;
|
|
304
|
+
avoidPatterns?: string[];
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export declare interface StyleValidationResult {
|
|
308
|
+
valid: boolean;
|
|
309
|
+
violations: StyleViolation[];
|
|
310
|
+
stats: DocumentStats;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export declare interface StyleViolation {
|
|
314
|
+
rule: string;
|
|
315
|
+
message: string;
|
|
316
|
+
line?: number;
|
|
317
|
+
severity: "error" | "warning" | "info";
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Validate document content against style rules
|
|
322
|
+
*/
|
|
323
|
+
export declare function validateStyle(content: string, rules: StyleRules): StyleValidationResult;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Voice and tone configuration
|
|
327
|
+
*/
|
|
328
|
+
export declare interface VoiceConfig {
|
|
329
|
+
/** Tone description (e.g., "conversational", "formal") */
|
|
330
|
+
tone: string;
|
|
331
|
+
/** Point of view (first, second, third) */
|
|
332
|
+
pointOfView: "first" | "second" | "third";
|
|
333
|
+
/** Style notes */
|
|
334
|
+
styleNotes: string[];
|
|
335
|
+
/** Things to avoid */
|
|
336
|
+
avoid: string[];
|
|
337
|
+
/** Example phrases that capture the voice */
|
|
338
|
+
examplePhrases?: string[];
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export declare const VoiceConfigSchema: z.ZodObject<{
|
|
342
|
+
tone: z.ZodString;
|
|
343
|
+
pointOfView: z.ZodEnum<["first", "second", "third"]>;
|
|
344
|
+
styleNotes: z.ZodArray<z.ZodString, "many">;
|
|
345
|
+
avoid: z.ZodArray<z.ZodString, "many">;
|
|
346
|
+
examplePhrases: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
347
|
+
}, "strip", z.ZodTypeAny, {
|
|
348
|
+
tone: string;
|
|
349
|
+
pointOfView: "first" | "second" | "third";
|
|
350
|
+
styleNotes: string[];
|
|
351
|
+
avoid: string[];
|
|
352
|
+
examplePhrases?: string[] | undefined;
|
|
353
|
+
}, {
|
|
354
|
+
tone: string;
|
|
355
|
+
pointOfView: "first" | "second" | "third";
|
|
356
|
+
styleNotes: string[];
|
|
357
|
+
avoid: string[];
|
|
358
|
+
examplePhrases?: string[] | undefined;
|
|
359
|
+
}>;
|
|
360
|
+
|
|
361
|
+
export { }
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { D, a, R, c, h, l, b, p, d } from "./loader-B7ZeTPQg.js";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
const DocumentConfigSchema = z.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
title: z.string(),
|
|
7
|
+
type: z.enum(["blog-post", "podcast-script", "technical-doc", "newsletter", "custom"]),
|
|
8
|
+
status: z.enum(["idea", "outlined", "drafting", "revising", "final", "exported"]),
|
|
9
|
+
createdAt: z.coerce.date(),
|
|
10
|
+
updatedAt: z.coerce.date(),
|
|
11
|
+
targetWordCount: z.number().optional(),
|
|
12
|
+
audience: z.string().optional(),
|
|
13
|
+
metadata: z.record(z.unknown()).optional()
|
|
14
|
+
});
|
|
15
|
+
const VoiceConfigSchema = z.object({
|
|
16
|
+
tone: z.string(),
|
|
17
|
+
pointOfView: z.enum(["first", "second", "third"]),
|
|
18
|
+
styleNotes: z.array(z.string()),
|
|
19
|
+
avoid: z.array(z.string()),
|
|
20
|
+
examplePhrases: z.array(z.string()).optional()
|
|
21
|
+
});
|
|
22
|
+
const DocumentObjectivesSchema = z.object({
|
|
23
|
+
primaryGoal: z.string(),
|
|
24
|
+
secondaryGoals: z.array(z.string()),
|
|
25
|
+
callToAction: z.string().optional(),
|
|
26
|
+
keyTakeaways: z.array(z.string()),
|
|
27
|
+
emotionalArc: z.string().optional()
|
|
28
|
+
});
|
|
29
|
+
function buildVoicePrompt(voice) {
|
|
30
|
+
const sections = [];
|
|
31
|
+
sections.push(`## Writing Voice
|
|
32
|
+
`);
|
|
33
|
+
sections.push(`Tone: ${voice.tone}`);
|
|
34
|
+
sections.push(`Point of view: ${formatPointOfView(voice.pointOfView)}`);
|
|
35
|
+
if (voice.styleNotes.length > 0) {
|
|
36
|
+
sections.push(`
|
|
37
|
+
### Style Guidelines
|
|
38
|
+
`);
|
|
39
|
+
sections.push(`Do:
|
|
40
|
+
${voice.styleNotes.map((n) => `- ${n}`).join("\n")}`);
|
|
41
|
+
}
|
|
42
|
+
if (voice.avoid.length > 0) {
|
|
43
|
+
sections.push(`
|
|
44
|
+
Avoid:
|
|
45
|
+
${voice.avoid.map((a2) => `- ${a2}`).join("\n")}`);
|
|
46
|
+
}
|
|
47
|
+
if (voice.examplePhrases && voice.examplePhrases.length > 0) {
|
|
48
|
+
sections.push(`
|
|
49
|
+
### Example Phrases
|
|
50
|
+
`);
|
|
51
|
+
sections.push(voice.examplePhrases.map((p2) => `"${p2}"`).join("\n"));
|
|
52
|
+
}
|
|
53
|
+
return sections.join("\n");
|
|
54
|
+
}
|
|
55
|
+
function formatPointOfView(pov) {
|
|
56
|
+
switch (pov) {
|
|
57
|
+
case "first":
|
|
58
|
+
return "First person (I, we)";
|
|
59
|
+
case "second":
|
|
60
|
+
return "Second person (you)";
|
|
61
|
+
case "third":
|
|
62
|
+
return "Third person (they, it)";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function validateStyle(content, rules) {
|
|
66
|
+
const violations = [];
|
|
67
|
+
const stats = calculateStats(content);
|
|
68
|
+
if (rules.maxWordCount && stats.wordCount > rules.maxWordCount) {
|
|
69
|
+
violations.push({
|
|
70
|
+
rule: "max-word-count",
|
|
71
|
+
message: `Document has ${stats.wordCount} words, exceeds max of ${rules.maxWordCount}`,
|
|
72
|
+
severity: "warning"
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (rules.minWordCount && stats.wordCount < rules.minWordCount) {
|
|
76
|
+
violations.push({
|
|
77
|
+
rule: "min-word-count",
|
|
78
|
+
message: `Document has ${stats.wordCount} words, below min of ${rules.minWordCount}`,
|
|
79
|
+
severity: "warning"
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (rules.maxSentenceLength) {
|
|
83
|
+
const longSentences = findLongSentences(content, rules.maxSentenceLength);
|
|
84
|
+
for (const sentence of longSentences) {
|
|
85
|
+
violations.push({
|
|
86
|
+
rule: "sentence-length",
|
|
87
|
+
message: `Sentence has ${sentence.wordCount} words: "${sentence.preview}..."`,
|
|
88
|
+
line: sentence.line,
|
|
89
|
+
severity: "info"
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (rules.checkPassiveVoice) {
|
|
94
|
+
const passiveInstances = findPassiveVoice(content);
|
|
95
|
+
for (const instance of passiveInstances) {
|
|
96
|
+
violations.push({
|
|
97
|
+
rule: "passive-voice",
|
|
98
|
+
message: `Possible passive voice: "${instance.text}"`,
|
|
99
|
+
line: instance.line,
|
|
100
|
+
severity: "info"
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (rules.avoidPatterns) {
|
|
105
|
+
for (const pattern of rules.avoidPatterns) {
|
|
106
|
+
const regex = new RegExp(pattern, "gi");
|
|
107
|
+
const matches = content.matchAll(regex);
|
|
108
|
+
for (const match of matches) {
|
|
109
|
+
violations.push({
|
|
110
|
+
rule: "avoid-pattern",
|
|
111
|
+
message: `Found "${match[0]}" which should be avoided`,
|
|
112
|
+
severity: "warning"
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
valid: violations.filter((v) => v.severity === "error").length === 0,
|
|
119
|
+
violations,
|
|
120
|
+
stats
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function calculateStats(content) {
|
|
124
|
+
const words = content.split(/\s+/).filter((w) => w.length > 0);
|
|
125
|
+
const sentences = content.split(/[.!?]+/).filter((s) => s.trim().length > 0);
|
|
126
|
+
const paragraphs = content.split(/\n\n+/).filter((p2) => p2.trim().length > 0);
|
|
127
|
+
return {
|
|
128
|
+
wordCount: words.length,
|
|
129
|
+
sentenceCount: sentences.length,
|
|
130
|
+
paragraphCount: paragraphs.length,
|
|
131
|
+
avgWordsPerSentence: sentences.length > 0 ? Math.round(words.length / sentences.length) : 0,
|
|
132
|
+
avgSentencesPerParagraph: paragraphs.length > 0 ? Math.round(sentences.length / paragraphs.length) : 0
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function findLongSentences(content, maxWords) {
|
|
136
|
+
const results = [];
|
|
137
|
+
const lines = content.split("\n");
|
|
138
|
+
let lineNum = 0;
|
|
139
|
+
for (const line of lines) {
|
|
140
|
+
lineNum++;
|
|
141
|
+
const sentences = line.split(/[.!?]+/);
|
|
142
|
+
for (const sentence of sentences) {
|
|
143
|
+
const words = sentence.trim().split(/\s+/).filter((w) => w.length > 0);
|
|
144
|
+
if (words.length > maxWords) {
|
|
145
|
+
results.push({
|
|
146
|
+
wordCount: words.length,
|
|
147
|
+
preview: sentence.trim().slice(0, 50),
|
|
148
|
+
line: lineNum
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return results;
|
|
154
|
+
}
|
|
155
|
+
function findPassiveVoice(content) {
|
|
156
|
+
const results = [];
|
|
157
|
+
const lines = content.split("\n");
|
|
158
|
+
const passivePatterns = [
|
|
159
|
+
/\b(was|were|been|being|is|are|am)\s+\w+ed\b/gi,
|
|
160
|
+
/\b(was|were|been|being|is|are|am)\s+\w+en\b/gi
|
|
161
|
+
];
|
|
162
|
+
let lineNum = 0;
|
|
163
|
+
for (const line of lines) {
|
|
164
|
+
lineNum++;
|
|
165
|
+
for (const pattern of passivePatterns) {
|
|
166
|
+
const matches = line.matchAll(pattern);
|
|
167
|
+
for (const match of matches) {
|
|
168
|
+
results.push({
|
|
169
|
+
text: match[0],
|
|
170
|
+
line: lineNum
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return results;
|
|
176
|
+
}
|
|
177
|
+
function formatStyleReport(result) {
|
|
178
|
+
const lines = [];
|
|
179
|
+
lines.push(chalk.cyan("\nš Document Statistics"));
|
|
180
|
+
lines.push(chalk.gray(` Words: ${result.stats.wordCount}`));
|
|
181
|
+
lines.push(chalk.gray(` Sentences: ${result.stats.sentenceCount}`));
|
|
182
|
+
lines.push(chalk.gray(` Paragraphs: ${result.stats.paragraphCount}`));
|
|
183
|
+
lines.push(chalk.gray(` Avg words/sentence: ${result.stats.avgWordsPerSentence}`));
|
|
184
|
+
if (result.violations.length === 0) {
|
|
185
|
+
lines.push(chalk.green("\nā
No style violations found."));
|
|
186
|
+
return lines.join("\n");
|
|
187
|
+
}
|
|
188
|
+
lines.push(chalk.yellow(`
|
|
189
|
+
ā ļø Style Issues (${result.violations.length}):`));
|
|
190
|
+
const grouped = groupViolations(result.violations);
|
|
191
|
+
for (const [severity, violations] of Object.entries(grouped)) {
|
|
192
|
+
if (violations.length === 0) continue;
|
|
193
|
+
const icon = severity === "error" ? "ā" : severity === "warning" ? "ā ļø" : "ā¹ļø";
|
|
194
|
+
const color = severity === "error" ? chalk.red : severity === "warning" ? chalk.yellow : chalk.gray;
|
|
195
|
+
lines.push(color(`
|
|
196
|
+
${icon} ${severity.toUpperCase()} (${violations.length}):`));
|
|
197
|
+
for (const v of violations.slice(0, 5)) {
|
|
198
|
+
const lineInfo = v.line ? ` (line ${v.line})` : "";
|
|
199
|
+
lines.push(color(` - ${v.message}${lineInfo}`));
|
|
200
|
+
}
|
|
201
|
+
if (violations.length > 5) {
|
|
202
|
+
lines.push(color(` ... and ${violations.length - 5} more`));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return lines.join("\n");
|
|
206
|
+
}
|
|
207
|
+
function groupViolations(violations) {
|
|
208
|
+
return {
|
|
209
|
+
error: violations.filter((v) => v.severity === "error"),
|
|
210
|
+
warning: violations.filter((v) => v.severity === "warning"),
|
|
211
|
+
info: violations.filter((v) => v.severity === "info")
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
export {
|
|
215
|
+
D as DEFAULT_OBJECTIVES,
|
|
216
|
+
a as DEFAULT_VOICE,
|
|
217
|
+
DocumentConfigSchema,
|
|
218
|
+
DocumentObjectivesSchema,
|
|
219
|
+
R as RIOTDOC_STRUCTURE,
|
|
220
|
+
VoiceConfigSchema,
|
|
221
|
+
buildVoicePrompt,
|
|
222
|
+
c as createWorkspace,
|
|
223
|
+
formatStyleReport,
|
|
224
|
+
h as hasVoiceConfig,
|
|
225
|
+
l as loadGlossary,
|
|
226
|
+
b as loadVoice,
|
|
227
|
+
p as parseStyleRulesMarkdown,
|
|
228
|
+
d as parseToneMarkdown,
|
|
229
|
+
validateStyle
|
|
230
|
+
};
|
|
231
|
+
//# sourceMappingURL=index.js.map
|