-
Notifications
You must be signed in to change notification settings - Fork 575
Feature: Add a file editor #779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
272129e
Feat: Add z.ai usage tracking
gsxdsm e777eb8
Feat: Add ability to duplicate a feature and duplicate as a child
gsxdsm 06eb0c5
Feat: Add scheduled feature support
gsxdsm c5dbcfa
Feat: Watchdog support for script
gsxdsm 5719f18
Feat: Show Gemini Usage in usage dropdown and mobile sidebar
gsxdsm bc41c06
fix: ScheduledTasks - Add removeRunningTaskFromWorkTrees function
gsxdsm 197a5bd
Feat: Add z.ai usage tracking
gsxdsm faee461
Feat: Add scheduled feature support
gsxdsm b376168
Feat: Show Gemini Usage in usage dropdown and mobile sidebar
gsxdsm 33e5dc2
feat: Add GLM-5 model support to z.AI provider
gsxdsm 308f357
feat: Add automatic port conflict resolution and new file operation h…
gsxdsm ee256d5
feat: Add markdown preview modes (editor, preview, split) for markdow…
gsxdsm b3b901f
feat: Rebase on v0.15.0rc branch
gsxdsm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| */ | ||
|
|
||
| import type { Request, Response } from 'express'; | ||
| import { CronExpressionParser } from 'cron-parser'; | ||
| import { FeatureLoader } from '../../../services/feature-loader.js'; | ||
| import type { Feature, FeatureStatus } from '@automaker/types'; | ||
| import { getErrorMessage, logError } from '../common.js'; | ||
|
|
@@ -40,28 +41,55 @@ export function createUpdateHandler(featureLoader: FeatureLoader) { | |
| return; | ||
| } | ||
|
|
||
| // Check for duplicate title if title is being updated | ||
| if (updates.title && updates.title.trim()) { | ||
| const duplicate = await featureLoader.findDuplicateTitle( | ||
| projectPath, | ||
| updates.title, | ||
| featureId // Exclude the current feature from duplicate check | ||
| ); | ||
| if (duplicate) { | ||
| res.status(409).json({ | ||
| success: false, | ||
| error: `A feature with title "${updates.title}" already exists`, | ||
| duplicateFeatureId: duplicate.id, | ||
| }); | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| // Get the current feature to detect status changes | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic to check for duplicate feature titles during an update seems to have been removed. This is important to prevent renaming a feature to a title that is already in use by another feature. Please restore this validation. // Check for duplicate title if title is being updated
if (updates.title && updates.title.trim()) {
const duplicate = await featureLoader.findDuplicateTitle(
projectPath,
updates.title,
featureId // Exclude the current feature from duplicate check
);
if (duplicate) {
res.status(409).json({
success: false,
error: `A feature with title "${updates.title}" already exists`,
duplicateFeatureId: duplicate.id,
});
return;
}
}
// Get the current feature to detect status changes |
||
| const currentFeature = await featureLoader.get(projectPath, featureId); | ||
| const previousStatus = currentFeature?.status as FeatureStatus | undefined; | ||
| const newStatus = updates.status as FeatureStatus | undefined; | ||
|
|
||
| // Handle schedule updates | ||
| // Check if schedule is being removed or disabled | ||
| const isScheduleBeingRemoved = | ||
| 'schedule' in updates && | ||
| (updates.schedule === undefined || | ||
| updates.schedule === null || | ||
| updates.schedule?.enabled === false); | ||
|
|
||
| if (isScheduleBeingRemoved) { | ||
| // If currently scheduled, move back to backlog | ||
| if (currentFeature?.status === 'scheduled') { | ||
| updates.status = 'backlog'; | ||
| logger.debug( | ||
| `Moving feature ${featureId} from 'scheduled' to 'backlog' (schedule removed/disabled)` | ||
| ); | ||
| } | ||
| // Clear the schedule | ||
| updates.schedule = undefined; | ||
| } else if (updates.schedule?.enabled && updates.schedule?.crontab) { | ||
| // Calculate nextRun if schedule is being updated and enabled | ||
| try { | ||
| const interval = CronExpressionParser.parse(updates.schedule.crontab, { | ||
| currentDate: new Date(), | ||
| }); | ||
| const nextRun = interval.next().toDate(); | ||
| updates.schedule = { | ||
| ...updates.schedule, | ||
| nextRun: nextRun.toISOString(), | ||
| }; | ||
| // If enabling a schedule on a feature that's not in_progress, move it to 'scheduled' | ||
| const currentStatus = currentFeature?.status; | ||
| if (currentStatus && currentStatus !== 'in_progress' && currentStatus !== 'scheduled') { | ||
| updates.status = 'scheduled'; | ||
| logger.debug(`Moving feature ${featureId} to 'scheduled' status`); | ||
| } | ||
| logger.debug(`Calculated nextRun for feature ${featureId}: ${nextRun.toISOString()}`); | ||
| } catch (err) { | ||
| logger.warn( | ||
| `Invalid crontab expression for feature ${featureId}: ${updates.schedule.crontab}`, | ||
| err | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| const updated = await featureLoader.update( | ||
| projectPath, | ||
| featureId, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic to check for and prevent duplicate feature titles appears to have been removed in this change. This could lead to multiple features having the same name, causing confusion. This check should be restored.