-
Notifications
You must be signed in to change notification settings - Fork 577
small fixes #261
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
small fixes #261
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -56,32 +56,56 @@ export function createCreatePRHandler() { | |||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Check for uncommitted changes | ||||||||||||||||||||||||||||||||||
| console.log(`[CreatePR] Checking for uncommitted changes in: ${worktreePath}`); | ||||||||||||||||||||||||||||||||||
| const { stdout: status } = await execAsync('git status --porcelain', { | ||||||||||||||||||||||||||||||||||
| cwd: worktreePath, | ||||||||||||||||||||||||||||||||||
| env: execEnv, | ||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||
| const hasChanges = status.trim().length > 0; | ||||||||||||||||||||||||||||||||||
| console.log(`[CreatePR] Has uncommitted changes: ${hasChanges}`); | ||||||||||||||||||||||||||||||||||
| if (hasChanges) { | ||||||||||||||||||||||||||||||||||
| console.log(`[CreatePR] Changed files:\n${status}`); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // If there are changes, commit them | ||||||||||||||||||||||||||||||||||
| let commitHash: string | null = null; | ||||||||||||||||||||||||||||||||||
| let commitError: string | null = null; | ||||||||||||||||||||||||||||||||||
| if (hasChanges) { | ||||||||||||||||||||||||||||||||||
| const message = commitMessage || `Changes from ${branchName}`; | ||||||||||||||||||||||||||||||||||
| console.log(`[CreatePR] Committing changes with message: ${message}`); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Stage all changes | ||||||||||||||||||||||||||||||||||
| await execAsync('git add -A', { cwd: worktreePath, env: execEnv }); | ||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||
| // Stage all changes | ||||||||||||||||||||||||||||||||||
| console.log(`[CreatePR] Running: git add -A`); | ||||||||||||||||||||||||||||||||||
| await execAsync('git add -A', { cwd: worktreePath, env: execEnv }); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Create commit | ||||||||||||||||||||||||||||||||||
| await execAsync(`git commit -m "${message.replace(/"/g, '\\"')}"`, { | ||||||||||||||||||||||||||||||||||
| cwd: worktreePath, | ||||||||||||||||||||||||||||||||||
| env: execEnv, | ||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||
| // Create commit | ||||||||||||||||||||||||||||||||||
| console.log(`[CreatePR] Running: git commit`); | ||||||||||||||||||||||||||||||||||
| await execAsync(`git commit -m "${message.replace(/"/g, '\\"')}"`, { | ||||||||||||||||||||||||||||||||||
| cwd: worktreePath, | ||||||||||||||||||||||||||||||||||
| env: execEnv, | ||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+84
to
+87
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. Potential command injection vulnerability in commit message. The commit message escapes only double quotes, but user input could contain other shell metacharacters (e.g., Consider using 🔎 Proposed fix using execFile for safer execution+import { execFile } from 'child_process';
+import { promisify } from 'util';
+
+const execFileAsync = promisify(execFile);
// In the commit block:
- await execAsync(`git commit -m "${message.replace(/"/g, '\\"')}"`, {
- cwd: worktreePath,
- env: execEnv,
- });
+ await execFileAsync('git', ['commit', '-m', message], {
+ cwd: worktreePath,
+ env: execEnv,
+ });📝 Committable suggestion
Suggested change
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Get commit hash | ||||||||||||||||||||||||||||||||||
| const { stdout: hashOutput } = await execAsync('git rev-parse HEAD', { | ||||||||||||||||||||||||||||||||||
| cwd: worktreePath, | ||||||||||||||||||||||||||||||||||
| env: execEnv, | ||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||
| commitHash = hashOutput.trim().substring(0, 8); | ||||||||||||||||||||||||||||||||||
| // Get commit hash | ||||||||||||||||||||||||||||||||||
| const { stdout: hashOutput } = await execAsync('git rev-parse HEAD', { | ||||||||||||||||||||||||||||||||||
| cwd: worktreePath, | ||||||||||||||||||||||||||||||||||
| env: execEnv, | ||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||
| commitHash = hashOutput.trim().substring(0, 8); | ||||||||||||||||||||||||||||||||||
| console.log(`[CreatePR] Commit successful: ${commitHash}`); | ||||||||||||||||||||||||||||||||||
| } catch (commitErr: unknown) { | ||||||||||||||||||||||||||||||||||
| const err = commitErr as { stderr?: string; message?: string }; | ||||||||||||||||||||||||||||||||||
| commitError = err.stderr || err.message || 'Commit failed'; | ||||||||||||||||||||||||||||||||||
| console.error(`[CreatePR] Commit failed: ${commitError}`); | ||||||||||||||||||||||||||||||||||
|
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. |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Return error immediately - don't proceed with push/PR if commit fails | ||||||||||||||||||||||||||||||||||
| res.status(500).json({ | ||||||||||||||||||||||||||||||||||
| success: false, | ||||||||||||||||||||||||||||||||||
| error: `Failed to commit changes: ${commitError}`, | ||||||||||||||||||||||||||||||||||
| commitError, | ||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Push the branch to remote | ||||||||||||||||||||||||||||||||||
|
|
@@ -360,8 +384,9 @@ export function createCreatePRHandler() { | |||||||||||||||||||||||||||||||||
| success: true, | ||||||||||||||||||||||||||||||||||
| result: { | ||||||||||||||||||||||||||||||||||
| branch: branchName, | ||||||||||||||||||||||||||||||||||
| committed: hasChanges, | ||||||||||||||||||||||||||||||||||
| committed: hasChanges && !commitError, | ||||||||||||||||||||||||||||||||||
| commitHash, | ||||||||||||||||||||||||||||||||||
| commitError: commitError || undefined, | ||||||||||||||||||||||||||||||||||
| pushed: true, | ||||||||||||||||||||||||||||||||||
| prUrl, | ||||||||||||||||||||||||||||||||||
| prNumber, | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -45,7 +45,7 @@ export function ArchiveAllVerifiedDialog({ | |||||||||||||||||||
| </Button> | ||||||||||||||||||||
| <Button variant="default" onClick={onConfirm} data-testid="confirm-archive-all-verified"> | ||||||||||||||||||||
| <Archive className="w-4 h-4 mr-2" /> | ||||||||||||||||||||
| Archive All | ||||||||||||||||||||
| Complete All | ||||||||||||||||||||
| </Button> | ||||||||||||||||||||
|
Comment on lines
46
to
49
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 button text has been changed to 'Complete All', but the
Suggested change
|
||||||||||||||||||||
| </DialogFooter> | ||||||||||||||||||||
| </DialogContent> | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -117,7 +117,7 @@ export function KanbanBoard({ | |||||||||||||||||||||||
| data-testid="archive-all-verified-button" | ||||||||||||||||||||||||
| > | ||||||||||||||||||||||||
| <Archive className="w-3 h-3 mr-1" /> | ||||||||||||||||||||||||
| Archive All | ||||||||||||||||||||||||
| Complete All | ||||||||||||||||||||||||
| </Button> | ||||||||||||||||||||||||
|
Comment on lines
117
to
121
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 button text has been changed to 'Complete All', but the
Suggested change
|
||||||||||||||||||||||||
| ) : column.id === 'backlog' ? ( | ||||||||||||||||||||||||
| <div className="flex items-center gap-1"> | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
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.
There are several
console.logstatements added for debugging purposes (lines 59, 65, 67, 75, 79, 83, 95). These should be removed before merging to keep the production logs clean. If this level of logging is desired, consider using a dedicated logger with adebuglevel.