mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-08 16:39:42 +02:00
fix: add cpulimit availability check to app settings
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+61
-5
@@ -2448,7 +2448,10 @@ class ClaudemanApp {
|
|||||||
generatedPlan: null, // [{content, priority, enabled, id}] or null
|
generatedPlan: null, // [{content, priority, enabled, id}] or null
|
||||||
planGenerated: false,
|
planGenerated: false,
|
||||||
skipPlanGeneration: false,
|
skipPlanGeneration: false,
|
||||||
|
planDetailLevel: 'standard', // 'brief', 'standard', 'detailed'
|
||||||
};
|
};
|
||||||
|
planLoadingTimer = null;
|
||||||
|
planLoadingStartTime = null;
|
||||||
|
|
||||||
showRalphWizard() {
|
showRalphWizard() {
|
||||||
// Reset wizard state
|
// Reset wizard state
|
||||||
@@ -2463,6 +2466,7 @@ class ClaudemanApp {
|
|||||||
generatedPlan: null,
|
generatedPlan: null,
|
||||||
planGenerated: false,
|
planGenerated: false,
|
||||||
skipPlanGeneration: false,
|
skipPlanGeneration: false,
|
||||||
|
planDetailLevel: 'standard',
|
||||||
};
|
};
|
||||||
|
|
||||||
// Reset UI
|
// Reset UI
|
||||||
@@ -2524,13 +2528,16 @@ class ClaudemanApp {
|
|||||||
this.ralphWizardConfig.completionPhrase = completionPhrase.toUpperCase();
|
this.ralphWizardConfig.completionPhrase = completionPhrase.toUpperCase();
|
||||||
this.ralphWizardConfig.caseName = caseName;
|
this.ralphWizardConfig.caseName = caseName;
|
||||||
|
|
||||||
// Move to step 2 (plan generation)
|
// Move to step 2 (plan generation) and auto-start
|
||||||
this.ralphWizardStep = 2;
|
this.ralphWizardStep = 2;
|
||||||
this.updateRalphWizardUI();
|
this.updateRalphWizardUI();
|
||||||
|
|
||||||
|
// Auto-start plan generation
|
||||||
|
this.generatePlan();
|
||||||
} else if (this.ralphWizardStep === 2) {
|
} else if (this.ralphWizardStep === 2) {
|
||||||
// Must have generated or skipped plan
|
// Must have generated or skipped plan
|
||||||
if (!this.ralphWizardConfig.planGenerated && !this.ralphWizardConfig.skipPlanGeneration) {
|
if (!this.ralphWizardConfig.planGenerated && !this.ralphWizardConfig.skipPlanGeneration) {
|
||||||
this.showToast('Generate a plan or skip', 'warning');
|
this.showToast('Wait for plan generation or skip', 'warning');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2628,24 +2635,55 @@ class ClaudemanApp {
|
|||||||
async generatePlan() {
|
async generatePlan() {
|
||||||
const config = this.ralphWizardConfig;
|
const config = this.ralphWizardConfig;
|
||||||
|
|
||||||
|
// Stop any existing timer
|
||||||
|
if (this.planLoadingTimer) {
|
||||||
|
clearInterval(this.planLoadingTimer);
|
||||||
|
this.planLoadingTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Show loading state
|
// Show loading state
|
||||||
document.getElementById('planGenerationControls')?.classList.add('hidden');
|
|
||||||
document.getElementById('planGenerationError')?.classList.add('hidden');
|
document.getElementById('planGenerationError')?.classList.add('hidden');
|
||||||
document.getElementById('planEditor')?.classList.add('hidden');
|
document.getElementById('planEditor')?.classList.add('hidden');
|
||||||
document.getElementById('planGenerationLoading')?.classList.remove('hidden');
|
document.getElementById('planGenerationLoading')?.classList.remove('hidden');
|
||||||
|
|
||||||
|
// Start elapsed time display
|
||||||
|
this.planLoadingStartTime = Date.now();
|
||||||
|
const timeEl = document.getElementById('planLoadingTime');
|
||||||
|
if (timeEl) timeEl.textContent = '0s';
|
||||||
|
|
||||||
|
this.planLoadingTimer = setInterval(() => {
|
||||||
|
const elapsed = Math.floor((Date.now() - this.planLoadingStartTime) / 1000);
|
||||||
|
if (timeEl) timeEl.textContent = `${elapsed}s`;
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
// Determine max items based on detail level
|
||||||
|
const detailConfig = {
|
||||||
|
brief: { maxItems: 5, includeTests: false },
|
||||||
|
standard: { maxItems: 8, includeTests: true },
|
||||||
|
detailed: { maxItems: 12, includeTests: true },
|
||||||
|
};
|
||||||
|
const { maxItems, includeTests } = detailConfig[config.planDetailLevel] || detailConfig.standard;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/generate-plan', {
|
const res = await fetch('/api/generate-plan', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
taskDescription: config.taskDescription,
|
taskDescription: config.taskDescription,
|
||||||
maxItems: 8,
|
maxItems,
|
||||||
|
includeTests,
|
||||||
|
detailLevel: config.planDetailLevel,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
|
// Stop timer
|
||||||
|
if (this.planLoadingTimer) {
|
||||||
|
clearInterval(this.planLoadingTimer);
|
||||||
|
this.planLoadingTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!data.success) {
|
if (!data.success) {
|
||||||
this.showPlanError(data.error || 'Failed to generate plan');
|
this.showPlanError(data.error || 'Failed to generate plan');
|
||||||
return;
|
return;
|
||||||
@@ -2665,15 +2703,33 @@ class ClaudemanApp {
|
|||||||
config.planGenerated = true;
|
config.planGenerated = true;
|
||||||
config.skipPlanGeneration = false;
|
config.skipPlanGeneration = false;
|
||||||
|
|
||||||
// Show editor
|
// Show editor and update detail buttons
|
||||||
this.renderPlanEditor();
|
this.renderPlanEditor();
|
||||||
|
this.updateDetailLevelButtons();
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
// Stop timer
|
||||||
|
if (this.planLoadingTimer) {
|
||||||
|
clearInterval(this.planLoadingTimer);
|
||||||
|
this.planLoadingTimer = null;
|
||||||
|
}
|
||||||
console.error('Plan generation failed:', err);
|
console.error('Plan generation failed:', err);
|
||||||
this.showPlanError('Network error: ' + err.message);
|
this.showPlanError('Network error: ' + err.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setPlanDetail(level) {
|
||||||
|
this.ralphWizardConfig.planDetailLevel = level;
|
||||||
|
this.updateDetailLevelButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateDetailLevelButtons() {
|
||||||
|
const level = this.ralphWizardConfig.planDetailLevel;
|
||||||
|
document.querySelectorAll('.plan-detail-btn').forEach(btn => {
|
||||||
|
btn.classList.toggle('active', btn.dataset.detail === level);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
showPlanError(message) {
|
showPlanError(message) {
|
||||||
document.getElementById('planGenerationLoading')?.classList.add('hidden');
|
document.getElementById('planGenerationLoading')?.classList.add('hidden');
|
||||||
document.getElementById('planGenerationControls')?.classList.add('hidden');
|
document.getElementById('planGenerationControls')?.classList.add('hidden');
|
||||||
|
|||||||
Reference in New Issue
Block a user