Factory: skills per phase

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Sonnet 5.5 committed 2026-11-17 14:43:38 +01:00
1 parent 0fd10df43d
commit 43b07aca48
6 files changed
+64 -3

No files matched your search

+7
View File
@@ -3,6 +3,13 @@
All notable changes to CodeCraft. Versions follow [Semantic Versioning](https://semver.org/); All notable changes to CodeCraft. Versions follow [Semantic Versioning](https://semver.org/);
until 1.0, minor versions may contain breaking changes. until 1.0, minor versions may contain breaking changes.
## [Unreleased]
### Added
- **Factory: skills per phase.** In the repository settings, each phase (review, build, acceptance) can have
skills switched on; the chat of that phase follows them in every turn.
## [v202611-00056] – 2026-11-17 ## [v202611-00056] – 2026-11-17
### Added ### Added
+7 -2
View File
@@ -49,6 +49,9 @@ pub struct PhaseCfg {
/// Extra instructions appended to the phase prompt. /// Extra instructions appended to the phase prompt.
#[serde(default)] #[serde(default)]
pub extra_prompt: String, pub extra_prompt: String,
/// Skills (names) switched on for the chat of this phase; only the CodeCraft agent uses them.
#[serde(default)]
pub skills: Vec<String>,
} }
fn default_agent() -> String { fn default_agent() -> String {
@@ -69,7 +72,7 @@ fn default_rework() -> i64 {
impl Default for PhaseCfg { impl Default for PhaseCfg {
fn default() -> Self { fn default() -> Self {
Self { model: String::new(), agent: default_agent(), permission_mode: default_mode(), timeout_minutes: default_timeout(), max_attempts: default_attempts(), extra_prompt: String::new() } Self { model: String::new(), agent: default_agent(), permission_mode: default_mode(), timeout_minutes: default_timeout(), max_attempts: default_attempts(), extra_prompt: String::new(), skills: Vec::new() }
} }
} }
@@ -171,6 +174,7 @@ impl RepoCfg {
} }
p.timeout_minutes = p.timeout_minutes.clamp(1, 24 * 60); p.timeout_minutes = p.timeout_minutes.clamp(1, 24 * 60);
p.max_attempts = p.max_attempts.clamp(1, 10); p.max_attempts = p.max_attempts.clamp(1, 10);
p.skills = p.skills.iter().map(|n| n.trim().to_string()).filter(|n| !n.is_empty() && n.len() <= 64).take(10).collect();
} }
Ok(()) Ok(())
} }
@@ -881,7 +885,8 @@ fn start_phase(app: &Arc<App>, user: &User, cfg: &RepoCfg, issue: i64, phase: &s
telegram_quiet: true, telegram_quiet: true,
summary: String::new(), summary: String::new(),
color: None, color: None,
icon: None, skills: Vec::new(), icon: None,
skills: pc.skills.clone(),
}; };
let session = app.save_session(session)?; let session = app.save_session(session)?;
let run_id = crate::types::new_id(); let run_id = crate::types::new_id();
+38 -1
View File
@@ -30,6 +30,7 @@ interface PhaseCfg {
timeout_minutes: number; timeout_minutes: number;
max_attempts: number; max_attempts: number;
extra_prompt: string; extra_prompt: string;
skills: string[];
} }
interface RepoCfg { interface RepoCfg {
url: string; url: string;
@@ -575,11 +576,46 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
); );
} }
const blankPhase = (): PhaseCfg => ({ model: "", agent: "codecraft", permission_mode: "auto", timeout_minutes: 60, max_attempts: 2, extra_prompt: "" }); const blankPhase = (): PhaseCfg => ({ model: "", agent: "codecraft", permission_mode: "auto", timeout_minutes: 60, max_attempts: 2, extra_prompt: "", skills: [] });
const blankRepo = (connection = "", kind = "gitea"): RepoCfg => ({ url: "", kind, connection, token: "", label: "factory", max_parallel: 1, max_rework: 2, allowed_users: [], enabled: true, review: blankPhase(), build: blankPhase(), qa: blankPhase() }); const blankRepo = (connection = "", kind = "gitea"): RepoCfg => ({ url: "", kind, connection, token: "", label: "factory", max_parallel: 1, max_rework: 2, allowed_users: [], enabled: true, review: blankPhase(), build: blankPhase(), qa: blankPhase() });
const blankConn = (): Connection => ({ id: "", name: "", kind: "gitea", url: "", token: "", owner: "" }); const blankConn = (): Connection => ({ id: "", name: "", kind: "gitea", url: "", token: "", owner: "" });
const MODES = ["default", "auto", "accept_edits", "bypass"]; const MODES = ["default", "auto", "accept_edits", "bypass"];
/** Skills switched on for the chat of one phase (the agent follows them in every turn). */
function PhaseSkills({ value, onChange }: { value: string[]; onChange: (v: string[]) => void }) {
const t = useT();
const [all, setAll] = useState<{ name: string; description: string }[]>([]);
useEffect(() => {
get<{ skills: { name: string; description: string }[] }>("/commands")
.then((d) => setAll(d.skills))
.catch(() => {});
}, []);
const rest = all.filter((s) => !value.includes(s.name));
return (
<div className="factory-skills">
<span>{t("factory.skills")}</span>
<div className="row" style={{ gap: 4, flexWrap: "wrap" }}>
{value.map((n) => (
<button key={n} type="button" className="chip" style={{ border: "none" }} title={t("factory.skillRemove")} onClick={() => onChange(value.filter((x) => x !== n))}>
{n} ×
</button>
))}
{rest.length > 0 && value.length < 10 && (
<select value="" onChange={(e) => e.target.value && onChange([...value, e.target.value])}>
<option value="">{t("factory.skillAdd")}</option>
{rest.map((s) => (
<option key={s.name} value={s.name} title={s.description}>
{s.name}
</option>
))}
</select>
)}
</div>
<div className="hint">{t("factory.skillsHint")}</div>
</div>
);
}
function PhaseForm({ phase, value, onChange }: { phase: Phase; value: PhaseCfg; onChange: (patch: Partial<PhaseCfg>) => void }) { function PhaseForm({ phase, value, onChange }: { phase: Phase; value: PhaseCfg; onChange: (patch: Partial<PhaseCfg>) => void }) {
const t = useT(); const t = useT();
return ( return (
@@ -614,6 +650,7 @@ function PhaseForm({ phase, value, onChange }: { phase: Phase; value: PhaseCfg;
<span>{t("factory.attempts")}</span> <span>{t("factory.attempts")}</span>
<input type="number" min={1} max={10} value={value.max_attempts} title={t("factory.attemptsHint")} onChange={(e) => onChange({ max_attempts: Math.max(1, Number(e.target.value) || 1) })} /> <input type="number" min={1} max={10} value={value.max_attempts} title={t("factory.attemptsHint")} onChange={(e) => onChange({ max_attempts: Math.max(1, Number(e.target.value) || 1) })} />
</label> </label>
<PhaseSkills value={value.skills ?? []} onChange={(skills) => onChange({ skills })} />
<label> <label>
<span>{t("factory.extraPrompt")}</span> <span>{t("factory.extraPrompt")}</span>
<textarea rows={3} value={value.extra_prompt} onChange={(e) => onChange({ extra_prompt: e.target.value })} /> <textarea rows={3} value={value.extra_prompt} onChange={(e) => onChange({ extra_prompt: e.target.value })} />
+4
View File
@@ -1292,6 +1292,10 @@ export const de: Messages = {
"factory.closeMsg": "Kommentar zum Schließen von Issue #{n}. Er wird im Issue veröffentlicht, danach wird das Issue geschlossen.", "factory.closeMsg": "Kommentar zum Schließen von Issue #{n}. Er wird im Issue veröffentlicht, danach wird das Issue geschlossen.",
"factory.closeDefault": "Erledigt und abgenommen.", "factory.closeDefault": "Erledigt und abgenommen.",
"factory.closed": "Issue geschlossen", "factory.closed": "Issue geschlossen",
"factory.skills": "Skills",
"factory.skillAdd": "Skill hinzufügen…",
"factory.skillRemove": "Entfernen",
"factory.skillsHint": "Für jeden Chat dieser Phase eingeschaltet (CodeCraft-Agent). Jeder belegt Kontext – wenige wählen.",
"factory.pr": "Pull Request", "factory.pr": "Pull Request",
"factory.round": "Runde {n}", "factory.round": "Runde {n}",
"factory.openChat": "Chat öffnen", "factory.openChat": "Chat öffnen",
+4
View File
@@ -1291,6 +1291,10 @@ export const en = {
"factory.closeMsg": "Comment for closing issue #{n}. It is posted on the issue, then the issue is closed.", "factory.closeMsg": "Comment for closing issue #{n}. It is posted on the issue, then the issue is closed.",
"factory.closeDefault": "Done and accepted.", "factory.closeDefault": "Done and accepted.",
"factory.closed": "Issue closed", "factory.closed": "Issue closed",
"factory.skills": "Skills",
"factory.skillAdd": "Add skill…",
"factory.skillRemove": "Remove",
"factory.skillsHint": "Switched on for every chat of this phase (CodeCraft agent). Each one uses context – choose few.",
"factory.pr": "Pull request", "factory.pr": "Pull request",
"factory.round": "round {n}", "factory.round": "round {n}",
"factory.openChat": "Open chat", "factory.openChat": "Open chat",
+4
View File
@@ -3,6 +3,10 @@
* under "unreleased"; scripts/release.sh renames the key to the release version. * under "unreleased"; scripts/release.sh renames the key to the release version.
*/ */
export const WHATS_NEW: Record<string, { en: string[]; de: string[] }> = { export const WHATS_NEW: Record<string, { en: string[]; de: string[] }> = {
unreleased: {
en: ["Factory: choose skills for each phase (review, build, acceptance)"],
de: ["Factory: Skills für jede Phase wählbar (Review, Build, Abnahme)"],
},
"202611-00056": { "202611-00056": {
en: ["Skills: create or import them from GitHub (Settings → Skills) and switch them on per chat; large libraries do not fill the context"], en: ["Skills: create or import them from GitHub (Settings → Skills) and switch them on per chat; large libraries do not fill the context"],
de: ["Skills: selbst anlegen oder von GitHub importieren (Einstellungen → Skills) und pro Chat einschalten; große Bibliotheken füllen den Kontext nicht"], de: ["Skills: selbst anlegen oder von GitHub importieren (Einstellungen → Skills) und pro Chat einschalten; große Bibliotheken füllen den Kontext nicht"],