uv/pyproject.toml tuki projektipipelineen, requirements.txt fallbackina

Managerin prompti ohjaa käyttämään pyproject.toml:ia (.toml sallittu).
Koodari saa pyproject.toml-tiedostolle eksplisiittisen esimerkkiformaatin
jossa [project] + dependencies + [project.scripts] start-komennolla.
requirements.txt toimii edelleen fallbackina jos malli tuottaa sen.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jaakko Vanhala
2026-04-06 07:43:47 +03:00
parent 095b72d2d6
commit bef5b6fc3c

View File

@@ -2025,9 +2025,10 @@ filename.py: what this file contains
Rules:
- Max 4 files
- Only .py, .txt, .json, .html files
- Only .py, .toml, .json, .html files
- No directories, no paths, just filenames
- List dependencies first, then main app (e.g. models.py before main.py)
- Use pyproject.toml for dependencies (not requirements.txt)
Project: ${task}`;
const plan = await kpnRun(agentPrompts.manager.model, managerPrompt);
@@ -2055,7 +2056,7 @@ Project: ${task}`;
// Fallback: manageri ei tuottanut tiedostolistaa, käytetään koko vastausta ohjeena
termLog(' <span style="color:#8b949e">Ei tiedostojakoa — generoidaan yhtenä kokonaisuutena</span>');
termLog(`\n<span style="color:#3fb950;font-weight:bold">[2] Koodari</span> — toteutus`);
const code = await kpnRun(agentPrompts.coder.model, `Project: ${task}\nFiles: ${plan}\n\nWrite all the code for this project. Use the exact libraries mentioned in the project description.`);
const code = await kpnRun(agentPrompts.coder.model, `Project: ${task}\nFiles: ${plan}\n\nWrite all the code for this project. Use the exact libraries mentioned in the project description. Use pyproject.toml for dependencies (not requirements.txt).`);
if (code) {
termLog(`\n<span style="color:#a371f7;font-weight:bold">━━━ Pipeline valmis ━━━</span>`);
}
@@ -2080,8 +2081,24 @@ Project: ${task}`;
).join('\n\n') + '\n\n';
}
// Erityisohjeet pyproject.toml / requirements.txt -tiedostoille
let extraInstructions = '';
if (file.name === 'pyproject.toml') {
extraInstructions = `\nUse this exact format:
[project]
name = "projectname"
version = "0.1.0"
requires-python = ">=3.11"
dependencies = ["fastapi", "uvicorn"]
[project.scripts]
start = "uvicorn main:app --reload"`;
} else if (file.name === 'requirements.txt') {
extraInstructions = '\nList one dependency per line. No version pins unless necessary.';
}
const coderPrompt = `${context}Project: ${task}
Write ONLY the file "${file.name}"${file.desc ? ': ' + file.desc : ''}.
Write ONLY the file "${file.name}"${file.desc ? ': ' + file.desc : ''}.${extraInstructions}
Use the exact libraries mentioned in the project description. Write correct, working code.`;
const code = await kpnRun(agentPrompts.coder.model, coderPrompt);
if (!code) {