{"version":3,"file":"goal-writer.d.ts","sourceRoot":"","sources":["../src/goal-writer.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,cAAc;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QAAE,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;KAAE,CAAC;IAC5E,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAS/E","sourcesContent":["import { writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nconst GOAL_SYSTEM = `You turn a user's one-line wish into a project goal document.\nThe document guides autonomous coding agents. Write plain markdown.\nInclude: a one-sentence product statement, the current state (say what exists,\nor that nothing exists yet), the direction (technology and constraints), and\na definition of done the agents can verify task by task.\nState one direction only. Never offer alternatives.\nKeep it under 30 lines. Output only the markdown document.`;\n\nexport interface GoalWriterDeps {\n\tprojectDir: string;\n\tprompt: string;\n\tcaller: { call(systemPrompt: string, userPrompt: string): Promise<string> };\n\tgoalPath?: string;\n}\n\nexport async function writeGoalFromPrompt(deps: GoalWriterDeps): Promise<string> {\n\tconst goalPath = deps.goalPath ?? join(deps.projectDir, \"GOAL.md\");\n\tconst raw = await deps.caller.call(GOAL_SYSTEM, `User wish: ${deps.prompt}`);\n\tconst trimmed = raw.replace(/```markdown|```/g, \"\").trim();\n\tif (trimmed.length < 20) {\n\t\tthrow new Error(`Generated goal is too short (${trimmed.length} chars); refusing to write it`);\n\t}\n\twriteFileSync(goalPath, `${trimmed}\\n`);\n\treturn goalPath;\n}\n"]}